mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 08:45:41 +08:00
chore: git hooks for linter and formatter
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
use crate::config::Config;
|
||||
use crate::utils::dirs;
|
||||
use crate::{config::Config, utils::dirs};
|
||||
use anyhow::{bail, Context, Result};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
use std::{env::current_exe, process::Command as StdCommand};
|
||||
use std::{collections::HashMap, env::current_exe, path::PathBuf, process::Command as StdCommand};
|
||||
use tokio::time::Duration;
|
||||
|
||||
// Windows only
|
||||
@@ -154,11 +151,13 @@ pub async fn reinstall_service() -> Result<()> {
|
||||
|
||||
let install_shell: String = install_path.to_string_lossy().into_owned();
|
||||
let uninstall_shell: String = uninstall_path.to_string_lossy().into_owned();
|
||||
|
||||
|
||||
// 获取提示文本,如果 i18n 失败则使用硬编码默认值
|
||||
let prompt = crate::utils::i18n::t("Service Administrator Prompt");
|
||||
let prompt = if prompt == "Service Administrator Prompt" {
|
||||
if Config::verge().latest().language.as_deref() == Some("zh") || Config::verge().latest().language.is_none() {
|
||||
if Config::verge().latest().language.as_deref() == Some("zh")
|
||||
|| Config::verge().latest().language.is_none()
|
||||
{
|
||||
"Clash Verge 需要使用管理员权限来重新安装系统服务"
|
||||
} else {
|
||||
"Clash Verge needs administrator privileges to reinstall the system service"
|
||||
@@ -166,7 +165,7 @@ pub async fn reinstall_service() -> Result<()> {
|
||||
} else {
|
||||
&prompt
|
||||
};
|
||||
|
||||
|
||||
let command = format!(
|
||||
r#"do shell script "sudo '{uninstall_shell}' && sudo '{install_shell}'" with administrator privileges with prompt "{prompt}""#
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user