fix(updater): fix restart after update

This commit is contained in:
t8y2
2026-05-09 18:08:06 +08:00
parent 4b0681f5af
commit 8d318a2146
5 changed files with 14 additions and 7 deletions
+1 -1
View File
@@ -84,7 +84,7 @@ const renderedNotes = computed(() => {
<Button variant="outline" @click="emit('open-latest-release')">{{ t("updates.openRelease") }}</Button>
<template v-if="isDesktop">
<div v-if="updateReady" class="flex flex-col items-end gap-1">
<Button @click="emit('restart')">{{ t("updates.exitAndUpdate") }}</Button>
<Button @click="emit('restart')">{{ t("updates.restart") }}</Button>
<span class="text-xs text-muted-foreground">{{ t("updates.reopenHint") }}</span>
</div>
<Button v-else-if="isDownloadingUpdate" disabled>
+6 -2
View File
@@ -91,8 +91,12 @@ export function useAppUpdater() {
async function restartApp() {
if (!isTauriRuntime()) return;
const { exit } = await import("@tauri-apps/plugin-process");
await exit(0);
try {
const { relaunch } = await import("@tauri-apps/plugin-process");
await relaunch();
} catch (e: any) {
toast(t("updates.restartFailed", { error: e?.message || String(e) }), 5000);
}
}
return {
+3 -2
View File
@@ -51,9 +51,10 @@ export default {
downloadAndInstall: "Download & Install",
downloading: "Downloading {progress}%",
downloadFailed: "Update download failed: {error}",
restart: "Restart Now",
restart: "Exit & Restart",
restartFailed: "Failed to restart app: {error}",
exitAndUpdate: "Exit & Update",
reopenHint: "Changes will take effect when you reopen the app",
reopenHint: "The app will relaunch to finish updating",
},
sidebar: {
connections: "CONNECTIONS",
+3 -2
View File
@@ -50,9 +50,10 @@ export default {
downloadAndInstall: "下载并安装",
downloading: "下载中 {progress}%",
downloadFailed: "更新下载失败:{error}",
restart: "立即重启",
restart: "退出并重启",
restartFailed: "重启应用失败:{error}",
exitAndUpdate: "退出并更新",
reopenHint: "更新将在重新打开应用后生效",
reopenHint: "应用将自动重启以完成更新",
},
sidebar: {
connections: "连接",