From 90ab9f8a97dfc2107a68548b326f4bef4e7769cb Mon Sep 17 00:00:00 2001 From: "954801926@qq.com" Date: Thu, 30 Jul 2026 00:22:49 +0800 Subject: [PATCH] feat(update): use platform-aware asset and filename in update flow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - check_for_update: download_url = pick_asset_for_current_os(assets) - download_update: temp file = update_temp_filename() (按 OS: msi/dmg/AppImage) --- src-tauri/src/commands.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src-tauri/src/commands.rs b/src-tauri/src/commands.rs index e19d6ab..cea3389 100644 --- a/src-tauri/src/commands.rs +++ b/src-tauri/src/commands.rs @@ -783,10 +783,7 @@ pub async fn check_for_update() -> Result { let download_url = first .get("assets") .and_then(|a| a.as_array()) - .and_then(|a| a.first()) - .and_then(|a| a.get("browser_download_url")) - .and_then(|v| v.as_str()) - .map(|s| s.to_string()); + .and_then(|a| pick_asset_for_current_os(a)); let update_available = version_lt(¤t, &latest); @@ -819,7 +816,7 @@ pub async fn download_update( let total = resp.content_length().unwrap_or(0); let temp_dir = std::env::temp_dir(); - let file_path = temp_dir.join("KimiSwitch_update.msi"); + let file_path = temp_dir.join(update_temp_filename()); let mut file = std::fs::File::create(&file_path) .map_err(|e| format!("create temp file failed: {e}"))?;