mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-08 11:02:08 +08:00
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:
@@ -118,6 +118,16 @@ pub async fn restart_core() -> CmdResult {
|
||||
result
|
||||
}
|
||||
|
||||
/// Replaces the managed core binary atomically instead of letting mihomo overwrite itself.
|
||||
#[tauri::command]
|
||||
pub async fn upgrade_clash_core(force: bool) -> CmdResult<feat::CoreUpgradeReport> {
|
||||
let report = feat::upgrade_core(force).await.with_error_code("CORE_UPGRADE_FAILED")?;
|
||||
if report.upgraded {
|
||||
handle::Handle::refresh_clash();
|
||||
}
|
||||
Ok(report)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn test_delay(url: String) -> CmdResult<u32> {
|
||||
let result = match feat::test_delay(url).await {
|
||||
|
||||
Reference in New Issue
Block a user