feat: release desktop 0.1.9 with device dedupe and new branding

This commit is contained in:
2026-02-19 20:33:54 +08:00
parent 71a19e9e87
commit 099ba3e3e0
61 changed files with 161 additions and 20 deletions

View File

@@ -7,11 +7,16 @@ use std::env;
use std::fs;
use std::io::Write;
use std::io::{Read, Seek, SeekFrom};
#[cfg(target_os = "windows")]
use std::os::windows::process::CommandExt;
use std::path::{Path, PathBuf};
use std::process::Command;
use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
use tauri::Emitter;
#[cfg(target_os = "windows")]
const CREATE_NO_WINDOW: u32 = 0x08000000;
struct ApiState {
client: reqwest::Client,
}
@@ -1122,21 +1127,25 @@ fn api_silent_install_and_restart(installer_path: String) -> Result<BridgeRespon
let app_text = current_exe.to_string_lossy().replace('"', "\"\"");
let script_content = format!(
"@echo off\r\n\
setlocal\r\n\
setlocal enableextensions\r\n\
set \"INSTALLER={installer}\"\r\n\
set \"APP_EXE={app_exe}\"\r\n\
if not exist \"%INSTALLER%\" exit /b 1\r\n\
timeout /t 2 /nobreak >nul\r\n\
start \"\" /wait \"%INSTALLER%\" /S\r\n\
start \"\" \"%APP_EXE%\"\r\n\
if exist \"%APP_EXE%\" start \"\" \"%APP_EXE%\"\r\n\
del \"%~f0\" >nul 2>nul\r\n",
installer = installer_text,
app_exe = app_text
);
fs::write(&script_path, script_content).map_err(|err| format!("写入更新脚本失败: {}", err))?;
let script_arg = script_path.to_string_lossy().to_string();
Command::new("cmd")
.args(["/C", "start", "", "/min", &script_arg])
let script_arg = format!("\"{}\"", script_path.to_string_lossy().replace('\"', "\"\""));
let mut updater_cmd = Command::new("cmd");
updater_cmd
.args(["/D", "/C", &script_arg])
.current_dir(&temp_dir)
.creation_flags(CREATE_NO_WINDOW)
.spawn()
.map_err(|err| format!("启动静默更新流程失败: {}", err))?;
}