fix
This commit is contained in:
+31
-14
@@ -2292,23 +2292,40 @@ impl Launcher {
|
|||||||
.and_then(|m| m.get("source_commit").and_then(|c| c.as_str().map(str::to_string))),
|
.and_then(|m| m.get("source_commit").and_then(|c| c.as_str().map(str::to_string))),
|
||||||
_ => None,
|
_ => 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 mcp = self.inner.lock().await.settings.mcp_url.clone();
|
||||||
let feed: Option<serde_json::Value> = match mcp.is_empty() {
|
let base = mcp.trim_end_matches('/').to_string();
|
||||||
true => None,
|
let get = |name: &str| {
|
||||||
false => match self
|
let url = format!("{base}/download/{name}");
|
||||||
.http
|
let http = self.http.clone();
|
||||||
.get(format!("{}/download/{LAUNCHER_FEED}", mcp.trim_end_matches('/')))
|
let skip = mcp.is_empty();
|
||||||
.timeout(Duration::from_secs(10))
|
async move {
|
||||||
.send()
|
if skip {
|
||||||
.await
|
return None;
|
||||||
{
|
}
|
||||||
Ok(r) if r.status().is_success() => r.json::<serde_json::Value>().await.ok(),
|
match http.get(url).timeout(Duration::from_secs(10)).send().await {
|
||||||
_ => None,
|
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_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(
|
crate::release::plan(
|
||||||
&dev_root,
|
&dev_root,
|
||||||
&dev_root.join("ODIAN_MCP_Server"),
|
&dev_root.join("ODIAN_MCP_Server"),
|
||||||
|
|||||||
Reference in New Issue
Block a user