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

@@ -187,7 +187,10 @@ pub fn core_main() -> Option<Vec<String>> {
}
#[cfg(windows)]
hbb_common::config::PeerConfig::preload_peers();
{
crate::platform::try_remove_temp_update_files();
hbb_common::config::PeerConfig::preload_peers();
}
std::thread::spawn(move || crate::start_server(false, no_server));
} else {
#[cfg(windows)]
@@ -202,17 +205,24 @@ pub fn core_main() -> Option<Vec<String>> {
if config::is_disable_installation() {
return None;
}
let res = platform::update_me(false);
let text = match res {
Ok(_) => translate("Update successfully!".to_string()),
Err(err) => {
log::error!("Failed with error: {err}");
translate("Update failed!".to_string())
let text = match crate::platform::prepare_custom_client_update() {
Err(e) => {
log::error!("Error preparing custom client update: {}", e);
"Update failed!".to_string()
}
Ok(false) => "Update failed!".to_string(),
Ok(true) => match platform::update_me(false) {
Ok(_) => "Update successfully!".to_string(),
Err(err) => {
log::error!("Failed with error: {err}");
"Update failed!".to_string()
}
},
};
Toast::new(Toast::POWERSHELL_APP_ID)
.title(&config::APP_NAME.read().unwrap())
.text1(&text)
.text1(&translate(text))
.sound(Some(Sound::Default))
.duration(Duration::Short)
.show()