fix(core): upgrade mihomo atomically instead of letting it self-update

mihomo's updater truncates its own running executable in place; macOS kills
that under Hardened Runtime and leaves a 0-byte core. Verge now downloads the
release, verifies a staged copy next to the target, and renames it into place,
which never touches the inode the running core executes from.

Closes #6834
This commit is contained in:
wonfen
2026-08-21 14:41:57 +08:00
parent e71cf0ec68
commit 1b75ea34f9
9 changed files with 529 additions and 12 deletions
+11
View File
@@ -210,6 +210,17 @@ export async function restartCore() {
return invoke<void>('restart_core')
}
export interface CoreUpgradeReport {
/** False when the managed core was already at the latest version. */
upgraded: boolean
from: string
to: string
}
export async function upgradeClashCore(force = false) {
return invoke<CoreUpgradeReport>('upgrade_clash_core', { force })
}
export async function restartApp() {
return invoke<void>('restart_app')
}