diff --git a/Changelog.md b/Changelog.md index d01e4a0c2..283fc612f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -7,6 +7,7 @@ - macOS 非预期 Tproxy 端口设置 - 流量图缩放异常 - PAC 自动代理脚本内容无法动态调整 +- 兼容从旧版服务模式升级 - Monaco 编辑器的行数上限
diff --git a/src-tauri/src/core/service.rs b/src-tauri/src/core/service.rs index 5c378e6f1..15426919a 100644 --- a/src-tauri/src/core/service.rs +++ b/src-tauri/src/core/service.rs @@ -555,6 +555,13 @@ impl ServiceManager { ServiceStatus::InstallRequired => { logging!(info, Type::Service, "需要安装服务,执行安装流程"); install_service().await?; + // compatible with older service version, force reinstall if service is unavailable + // wait for service server is running + tokio::time::sleep(Duration::from_millis(500)).await; + if is_service_available().await.is_err() { + logging!(info, Type::Service, "服务需要强制重装,执行强制重装流程"); + force_reinstall_service().await?; + } self.0 = ServiceStatus::Ready; } ServiceStatus::UninstallRequired => {