renamed to koala clash

This commit is contained in:
coolcoala
2025-08-05 17:51:26 +03:00
parent 7be3cdeb65
commit e32e83d45e
36 changed files with 286 additions and 276 deletions

192
src-tauri/Cargo.lock generated
View File

@@ -1059,80 +1059,6 @@ dependencies = [
"inout",
]
[[package]]
name = "clash-verge"
version = "0.2.4"
dependencies = [
"ab_glyph",
"aes-gcm",
"anyhow",
"async-trait",
"base64 0.22.1",
"boa_engine",
"chrono",
"deelevate",
"delay_timer",
"dirs 6.0.0",
"dunce",
"futures",
"gethostname 1.0.2",
"getrandom 0.3.3",
"hex",
"hmac",
"image",
"imageproc",
"lazy_static",
"libc",
"log",
"log4rs",
"machine-uid",
"mihomo_api",
"nanoid",
"network-interface",
"once_cell",
"open",
"os_info",
"parking_lot",
"percent-encoding",
"port_scanner",
"regex",
"reqwest",
"reqwest_dav",
"runas",
"scopeguard",
"serde",
"serde_json",
"serde_yaml",
"sha2 0.10.9",
"sys-locale",
"sysinfo",
"sysproxy",
"tauri",
"tauri-build",
"tauri-plugin-autostart",
"tauri-plugin-clipboard-manager",
"tauri-plugin-deep-link",
"tauri-plugin-devtools",
"tauri-plugin-dialog",
"tauri-plugin-fs",
"tauri-plugin-global-shortcut",
"tauri-plugin-notification",
"tauri-plugin-process",
"tauri-plugin-shell",
"tauri-plugin-updater",
"tauri-plugin-window-state",
"tempfile",
"tokio",
"tokio-tungstenite 0.27.0",
"tungstenite 0.27.0",
"url",
"users",
"warp",
"winapi",
"winreg 0.55.0",
"zip",
]
[[package]]
name = "clipboard-win"
version = "5.4.0"
@@ -3622,6 +3548,81 @@ dependencies = [
"unicode-segmentation",
]
[[package]]
name = "koala-clash"
version = "0.2.4"
dependencies = [
"ab_glyph",
"aes-gcm",
"anyhow",
"async-trait",
"base64 0.22.1",
"boa_engine",
"chrono",
"deelevate",
"delay_timer",
"dirs 6.0.0",
"dunce",
"futures",
"gethostname 1.0.2",
"getrandom 0.3.3",
"hex",
"hmac",
"image",
"imageproc",
"lazy_static",
"libc",
"log",
"log4rs",
"machine-uid",
"mihomo_api",
"nanoid",
"network-interface",
"once_cell",
"open",
"os_info",
"parking_lot",
"percent-encoding",
"port_scanner",
"regex",
"reqwest",
"reqwest_dav",
"runas",
"scopeguard",
"serde",
"serde_json",
"serde_yaml",
"sha2 0.10.9",
"sys-locale",
"sysinfo",
"sysproxy",
"tauri",
"tauri-build",
"tauri-plugin-autostart",
"tauri-plugin-clipboard-manager",
"tauri-plugin-deep-link",
"tauri-plugin-devtools",
"tauri-plugin-dialog",
"tauri-plugin-fs",
"tauri-plugin-global-shortcut",
"tauri-plugin-notification",
"tauri-plugin-process",
"tauri-plugin-shell",
"tauri-plugin-single-instance",
"tauri-plugin-updater",
"tauri-plugin-window-state",
"tempfile",
"tokio",
"tokio-tungstenite 0.27.0",
"tungstenite 0.27.0",
"url",
"users",
"warp",
"winapi",
"winreg 0.55.0",
"zip",
]
[[package]]
name = "kuchikiki"
version = "0.8.8-speedreader"
@@ -3887,11 +3888,12 @@ dependencies = [
[[package]]
name = "machine-uid"
version = "0.2.0"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f1595709b0a7386bcd56ba34d250d626e5503917d05d32cdccddcd68603e212"
checksum = "0c4506fa0abb0a2ea93f5862f55973da0a662d2ad0e98f337a1c5aac657f0892"
dependencies = [
"winreg 0.6.2",
"libc",
"winreg 0.52.0",
]
[[package]]
@@ -6846,9 +6848,9 @@ dependencies = [
[[package]]
name = "sysinfo"
version = "0.35.2"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c3ffa3e4ff2b324a57f7aeb3c349656c7b127c3c189520251a648102a92496e"
checksum = "252800745060e7b9ffb7b2badbd8b31cfa4aa2e61af879d0a3bf2a317c20217d"
dependencies = [
"libc",
"memchr",
@@ -7294,6 +7296,21 @@ dependencies = [
"tokio",
]
[[package]]
name = "tauri-plugin-single-instance"
version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50a0e5a4ce43cb3a733c3aef85e8478bc769dac743c615e26639cbf5d953faf7"
dependencies = [
"serde",
"serde_json",
"tauri",
"thiserror 2.0.12",
"tracing",
"windows-sys 0.60.2",
"zbus",
]
[[package]]
name = "tauri-plugin-updater"
version = "2.9.0"
@@ -9323,15 +9340,6 @@ dependencies = [
"memchr",
]
[[package]]
name = "winreg"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9"
dependencies = [
"winapi",
]
[[package]]
name = "winreg"
version = "0.10.1"
@@ -9568,9 +9576,9 @@ dependencies = [
[[package]]
name = "zbus"
version = "5.7.1"
version = "5.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3a7c7cee313d044fca3f48fa782cb750c79e4ca76ba7bc7718cd4024cdf6f68"
checksum = "4bb4f9a464286d42851d18a605f7193b8febaf5b0919d71c6399b7b26e5b0aad"
dependencies = [
"async-broadcast",
"async-executor",
@@ -9602,9 +9610,9 @@ dependencies = [
[[package]]
name = "zbus_macros"
version = "5.7.1"
version = "5.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a17e7e5eec1550f747e71a058df81a9a83813ba0f6a95f39c4e218bdc7ba366a"
checksum = "ef9859f68ee0c4ee2e8cde84737c78e3f4c54f946f2a38645d0d4c7a95327659"
dependencies = [
"proc-macro-crate 3.3.0",
"proc-macro2",

View File

@@ -1,16 +1,16 @@
[package]
name = "clash-verge"
name = "koala-clash"
version = "0.2.4"
description = "clash verge"
description = "koala clash"
authors = ["zzzgydi", "wonfen", "MystiPanda", "coolcoala"]
license = "GPL-3.0-only"
repository = "https://github.com/coolcoala/clash-verge-rev-lite.git"
default-run = "clash-verge"
default-run = "koala-clash"
edition = "2021"
build = "build.rs"
[package.metadata.bundle]
identifier = "io.github.clash-verge-rev.clash-verge-rev"
identifier = "io.github.koala-clash"
[build-dependencies]
tauri-build = { version = "2.3.0", features = [] }
@@ -18,7 +18,7 @@ tauri-build = { version = "2.3.0", features = [] }
[dependencies]
url = "2.5.4"
os_info = "3.0"
machine-uid = "0.2"
machine-uid = "0.5.3"
warp = "0.3.7"
anyhow = "1.0.98"
dirs = "6.0"
@@ -28,7 +28,7 @@ dunce = "1.0.5"
log4rs = "1.3.0"
nanoid = "0.4"
chrono = "0.4.41"
sysinfo = "0.35.2"
sysinfo = "0.36.1"
boa_engine = "0.20.0"
serde_json = "1.0.140"
serde_yaml = "0.9.34-deprecated"
@@ -110,6 +110,7 @@ users = "0.11.0"
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
tauri-plugin-autostart = "2.5.0"
tauri-plugin-global-shortcut = "2.3.0"
tauri-plugin-single-instance = "2"
tauri-plugin-updater = "2.9.0"
[features]

View File

@@ -1,4 +1,4 @@
#!/bin/bash
chmod +x /usr/bin/install-service
chmod +x /usr/bin/uninstall-service
chmod +x /usr/bin/clash-verge-service
chmod +x /usr/bin/koala-clash-service

View File

@@ -6,7 +6,7 @@
<false/>
<key>com.apple.security.application-groups</key>
<array>
<string>io.github.clash-verge-rev.clash-verge-rev</string>
<string>io.github.koala-clash</string>
</array>
<key>com.apple.security.inherit</key>
<true/>

View File

@@ -427,52 +427,52 @@ Function .onInit
!endif
FunctionEnd
!macro CheckAllVergeProcesses
; Check if clash-verge-service.exe is running
!macro CheckAllKoalaProcesses
; Check if koala-clash-service.exe is running
!if "${INSTALLMODE}" == "currentUser"
nsis_tauri_utils::FindProcessCurrentUser "clash-verge-service.exe"
nsis_tauri_utils::FindProcessCurrentUser "koala-clash-service.exe"
!else
nsis_tauri_utils::FindProcess "clash-verge-service.exe"
nsis_tauri_utils::FindProcess "koala-clash-service.exe"
!endif
Pop $R0
${If} $R0 = 0
DetailPrint "Kill clash-verge-service.exe..."
DetailPrint "Kill koala-clash-service.exe..."
!if "${INSTALLMODE}" == "currentUser"
nsis_tauri_utils::KillProcessCurrentUser "clash-verge-service.exe"
nsis_tauri_utils::KillProcessCurrentUser "koala-clash-service.exe"
!else
nsis_tauri_utils::KillProcess "clash-verge-service.exe"
nsis_tauri_utils::KillProcess "koala-clash-service.exe"
!endif
${EndIf}
; Check if verge-mihomo-alpha.exe is running
; Check if koala-mihomo-alpha.exe is running
!if "${INSTALLMODE}" == "currentUser"
nsis_tauri_utils::FindProcessCurrentUser "verge-mihomo-alpha.exe"
nsis_tauri_utils::FindProcessCurrentUser "koala-mihomo-alpha.exe"
!else
nsis_tauri_utils::FindProcess "verge-mihomo-alpha.exe"
nsis_tauri_utils::FindProcess "koala-mihomo-alpha.exe"
!endif
Pop $R0
${If} $R0 = 0
DetailPrint "Kill verge-mihomo-alpha.exe..."
DetailPrint "Kill koala-mihomo-alpha.exe..."
!if "${INSTALLMODE}" == "currentUser"
nsis_tauri_utils::KillProcessCurrentUser "verge-mihomo-alpha.exe"
nsis_tauri_utils::KillProcessCurrentUser "koala-mihomo-alpha.exe"
!else
nsis_tauri_utils::KillProcess "verge-mihomo-alpha.exe"
nsis_tauri_utils::KillProcess "koala-mihomo-alpha.exe"
!endif
${EndIf}
; Check if verge-mihomo.exe is running
; Check if koala-mihomo.exe is running
!if "${INSTALLMODE}" == "currentUser"
nsis_tauri_utils::FindProcessCurrentUser "verge-mihomo.exe"
nsis_tauri_utils::FindProcessCurrentUser "koala-mihomo.exe"
!else
nsis_tauri_utils::FindProcess "verge-mihomo.exe"
nsis_tauri_utils::FindProcess "koala-mihomo.exe"
!endif
Pop $R0
${If} $R0 = 0
DetailPrint "Kill verge-mihomo.exe..."
DetailPrint "Kill koala-mihomo.exe..."
!if "${INSTALLMODE}" == "currentUser"
nsis_tauri_utils::KillProcessCurrentUser "verge-mihomo.exe"
nsis_tauri_utils::KillProcessCurrentUser "koala-mihomo.exe"
!else
nsis_tauri_utils::KillProcess "verge-mihomo.exe"
nsis_tauri_utils::KillProcess "koala-mihomo.exe"
!endif
${EndIf}
@@ -509,22 +509,22 @@ FunctionEnd
${EndIf}
!macroend
!macro StartVergeService
!macro StartKoalaService
; Check if the service exists
SimpleSC::ExistsService "clash_verge_service"
SimpleSC::ExistsService "koala_clash_service"
Pop $0 ; 0service existsother: service not exists
; Service exists
${If} $0 == 0
Push $0
; Check if the service is running
SimpleSC::ServiceIsRunning "clash_verge_service"
SimpleSC::ServiceIsRunning "koala_clash_service"
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
Pop $1 ; returns 1 (service is running) - returns 0 (service is not running)
${If} $0 == 0
Push $0
${If} $1 == 0
DetailPrint "Restart Clash Verge Service..."
SimpleSC::StartService "clash_verge_service" "" 30
DetailPrint "Restart Koala Clash Service..."
SimpleSC::StartService "koala_clash_service" "" 30
${EndIf}
${ElseIf} $0 != 0
Push $0
@@ -535,35 +535,35 @@ FunctionEnd
${EndIf}
!macroend
!macro RemoveVergeService
!macro RemoveKoalaService
; Check if the service exists
SimpleSC::ExistsService "clash_verge_service"
SimpleSC::ExistsService "koala_clash_service"
Pop $0 ; 0service existsother: service not exists
; Service exists
${If} $0 == 0
Push $0
; Check if the service is running
SimpleSC::ServiceIsRunning "clash_verge_service"
SimpleSC::ServiceIsRunning "koala_clash_service"
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
Pop $1 ; returns 1 (service is running) - returns 0 (service is not running)
${If} $0 == 0
Push $0
${If} $1 == 1
DetailPrint "Stop Clash Verge Service..."
SimpleSC::StopService "clash_verge_service" 1 30
DetailPrint "Stop Koala Clash Service..."
SimpleSC::StopService "koala_clash_service" 1 30
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
${If} $0 == 0
DetailPrint "Removing Clash Verge Service..."
SimpleSC::RemoveService "clash_verge_service"
DetailPrint "Removing Koala Clash Service..."
SimpleSC::RemoveService "koala_clash_service"
${ElseIf} $0 != 0
Push $0
SimpleSC::GetErrorMessage
Pop $0
MessageBox MB_OK|MB_ICONSTOP "Clash Verge Service Stop Error ($0)"
MessageBox MB_OK|MB_ICONSTOP "Koala Clash Service Stop Error ($0)"
${EndIf}
${ElseIf} $1 == 0
DetailPrint "Removing Clash Verge Service..."
SimpleSC::RemoveService "clash_verge_service"
DetailPrint "Removing Koala Clash Service..."
SimpleSC::RemoveService "koala_clash_service"
${EndIf}
${ElseIf} $0 != 0
Push $0
@@ -764,7 +764,7 @@ Section Install
SetOutPath $INSTDIR
nsExec::Exec 'netsh int tcp res'
!insertmacro CheckIfAppIsRunning
!insertmacro CheckAllVergeProcesses
!insertmacro CheckAllKoalaProcesses
; 清理自启动注册表项
DetailPrint "Cleaning auto-launch registry entries..."
@@ -772,32 +772,32 @@ Section Install
StrCpy $R1 "Software\Microsoft\Windows\CurrentVersion\Run"
SetRegView 64
; 清理旧版本的注册表项 (Clash Verge)
ReadRegStr $R2 HKCU "$R1" "Clash Verge"
; 清理旧版本的注册表项 (Koala Clash)
ReadRegStr $R2 HKCU "$R1" "Koala Clash"
${If} $R2 != ""
DeleteRegValue HKCU "$R1" "Clash Verge"
DeleteRegValue HKCU "$R1" "Koala Clash"
${EndIf}
ReadRegStr $R2 HKLM "$R1" "Clash Verge"
ReadRegStr $R2 HKLM "$R1" "Koala Clash"
${If} $R2 != ""
DeleteRegValue HKLM "$R1" "Clash Verge"
DeleteRegValue HKLM "$R1" "Koala Clash"
${EndIf}
; 清理新版本的注册表项 (clash-verge)
ReadRegStr $R2 HKCU "$R1" "clash-verge"
; 清理新版本的注册表项 (koala-clash)
ReadRegStr $R2 HKCU "$R1" "koala-clash"
${If} $R2 != ""
DeleteRegValue HKCU "$R1" "clash-verge"
DeleteRegValue HKCU "$R1" "koala-clash"
${EndIf}
ReadRegStr $R2 HKLM "$R1" "clash-verge"
ReadRegStr $R2 HKLM "$R1" "koala-clash"
${If} $R2 != ""
DeleteRegValue HKLM "$R1" "clash-verge"
DeleteRegValue HKLM "$R1" "koala-clash"
${EndIf}
; Delete old files before installation
; Delete clash-verge.desktop
IfFileExists "$INSTDIR\Clash Verge.exe" 0 +2
Delete "$INSTDIR\Clash Verge.exe"
; Delete koala-clash.desktop
IfFileExists "$INSTDIR\Koala Clash.exe" 0 +2
Delete "$INSTDIR\Koala Clash.exe"
; Copy main executable
File "${MAINBINARYSRCPATH}"
@@ -815,7 +815,7 @@ Section Install
File /a "/oname={{this}}" "{{@key}}"
{{/each}}
!insertmacro StartVergeService
!insertmacro StartKoalaService
; Create uninstaller
WriteUninstaller "$INSTDIR\uninstall.exe"
@@ -918,11 +918,11 @@ FunctionEnd
Section Uninstall
;删除 window-state.json 文件
SetShellVarContext current
Delete "$APPDATA\io.github.clash-verge-rev.clash-verge-rev\window-state.json"
Delete "$APPDATA\io.github.koala-clash\window-state.json"
!insertmacro CheckIfAppIsRunning
!insertmacro CheckAllVergeProcesses
!insertmacro RemoveVergeService
!insertmacro CheckAllKoalaProcesses
!insertmacro RemoveKoalaService
; 清理自启动注册表项
DetailPrint "Cleaning auto-launch registry entries..."
@@ -930,26 +930,26 @@ Section Uninstall
StrCpy $R1 "Software\Microsoft\Windows\CurrentVersion\Run"
SetRegView 64
; 清理旧版本的注册表项 (Clash Verge)
ReadRegStr $R2 HKCU "$R1" "Clash Verge"
; 清理旧版本的注册表项 (Koala Clash)
ReadRegStr $R2 HKCU "$R1" "Koala Clash"
${If} $R2 != ""
DeleteRegValue HKCU "$R1" "Clash Verge"
DeleteRegValue HKCU "$R1" "Koala Clash"
${EndIf}
ReadRegStr $R2 HKLM "$R1" "Clash Verge"
ReadRegStr $R2 HKLM "$R1" "Koala Clash"
${If} $R2 != ""
DeleteRegValue HKLM "$R1" "Clash Verge"
DeleteRegValue HKLM "$R1" "Koala Clash"
${EndIf}
; 清理新版本的注册表项 (clash-verge)
ReadRegStr $R2 HKCU "$R1" "clash-verge"
; 清理新版本的注册表项 (koala-clash)
ReadRegStr $R2 HKCU "$R1" "koala-clash"
${If} $R2 != ""
DeleteRegValue HKCU "$R1" "clash-verge"
DeleteRegValue HKCU "$R1" "koala-clash"
${EndIf}
ReadRegStr $R2 HKLM "$R1" "clash-verge"
ReadRegStr $R2 HKLM "$R1" "koala-clash"
${If} $R2 != ""
DeleteRegValue HKLM "$R1" "clash-verge"
DeleteRegValue HKLM "$R1" "koala-clash"
${EndIf}
; Delete the app directory and its content from disk
@@ -966,9 +966,9 @@ Section Uninstall
Delete "$INSTDIR\\{{this}}"
{{/each}}
; Delete clash-verge.desktop
IfFileExists "$INSTDIR\Clash Verge.exe" 0 +2
Delete "$INSTDIR\Clash Verge.exe"
; Delete koala-clash.desktop
IfFileExists "$INSTDIR\Koala Clash.exe" 0 +2
Delete "$INSTDIR\Koala Clash.exe"
; Delete uninstaller
Delete "$INSTDIR\uninstall.exe"
@@ -982,20 +982,20 @@ Section Uninstall
!insertmacro UnpinShortcut "$SMPROGRAMS\$AppStartMenuFolder\${PRODUCTNAME}.lnk"
!insertmacro UnpinShortcut "$DESKTOP\${PRODUCTNAME}.lnk"
; 兼容旧名称快捷方式
!insertmacro UnpinShortcut "$SMPROGRAMS\$AppStartMenuFolder\clash-verge.lnk"
!insertmacro UnpinShortcut "$DESKTOP\clash-verge.lnk"
!insertmacro UnpinShortcut "$SMPROGRAMS\$AppStartMenuFolder\koala-clash.lnk"
!insertmacro UnpinShortcut "$DESKTOP\koala-clash.lnk"
; Remove start menu shortcut
!insertmacro MUI_STARTMENU_GETFOLDER Application $AppStartMenuFolder
Delete "$SMPROGRAMS\$AppStartMenuFolder\${PRODUCTNAME}.lnk"
; 兼容旧名称快捷方式
Delete "$SMPROGRAMS\$AppStartMenuFolder\clash-verge.lnk"
Delete "$SMPROGRAMS\$AppStartMenuFolder\koala-clash.lnk"
RMDir "$SMPROGRAMS\$AppStartMenuFolder"
; Remove desktop shortcuts
Delete "$DESKTOP\${PRODUCTNAME}.lnk"
; 兼容旧名称快捷方式
Delete "$DESKTOP\clash-verge.lnk"
Delete "$DESKTOP\koala-clash.lnk"
; Remove registry information for add/remove programs
!if "${INSTALLMODE}" == "both"
@@ -1017,7 +1017,7 @@ Section Uninstall
;删除 window-state.json 文件
SetShellVarContext current
Delete "$APPDATA\io.github.clash-verge-rev.clash-verge-rev\window-state.json"
Delete "$APPDATA\io.github.koala-clash\window-state.json"
${GetOptions} $CMDLINE "/P" $R0
IfErrors +2 0

View File

@@ -129,7 +129,7 @@ impl IClashTemp {
help::save_yaml(
&dirs::clash_path()?,
&self.0,
Some("# Generated by Clash Verge"),
Some("# Generated by Koala Clash"),
)
}

View File

@@ -11,8 +11,8 @@ use once_cell::sync::OnceCell;
use std::path::PathBuf;
use tokio::time::{sleep, Duration};
pub const RUNTIME_CONFIG: &str = "clash-verge.yaml";
pub const CHECK_CONFIG: &str = "clash-verge-check.yaml";
pub const RUNTIME_CONFIG: &str = "koala-clash.yaml";
pub const CHECK_CONFIG: &str = "koala-clash-check.yaml";
pub struct Config {
clash_config: Draft<Box<IClashTemp>>,
@@ -141,7 +141,7 @@ impl Config {
.as_ref()
.ok_or(anyhow!("failed to get runtime config"))?;
help::save_yaml(&path, &config, Some("# Generated by Clash Verge"))?;
help::save_yaml(&path, &config, Some("# Generated by Koala Clash"))?;
Ok(path)
}

View File

@@ -4,11 +4,11 @@ use crate::utils::{
tmpl,
};
use anyhow::{bail, Context, Result};
use base64::{engine::general_purpose::STANDARD, Engine as _};
use reqwest::StatusCode;
use serde::{Deserialize, Serialize};
use serde_yaml::Mapping;
use std::{fs, time::Duration};
use base64::{engine::general_purpose::STANDARD, Engine as _};
use url::Url;
use super::Config;
@@ -407,7 +407,8 @@ impl PrfItem {
Some(value) => {
let str_value = value.to_str().unwrap_or("");
if let Some(b64_data) = str_value.strip_prefix("base64:") {
STANDARD.decode(b64_data)
STANDARD
.decode(b64_data)
.ok()
.and_then(|bytes| String::from_utf8(bytes).ok())
} else {
@@ -423,7 +424,7 @@ impl PrfItem {
bail!(announce_msg.clone());
}
}
let announce_url = match header.get("announce-url") {
Some(value) => {
let str_value = value.to_str().unwrap_or("");
@@ -436,7 +437,8 @@ impl PrfItem {
Some(value) => {
let str_value = value.to_str().unwrap_or("");
if let Some(b64_data) = str_value.strip_prefix("base64:") {
STANDARD.decode(b64_data)
STANDARD
.decode(b64_data)
.ok()
.and_then(|bytes| String::from_utf8(bytes).ok())
} else {
@@ -448,7 +450,9 @@ impl PrfItem {
let uid = help::get_uid("R");
let file = format!("{uid}.yaml");
let name = name.or(profile_title).unwrap_or(filename.unwrap_or("Remote File".into()));
let name = name
.or(profile_title)
.unwrap_or(filename.unwrap_or("Remote File".into()));
let data = resp.text_with_charset("utf-8").await?;
// process the charset "UTF-8 with BOM"

View File

@@ -66,7 +66,7 @@ impl IProfiles {
help::save_yaml(
&dirs::profiles_path()?,
self,
Some("# Profiles Config for Clash Verge"),
Some("# Profiles Config for Koala Clash"),
)
}

View File

@@ -238,7 +238,7 @@ pub struct IVergeTheme {
impl IVerge {
/// 有效的clash核心名称
pub const VALID_CLASH_CORES: &'static [&'static str] = &["verge-mihomo", "verge-mihomo-alpha"];
pub const VALID_CLASH_CORES: &'static [&'static str] = &["koala-mihomo", "koala-mihomo-alpha"];
/// 验证并修正配置文件中的clash_core值
pub fn validate_and_fix_config() -> Result<()> {
@@ -257,10 +257,10 @@ impl IVerge {
warn,
Type::Config,
true,
"启动时发现无效的clash_core配置: '{}', 将自动修正为 'verge-mihomo'",
"启动时发现无效的clash_core配置: '{}', 将自动修正为 'koala-mihomo'",
core
);
config.clash_core = Some("verge-mihomo".to_string());
config.clash_core = Some("koala-mihomo".to_string());
needs_fix = true;
}
} else {
@@ -268,16 +268,16 @@ impl IVerge {
info,
Type::Config,
true,
"启动时发现未配置clash_core, 将设置为默认值 'verge-mihomo'"
"启动时发现未配置clash_core, 将设置为默认值 'koala-mihomo'"
);
config.clash_core = Some("verge-mihomo".to_string());
config.clash_core = Some("koala-mihomo".to_string());
needs_fix = true;
}
// 修正后保存配置
if needs_fix {
logging!(info, Type::Config, true, "正在保存修正后的配置文件...");
help::save_yaml(&config_path, &config, Some("# Clash Verge Config"))?;
help::save_yaml(&config_path, &config, Some("# Koala Clash Config"))?;
logging!(
info,
Type::Config,
@@ -321,7 +321,7 @@ impl IVerge {
pub fn get_valid_clash_core(&self) -> String {
self.clash_core
.clone()
.unwrap_or_else(|| "verge-mihomo".to_string())
.unwrap_or_else(|| "koala-mihomo".to_string())
}
fn get_system_language() -> String {
@@ -340,18 +340,15 @@ impl IVerge {
}
pub fn new() -> Self {
match dirs::verge_path().and_then(|path| help::read_yaml::<IVerge>(&path)) {
Ok(config) => config,
Err(err) => {
log::error!(target: "app", "{err}");
Self::template()
}
}
dirs::verge_path().and_then(|path| help::read_yaml::<IVerge>(&path)).unwrap_or_else(|err| {
log::error!(target: "app", "{err}");
Self::template()
})
}
pub fn template() -> Self {
Self {
clash_core: Some("verge-mihomo".into()),
clash_core: Some("koala-mihomo".into()),
language: Some(Self::get_system_language()),
theme_mode: Some("system".into()),
#[cfg(not(target_os = "windows"))]
@@ -415,7 +412,7 @@ impl IVerge {
/// Save IVerge App Config
pub fn save_file(&self) -> Result<()> {
help::save_yaml(&dirs::verge_path()?, &self, Some("# Clash Verge Config"))
help::save_yaml(&dirs::verge_path()?, &self, Some("# Koala Clash Config"))
}
/// patch verge config

View File

@@ -108,7 +108,7 @@ impl WebDavClient {
reqwest::Client::builder()
.danger_accept_invalid_certs(true)
.timeout(Duration::from_secs(op.timeout()))
.user_agent(format!("clash-verge/{APP_VERSION} ({OS} WebDAV-Client)"))
.user_agent(format!("koala-clash/{APP_VERSION} ({OS} WebDAV-Client)"))
.redirect(reqwest::redirect::Policy::custom(|attempt| {
// 允许所有请求类型的重定向包括PUT
if attempt.previous().len() >= 5 {

View File

@@ -146,7 +146,7 @@ impl CoreManager {
help::save_yaml(
&runtime_path,
&Config::clash().latest().0,
Some("# Clash Verge Runtime"),
Some("# Koala Clash Runtime"),
)?;
handle::Handle::notice_message(msg_type, msg_content);
Ok(())
@@ -443,7 +443,7 @@ impl CoreManager {
child_guard.as_ref().map(|child| child.pid())
};
let target_processes = ["verge-mihomo", "verge-mihomo-alpha"];
let target_processes = ["koala-mihomo", "koala-mihomo-alpha"];
// 并行查找所有目标进程
let mut process_futures = Vec::new();

View File

@@ -578,7 +578,7 @@ pub async fn check_ipc_service_status() -> Result<JsonResponse> {
}
Err(e) => {
logging!(error, Type::Service, true, "IPC通信失败: {}", e);
bail!("无法连接到Clash Verge Service: {}", e)
bail!("无法连接到Koala Clash Service: {}", e)
}
}
}
@@ -667,7 +667,7 @@ pub async fn check_service_version() -> Result<String> {
}
Err(e) => {
logging!(error, Type::Service, true, "IPC通信失败: {}", e);
bail!("无法连接到Clash Verge Service: {}", e)
bail!("无法连接到Koala Clash Service: {}", e)
}
}
}
@@ -814,7 +814,7 @@ pub(super) async fn start_with_existing_service(config_file: &PathBuf) -> Result
}
Err(e) => {
logging!(error, Type::Service, true, "启动核心IPC通信失败: {}", e);
bail!("无法连接到Clash Verge Service: {}", e)
bail!("无法连接到Koala Clash Service: {}", e)
}
}
}
@@ -910,7 +910,7 @@ pub(super) async fn stop_core_by_service() -> Result<()> {
let payload = serde_json::json!({});
let response = send_ipc_request(IpcCommand::StopClash, payload)
.await
.context("无法连接到Clash Verge Service")?;
.context("无法连接到Koala Clash Service")?;
if !response.success {
bail!(response.error.unwrap_or_else(|| "停止核心失败".to_string()));

View File

@@ -6,9 +6,9 @@ use sha2::{Digest, Sha256};
use std::time::{SystemTime, UNIX_EPOCH};
const IPC_SOCKET_NAME: &str = if cfg!(windows) {
r"\\.\pipe\clash-verge-service"
r"\\.\pipe\koala-clash-service"
} else {
"/tmp/clash-verge-service.sock"
"/tmp/koala-clash-service.sock"
};
// 定义命令类型
@@ -43,7 +43,7 @@ pub struct IpcResponse {
fn derive_secret_key() -> Vec<u8> {
// to do
// 从系统安全存储中获取或从程序安装时生成的密钥文件中读取
let unique_app_id = "clash-verge-app-secret-fuck-me-until-daylight";
let unique_app_id = "koala-clash-app-secret-fuck-me-until-daylight";
let mut hasher = Sha256::new();
hasher.update(unique_app_id.as_bytes());
hasher.finalize().to_vec()

View File

@@ -414,7 +414,7 @@ impl Tray {
if let Some(tray) = app_handle.tray_by_id("main") {
let _ = tray.set_tooltip(Some(&format!(
"Clash Verge {version}\n{}: {}\n{}: {}\n{}: {}",
"Koala Clash {version}\n{}: {}\n{}: {}\n{}: {}",
t("SysProxy"),
switch_map[system_proxy],
t("TUN"),

View File

@@ -108,8 +108,8 @@ impl ChainSupport {
(self, core.as_str()),
(ChainSupport::All, _)
| (ChainSupport::Clash, "clash")
| (ChainSupport::ClashMeta, "verge-mihomo")
| (ChainSupport::ClashMetaAlpha, "verge-mihomo-alpha")
| (ChainSupport::ClashMeta, "koala-mihomo")
| (ChainSupport::ClashMetaAlpha, "koala-mihomo-alpha")
),
None => true,
}

View File

@@ -39,7 +39,7 @@ pub fn get_exe_path() -> Result<PathBuf> {
pub fn create_shortcut() -> Result<()> {
let exe_path = get_exe_path()?;
let startup_dir = get_startup_dir()?;
let shortcut_path = startup_dir.join("Clash-Verge.lnk");
let shortcut_path = startup_dir.join("Koala-Clash.lnk");
// 如果快捷方式已存在,直接返回成功
if shortcut_path.exists() {
@@ -77,7 +77,7 @@ pub fn create_shortcut() -> Result<()> {
#[cfg(target_os = "windows")]
pub fn remove_shortcut() -> Result<()> {
let startup_dir = get_startup_dir()?;
let shortcut_path = startup_dir.join("Clash-Verge.lnk");
let shortcut_path = startup_dir.join("Koala-Clash.lnk");
// 如果快捷方式不存在,直接返回成功
if !shortcut_path.exists() {
@@ -96,7 +96,7 @@ pub fn remove_shortcut() -> Result<()> {
#[cfg(target_os = "windows")]
pub fn is_shortcut_enabled() -> Result<bool> {
let startup_dir = get_startup_dir()?;
let shortcut_path = startup_dir.join("Clash-Verge.lnk");
let shortcut_path = startup_dir.join("Koala-Clash.lnk");
Ok(shortcut_path.exists())
}

View File

@@ -5,14 +5,14 @@ use std::{fs, path::PathBuf};
use tauri::Manager;
#[cfg(not(feature = "verge-dev"))]
pub static APP_ID: &str = "io.github.clash-verge-rev.clash-verge-rev";
pub static APP_ID: &str = "io.github.koala-clash";
#[cfg(not(feature = "verge-dev"))]
pub static BACKUP_DIR: &str = "clash-verge-rev-backup";
pub static BACKUP_DIR: &str = "io.github.koala-clash-backup";
#[cfg(feature = "verge-dev")]
pub static APP_ID: &str = "io.github.clash-verge-rev.clash-verge-rev.dev";
pub static APP_ID: &str = "io.github.koala-clash.dev";
#[cfg(feature = "verge-dev")]
pub static BACKUP_DIR: &str = "clash-verge-rev-backup-dev";
pub static BACKUP_DIR: &str = "io.github.koala-clash-backup-dev";
pub static PORTABLE_FLAG: OnceCell<bool> = OnceCell::new();
@@ -188,13 +188,13 @@ pub fn profiles_path() -> Result<PathBuf> {
#[cfg(target_os = "macos")]
pub fn service_path() -> Result<PathBuf> {
let res_dir = app_resources_dir()?;
Ok(res_dir.join("clash-verge-service"))
Ok(res_dir.join("koala-clash-service"))
}
#[cfg(windows)]
pub fn service_path() -> Result<PathBuf> {
let res_dir = app_resources_dir()?;
Ok(res_dir.join("clash-verge-service.exe"))
Ok(res_dir.join("koala-clash-service.exe"))
}
pub fn service_log_file() -> Result<PathBuf> {

View File

@@ -246,7 +246,7 @@ fn init_dns_config() -> Result<()> {
help::save_yaml(
&dns_path,
&default_dns_config,
Some("# Clash Verge DNS Config"),
Some("# Koala Clash DNS Config"),
)?;
}
@@ -274,14 +274,14 @@ pub fn init_config() -> Result<()> {
crate::log_err!(dirs::clash_path().map(|path| {
if !path.exists() {
help::save_yaml(&path, &IClashTemp::template().0, Some("# Clash Vergeasu"))?;
help::save_yaml(&path, &IClashTemp::template().0, Some("# Koala Clash"))?;
}
<Result<()>>::Ok(())
}));
crate::log_err!(dirs::verge_path().map(|path| {
if !path.exists() {
help::save_yaml(&path, &IVerge::template(), Some("# Clash Verge"))?;
help::save_yaml(&path, &IVerge::template(), Some("# Koala Clash"))?;
}
<Result<()>>::Ok(())
}));
@@ -291,7 +291,7 @@ pub fn init_config() -> Result<()> {
crate::log_err!(dirs::profiles_path().map(|path| {
if !path.exists() {
help::save_yaml(&path, &IProfiles::template(), Some("# Clash Verge"))?;
help::save_yaml(&path, &IProfiles::template(), Some("# Koala Clash"))?;
}
<Result<()>>::Ok(())
}));
@@ -371,8 +371,8 @@ pub fn init_scheme() -> Result<()> {
let hkcu = RegKey::predef(HKEY_CURRENT_USER);
let (clash, _) = hkcu.create_subkey("Software\\Classes\\Clash")?;
clash.set_value("", &"Clash Verge")?;
clash.set_value("URL Protocol", &"Clash Verge URL Scheme Protocol")?;
clash.set_value("", &"Koala Clash")?;
clash.set_value("URL Protocol", &"Koala Clash URL Scheme Protocol")?;
let (default_icon, _) = hkcu.create_subkey("Software\\Classes\\Clash\\DefaultIcon")?;
default_icon.set_value("", &app_exe)?;
let (command, _) = hkcu.create_subkey("Software\\Classes\\Clash\\Shell\\Open\\Command")?;
@@ -384,7 +384,7 @@ pub fn init_scheme() -> Result<()> {
pub fn init_scheme() -> Result<()> {
let output = std::process::Command::new("xdg-mime")
.arg("default")
.arg("clash-verge.desktop")
.arg("koala-clash.desktop")
.arg("x-scheme-handler/clash")
.output()?;
if !output.status.success() {

View File

@@ -8,6 +8,6 @@ pub mod network;
pub mod notification;
pub mod resolve;
pub mod server;
pub mod sys_info;
pub mod tmpl;
pub mod window_manager;
pub mod sys_info;

View File

@@ -40,7 +40,7 @@ impl NetworkManager {
// 创建专用的异步运行时线程数限制为4个
let runtime = Builder::new_multi_thread()
.worker_threads(4)
.thread_name("clash-verge-network")
.thread_name("koala-clash-network")
.enable_io()
.enable_time()
.build()
@@ -323,8 +323,8 @@ impl NetworkManager {
use crate::utils::resolve::VERSION;
let version = match VERSION.get() {
Some(v) => format!("clash-verge/v{v}"),
None => "clash-verge/unknown".to_string(),
Some(v) => format!("koala-clash/v{v}"),
None => "koala-clash/unknown".to_string(),
};
builder = builder.user_agent(version);

View File

@@ -549,7 +549,7 @@ pub async fn resolve_scheme(param: String) -> Result<()> {
}
};
if link_parsed.scheme() == "clash" || link_parsed.scheme() == "clash-verge" {
if link_parsed.scheme() == "clash" || link_parsed.scheme() == "koala-clash" {
let mut name: Option<String> = None;
let mut url_param: Option<String> = None;

View File

@@ -1,7 +1,7 @@
//! Some config file template
/// template for new a profile item
pub const ITEM_LOCAL: &str = "# Profile Template for Clash Verge
pub const ITEM_LOCAL: &str = "# Profile Template for Koala Clash
proxies: []
@@ -11,13 +11,13 @@ rules: []
";
/// enhanced profile
pub const ITEM_MERGE: &str = "# Profile Enhancement Merge Template for Clash Verge
pub const ITEM_MERGE: &str = "# Profile Enhancement Merge Template for Koala Clash
profile:
store-selected: true
";
pub const ITEM_MERGE_EMPTY: &str = "# Profile Enhancement Merge Template for Clash Verge
pub const ITEM_MERGE_EMPTY: &str = "# Profile Enhancement Merge Template for Koala Clash
";
@@ -30,7 +30,7 @@ function main(config, profileName) {
";
/// enhanced profile
pub const ITEM_RULES: &str = "# Profile Enhancement Rules Template for Clash Verge
pub const ITEM_RULES: &str = "# Profile Enhancement Rules Template for Koala Clash
prepend: []
@@ -40,7 +40,7 @@ delete: []
";
/// enhanced profile
pub const ITEM_PROXIES: &str = "# Profile Enhancement Proxies Template for Clash Verge
pub const ITEM_PROXIES: &str = "# Profile Enhancement Proxies Template for Koala Clash
prepend: []
@@ -50,7 +50,7 @@ delete: []
";
/// enhanced profile
pub const ITEM_GROUPS: &str = "# Profile Enhancement Groups Template for Clash Verge
pub const ITEM_GROUPS: &str = "# Profile Enhancement Groups Template for Koala Clash
prepend: []

View File

@@ -13,7 +13,7 @@
],
"resources": ["resources", "resources/locales/*"],
"publisher": "Koala Clash",
"externalBin": ["sidecar/verge-mihomo", "sidecar/verge-mihomo-alpha"],
"externalBin": ["sidecar/koala-mihomo", "sidecar/koala-mihomo-alpha"],
"copyright": "GNU General Public License v3.0",
"category": "DeveloperTool",
"shortDescription": "Koala Clash",
@@ -26,7 +26,7 @@
"devUrl": "http://localhost:3000/"
},
"productName": "Koala Clash",
"identifier": "io.github.clash-verge-rev.clash-verge-rev",
"identifier": "io.github.koala-clash",
"plugins": {
"updater": {
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IERCQjQ1QjQ0QUJDQTU1RTkKUldUcFZjcXJSRnUwMjdXSERoZVQ1R0hHRDMrT3VkSmpvbDJmb01sN3ZpYWhVYnEwaWpYUWU4YU0K",
@@ -40,7 +40,7 @@
},
"deep-link": {
"desktop": {
"schemes": ["clash", "clash-verge"]
"schemes": ["clash", "koala-clash"]
}
}
},

View File

@@ -1,34 +1,34 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"identifier": "io.github.clash-verge-rev.clash-verge-rev",
"identifier": "io.github.koala-clash",
"bundle": {
"targets": ["deb", "rpm"],
"linux": {
"deb": {
"depends": ["openssl"],
"desktopTemplate": "./packages/linux/clash-verge.desktop",
"provides": ["clash-verge"],
"conflicts": ["clash-verge"],
"replaces": ["clash-verge"],
"desktopTemplate": "./packages/linux/koala-clash.desktop",
"provides": ["koala-clash"],
"conflicts": ["koala-clash"],
"replaces": ["koala-clash"],
"postInstallScript": "./packages/linux/post-install.sh",
"preRemoveScript": "./packages/linux/pre-remove.sh"
},
"rpm": {
"depends": ["openssl"],
"desktopTemplate": "./packages/linux/clash-verge.desktop",
"provides": ["clash-verge"],
"conflicts": ["clash-verge"],
"obsoletes": ["clash-verge"],
"desktopTemplate": "./packages/linux/koala-clash.desktop",
"provides": ["koala-clash"],
"conflicts": ["koala-clash"],
"obsoletes": ["koala-clash"],
"postInstallScript": "./packages/linux/post-install.sh",
"preRemoveScript": "./packages/linux/pre-remove.sh"
}
},
"externalBin": [
"./resources/clash-verge-service",
"./resources/koala-clash-service",
"./resources/install-service",
"./resources/uninstall-service",
"./sidecar/verge-mihomo",
"./sidecar/verge-mihomo-alpha"
"./sidecar/koala-mihomo",
"./sidecar/koala-mihomo-alpha"
]
}
}

View File

@@ -1,6 +1,6 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"identifier": "io.github.clash-verge-rev.clash-verge-rev",
"identifier": "io.github.koala-clash",
"productName": "Koala Clash",
"bundle": {
"targets": ["app", "dmg"],

View File

@@ -1,6 +1,6 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"identifier": "io.github.clash-verge-rev.clash-verge-rev",
"identifier": "io.github.koala-clash",
"bundle": {
"targets": ["nsis"],
"windows": {

View File

@@ -1,6 +1,6 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"identifier": "io.github.clash-verge-rev.clash-verge-rev",
"identifier": "io.github.koala-clash",
"bundle": {
"targets": ["nsis"],
"windows": {

View File

@@ -1,6 +1,6 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"identifier": "io.github.clash-verge-rev.clash-verge-rev",
"identifier": "io.github.koala-clash",
"bundle": {
"targets": ["nsis"],
"windows": {

View File

@@ -1,6 +1,6 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"identifier": "io.github.clash-verge-rev.clash-verge-rev",
"identifier": "io.github.koala-clash",
"bundle": {
"targets": ["nsis"],
"windows": {