mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-04-14 22:10:32 +08:00
chore: update clash_verge_service_ipc to version 2.0.24 , improve service prompts and improve service need reinstall process
This commit is contained in:
parent
7aeaab6e5c
commit
f2ad62e446
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -1315,8 +1315,8 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clash_verge_service_ipc"
|
name = "clash_verge_service_ipc"
|
||||||
version = "2.0.23"
|
version = "2.0.24"
|
||||||
source = "git+https://github.com/clash-verge-rev/clash-verge-service-ipc#957fdfa7d26ba7afa1a64efef925c99163fdc598"
|
source = "git+https://github.com/clash-verge-rev/clash-verge-service-ipc#c5a557d5a9f15264697a8ac70d42946a881598d7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"compact_str",
|
"compact_str",
|
||||||
|
|||||||
@ -24,6 +24,7 @@
|
|||||||
- 修复创建窗口时在非简体中文环境或深色主题下的短暂闪烁
|
- 修复创建窗口时在非简体中文环境或深色主题下的短暂闪烁
|
||||||
- 修复更新时加载进度条异常
|
- 修复更新时加载进度条异常
|
||||||
- 升级内核失败导致内核不可用问题
|
- 升级内核失败导致内核不可用问题
|
||||||
|
- 修复 macOS 在安装和卸载服务时提示与操作不匹配
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><strong> ✨ 新增功能 </strong></summary>
|
<summary><strong> ✨ 新增功能 </strong></summary>
|
||||||
@ -57,6 +58,7 @@
|
|||||||
- 优化流量采样和数据处理
|
- 优化流量采样和数据处理
|
||||||
- 优化应用重启/退出时的资源清理性能, 大幅缩短执行时间
|
- 优化应用重启/退出时的资源清理性能, 大幅缩短执行时间
|
||||||
- 优化 WebSocket 连接机制
|
- 优化 WebSocket 连接机制
|
||||||
|
- 改进旧版 Service 需要重新安装检测流程
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
|||||||
@ -93,7 +93,7 @@ tauri-plugin-devtools = { version = "2.0.1" }
|
|||||||
tauri-plugin-mihomo = { git = "https://github.com/clash-verge-rev/tauri-plugin-mihomo" }
|
tauri-plugin-mihomo = { git = "https://github.com/clash-verge-rev/tauri-plugin-mihomo" }
|
||||||
clash_verge_logger = { git = "https://github.com/clash-verge-rev/clash-verge-logger" }
|
clash_verge_logger = { git = "https://github.com/clash-verge-rev/clash-verge-logger" }
|
||||||
async-trait = "0.1.89"
|
async-trait = "0.1.89"
|
||||||
clash_verge_service_ipc = { version = "2.0.23", features = [
|
clash_verge_service_ipc = { version = "2.0.24", features = [
|
||||||
"client",
|
"client",
|
||||||
], git = "https://github.com/clash-verge-rev/clash-verge-service-ipc" }
|
], git = "https://github.com/clash-verge-rev/clash-verge-service-ipc" }
|
||||||
arc-swap = "1.7.1"
|
arc-swap = "1.7.1"
|
||||||
|
|||||||
@ -25,7 +25,9 @@ notifications:
|
|||||||
title: Application Hidden
|
title: Application Hidden
|
||||||
body: Clash Verge is running in the background.
|
body: Clash Verge is running in the background.
|
||||||
service:
|
service:
|
||||||
adminPrompt: Installing the service requires administrator privileges.
|
adminInstallPrompt: Installing the service requires administrator privileges.
|
||||||
|
adminUninstallPrompt: Uninstalling the service requires administrator privileges.
|
||||||
|
|
||||||
tray:
|
tray:
|
||||||
dashboard: Dashboard
|
dashboard: Dashboard
|
||||||
ruleMode: Rule Mode
|
ruleMode: Rule Mode
|
||||||
|
|||||||
@ -25,7 +25,8 @@ notifications:
|
|||||||
title: 应用已隐藏
|
title: 应用已隐藏
|
||||||
body: Clash Verge 正在后台运行。
|
body: Clash Verge 正在后台运行。
|
||||||
service:
|
service:
|
||||||
adminPrompt: 安装服务需要管理员权限
|
adminInstallPrompt: 安装服务需要管理员权限
|
||||||
|
adminUninstallPrompt: 写在服务需要管理员权限
|
||||||
tray:
|
tray:
|
||||||
dashboard: 仪表板
|
dashboard: 仪表板
|
||||||
ruleMode: 规则模式
|
ruleMode: 规则模式
|
||||||
|
|||||||
@ -25,7 +25,8 @@ notifications:
|
|||||||
title: 應用已隱藏
|
title: 應用已隱藏
|
||||||
body: Clash Verge 正在背景執行。
|
body: Clash Verge 正在背景執行。
|
||||||
service:
|
service:
|
||||||
adminPrompt: 安裝服務需要管理員權限
|
adminInstallPrompt: 安裝服務需要管理員權限
|
||||||
|
adminUninstallPrompt: 卸载服務需要管理員權限
|
||||||
tray:
|
tray:
|
||||||
dashboard: 儀表板
|
dashboard: 儀表板
|
||||||
ruleMode: 規則模式
|
ruleMode: 規則模式
|
||||||
|
|||||||
@ -275,7 +275,7 @@ async fn uninstall_service() -> Result<()> {
|
|||||||
|
|
||||||
crate::utils::i18n::sync_locale().await;
|
crate::utils::i18n::sync_locale().await;
|
||||||
|
|
||||||
let prompt = rust_i18n::t!("service.adminPrompt").to_string();
|
let prompt = rust_i18n::t!("service.adminUninstallPrompt").to_string();
|
||||||
let command = format!(
|
let command = format!(
|
||||||
r#"do shell script "sudo '{uninstall_shell}'" with administrator privileges with prompt "{prompt}""#
|
r#"do shell script "sudo '{uninstall_shell}'" with administrator privileges with prompt "{prompt}""#
|
||||||
);
|
);
|
||||||
@ -311,13 +311,11 @@ async fn install_service() -> Result<()> {
|
|||||||
|
|
||||||
crate::utils::i18n::sync_locale().await;
|
crate::utils::i18n::sync_locale().await;
|
||||||
|
|
||||||
let prompt = rust_i18n::t!("service.adminPrompt").to_string();
|
let prompt = rust_i18n::t!("service.adminInstallPrompt").to_string();
|
||||||
let command = format!(
|
let command = format!(
|
||||||
r#"do shell script "sudo '{install_shell}'" with administrator privileges with prompt "{prompt}""#
|
r#"do shell script "sudo '{install_shell}'" with administrator privileges with prompt "{prompt}""#
|
||||||
);
|
);
|
||||||
|
|
||||||
// logging!(debug, Type::Service, "install command: {}", command);
|
|
||||||
|
|
||||||
let status = StdCommand::new("osascript")
|
let status = StdCommand::new("osascript")
|
||||||
.args(vec!["-e", &command])
|
.args(vec!["-e", &command])
|
||||||
.status()?;
|
.status()?;
|
||||||
@ -351,7 +349,7 @@ async fn reinstall_service() -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// 强制重装服务(UI修复按钮)
|
/// 强制重装服务(UI修复按钮)
|
||||||
pub async fn force_reinstall_service() -> Result<()> {
|
async fn force_reinstall_service() -> Result<()> {
|
||||||
logging!(info, Type::Service, "用户请求强制重装服务");
|
logging!(info, Type::Service, "用户请求强制重装服务");
|
||||||
reinstall_service().await.map_err(|err| {
|
reinstall_service().await.map_err(|err| {
|
||||||
logging!(error, Type::Service, "强制重装服务失败: {}", err);
|
logging!(error, Type::Service, "强制重装服务失败: {}", err);
|
||||||
@ -383,10 +381,10 @@ async fn check_service_version() -> Result<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// 检查服务是否需要重装
|
/// 检查服务是否需要重装
|
||||||
pub async fn check_service_needs_reinstall() -> bool {
|
pub async fn check_service_needs_reinstall() -> Result<bool> {
|
||||||
match check_service_version().await {
|
match check_service_version().await {
|
||||||
Ok(version) => version != clash_verge_service_ipc::VERSION,
|
Ok(version) => Ok(version != clash_verge_service_ipc::VERSION),
|
||||||
Err(_) => false,
|
Err(e) => Err(e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,9 +427,10 @@ pub(super) async fn start_with_existing_service(config_file: &PathBuf) -> Result
|
|||||||
pub(super) async fn run_core_by_service(config_file: &PathBuf) -> Result<()> {
|
pub(super) async fn run_core_by_service(config_file: &PathBuf) -> Result<()> {
|
||||||
logging!(info, Type::Service, "正在尝试通过服务启动核心");
|
logging!(info, Type::Service, "正在尝试通过服务启动核心");
|
||||||
|
|
||||||
if check_service_needs_reinstall().await {
|
let mut manager = SERVICE_MANAGER.lock().await;
|
||||||
reinstall_service().await?;
|
let status = manager.check_service_comprehensive().await;
|
||||||
}
|
manager.handle_service_status(&status).await?;
|
||||||
|
drop(manager);
|
||||||
|
|
||||||
logging!(info, Type::Service, "服务已运行且版本匹配,直接使用");
|
logging!(info, Type::Service, "服务已运行且版本匹配,直接使用");
|
||||||
start_with_existing_service(config_file).await
|
start_with_existing_service(config_file).await
|
||||||
@ -521,11 +520,11 @@ impl ServiceManager {
|
|||||||
|
|
||||||
/// 综合服务状态检查(一次性完成所有检查)
|
/// 综合服务状态检查(一次性完成所有检查)
|
||||||
pub async fn check_service_comprehensive(&self) -> ServiceStatus {
|
pub async fn check_service_comprehensive(&self) -> ServiceStatus {
|
||||||
match is_service_available().await {
|
match check_service_needs_reinstall().await {
|
||||||
Ok(_) => {
|
Ok(need) => {
|
||||||
logging!(info, Type::Service, "服务当前可用,检查是否需要重装");
|
logging!(debug, Type::Service, "服务当前可用,检查是否需要重装");
|
||||||
if check_service_needs_reinstall().await {
|
if need {
|
||||||
logging!(info, Type::Service, "服务需要重装且允许重装");
|
logging!(debug, Type::Service, "服务需要重装且需要重装");
|
||||||
ServiceStatus::NeedsReinstall
|
ServiceStatus::NeedsReinstall
|
||||||
} else {
|
} else {
|
||||||
ServiceStatus::Ready
|
ServiceStatus::Ready
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user