diff --git a/deploy/README.md b/deploy/README.md
index 7456dc335..f0432f972 100644
--- a/deploy/README.md
+++ b/deploy/README.md
@@ -1003,10 +1003,10 @@ alpha、beta、rc、exp 在 GitHub 标记为 Pre-release,不覆盖 GitHub Late
在线更新要求官方构建且起始版本不低于 **v3.18.1**,版本选择遵循上述规则;源码等非官方构建返回不支持原因,不提供可用更新。
不满足在线更新条件时,使用完整发行包或镜像[手动部署](#镜像升级与源码构建)。
-点击「下载更新」后,操作日志显示下载、校验与安装过程,完成后显示「待重启」及待生效版本。点击「重启服务」并确认后才使用新程序。
+检查到可用版本后,右侧的「检查更新」切换为「下载更新」。操作日志显示下载、校验与安装过程,完成后显示待生效版本,点击右侧「重启服务」后生效。重启前检查目标版本和插件兼容性,目标变化或有不兼容插件时需要确认。
「当前版本」表示正在运行的版本,「通道最新」显示所选通道已发布的版本。通道版本较低时仍显示其版本号,并提示无可用更新
-启用在线重启的部署,在没有更新时也可点击「检查更新」左侧的「重启服务」。确认框提示请求中断影响,有不兼容插件时同时展示清单;取消不执行重启。服务恢复后页面自动刷新,未启用在线重启时按钮不可用
+没有待生效版本时,可点击「重启服务」并确认。重启会中断正在进行的请求,服务恢复后页面自动刷新。未启用在线重启时按钮不可用
手动更换镜像或程序后,更新器会核对安装文件并校准历史状态,不以旧成功记录推断需要重启。
运行期间检测到外部文件变动或文件缺失时会报告异常,需要核对完整发行包并重启服务后再检查。
@@ -1025,7 +1025,7 @@ host:
```
`executable_path` 为可选项:未指定时,服务在启动时解析并固定当前程序路径;
-显式配置时,将示例改为实际程序的绝对路径。`self_restart_enabled` 控制管理端的「立即重启」操作;
+显式配置时,将示例改为实际程序的绝对路径。`self_restart_enabled` 控制管理端的在线重启;
修改配置后需手动重启当前服务一次才会生效。
以上三个字段也可分别通过 `CPR_DEPLOYMENT_MODE`、`CPR_ENABLE_SELF_RESTART` 和 `CPR_UPDATE_EXE_PATH` 设置,
YAML 中显式配置的值优先于对应环境变量
diff --git a/frontend/src/i18n/locales/en/systemUpdate.json b/frontend/src/i18n/locales/en/systemUpdate.json
index f4fd5974b..b412a463c 100644
--- a/frontend/src/i18n/locales/en/systemUpdate.json
+++ b/frontend/src/i18n/locales/en/systemUpdate.json
@@ -33,7 +33,6 @@
},
"errors": {
"preRestartCheck": "Pre-restart check failed",
- "restart": "Restart failed, please check again",
"unconfirmed": "Update task has not been confirmed, check its status and try again",
"updateFailed": "Update failed",
"startTimeout": "Timed out waiting for v{version} to restart. Refresh the page to check the running version.",
@@ -52,6 +51,7 @@
"restarting": "Restarting",
"checking": "Checking",
"restartRequired": "Restart required",
+ "pendingVersion": "Restart for v{version}",
"available": "Update available",
"upToDate": "No updates available",
"notChecked": "Not checked",
diff --git a/frontend/src/i18n/locales/zh-Hans/systemUpdate.json b/frontend/src/i18n/locales/zh-Hans/systemUpdate.json
index 726f6df4a..9c1acbb13 100644
--- a/frontend/src/i18n/locales/zh-Hans/systemUpdate.json
+++ b/frontend/src/i18n/locales/zh-Hans/systemUpdate.json
@@ -33,7 +33,6 @@
},
"errors": {
"preRestartCheck": "重启前检查失败",
- "restart": "重启失败,请重新检查",
"unconfirmed": "尚未确认更新任务,请检查状态后重试",
"updateFailed": "更新失败",
"startTimeout": "等待 v{version} 重启确认超时,请刷新页面查看运行版本",
@@ -52,6 +51,7 @@
"restarting": "重启中",
"checking": "检查中",
"restartRequired": "待重启",
+ "pendingVersion": "待重启 · v{version}",
"available": "有可用更新",
"upToDate": "无可用更新",
"notChecked": "未检查",
diff --git a/frontend/src/i18n/locales/zh-Hant/systemUpdate.json b/frontend/src/i18n/locales/zh-Hant/systemUpdate.json
index 2cf72f07b..0c7dc04dc 100644
--- a/frontend/src/i18n/locales/zh-Hant/systemUpdate.json
+++ b/frontend/src/i18n/locales/zh-Hant/systemUpdate.json
@@ -33,7 +33,6 @@
},
"errors": {
"preRestartCheck": "重啓前檢查失敗",
- "restart": "重啓失敗,請重新檢查",
"unconfirmed": "尚未確認更新任務,請檢查狀態後重試",
"updateFailed": "更新失敗",
"startTimeout": "等待 v{version} 重新啟動確認逾時,請重新整理頁面查看執行版本",
@@ -52,6 +51,7 @@
"restarting": "重啓中",
"checking": "檢查中",
"restartRequired": "待重啓",
+ "pendingVersion": "待重啓 · v{version}",
"available": "有可用更新",
"upToDate": "無可用更新",
"notChecked": "未檢查",
diff --git a/frontend/src/layout/components/system-update-modal/index.vue b/frontend/src/layout/components/system-update-modal/index.vue
index 27ec95fdc..ef7316236 100644
--- a/frontend/src/layout/components/system-update-modal/index.vue
+++ b/frontend/src/layout/components/system-update-modal/index.vue
@@ -20,9 +20,10 @@ import { storeToRefs } from 'pinia'
import { computed, nextTick, shallowRef, useTemplateRef, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import { checkSystemRestart } from '@/api'
+import { useRequestState } from '@/composables/useRequestState'
import { systemUpdateChannelLabels } from '@/layout/constants/system-update-channels'
import { notification as ZNotification } from '@/plugins/notification'
-import { useSystemUpdateStore } from '@/stores/modules/system-update'
+import { normalizeSystemVersion, useSystemUpdateStore } from '@/stores/modules/system-update'
import { errorMessage } from '@/utils/operation'
import {
resolveSystemUpdateLogClasses,
@@ -48,6 +49,7 @@ const {
updateError,
lastFailedOperation,
needRestart,
+ pendingVersion,
updateLogs,
updateStreaming,
updateStreamError,
@@ -57,9 +59,15 @@ const {
} = storeToRefs(systemUpdateStore)
const { loadSystem, checkUpdates, changeChannel, updateNow, restartNow } = systemUpdateStore
+const updateDialog = useTemplateRef>('updateDialog')
const updateLogScrollbar = useTemplateRef>('updateLogScrollbar')
const restartButton = useTemplateRef>('restartButton')
-const checkingRestart = shallowRef(false)
+const restartCheck = useRequestState((error) => {
+ ZNotification.error({
+ message: errorMessage(error, t('systemUpdate.errors.preRestartCheck')),
+ })
+})
+const { loading: checkingRestart } = restartCheck
const restartConfirmOpen = shallowRef(false)
const restartPlan = shallowRef(null)
@@ -68,10 +76,11 @@ const presentation = computed(() => resolveSystemUpdatePresentation({
updateInfo: updateInfo.value,
loading: loading.value,
checking: checking.value || changingChannel.value,
- restarting: restarting.value,
+ restarting: restarting.value && !restartConfirmOpen.value,
updating: updating.value,
updateError: updateError.value,
needRestart: needRestart.value,
+ pendingVersion: pendingVersion.value,
hasUpdate: hasUpdate.value,
updateStreaming: updateStreaming.value,
updateStreamError: updateStreamError.value,
@@ -169,48 +178,57 @@ async function handleUpdateRequest() {
}
async function handleRestart() {
- if (checkingRestart.value || !canRestart.value)
+ if (checkingRestart.value || restartConfirmOpen.value || !canRestart.value)
return
- checkingRestart.value = true
+ const activationVersion = pendingVersion.value
+ const requestId = restartCheck.start()
+ // 按钮在检查期间禁用,焦点留在弹窗内才能继续用 Escape 取消
+ updateDialog.value?.focus()
+ let plan: SystemRestartPlan
try {
- restartPlan.value = await checkSystemRestart({ silent: true })
- if (!open.value)
- return
- checkingRestart.value = false
- await nextTick()
- // 检查期间按钮暂时禁用,恢复焦点后再让确认框记录返回位置
- restartButton.value?.focus()
- restartConfirmOpen.value = true
+ plan = await checkSystemRestart({ silent: true, signal: restartCheck.signal })
}
catch (error: unknown) {
- ZNotification.error({
- message: errorMessage(error, t('systemUpdate.errors.preRestartCheck')),
- })
+ restartCheck.fail(requestId, error)
+ return
}
finally {
- checkingRestart.value = false
+ restartCheck.finish(requestId)
}
+ if (!open.value || !restartCheck.isCurrent(requestId) || !canRestart.value)
+ return
+
+ // 只有检查结果与点击时的待生效版本一致,才可直接继续升级
+ if (activationVersion && activationVersion === pendingVersion.value
+ && activationVersion === normalizeSystemVersion(plan.targetVersion) && !plan.incompatiblePlugins.length) {
+ await restartNow(plan).catch(() => undefined)
+ return
+ }
+
+ restartPlan.value = plan
+ await nextTick()
+ if (!open.value || !restartCheck.isCurrent(requestId))
+ return
+ // 检查期间按钮暂时禁用,恢复焦点后再让确认框记录返回位置
+ restartButton.value?.focus()
+ restartConfirmOpen.value = true
}
async function handleConfirmRestart() {
if (!restartPlan.value)
return
- try {
- await restartNow(restartPlan.value)
- restartConfirmOpen.value = false
- }
- catch (error: unknown) {
- restartConfirmOpen.value = false
- ZNotification.error({
- message: errorMessage(error, t('systemUpdate.errors.restart')),
- })
- }
+ await restartNow(restartPlan.value).catch(() => undefined)
+ restartConfirmOpen.value = false
}
watch(open, (visible) => {
if (visible) {
void loadSystem(false).catch(() => undefined)
}
+ else {
+ restartCheck.invalidate()
+ restartConfirmOpen.value = false
+ }
})
watch(
@@ -227,6 +245,7 @@ watch(
@@ -459,7 +478,9 @@ watch(
@@ -474,8 +495,21 @@ watch(
+
+
+
+ {{ updating ? t('systemUpdate.status.updating') : t('systemUpdate.actions.install') }}
+
+
@@ -486,18 +520,6 @@ watch(
{{ t('systemUpdate.actions.check') }}
-
-
-
-
- {{ updating ? t('systemUpdate.status.updating') : t('systemUpdate.actions.install') }}
-
diff --git a/frontend/src/layout/components/system-update-modal/presenter.ts b/frontend/src/layout/components/system-update-modal/presenter.ts
index 616ec7b1c..467574c7f 100644
--- a/frontend/src/layout/components/system-update-modal/presenter.ts
+++ b/frontend/src/layout/components/system-update-modal/presenter.ts
@@ -11,6 +11,7 @@ interface SystemUpdatePresentationInput {
updating: boolean
updateError: string
needRestart: boolean
+ pendingVersion: string
hasUpdate: boolean
updateStreaming: boolean
updateStreamError: string
@@ -74,7 +75,9 @@ function resolveStatus(input: SystemUpdatePresentationInput) {
if (input.needRestart || input.hasUpdate || input.updateInfo) {
return {
label: input.needRestart
- ? t('systemUpdate.status.restartRequired')
+ ? input.pendingVersion
+ ? t('systemUpdate.status.pendingVersion', { version: input.pendingVersion })
+ : t('systemUpdate.status.restartRequired')
: input.hasUpdate
? t('systemUpdate.status.available')
: t('systemUpdate.status.upToDate'),
diff --git a/frontend/src/stores/modules/system-update.ts b/frontend/src/stores/modules/system-update.ts
index af3ea8209..700eac993 100644
--- a/frontend/src/stores/modules/system-update.ts
+++ b/frontend/src/stores/modules/system-update.ts
@@ -107,6 +107,9 @@ export const useSystemUpdateStore = defineStore('system-update', () => {
})
const needRestart = computed(() => Boolean(updateStatus.value?.needRestart))
+ const pendingVersion = computed(() => needRestart.value
+ ? normalizeSystemVersion(updateStatus.value?.currentVersion)
+ : '')
const canRestart = computed(() => version.value?.restartSupported === true
&& statusAvailable.value && !UPDATE_BUSY_PHASES.has(phaseKind.value))
const selectedChannel = computed(() => policy.value?.channel ?? 'stable')
@@ -446,6 +449,8 @@ export const useSystemUpdateStore = defineStore('system-update', () => {
updateStreamError.value = t('systemUpdate.status.confirmingStart')
return null
}
+ if (error instanceof ApiError && error.status === 409)
+ updateInfo.value = null
updateError.value = errorMessage(error)
setPhase({ kind: 'failed' })
disconnectUpdateEvents()
@@ -539,6 +544,7 @@ export const useSystemUpdateStore = defineStore('system-update', () => {
updateError,
lastFailedOperation,
needRestart,
+ pendingVersion,
updateLogs,
updateStreaming,
updateStreamError,
diff --git a/frontend/src/views/dashboard/components/account-overview/index.vue b/frontend/src/views/dashboard/components/account-overview/index.vue
index 60dad61db..6ac3b8d59 100644
--- a/frontend/src/views/dashboard/components/account-overview/index.vue
+++ b/frontend/src/views/dashboard/components/account-overview/index.vue
@@ -276,7 +276,7 @@ const statusBars = computed(() => {
v-if="accounts.length === 0"
:title="t('dashboard.activeAccounts.empty')"
surface="inset"
- class="min-h-40 place-content-center xl:h-full"
+ class="min-h-40 place-content-center xl:min-h-82.5"
/>