This commit is contained in:
Kelorastus
2026-09-30 13:13:22 +02:00
parent 20227eda0e
commit feed0fa869
+31 -14
View File
@@ -2292,23 +2292,40 @@ impl Launcher {
.and_then(|m| m.get("source_commit").and_then(|c| c.as_str().map(str::to_string))),
_ => None,
};
// The launcher's own feed is public, so this needs no token.
// The launcher's own feeds are public, so this needs no token.
let mcp = self.inner.lock().await.settings.mcp_url.clone();
let feed: Option<serde_json::Value> = match mcp.is_empty() {
true => None,
false => match self
.http
.get(format!("{}/download/{LAUNCHER_FEED}", mcp.trim_end_matches('/')))
.timeout(Duration::from_secs(10))
.send()
.await
{
Ok(r) if r.status().is_success() => r.json::<serde_json::Value>().await.ok(),
_ => None,
},
let base = mcp.trim_end_matches('/').to_string();
let get = |name: &str| {
let url = format!("{base}/download/{name}");
let http = self.http.clone();
let skip = mcp.is_empty();
async move {
if skip {
return None;
}
match http.get(url).timeout(Duration::from_secs(10)).send().await {
Ok(r) if r.status().is_success() => r.json::<serde_json::Value>().await.ok(),
_ => None,
}
}
};
let feed = get(LAUNCHER_FEED).await;
let launcher_live = feed.as_ref().and_then(|f| f.get("version").and_then(|v| v.as_str().map(str::to_string)));
let launcher_commit = feed.as_ref().and_then(|f| f.get("source_commit").and_then(|v| v.as_str()).filter(|s| !s.is_empty()).map(str::to_string));
// The commit is NOT in the updater feed and must not be put there: that document is
// Tauri's own format and goes out to every launcher in the field. `latest.json`, which
// this pipeline writes itself, carries it. Pair the two only when both name the same
// version - if they disagree, what is published is unknown and the row says so rather
// than claiming "up to date" and skipping a release that was needed.
let latest = get("latest.json").await;
let launcher_commit = match (&launcher_live, &latest) {
(Some(live), Some(l))
if l.get("kind").and_then(|k| k.as_str()) == Some("launcher")
&& l.get("version").and_then(|v| v.as_str()) == Some(live.as_str()) =>
{
l.get("source_commit").and_then(|v| v.as_str()).filter(|s| !s.is_empty()).map(str::to_string)
}
_ => None,
};
crate::release::plan(
&dev_root,
&dev_root.join("ODIAN_MCP_Server"),