mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-20 00:23:58 +01:00
release: add per-machine NSIS installer and X-Install-Mode updater header
This commit is contained in:
@@ -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<R: Runtime>(
|
||||
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<R: Runtime>(
|
||||
window: &WebviewWindow<R>,
|
||||
update: &Update,
|
||||
|
||||
Reference in New Issue
Block a user