fix(service): notify users about macOS App Translocation

Show a delayed localized error notice when Clash Verge is running from a
translocated temporary path and no stable core path can be resolved.
This commit is contained in:
wonfen
2026-06-28 03:48:13 +08:00
parent 4c46223107
commit 1e44bafa79
14 changed files with 30 additions and 0 deletions
+1
View File
@@ -34,6 +34,7 @@ notifications:
service:
adminInstallPrompt: يتطلب تثبيت خدمة Clash Verge صلاحيات المسؤول.
adminUninstallPrompt: يتطلب إلغاء تثبيت خدمة Clash Verge صلاحيات المسؤول.
translocatedCorePath: Clash Verge is running from a temporary (App Translocation) path and can't locate the core. Please move Clash Verge into the Applications folder and reopen it.
tray:
dashboard: لوحة التحكم
ruleMode: وضع القواعد
+1
View File
@@ -34,6 +34,7 @@ notifications:
service:
adminInstallPrompt: Für die Installation des Clash-Verge-Dienstes sind Administratorrechte erforderlich.
adminUninstallPrompt: Für die Deinstallation des Clash-Verge-Dienstes sind Administratorrechte erforderlich.
translocatedCorePath: Clash Verge is running from a temporary (App Translocation) path and can't locate the core. Please move Clash Verge into the Applications folder and reopen it.
tray:
dashboard: Übersicht
ruleMode: Regelmodus
+1
View File
@@ -34,6 +34,7 @@ notifications:
service:
adminInstallPrompt: Installing the Clash Verge service requires administrator privileges.
adminUninstallPrompt: Uninstalling the Clash Verge service requires administrator privileges.
translocatedCorePath: Clash Verge is running from a temporary (App Translocation) path and can't locate the core. Please move Clash Verge into the Applications folder and reopen it.
tray:
dashboard: Dashboard
ruleMode: Rule Mode
+1
View File
@@ -34,6 +34,7 @@ notifications:
service:
adminInstallPrompt: Instalar el servicio de Clash Verge requiere privilegios de administrador.
adminUninstallPrompt: Desinstalar el servicio de Clash Verge requiere privilegios de administrador.
translocatedCorePath: Clash Verge is running from a temporary (App Translocation) path and can't locate the core. Please move Clash Verge into the Applications folder and reopen it.
tray:
dashboard: Panel
ruleMode: Modo de reglas
+1
View File
@@ -34,6 +34,7 @@ notifications:
service:
adminInstallPrompt: نصب سرویس Clash Verge به دسترسی مدیر نیاز دارد.
adminUninstallPrompt: حذف سرویس Clash Verge به دسترسی مدیر نیاز دارد.
translocatedCorePath: Clash Verge is running from a temporary (App Translocation) path and can't locate the core. Please move Clash Verge into the Applications folder and reopen it.
tray:
dashboard: داشبورد
ruleMode: حالت قوانین
+1
View File
@@ -34,6 +34,7 @@ notifications:
service:
adminInstallPrompt: Menginstal layanan Clash Verge memerlukan hak administrator.
adminUninstallPrompt: Menghapus instalasi layanan Clash Verge memerlukan hak administrator.
translocatedCorePath: Clash Verge is running from a temporary (App Translocation) path and can't locate the core. Please move Clash Verge into the Applications folder and reopen it.
tray:
dashboard: Dasbor
ruleMode: Mode Aturan
+1
View File
@@ -34,6 +34,7 @@ notifications:
service:
adminInstallPrompt: Clash Verge サービスのインストールには管理者権限が必要です。
adminUninstallPrompt: Clash Verge サービスのアンインストールには管理者権限が必要です。
translocatedCorePath: Clash Verge is running from a temporary (App Translocation) path and can't locate the core. Please move Clash Verge into the Applications folder and reopen it.
tray:
dashboard: ダッシュボード
ruleMode: ルールモード
+1
View File
@@ -34,6 +34,7 @@ notifications:
service:
adminInstallPrompt: Clash Verge 서비스 설치에는 관리자 권한이 필요합니다.
adminUninstallPrompt: Clash Verge 서비스 제거에는 관리자 권한이 필요합니다.
translocatedCorePath: Clash Verge is running from a temporary (App Translocation) path and can't locate the core. Please move Clash Verge into the Applications folder and reopen it.
tray:
dashboard: 대시보드
ruleMode: 규칙 모드
+1
View File
@@ -34,6 +34,7 @@ notifications:
service:
adminInstallPrompt: Для установки службы Clash Verge требуются права администратора.
adminUninstallPrompt: Для удаления службы Clash Verge требуются права администратора.
translocatedCorePath: Clash Verge is running from a temporary (App Translocation) path and can't locate the core. Please move Clash Verge into the Applications folder and reopen it.
tray:
dashboard: Панель
ruleMode: Режим правил
+1
View File
@@ -34,6 +34,7 @@ notifications:
service:
adminInstallPrompt: Clash Verge hizmetini kurmak için yönetici ayrıcalıkları gerekir.
adminUninstallPrompt: Clash Verge hizmetini kaldırmak için yönetici ayrıcalıkları gerekir.
translocatedCorePath: Clash Verge is running from a temporary (App Translocation) path and can't locate the core. Please move Clash Verge into the Applications folder and reopen it.
tray:
dashboard: Gösterge Paneli
ruleMode: Kural Modu
+1
View File
@@ -34,6 +34,7 @@ notifications:
service:
adminInstallPrompt: Clash Verge хезмәтен урнаштыру өчен администратор хокуклары кирәк.
adminUninstallPrompt: Clash Verge хезмәтен бетерү өчен администратор хокуклары кирәк.
translocatedCorePath: Clash Verge is running from a temporary (App Translocation) path and can't locate the core. Please move Clash Verge into the Applications folder and reopen it.
tray:
dashboard: Идарә панеле
ruleMode: Кагыйдә режимы
+1
View File
@@ -34,6 +34,7 @@ notifications:
service:
adminInstallPrompt: 安装 Clash Verge 服务需要管理员权限
adminUninstallPrompt: 卸载 Clash Verge 服务需要管理员权限
translocatedCorePath: 检测到 Clash Verge 从临时路径(App Translocation)运行,无法定位内核。请将 Clash Verge 移动到「应用程序」文件夹后重新打开。
tray:
dashboard: 仪表板
ruleMode: 规则模式
+1
View File
@@ -34,6 +34,7 @@ notifications:
service:
adminInstallPrompt: 安裝 Clash Verge 服務需要管理員權限
adminUninstallPrompt: 卸载 Clash Verge 服務需要管理員權限
translocatedCorePath: Clash Verge is running from a temporary (App Translocation) path and can't locate the core. Please move Clash Verge into the Applications folder and reopen it.
tray:
dashboard: 儀表板
ruleMode: 規則模式
+17
View File
@@ -65,12 +65,29 @@ fn service_core_path(clash_core: &str, bin_ext: &str) -> Result<PathBuf> {
return Ok(stable_path);
}
// 给用户一个可操作的提示,再 bail 让服务启动失败 —— 避免用临时路径起内核。
notify_translocated_core_path();
bail!(
"macOS App Translocation detected; refusing to start service with temporary core path {:?}",
candidate
)
}
/// 发送 translocation 用户提示。**延迟**发送:app 启动期会自动尝试起 core,此时前端的
/// `verge://notice-message` 监听器(随 React 布局挂载后才注册)可能尚未就绪,而后端 emit
/// 没有重放队列 —— 立即发会丢失。延迟到前端挂载后再发,既覆盖"启动自动起 core 失败"、
/// 也兼顾手动启动(错误提示略迟可接受)。复用前端 `set_config::error` 处理器直接展示该消息。
#[cfg(target_os = "macos")]
fn notify_translocated_core_path() {
crate::process::AsyncHandler::spawn(|| async {
tokio::time::sleep(std::time::Duration::from_secs(3)).await;
crate::core::handle::Handle::notice_message(
"set_config::error",
clash_verge_i18n::t!("service.translocatedCorePath").to_string(),
);
});
}
#[cfg(target_os = "macos")]
fn is_macos_app_translocated(path: &Path) -> bool {
path.components()