fix: stabilize silent updater and release 0.1.22
This commit is contained in:
@@ -112,7 +112,7 @@ const DOWNLOAD_SIGNED_URL_EXPIRES_SECONDS = Math.max(
|
|||||||
10,
|
10,
|
||||||
Math.min(3600, Number(process.env.DOWNLOAD_SIGNED_URL_EXPIRES_SECONDS || 30))
|
Math.min(3600, Number(process.env.DOWNLOAD_SIGNED_URL_EXPIRES_SECONDS || 30))
|
||||||
);
|
);
|
||||||
const DEFAULT_DESKTOP_VERSION = process.env.DESKTOP_LATEST_VERSION || '0.1.21';
|
const DEFAULT_DESKTOP_VERSION = process.env.DESKTOP_LATEST_VERSION || '0.1.22';
|
||||||
const DEFAULT_DESKTOP_INSTALLER_URL = process.env.DESKTOP_INSTALLER_URL || '';
|
const DEFAULT_DESKTOP_INSTALLER_URL = process.env.DESKTOP_INSTALLER_URL || '';
|
||||||
const DEFAULT_DESKTOP_RELEASE_NOTES = process.env.DESKTOP_RELEASE_NOTES || '';
|
const DEFAULT_DESKTOP_RELEASE_NOTES = process.env.DESKTOP_RELEASE_NOTES || '';
|
||||||
const DESKTOP_INSTALLERS_DIR = path.resolve(__dirname, '../frontend/downloads');
|
const DESKTOP_INSTALLERS_DIR = path.resolve(__dirname, '../frontend/downloads');
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "desktop-client",
|
"name": "desktop-client",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.1.21",
|
"version": "0.1.22",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
2
desktop-client/src-tauri/Cargo.lock
generated
2
desktop-client/src-tauri/Cargo.lock
generated
@@ -693,7 +693,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "desktop-client"
|
name = "desktop-client"
|
||||||
version = "0.1.21"
|
version = "0.1.22"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"reqwest 0.12.28",
|
"reqwest 0.12.28",
|
||||||
"rusqlite",
|
"rusqlite",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "desktop-client"
|
name = "desktop-client"
|
||||||
version = "0.1.21"
|
version = "0.1.22"
|
||||||
description = "A Tauri App"
|
description = "A Tauri App"
|
||||||
authors = ["you"]
|
authors = ["you"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|||||||
@@ -1115,6 +1115,7 @@ fn api_silent_install_and_restart(installer_path: String) -> Result<BridgeRespon
|
|||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
{
|
{
|
||||||
let current_exe = env::current_exe().map_err(|err| format!("获取当前程序路径失败: {}", err))?;
|
let current_exe = env::current_exe().map_err(|err| format!("获取当前程序路径失败: {}", err))?;
|
||||||
|
let current_pid = std::process::id();
|
||||||
let temp_dir = env::temp_dir().join("wanwan-cloud-desktop");
|
let temp_dir = env::temp_dir().join("wanwan-cloud-desktop");
|
||||||
fs::create_dir_all(&temp_dir).map_err(|err| format!("创建更新脚本目录失败: {}", err))?;
|
fs::create_dir_all(&temp_dir).map_err(|err| format!("创建更新脚本目录失败: {}", err))?;
|
||||||
let script_stamp = SystemTime::now()
|
let script_stamp = SystemTime::now()
|
||||||
@@ -1130,20 +1131,26 @@ fn api_silent_install_and_restart(installer_path: String) -> Result<BridgeRespon
|
|||||||
setlocal enableextensions\r\n\
|
setlocal enableextensions\r\n\
|
||||||
set \"INSTALLER={installer}\"\r\n\
|
set \"INSTALLER={installer}\"\r\n\
|
||||||
set \"APP_EXE={app_exe}\"\r\n\
|
set \"APP_EXE={app_exe}\"\r\n\
|
||||||
|
set \"APP_PID={app_pid}\"\r\n\
|
||||||
if not exist \"%INSTALLER%\" exit /b 1\r\n\
|
if not exist \"%INSTALLER%\" exit /b 1\r\n\
|
||||||
timeout /t 2 /nobreak >nul\r\n\
|
timeout /t 1 /nobreak >nul\r\n\
|
||||||
|
taskkill /PID %APP_PID% /T /F >nul 2>nul\r\n\
|
||||||
|
timeout /t 1 /nobreak >nul\r\n\
|
||||||
start \"\" /wait \"%INSTALLER%\" /S\r\n\
|
start \"\" /wait \"%INSTALLER%\" /S\r\n\
|
||||||
|
timeout /t 1 /nobreak >nul\r\n\
|
||||||
if exist \"%APP_EXE%\" start \"\" \"%APP_EXE%\"\r\n\
|
if exist \"%APP_EXE%\" start \"\" \"%APP_EXE%\"\r\n\
|
||||||
del \"%~f0\" >nul 2>nul\r\n",
|
del \"%~f0\" >nul 2>nul\r\n",
|
||||||
installer = installer_text,
|
installer = installer_text,
|
||||||
app_exe = app_text
|
app_exe = app_text,
|
||||||
|
app_pid = current_pid
|
||||||
);
|
);
|
||||||
fs::write(&script_path, script_content).map_err(|err| format!("写入更新脚本失败: {}", err))?;
|
fs::write(&script_path, script_content).map_err(|err| format!("写入更新脚本失败: {}", err))?;
|
||||||
|
|
||||||
let script_arg = format!("\"{}\"", script_path.to_string_lossy().replace('\"', "\"\""));
|
|
||||||
let mut updater_cmd = Command::new("cmd");
|
let mut updater_cmd = Command::new("cmd");
|
||||||
updater_cmd
|
updater_cmd
|
||||||
.args(["/D", "/C", &script_arg])
|
.arg("/D")
|
||||||
|
.arg("/C")
|
||||||
|
.arg(&script_path)
|
||||||
.current_dir(&temp_dir)
|
.current_dir(&temp_dir)
|
||||||
.creation_flags(CREATE_NO_WINDOW)
|
.creation_flags(CREATE_NO_WINDOW)
|
||||||
.spawn()
|
.spawn()
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://schema.tauri.app/config/2",
|
"$schema": "https://schema.tauri.app/config/2",
|
||||||
"productName": "玩玩云",
|
"productName": "玩玩云",
|
||||||
"version": "0.1.21",
|
"version": "0.1.22",
|
||||||
"identifier": "cn.workyai.wanwancloud.desktop",
|
"identifier": "cn.workyai.wanwancloud.desktop",
|
||||||
"build": {
|
"build": {
|
||||||
"beforeDevCommand": "npm run dev",
|
"beforeDevCommand": "npm run dev",
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ const syncState = reactive({
|
|||||||
nextRunAt: "",
|
nextRunAt: "",
|
||||||
});
|
});
|
||||||
const updateState = reactive({
|
const updateState = reactive({
|
||||||
currentVersion: "0.1.21",
|
currentVersion: "0.1.22",
|
||||||
latestVersion: "",
|
latestVersion: "",
|
||||||
available: false,
|
available: false,
|
||||||
mandatory: false,
|
mandatory: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user