修复客户端更新流程与设置布局
Project CI / Repository checks (pull_request) Failing after 16s
Project CI / Backend tests (pull_request) Failing after 16s
Project CI / Frontend tests (pull_request) Failing after 3m49s
Project CI / Native shell tests (pull_request) Failing after 16m5s

补充安装完成后的客户端自动重启

修正关于页检查更新按钮被裁切

同步更新提权安装流程文档
This commit is contained in:
2026-09-01 18:11:53 +08:00
parent 9eae0a0a87
commit 51f19f3b72
2 changed files with 16 additions and 19 deletions
@@ -58,14 +58,15 @@ struct AgcUpdateDownloadProgress {
}
#[cfg(windows)]
fn launch_agc_installer(path: &Path) -> Result<(), String> {
fn launch_agc_installer(path: &Path, relaunch_path: &Path) -> Result<(), String> {
use std::os::windows::process::CommandExt;
let executable = path.to_string_lossy().replace('\'', "''");
let relaunch_executable = relaunch_path.to_string_lossy().replace('\'', "''");
let script = format!(
"$ErrorActionPreference = 'Stop'; Start-Process -Verb RunAs -FilePath '{executable}' -ArgumentList @('/S')"
"$ErrorActionPreference = 'Stop'; $installer = Start-Process -Verb RunAs -Wait -PassThru -FilePath '{executable}' -ArgumentList @('/S'); if ($installer.ExitCode -eq 0 -and (Test-Path -LiteralPath '{relaunch_executable}')) {{ Start-Process -FilePath '{relaunch_executable}' }}; exit $installer.ExitCode"
);
let status = Command::new("powershell.exe")
Command::new("powershell.exe")
.args([
"-NoProfile",
"-NonInteractive",
@@ -75,20 +76,13 @@ fn launch_agc_installer(path: &Path) -> Result<(), String> {
script.as_str(),
])
.creation_flags(0x0800_0000)
.status()
.map_err(|error| format!("无法启动更新安装程序:{error}"))?;
if status.success() {
Ok(())
} else {
Err(format!(
"无法启动更新安装程序(exit code {:?}",
status.code()
))
}
.spawn()
.map(|_| ())
.map_err(|error| format!("无法启动更新安装程序:{error}"))
}
#[cfg(not(windows))]
fn launch_agc_installer(path: &Path) -> Result<(), String> {
fn launch_agc_installer(path: &Path, _relaunch_path: &Path) -> Result<(), String> {
Command::new(path)
.arg("/S")
.spawn()
@@ -221,7 +215,9 @@ async fn download_agc_update(
let _ = fs::remove_file(&temporary);
return Err(format!("提交更新文件失败:{error}"));
}
launch_agc_installer(&target)?;
let relaunch_path = std::env::current_exe()
.map_err(|error| format!("无法定位客户端程序:{error}"))?;
launch_agc_installer(&target, &relaunch_path)?;
app.exit(0);
Ok(target.to_string_lossy().into_owned())
}
+5 -4
View File
@@ -3508,8 +3508,8 @@ h2 {
grid-template-rows: auto minmax(0, 1fr) auto;
gap: 0;
width: min(1080px, 100%);
height: min(760px, calc(100dvh - 48px));
max-height: calc(100dvh - 48px);
height: min(760px, calc(100dvh - var(--window-chrome-height) - 48px));
max-height: calc(100dvh - var(--window-chrome-height) - 48px);
padding: 0;
overflow: hidden;
border-color: var(--platform-modal-border);
@@ -4619,6 +4619,7 @@ iframe.preview-frame {
@media (max-width: 760px) {
.settings-overlay {
padding: 0;
overflow: auto;
}
.runtime-settings-toast {
@@ -4630,8 +4631,8 @@ iframe.preview-frame {
.runtime-settings-panel {
width: 100%;
height: 100dvh;
max-height: 100dvh;
height: calc(100dvh - var(--window-chrome-height));
max-height: calc(100dvh - var(--window-chrome-height));
border: 0;
border-radius: 0;
}