refactor: replace smartstring with tristr for backend strings (#8673)

* refactor(config): adopt tristr for config strings

Wire the tristr git dependency (pinned rev) and switch the config and
enhance modules from smartstring::alias::String to tristr::alias::String.
Drop the smartstring-era per-field specta overrides except the three
webdav fields required by serialize_with and the ipc::JsonValue bridge:
tristr maps to Primitive::str natively and the generated bindings stay
byte-identical (gen-contract --check passes).

Call sites in not-yet-migrated modules (cmd/core/feat/utils) are bridged
with explicit tristr::alias::String paths and as_str().into() conversions;
each bridge is absorbed when its module migrates.

* refactor(cmd): adopt tristr for command strings

Switch the cmd module from smartstring::alias::String to
tristr::alias::String and drop its smartstring-era per-field specta
overrides (ProfileSelection/ProfileCreate/ProfilePatch, RuntimeLogs);
bindings stay byte-identical. Calls into not-yet-migrated feat/core
functions keep smartstring-typed locals via full paths until those
modules migrate.

* refactor(core): adopt tristr for core strings

Switch the core module (validate, timer, sysopt, backup, hotkey, tray,
manager, notify) from smartstring::alias::String to tristr::alias::String
and drop the smartstring-era specta overrides on ValidationOutcome and
the notify payload structs; bindings stay byte-identical. WebDAV calls
from the not-yet-migrated feat module are bridged with as_str().into().

* refactor(feat): adopt tristr for feature strings

Switch the feat module (backup, icon, dns, profile, clash) from
smartstring::alias::String to tristr::alias::String, drop its
smartstring-era specta overrides (IconInfo, backup listings,
DnsOverrideOutcome), and absorb the temporary smartstring-typed bridge
locals the cmd module used to call into feat.

* refactor(utils): adopt tristr for utility strings

Switch utils/network.rs and utils/resolve/scheme.rs from
smartstring::alias::String to tristr::alias::String and absorb the
temporary user_agent and profile-name bridge conversions.

* refactor(deps): drop smartstring in favor of tristr

Remove the smartstring workspace and member dependencies and its
Cargo.lock entry; tristr is the only string representation left.

* build(deps): bump tristr to fuzz-harness fix rev

Pin 3738d8c renames the stale vstr path dependency in the upstream
fuzz manifest so its seven targets build again; library code is
unchanged from 3756ed1a.
This commit is contained in:
Tunglies
2026-11-17 08:36:22 +00:00
committed by GitHub
parent dc71c11ef2
commit 3e3084cd34
38 changed files with 53 additions and 141 deletions
Generated
+10 -13
View File
@@ -1127,7 +1127,6 @@ dependencies = [
"serde_json",
"serde_yaml_ng",
"sha2 0.11.1",
"smartstring",
"socket2",
"specta",
"specta-typescript",
@@ -1155,6 +1154,7 @@ dependencies = [
"tokio-rustls",
"tokio-util",
"tracing",
"tristr",
"warp",
"webpki-roots",
"windows 0.62.2",
@@ -6801,18 +6801,6 @@ dependencies = [
"thiserror 2.0.20",
]
[[package]]
name = "smartstring"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a155190f9c039a1e9b6e92efbfa50ae68daad98a0fd6d5521a5a09ef782383e8"
dependencies = [
"autocfg",
"serde",
"static_assertions",
"version_check",
]
[[package]]
name = "socket2"
version = "0.6.5"
@@ -8577,6 +8565,15 @@ dependencies = [
"stable_deref_trait",
]
[[package]]
name = "tristr"
version = "0.1.0"
source = "git+https://github.com/Tunglies/tristr?rev=3738d8c5785d609674c5f4f05def26b94724200c#3738d8c5785d609674c5f4f05def26b94724200c"
dependencies = [
"serde",
"specta",
]
[[package]]
name = "try-lock"
version = "0.2.5"
+1 -2
View File
@@ -84,9 +84,8 @@ reqwest = { version = "0.13.5", features = [
] }
rust_iso3166 = "0.2.0"
smartstring = { version = "2.0.0" }
serde = { version = "1.0.229" }
tristr = { git = "https://github.com/Tunglies/tristr", rev = "3738d8c5785d609674c5f4f05def26b94724200c", default-features = false, features = ["serde", "specta"] }
serde_json = { version = "1.0.154" }
serde_yaml_ng = { version = "0.10.0" }
socket2 = "0.6.5"
+1 -1
View File
@@ -54,7 +54,7 @@ log = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
serde_yaml_ng = { workspace = true }
smartstring = { workspace = true, features = ["serde"] }
tristr = { workspace = true }
socket2 = { workspace = true }
warp = { version = "0.4.4", features = ["server"] }
open = "5.4.5"
+1 -1
View File
@@ -8,8 +8,8 @@ use crate::{
feat,
utils::dirs,
};
use smartstring::alias::String;
use tauri::{AppHandle, Manager as _, ipc::Channel};
use tristr::alias::String;
#[tauri::command]
#[specta::specta]
+1 -1
View File
@@ -1,7 +1,7 @@
use super::CmdResult;
use crate::{cmd::StringifyErr as _, feat};
use feat::LocalBackupFile;
use smartstring::alias::String;
use tristr::alias::String;
#[tauri::command]
#[specta::specta]
+1 -1
View File
@@ -12,8 +12,8 @@ use crate::{
},
};
use clash_verge_logging::{Type, logging, logging_error};
use smartstring::alias::String;
use tokio::fs;
use tristr::alias::String;
#[tauri::command]
#[specta::specta]
+1 -1
View File
@@ -1,5 +1,5 @@
use anyhow::Result;
use smartstring::alias::String;
use tristr::alias::String;
pub type CmdResult<T = ()> = Result<T, CommandFailure>;
+1 -11
View File
@@ -18,11 +18,11 @@ use crate::{
};
use clash_verge_draft::{Draft, SharedDraft};
use clash_verge_logging::{Type, logging, logging_error};
use smartstring::alias::String;
use std::{
mem::DropGuard,
sync::atomic::{AtomicBool, Ordering},
};
use tristr::alias::String;
static CURRENT_SWITCHING_PROFILE: AtomicBool = AtomicBool::new(false);
@@ -322,7 +322,6 @@ async fn perform_config_update(
#[derive(Default, serde::Deserialize, specta::Type)]
#[serde(default)]
pub struct ProfileSelection {
#[specta(type = Option<std::string::String>)]
pub current: Option<String>,
}
@@ -330,13 +329,9 @@ pub struct ProfileSelection {
#[serde(default)]
pub struct ProfileCreate {
#[serde(rename = "type")]
#[specta(type = Option<std::string::String>)]
pub itype: Option<String>,
#[specta(type = Option<std::string::String>)]
pub name: Option<String>,
#[specta(type = Option<std::string::String>)]
pub desc: Option<String>,
#[specta(type = Option<std::string::String>)]
pub url: Option<String>,
pub option: Option<PrfOption>,
}
@@ -358,15 +353,10 @@ impl From<ProfileCreate> for PrfItem {
#[serde(default)]
pub struct ProfilePatch {
#[serde(rename = "type")]
#[specta(type = Option<std::string::String>)]
pub itype: Option<String>,
#[specta(type = Option<std::string::String>)]
pub name: Option<String>,
#[specta(type = Option<std::string::String>)]
pub desc: Option<String>,
#[specta(type = Option<std::string::String>)]
pub file: Option<String>,
#[specta(type = Option<std::string::String>)]
pub url: Option<String>,
pub selected: Option<Vec<crate::config::PrfSelected>>,
pub extra: Option<crate::config::PrfExtra>,
+2 -5
View File
@@ -1,8 +1,8 @@
use super::CmdResult;
use crate::{cmd::StringifyErr as _, config::Config, core::CoreManager, utils::yaml_emitter};
use anyhow::{Context as _, anyhow};
use smartstring::alias::String;
use std::collections::HashMap;
use tristr::alias::String;
#[tauri::command]
#[specta::specta]
@@ -36,10 +36,7 @@ pub async fn get_runtime_logs() -> CmdResult<RuntimeLogs> {
#[derive(serde::Serialize, specta::Type)]
#[serde(transparent)]
pub struct RuntimeLogs(
#[specta(type = HashMap<std::string::String, Vec<(std::string::String, std::string::String)>>)]
HashMap<String, Vec<(String, String)>>,
);
pub struct RuntimeLogs(HashMap<String, Vec<(String, String)>>);
#[tauri::command]
#[specta::specta]
+1 -1
View File
@@ -11,8 +11,8 @@ use crate::{
utils::dirs,
};
use clash_verge_logging::{Type, logging};
use smartstring::alias::String;
use tokio::fs;
use tristr::alias::String;
/// 保存profiles的配置
#[tauri::command]
+1 -1
View File
@@ -4,7 +4,7 @@ use crate::{
config::{Config, IVerge},
core, feat,
};
use smartstring::alias::String;
use tristr::alias::String;
#[tauri::command]
#[specta::specta]
+1 -1
View File
@@ -20,10 +20,10 @@ use backon::{ExponentialBuilder, Retryable as _};
use clash_verge_draft::Draft;
use clash_verge_logging::{Type, logging, logging_error};
use serde_yaml_ng::{Mapping, Value};
use smartstring::alias::String;
use std::{collections::HashSet, path::PathBuf};
use tokio::sync::{Mutex, MutexGuard, OnceCell};
use tokio::time::sleep;
use tristr::alias::String;
pub(crate) struct Config {
clash_config: Draft<IClashTemp>,
+1 -2
View File
@@ -5,8 +5,8 @@ use clash_verge_draft::DraftTransaction;
use serde::{Deserialize, Serialize};
use serde_yaml_ng::{Mapping, Value};
use sha2::{Digest as _, Sha256};
use smartstring::alias::String;
use std::sync::atomic::{AtomicBool, Ordering};
use tristr::alias::String;
use super::{Config, IVerge};
use crate::core::handle::Handle;
@@ -109,7 +109,6 @@ impl DnsOverrideState {
pub struct ProfileDnsSettings {
pub enabled: bool,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[specta(type = Option<std::string::String>)]
pub confirmation: Option<String>,
}
+1 -17
View File
@@ -11,9 +11,9 @@ use crate::{
use anyhow::{Context as _, Result, bail};
use serde::{Deserialize, Serialize};
use serde_yaml_ng::Mapping;
use smartstring::alias::String;
use std::time::Duration;
use tokio::fs;
use tristr::alias::String;
// TODO, use other re-export
use reqwest_dav::re_exports::url::form_urlencoded;
use tauri::Url;
@@ -32,24 +32,18 @@ pub(super) fn normalize_profile_home_url(raw: &str) -> Option<String> {
#[derive(Debug, Clone, Deserialize, Serialize, Default, specta::Type)]
#[serde(default)]
pub struct PrfItem {
#[specta(type = Option<std::string::String>)]
pub uid: Option<String>,
/// enum value: remote | local | script | merge
#[serde(rename = "type")]
#[specta(type = Option<std::string::String>)]
pub itype: Option<String>,
#[specta(type = Option<std::string::String>)]
pub name: Option<String>,
#[specta(type = Option<std::string::String>)]
pub file: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
#[specta(type = Option<std::string::String>)]
pub desc: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
#[specta(type = Option<std::string::String>)]
pub url: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
@@ -64,20 +58,16 @@ pub struct PrfItem {
pub option: Option<PrfOption>,
#[serde(skip_serializing_if = "Option::is_none")]
#[specta(type = Option<std::string::String>)]
pub home: Option<String>,
#[serde(skip)]
#[specta(type = Option<std::string::String>)]
pub file_data: Option<String>,
}
#[derive(Default, Debug, Clone, Deserialize, Serialize, PartialEq, Eq, specta::Type)]
#[serde(default)]
pub struct PrfSelected {
#[specta(type = Option<std::string::String>)]
pub name: Option<String>,
#[specta(type = Option<std::string::String>)]
pub now: Option<String>,
}
@@ -93,7 +83,6 @@ pub struct PrfExtra {
#[serde(default)]
pub struct PrfOption {
#[serde(skip_serializing_if = "Option::is_none")]
#[specta(type = Option<std::string::String>)]
pub user_agent: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
@@ -116,15 +105,10 @@ pub struct PrfOption {
#[serde(skip_serializing_if = "Option::is_none")]
pub allow_auto_update: Option<bool>,
#[specta(type = Option<std::string::String>)]
pub merge: Option<String>,
#[specta(type = Option<std::string::String>)]
pub script: Option<String>,
#[specta(type = Option<std::string::String>)]
pub rules: Option<String>,
#[specta(type = Option<std::string::String>)]
pub proxies: Option<String>,
#[specta(type = Option<std::string::String>)]
pub groups: Option<String>,
}
+1 -2
View File
@@ -17,7 +17,6 @@ use clash_verge_logging::{Type, logging};
use parking_lot::Mutex;
use serde::{Deserialize, Serialize};
use serde_yaml_ng::Mapping;
use smartstring::alias::String;
use std::num::NonZeroUsize;
use std::{
collections::{HashMap, HashSet},
@@ -30,6 +29,7 @@ use std::{
};
use tauri_plugin_mihomo::models::{Proxies, ProxyType};
use tokio::{fs, task::JoinHandle};
use tristr::alias::String;
pub(crate) static PROFILE_WRITE_LOCK: tokio::sync::Mutex<()> = tokio::sync::Mutex::const_new(());
@@ -51,7 +51,6 @@ const SELECTED_NODES_FIRST_PASS_BUDGET: Duration = Duration::from_secs(3);
#[derive(Default, Debug, Clone, Deserialize, Serialize, specta::Type)]
#[serde(default)]
pub struct IProfiles {
#[specta(type = Option<std::string::String>)]
pub current: Option<String>,
pub items: Option<Vec<PrfItem>>,
+1 -1
View File
@@ -1,6 +1,6 @@
use serde_yaml_ng::{Mapping, Value};
use smartstring::alias::String;
use std::collections::{HashMap, HashSet};
use tristr::alias::String;
use crate::enhance::field::use_keys;
+1 -36
View File
@@ -8,33 +8,26 @@ use anyhow::Result;
use clash_verge_logging::{Type, logging};
use log::LevelFilter;
use serde::{Deserialize, Serialize};
use smartstring::alias::String;
use tristr::alias::String;
/// ### `verge.yaml` schema
#[derive(Default, Debug, Clone, Deserialize, Serialize, specta::Type)]
#[serde(default)]
pub struct IVerge {
/// silent | error | warn | info | debug | trace
#[specta(type = Option<std::string::String>)]
pub app_log_level: Option<String>,
/// Maximum app log size in KiB.
pub app_log_max_size: Option<u64>,
pub app_log_max_count: Option<usize>,
#[specta(type = Option<std::string::String>)]
pub language: Option<String>,
/// `light` or `dark` or `system`
#[specta(type = Option<std::string::String>)]
pub theme_mode: Option<String>,
#[specta(type = Option<std::string::String>)]
pub tray_event: Option<String>,
#[specta(type = Option<std::string::String>)]
pub env_type: Option<String>,
#[specta(type = Option<std::string::String>)]
pub start_page: Option<String>,
#[specta(type = Option<std::string::String>)]
pub startup_script: Option<String>,
pub traffic_graph: Option<bool>,
@@ -52,23 +45,18 @@ pub struct IVerge {
#[cfg(target_os = "macos")]
#[serde(skip_serializing_if = "Option::is_none")]
#[specta(type = Option<std::string::String>)]
pub tray_icon: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
#[specta(type = Option<std::string::String>)]
pub menu_icon: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
#[specta(type = Option<Vec<std::string::String>>)]
pub menu_order: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[specta(type = Option<std::string::String>)]
pub proxy_group_tools_position: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
#[specta(type = Option<std::string::String>)]
pub notice_position: Option<String>,
pub collapse_navbar: Option<bool>,
@@ -93,32 +81,25 @@ pub struct IVerge {
pub enable_dns_settings: Option<bool>,
#[serde(default, skip_serializing_if = "std::collections::BTreeMap::is_empty")]
#[specta(type = std::collections::BTreeMap<std::string::String, super::dns::ProfileDnsSettings>)]
pub profile_dns_settings: std::collections::BTreeMap<String, super::dns::ProfileDnsSettings>,
pub use_default_bypass: Option<bool>,
#[specta(type = Option<std::string::String>)]
pub system_proxy_bypass: Option<String>,
pub proxy_guard_duration: Option<u64>,
pub proxy_auto_config: Option<bool>,
#[specta(type = Option<std::string::String>)]
pub pac_file_content: Option<String>,
#[specta(type = Option<std::string::String>)]
pub proxy_host: Option<String>,
pub theme_setting: Option<IVergeTheme>,
#[specta(type = Option<Vec<std::string::String>>)]
pub web_ui_list: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[specta(type = Option<std::string::String>)]
pub clash_core: Option<String>,
/// format: {func},{key}
#[serde(skip_serializing_if = "Option::is_none")]
#[specta(type = Option<Vec<std::string::String>>)]
pub hotkeys: Option<Vec<String>>,
pub enable_global_hotkey: Option<bool>,
@@ -129,7 +110,6 @@ pub struct IVerge {
pub auto_close_connection: Option<bool>,
pub auto_check_update: Option<bool>,
#[specta(type = Option<std::string::String>)]
pub default_latency_test: Option<String>,
pub default_latency_timeout: Option<i16>,
@@ -209,7 +189,6 @@ pub struct IVerge {
pub enable_tray_speed: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
#[specta(type = Option<std::string::String>)]
pub tray_proxy_groups_display_mode: Option<String>,
pub tray_inline_outbound_modes: Option<bool>,
@@ -229,38 +208,24 @@ pub struct IVerge {
#[derive(Default, Debug, Clone, Deserialize, Serialize, specta::Type)]
#[serde(default)]
pub struct IVergeTestItem {
#[specta(type = Option<std::string::String>)]
pub uid: Option<String>,
#[specta(type = Option<std::string::String>)]
pub name: Option<String>,
#[specta(type = Option<std::string::String>)]
pub icon: Option<String>,
#[specta(type = Option<std::string::String>)]
pub url: Option<String>,
}
#[derive(Default, Debug, Clone, Deserialize, Serialize, specta::Type)]
#[serde(default)]
pub struct IVergeTheme {
#[specta(type = Option<std::string::String>)]
pub primary_color: Option<String>,
#[specta(type = Option<std::string::String>)]
pub secondary_color: Option<String>,
#[specta(type = Option<std::string::String>)]
pub primary_text: Option<String>,
#[specta(type = Option<std::string::String>)]
pub secondary_text: Option<String>,
#[specta(type = Option<std::string::String>)]
pub info_color: Option<String>,
#[specta(type = Option<std::string::String>)]
pub error_color: Option<String>,
#[specta(type = Option<std::string::String>)]
pub warning_color: Option<String>,
#[specta(type = Option<std::string::String>)]
pub success_color: Option<String>,
#[specta(type = Option<std::string::String>)]
pub font_family: Option<String>,
#[specta(type = Option<std::string::String>)]
pub css_injection: Option<String>,
}
+1 -1
View File
@@ -5,7 +5,6 @@ use arc_swap::{ArcSwap, ArcSwapOption};
use backon::{ConstantBuilder, Retryable as _};
use clash_verge_logging::{Type, logging};
use reqwest_dav::list_cmd::{ListEntity, ListFile, ListMultiStatus};
use smartstring::alias::String;
use std::{
collections::HashMap,
env::{consts::OS, temp_dir},
@@ -15,6 +14,7 @@ use std::{
time::Duration,
};
use tokio::{fs, time::timeout};
use tristr::alias::String;
use zip::write::SimpleFileOptions;
const APP_VERSION: &str = env!("CARGO_PKG_VERSION");
+1 -1
View File
@@ -7,7 +7,6 @@ use crate::{config::Config, core::handle, core::lightweight::entry_lightweight_m
use anyhow::{Result, bail};
use arc_swap::ArcSwap;
use clash_verge_logging::{Type, logging};
use smartstring::alias::String;
use std::{
collections::HashMap,
fmt,
@@ -18,6 +17,7 @@ use std::{
},
};
use tauri_plugin_global_shortcut::{Code, GlobalShortcutExt as _, ShortcutState};
use tristr::alias::String;
/// Enum representing all available hotkey functions
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+1 -1
View File
@@ -14,7 +14,6 @@ use anyhow::{Result, anyhow};
use clash_verge_draft::DraftTransaction;
use clash_verge_logging::{Type, logging};
use clash_verge_service_ipc::StageRuntimeOutcome;
use smartstring::alias::String;
use std::{
collections::HashSet,
mem::DropGuard,
@@ -23,6 +22,7 @@ use std::{
time::{Duration, Instant},
};
use tauri_plugin_mihomo::Error as MihomoError;
use tristr::alias::String;
/// A staging result separated from the policy that acts on it.
#[derive(Debug, Clone, PartialEq, Eq)]
+1 -1
View File
@@ -6,10 +6,10 @@ use crate::core::proxy_control::{self, SysproxyFailure};
use crate::core::service::{SERVICE_MANAGER, ServiceStatus};
use anyhow::Result;
use clash_verge_logging::{Type, logging};
use smartstring::alias::String;
use std::{mem::DropGuard, path::Path};
#[cfg(target_os = "windows")]
use tauri_plugin_clash_verge_sysinfo::is_current_app_handle_admin;
use tristr::alias::String;
#[cfg(any(target_os = "windows", test))]
const fn should_wait_for_service(tun_enabled: bool, service_ready: bool, is_admin: bool) -> bool {
+2 -2
View File
@@ -1,13 +1,13 @@
use super::NoticeStatus;
use crate::{APP_HANDLE, singleton};
#[cfg(target_os = "macos")]
use smartstring::alias::String;
use std::sync::{
Arc,
atomic::{AtomicBool, Ordering},
};
use tauri::AppHandle;
use tauri_plugin_mihomo::{Mihomo, MihomoExt as _};
#[cfg(target_os = "macos")]
use tristr::alias::String;
use super::notification::{FrontendEvent, NotificationSystem};
+1 -4
View File
@@ -3,11 +3,11 @@ use clash_verge_logging::{Type, logging};
use parking_lot::Mutex;
#[cfg(test)]
use serde_json::json;
use smartstring::alias::String;
use std::sync::Arc;
use std::sync::LazyLock;
use std::{collections::HashMap, future::Future};
use tauri::{AppHandle, Emitter as _, Manager as _, WebviewWindow};
use tristr::alias::String;
#[derive(Debug, Clone)]
pub enum FrontendEvent<'a> {
@@ -77,10 +77,8 @@ impl FailedOperation {
#[serde(rename_all = "camelCase")]
pub struct PendingFailure {
/// Stable code used as the table key.
#[specta(type = std::string::String)]
pub code: String,
/// Full diagnostic context chain.
#[specta(type = std::string::String)]
pub detail: String,
pub operation: FailedOperation,
/// Monotonic identity for repeated failures under the same code.
@@ -247,7 +245,6 @@ static PENDING_FAILURES: LazyLock<FailureTable> = LazyLock::new(FailureTable::de
#[derive(Debug, Default, Clone, serde::Serialize, specta::Type)]
pub struct SidecarFailureSnapshot {
pub revision: u64,
#[specta(type = Option<std::string::String>)]
pub detail: Option<String>,
}
+1 -1
View File
@@ -7,7 +7,6 @@ use crate::{
use anyhow::Result;
use clash_verge_logging::{Type, logging};
use parking_lot::RwLock;
use smartstring::alias::String;
use std::{
mem::DropGuard,
sync::{
@@ -18,6 +17,7 @@ use std::{
};
use sysproxy::{Autoproxy, GuardMonitor, GuardType, Sysproxy};
use tokio::sync::Mutex as TokioMutex;
use tristr::alias::String;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
enum ProxyApplyStep {
+2 -2
View File
@@ -9,7 +9,6 @@ use anyhow::Result;
use clash_verge_logging::{Type, logging, logging_error};
use futures::StreamExt as _;
use parking_lot::{Mutex, RwLock};
use smartstring::alias::String;
use std::{
collections::HashMap,
sync::{
@@ -23,6 +22,7 @@ use tokio::{
time::{sleep, timeout},
};
use tokio_util::time::{DelayQueue, delay_queue::Key};
use tristr::alias::String;
enum TimerCommand {
Apply(HashMap<String, TaskSchedule>),
@@ -503,7 +503,6 @@ mod tests {
use crate::config::{PrfItem, PrfOption};
use futures::StreamExt as _;
use parking_lot::Mutex;
use smartstring::alias::String;
use std::collections::HashMap;
use std::{
sync::{
@@ -515,6 +514,7 @@ mod tests {
};
use tokio::sync::Barrier;
use tokio_util::time::DelayQueue;
use tristr::alias::String;
struct CancellationProbe {
cancelled: Arc<AtomicBool>,
+1 -1
View File
@@ -19,7 +19,6 @@ use tokio::fs;
use super::handle;
use anyhow::Result;
use smartstring::alias::String;
use std::borrow::Cow;
use std::collections::HashMap;
use std::time::Duration;
@@ -27,6 +26,7 @@ use tauri::{
AppHandle, Wry,
menu::{CheckMenuItem, IsMenuItem, MenuEvent, MenuItem, PredefinedMenuItem, Submenu},
};
use tristr::alias::String;
mod menu_def;
#[cfg(target_os = "macos")]
+3 -9
View File
@@ -1,6 +1,5 @@
use anyhow::Result;
use serde::Serialize;
use smartstring::alias::String;
use std::{
fmt,
hash::{DefaultHasher, Hash as _, Hasher as _},
@@ -10,6 +9,7 @@ use std::{
};
use tauri_plugin_shell::ShellExt as _;
use tokio::fs;
use tristr::alias::String;
use crate::config::Config;
use crate::core::handle;
@@ -114,14 +114,8 @@ impl fmt::Display for ValidationSkipReason {
#[serde(tag = "status", rename_all = "camelCase")]
pub enum ValidationOutcome {
Valid,
Invalid {
kind: ValidationErrorKind,
#[specta(type = std::string::String)]
message: String,
},
Skipped {
reason: ValidationSkipReason,
},
Invalid { kind: ValidationErrorKind, message: String },
Skipped { reason: ValidationSkipReason },
Busy,
}
+1 -1
View File
@@ -4,8 +4,8 @@ use crate::{
utils::{dirs, help},
};
use serde_yaml_ng::Mapping;
use smartstring::alias::String;
use tokio::fs;
use tristr::alias::String;
#[derive(Debug, Clone)]
pub struct ChainItem {
+1 -1
View File
@@ -1,5 +1,5 @@
use serde_yaml_ng::{Mapping, Value};
use smartstring::alias::String;
use tristr::alias::String;
pub const HANDLE_FIELDS: [&str; 12] = [
"mode",
+1 -1
View File
@@ -26,10 +26,10 @@ use anyhow::{Context as _, Result};
use clash_verge_logging::{Type, logging};
use parking_lot::Mutex;
use serde_yaml_ng::{Mapping, Value};
use smartstring::alias::String;
use std::collections::{HashMap, HashSet};
use std::hash::{Hash as _, Hasher as _};
use tokio::fs;
use tristr::alias::String;
type ResultLog = Vec<(String, String)>;
#[derive(Debug)]
+1 -1
View File
@@ -6,8 +6,8 @@ use boa_engine::{Context, JsString, JsValue, Source, js_string, native_function:
use clash_verge_logging::{Type, logging};
use parking_lot::Mutex;
use serde_yaml_ng::Mapping;
use smartstring::alias::String;
use std::sync::Arc;
use tristr::alias::String;
const MAX_OUTPUTS: usize = 1000;
const MAX_OUTPUT_SIZE: usize = 1024 * 1024; // 1MB
+1 -4
View File
@@ -12,17 +12,14 @@ use chrono::Utc;
use clash_verge_logging::{Type, logging};
use reqwest_dav::list_cmd::ListFile;
use serde::Serialize;
use smartstring::alias::String;
use std::path::PathBuf;
use tokio::fs;
use tristr::alias::String;
#[derive(Debug, Serialize, specta::Type)]
pub struct LocalBackupFile {
#[specta(type = std::string::String)]
pub filename: String,
#[specta(type = std::string::String)]
pub path: String,
#[specta(type = std::string::String)]
pub last_modified: String,
pub content_length: u64,
}
+1 -1
View File
@@ -10,8 +10,8 @@ use crate::{
use bytes::BytesMut;
use clash_verge_logging::{Type, logging};
use serde_yaml_ng::{Mapping, Value};
use smartstring::alias::String;
use std::sync::{Arc, LazyLock};
use tristr::alias::String;
#[allow(clippy::expect_used)]
static TLS_CONFIG: LazyLock<Arc<rustls::ClientConfig>> =
+2 -5
View File
@@ -2,7 +2,7 @@ use crate::core::notify::{Refresh, announce};
use anyhow::{Result, ensure};
use clash_verge_draft::DraftTransaction;
use serde::Serialize;
use smartstring::alias::String;
use tristr::alias::String;
use crate::{
config::{
@@ -19,10 +19,7 @@ use crate::{
#[serde(tag = "status", rename_all = "snake_case")]
pub enum DnsOverrideOutcome {
Applied,
ConfirmationRequired {
#[specta(type = std::string::String)]
source: String,
},
ConfirmationRequired { source: String },
}
pub async fn set_dns_override(
+1 -4
View File
@@ -3,18 +3,15 @@ use crate::{
utils::dirs::{self, PathBufExec as _},
};
use clash_verge_logging::{Type, logging};
use smartstring::alias::String;
use std::path::{Component, Path, PathBuf};
use tokio::fs;
use tokio::io::AsyncWriteExt as _;
use tristr::alias::String;
#[derive(Debug, serde::Serialize, serde::Deserialize, specta::Type)]
pub struct IconInfo {
#[specta(type = std::string::String)]
name: String,
#[specta(type = std::string::String)]
previous_t: String,
#[specta(type = std::string::String)]
current_t: String,
}
+1 -1
View File
@@ -9,7 +9,7 @@ use crate::{
};
use anyhow::{Result, bail};
use clash_verge_logging::{Type, logging};
use smartstring::alias::String;
use tristr::alias::String;
/// Toggle proxy profile
pub async fn toggle_proxy_profile(profile_index: String) {
+1 -1
View File
@@ -5,10 +5,10 @@ use reqwest::{
Client, Proxy, StatusCode,
header::{HeaderMap, HeaderValue, USER_AGENT},
};
use smartstring::alias::String;
use std::{sync::Arc, time::Duration};
use sysproxy::Sysproxy;
use tauri::Url;
use tristr::alias::String;
#[derive(Debug)]
pub struct HttpResponse {
+1 -1
View File
@@ -1,8 +1,8 @@
use crate::core::notify::NoticeStatus;
use anyhow::Result;
use percent_encoding::percent_decode_str;
use smartstring::alias::String;
use tauri::Url;
use tristr::alias::String;
use crate::{
config::{Config, PrfItem, profiles},