diff --git a/crates-tauri/yaak-app/src/updates.rs b/crates-tauri/yaak-app/src/updates.rs index c068a813..6fd7fe74 100644 --- a/crates-tauri/yaak-app/src/updates.rs +++ b/crates-tauri/yaak-app/src/updates.rs @@ -119,6 +119,7 @@ impl YaakUpdater { UpdateTrigger::User => "user", }, )? + .header("X-Install-Mode", detect_install_mode().unwrap_or("unknown"))? .build()? .check() .await; @@ -361,6 +362,22 @@ pub async fn download_update_idempotent( Ok(dl_path) } +/// Detect the installer type so the update server can serve the correct artifact. +fn detect_install_mode() -> Option<&'static str> { + #[cfg(target_os = "windows")] + { + if let Ok(exe) = std::env::current_exe() { + let path = exe.to_string_lossy().to_lowercase(); + if path.starts_with(r"c:\program files") { + return Some("nsis-machine"); + } + } + return Some("nsis"); + } + #[allow(unreachable_code)] + None +} + pub async fn install_update_maybe_download( window: &WebviewWindow, update: &Update,