fix: update service to 2.1.0 and improve service installation for Unix systems (#6114)

* fix: update service to 2.1.0 and improve service installation for Unix systems

* fix: set GID environment variable during service installation on Linux

* Revert "fix: set GID environment variable during service installation on Linux"

This reverts commit 373aec579b.
This commit is contained in:
Tunglies
2026-01-19 14:02:25 +08:00
committed by GitHub
parent 2869a35f1e
commit d1649e3017
5 changed files with 12 additions and 24 deletions

2
Cargo.lock generated
View File

@@ -1312,7 +1312,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"
dependencies = [
"lazy_static",
"windows-sys 0.59.0",
"windows-sys 0.48.0",
]
[[package]]

View File

@@ -1,25 +1,5 @@
## v2.4.5
> [!WARNING]
> 此版本 macOS 和 Linux 对服务 IPC 权限进一步限制引入了破坏性变更,需要先在旧版本**卸载 TUN 服务**后再安装新版本。
>
> **已经安装的用户**可在终端卸载服务再安装。
>
> 对于 macOS
>
> ```bash
> APP="/Applications/Clash Verge.app"
> sudo "$APP/Contents/Resources/resources/clash-verge-service-uninstall"
> sudo "$APP/Contents/Resources/resources/clash-verge-service-install"
> ```
>
> 对于 Linux
>
> ```bash
> sudo clash-verge-service-uninstall
> sudo clash-verge-service-install
> ```
- **Mihomo(Meta) 内核升级至 v1.19.19**
### 🐞 修复问题

View File

@@ -120,6 +120,12 @@ fn is_binary_admin() -> bool {
.unwrap_or(false)
}
#[inline]
#[cfg(unix)]
pub fn current_gid() -> u32 {
unsafe { libc::getgid() }
}
#[inline]
pub fn list_network_interfaces() -> Vec<String> {
let mut networks = Networks::new();

View File

@@ -99,7 +99,7 @@ tauri-plugin-devtools = { version = "2.0.1" }
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" }
async-trait = "0.1.89"
clash_verge_service_ipc = { version = "2.0.30", features = [
clash_verge_service_ipc = { version = "2.1.0", features = [
"client",
], git = "https://github.com/clash-verge-rev/clash-verge-service-ipc" }
arc-swap = "1.8.0"

View File

@@ -256,9 +256,11 @@ fn install_service() -> Result<()> {
// clash_verge_i18n::sync_locale(Config::verge().await.latest_arc().language.as_deref());
let gid = tauri_plugin_clash_verge_sysinfo::current_gid();
let prompt = clash_verge_i18n::t!("service.adminInstallPrompt");
let command =
format!(r#"do shell script "sudo '{install_shell}'" with administrator privileges with prompt "{prompt}""#);
let command = format!(
r#"do shell script "sudo CLASH_VERGE_SERVICE_GID={gid} '{install_shell}'" with administrator privileges with prompt "{prompt}""#
);
let status = StdCommand::new("osascript").args(vec!["-e", &command]).status()?;