feat: windows, custom client, update (#13687)

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou
2026-02-27 21:50:20 +08:00
committed by GitHub
parent d49ae493b2
commit 4abdb2e08b
15 changed files with 957 additions and 124 deletions

View File

@@ -2776,10 +2776,13 @@ pub fn main_get_common(key: String) -> String {
} else if key.starts_with("download-file-") {
let _version = key.replace("download-file-", "");
#[cfg(target_os = "windows")]
return match crate::platform::windows::is_msi_installed() {
Ok(true) => format!("rustdesk-{_version}-x86_64.msi"),
Ok(false) => format!("rustdesk-{_version}-x86_64.exe"),
Err(e) => {
return match (
crate::platform::windows::is_msi_installed(),
crate::common::is_custom_client(),
) {
(Ok(true), false) => format!("rustdesk-{_version}-x86_64.msi"),
(Ok(true), true) | (Ok(false), _) => format!("rustdesk-{_version}-x86_64.exe"),
(Err(e), _) => {
log::error!("Failed to check if is msi: {}", e);
format!("error:update-failed-check-msi-tip")
}
@@ -2876,30 +2879,17 @@ pub fn main_set_common(_key: String, _value: String) {
if let Some(f) = new_version_file.to_str() {
// 1.4.0 does not support "--update"
// But we can assume that the new version supports it.
#[cfg(target_os = "windows")]
if f.ends_with(".exe") {
if let Err(e) =
crate::platform::run_exe_in_cur_session(f, vec!["--update"], false)
{
log::error!("Failed to run the update exe: {}", e);
}
} else if f.ends_with(".msi") {
if let Err(e) = crate::platform::update_me_msi(f, false) {
log::error!("Failed to run the update msi: {}", e);
}
} else {
// unreachable!()
}
#[cfg(target_os = "macos")]
#[cfg(any(target_os = "windows", target_os = "macos"))]
match crate::platform::update_to(f) {
Ok(_) => {
log::info!("Update successfully!");
log::info!("Update process is launched successfully!");
}
Err(e) => {
log::error!("Failed to update to new version, {}", e);
fs::remove_file(f).ok();
}
}
fs::remove_file(f).ok();
}
}
} else if _key == "extract-update-dmg" {