mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-19 02:12:10 +08:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c19aa23d4 | ||
|
|
4890f8eaa7 | ||
|
|
60456a2c84 | ||
|
|
7d8fec7314 | ||
|
|
16667137a7 |
@@ -5,7 +5,7 @@
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/node:2": {
|
||||
"version": "26.13.1",
|
||||
"pnpmVersion": "12.18.0"
|
||||
"pnpmVersion": "12.21.0"
|
||||
},
|
||||
"ghcr.io/devcontainers/features/rust:1": {
|
||||
"version": "1.100.0",
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
nodejs 26.13.1
|
||||
pnpm 12.18.0
|
||||
pnpm 12.21.0
|
||||
rust 1.100.0
|
||||
|
||||
Generated
+75
-10
@@ -821,9 +821,9 @@ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.12.1"
|
||||
version = "1.12.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
|
||||
checksum = "776dfebd015e2d8732c684a2c71003674ccb49457b539b9e82151ba38e96dd7c"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
@@ -1191,7 +1191,7 @@ name = "clash-verge-logging"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"flexi_logger",
|
||||
"flexi_logger 0.32.0",
|
||||
"log",
|
||||
"parking_lot 0.13.0",
|
||||
"tracing-estuary",
|
||||
@@ -2425,6 +2425,19 @@ dependencies = [
|
||||
"thiserror 2.0.20",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "flexi_logger"
|
||||
version = "0.32.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e87b74024da93123949cca26cb6e366744234fdd4d7914eb3dfeab0baa82d51"
|
||||
dependencies = [
|
||||
"jiff",
|
||||
"log",
|
||||
"nu-ansi-term",
|
||||
"regex",
|
||||
"thiserror 2.0.20",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "float16"
|
||||
version = "0.1.5"
|
||||
@@ -3737,6 +3750,58 @@ dependencies = [
|
||||
"system-deps 6.2.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jiff"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed5d126d72eb017f10b302e73bdeca446bea405ee449af4d9e7866d6b082d83e"
|
||||
dependencies = [
|
||||
"jiff-core",
|
||||
"jiff-static",
|
||||
"jiff-tzdb-platform",
|
||||
"log",
|
||||
"portable-atomic",
|
||||
"portable-atomic-util",
|
||||
"serde_core",
|
||||
"windows-link 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jiff-core"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6b46a105a9874634dd96231021526bf24ca04955a5998c59a9c7666e634b7b8"
|
||||
dependencies = [
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jiff-static"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0127e9bde3c6130d6169e7d8d68676e4be69c4bf7573c308b6f960a5089c428"
|
||||
dependencies = [
|
||||
"jiff-core",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 3.0.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jiff-tzdb"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12e71a1b68a875a44a33bb7a1dd84392cb77145a3367a552a3cfe6a4f5cf3afc"
|
||||
|
||||
[[package]]
|
||||
name = "jiff-tzdb-platform"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc65b284afcfa8f6cf189c7274c805505314a7ab975c60e1f548bff56525420e"
|
||||
dependencies = [
|
||||
"jiff-tzdb",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jni"
|
||||
version = "0.21.1"
|
||||
@@ -7072,9 +7137,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sysinfo"
|
||||
version = "0.40.3"
|
||||
version = "0.40.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a86bac2f7d06e6384984118ad727f5694110f0ec44d924d05c8fdec3d030bee6"
|
||||
checksum = "3e80749408e2d8bec0ffa303012cf4e1b3b355f4a09087b4fdf7473680f6a2de"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"memchr",
|
||||
@@ -7545,8 +7610,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-mihomo"
|
||||
version = "0.7.0"
|
||||
source = "git+https://github.com/clash-verge-rev/tauri-plugin-mihomo?rev=e49bbedcc67d60da2c10e81bc6433b0f8e8fa232#e49bbedcc67d60da2c10e81bc6433b0f8e8fa232"
|
||||
version = "0.7.1"
|
||||
source = "git+https://github.com/clash-verge-rev/tauri-plugin-mihomo?rev=7e4fa8642cf6c394ed88b5a969420d8eab60087f#7e4fa8642cf6c394ed88b5a969420d8eab60087f"
|
||||
dependencies = [
|
||||
"arc-swap",
|
||||
"clashmap",
|
||||
@@ -8476,7 +8541,7 @@ dependencies = [
|
||||
"anyhow",
|
||||
"compact_str",
|
||||
"console-subscriber",
|
||||
"flexi_logger",
|
||||
"flexi_logger 0.31.10",
|
||||
"log",
|
||||
"nu-ansi-term",
|
||||
"parking_lot 0.12.5",
|
||||
@@ -10136,9 +10201,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
version = "9.6.0"
|
||||
version = "9.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80cc68510ea7553c30a69c732de5278e94183f68765af6c642dbccefd6ec777e"
|
||||
checksum = "08687262e7c0f1284b259686f322805a8adaa8ef4d7210e76448950b3f083bf7"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"bzip2",
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ tokio = { version = "1.54.1", features = [
|
||||
"time",
|
||||
"sync",
|
||||
] }
|
||||
flexi_logger = "0.31.10"
|
||||
flexi_logger = "0.32.0"
|
||||
log = "0.4.35"
|
||||
reqwest = { version = "0.13.5", features = [
|
||||
"json",
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
|
||||
- 优化连接、规则和日志筛选:切换页面后保留过滤条件
|
||||
- 优化全局模式代理列表:仅显示 `GLOBAL` 节点,选中其中的策略组时才显示该组
|
||||
- 优化设置页开关和选项所在行的鼠标悬停高亮,便于对应说明与控件
|
||||
|
||||
**🍎 macOS**
|
||||
|
||||
|
||||
@@ -15,3 +15,6 @@ tokio = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@@ -19,6 +19,7 @@ fn make_draft() -> Draft<IVerge> {
|
||||
}
|
||||
|
||||
pub fn bench_draft(c: &mut Criterion) {
|
||||
#[allow(clippy::panic, reason = "bench setup cannot proceed without a runtime")]
|
||||
let rt = Runtime::new().unwrap_or_else(|e| panic!("Tokio runtime init failed: {e}"));
|
||||
|
||||
let mut group = c.benchmark_group("draft");
|
||||
|
||||
@@ -102,6 +102,7 @@ impl<T: Clone> Draft<T> {
|
||||
let (local, original_arc) = {
|
||||
let guard = self.inner.data.lock();
|
||||
let arc = Arc::clone(&guard.0);
|
||||
drop(guard);
|
||||
((**arc).clone(), arc)
|
||||
};
|
||||
let (new_local, res) = f(local).await?;
|
||||
@@ -112,6 +113,7 @@ impl<T: Clone> Draft<T> {
|
||||
));
|
||||
}
|
||||
guard.0 = Arc::new(Box::new(new_local));
|
||||
drop(guard);
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
@@ -125,7 +127,10 @@ impl<T: Clone> Draft<T> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
async fn acquire_data_modify_permit(&self) -> DataModifyPermit<'_> {
|
||||
async fn acquire_data_modify_permit(&self) -> DataModifyPermit<'_>
|
||||
where
|
||||
T: Send + Sync,
|
||||
{
|
||||
for _ in 0..DATA_MODIFY_FAST_RETRY_YIELDS {
|
||||
if let Some(permit) = self.try_acquire_data_modify_permit() {
|
||||
return permit;
|
||||
|
||||
@@ -15,3 +15,6 @@ default = []
|
||||
tokio-trace = ["tracing-estuary/tokio-trace"]
|
||||
chrome-trace = ["tracing-estuary/chrome-trace"]
|
||||
color = ["tracing-estuary/color"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@@ -160,7 +160,7 @@ pub struct Logger {
|
||||
static LOGGER: OnceLock<Logger> = OnceLock::new();
|
||||
|
||||
impl Logger {
|
||||
fn new() -> Self {
|
||||
const fn new() -> Self {
|
||||
Self {
|
||||
pipeline: OnceLock::new(),
|
||||
sidecar_file_writer: RwLock::new(None),
|
||||
@@ -185,7 +185,7 @@ impl Logger {
|
||||
self.store_config(cfg);
|
||||
let pipeline = tracing_estuary::PipelineBuilder::new()
|
||||
.default_level(log_level)
|
||||
.file_writer(self.generate_file_log_writer()?)
|
||||
.file_writer(self.generate_file_log_writer())
|
||||
.init()?;
|
||||
self.pipeline.set(pipeline).ok();
|
||||
Ok(())
|
||||
@@ -225,11 +225,11 @@ impl Logger {
|
||||
self.log_max_count.store(cfg.max_count, Ordering::SeqCst);
|
||||
}
|
||||
|
||||
fn generate_file_log_writer(&self) -> Result<FileLogWriterBuilder> {
|
||||
fn generate_file_log_writer(&self) -> FileLogWriterBuilder {
|
||||
let log_dir = self.log_dir.get().cloned().unwrap_or_default();
|
||||
let log_max_size = self.log_max_size.load(Ordering::SeqCst);
|
||||
let log_max_count = self.log_max_count.load(Ordering::SeqCst);
|
||||
let flwb = FileLogWriter::builder(FileSpec::default().directory(log_dir).basename(""))
|
||||
FileLogWriter::builder(FileSpec::default().directory(log_dir).basename(""))
|
||||
.format(tracing_estuary::file_format_with_level)
|
||||
.write_mode(flexi_logger::WriteMode::BufferAndFlushWith(
|
||||
WRITE_BUFFER_CAPACITY,
|
||||
@@ -239,8 +239,7 @@ impl Logger {
|
||||
Criterion::Size(log_max_size * 1024),
|
||||
ROTATE_NAMING,
|
||||
Cleanup::KeepLogFiles(log_max_count),
|
||||
);
|
||||
Ok(flwb)
|
||||
)
|
||||
}
|
||||
|
||||
/// Ensures the sidecar writer exists and points at `builder`'s config:
|
||||
@@ -311,7 +310,7 @@ impl Logger {
|
||||
self.log_max_size.store(log_max_size, Ordering::SeqCst);
|
||||
self.log_max_count.store(log_max_count, Ordering::SeqCst);
|
||||
if let Some(pipeline) = self.pipeline.get() {
|
||||
let log_file_writer = self.generate_file_log_writer()?;
|
||||
let log_file_writer = self.generate_file_log_writer();
|
||||
if let Some(sink) = pipeline.sink.as_ref() {
|
||||
sink.reset(log_file_writer)
|
||||
.map_err(|error| anyhow::anyhow!("failed to reset log writer: {error}"))?;
|
||||
|
||||
@@ -12,7 +12,7 @@ parking_lot = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
# sysinfo 0.38.2 conflicts with dark-light
|
||||
# see https://github.com/GuillaumeGomez/sysinfo/issues/1623
|
||||
sysinfo = { version = "0.40.3", default-features = false, features = ["network", "system"] }
|
||||
sysinfo = { version = "0.40.4", default-features = false, features = ["network", "system"] }
|
||||
|
||||
[target.'cfg(not(windows))'.dependencies]
|
||||
libc = "0.2.191"
|
||||
|
||||
+1
-1
@@ -138,5 +138,5 @@
|
||||
]
|
||||
},
|
||||
"type": "module",
|
||||
"packageManager": "pnpm@12.18.0"
|
||||
"packageManager": "pnpm@12.21.0"
|
||||
}
|
||||
|
||||
Generated
+70
-61
@@ -7,153 +7,162 @@ importers:
|
||||
configDependencies: {}
|
||||
packageManagerDependencies:
|
||||
pnpm:
|
||||
specifier: 12.18.0
|
||||
version: 12.18.0
|
||||
specifier: 12.21.0
|
||||
version: 12.21.0
|
||||
|
||||
packages:
|
||||
|
||||
'@pnpm/exe.android-arm64@12.18.0':
|
||||
resolution: {integrity: sha512-fOF6IwgvnUKEmVedGqiAsNPfN2Ry8GvaqzSQOiF3RJFbpBfPKO/6YT54s1GjToyYinRxw9preHHPe4y2N3SzhA==}
|
||||
'@pnpm/exe.android-arm64@12.21.0':
|
||||
resolution: {integrity: sha512-iaWidxR5B9NUBpwMznCQu1yUpKB6BjTY5BYX2lORj76VsfINdj8Z8XWSzSNrGI8qlxa28Jzdp5fiaspzOaJZlA==}
|
||||
cpu: [arm64]
|
||||
os: [android]
|
||||
|
||||
'@pnpm/exe.android-x64@12.18.0':
|
||||
resolution: {integrity: sha512-6OiolnaCsB3/GcJ9XNrenbUH3zFHRJ+5QynrMUUEyThbgnnCzWxa199hpQlOmxN4rAXuYQ0IYgWFNUZxyzg31Q==}
|
||||
'@pnpm/exe.android-x64@12.21.0':
|
||||
resolution: {integrity: sha512-35e5v3wlwjIYxDywq+R6/z8CE4gLOEgRxt18yqz1tMRLmx2mnW+CFJI2Q8+srTNjn7gykXUC0x1k195JNikC5A==}
|
||||
cpu: [x64]
|
||||
os: [android]
|
||||
|
||||
'@pnpm/exe.darwin-arm64@12.18.0':
|
||||
resolution: {integrity: sha512-zkq+4YzVIX39ETYLyC3W7LY7MpHEU/J3nRhHl4i2yPld2Cf2+rEKRh3ejJ4AmaQ77HHJLCktY4Z3jq0fpcxFXg==}
|
||||
'@pnpm/exe.darwin-arm64@12.21.0':
|
||||
resolution: {integrity: sha512-F5OyMX/6zLSowpTZEQRojbCmPS1Pq+fyRaIinslsIe6Glh3qbyQ52u+Fe0eEzSaRuIbWZkXmAAXSWh6Q5Wrlgg==}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
'@pnpm/exe.darwin-x64@12.18.0':
|
||||
resolution: {integrity: sha512-qMsL9qx92unOTa6hgkfiTJv8ceZaTx0IQg7InhYDVX2ZrTECujaVEEVypnJK5m3eGUsP1KD7Y4qIgleCwfRsYw==}
|
||||
'@pnpm/exe.darwin-x64@12.21.0':
|
||||
resolution: {integrity: sha512-EzpvcsaE6hrrgYeEiAFYd2rSgFybYyxXhkAY7K3y6Hg3loVfcyJ81hHczpFzi8lW5RXtUlFECRPZ8ZAMRFQYYg==}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
'@pnpm/exe.freebsd-x64@12.18.0':
|
||||
resolution: {integrity: sha512-/9vy/4ms52cU4MjZ5NhHd6N2d9L9W0kARf5/ff2tweAHu0VeUzs/0qp/7ZHFuddm2Wa/m0AKQoPum9AVUCqKsw==}
|
||||
'@pnpm/exe.freebsd-x64@12.21.0':
|
||||
resolution: {integrity: sha512-wNjuEnmdLks4aayPu/QZWQ5tQM9Jn+odUp/vwQM8BXRYoulkTZhtZTHoD60N6mUdLWef1hgUeUh8llNGEUsimw==}
|
||||
cpu: [x64]
|
||||
os: [freebsd]
|
||||
|
||||
'@pnpm/exe.linux-arm64-musl@12.18.0':
|
||||
resolution: {integrity: sha512-Vp+TIMPPyackVCXkOdEKH/RmAn/r07EcIyrgZYQK7VrkksqZOie0GnWIx+85mPqeFEYCRtXIZAFJ9L4ceTndDg==}
|
||||
'@pnpm/exe.linux-arm64-musl@12.21.0':
|
||||
resolution: {integrity: sha512-Ceit9zn4g5ZqCJtx1fV8eJE7p8aeXMrGZ+Dc01vRqZLIUNgNeI+Ur0ruyqxtsnJx6rGADyXzohumxPLHjaJ5AQ==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@pnpm/exe.linux-arm64@12.18.0':
|
||||
resolution: {integrity: sha512-2dpyVBCHT+FfpuQh9i+7MXAqNWYLCvD5vYr5p6Eimxoga8USLnjbUgyj72AOrO0hjc5ri3TEFP3jiyBHjkSZpQ==}
|
||||
'@pnpm/exe.linux-arm64@12.21.0':
|
||||
resolution: {integrity: sha512-4Oj/iF2TDCe2lcH0n4TupPR5sSdrNLclJB6xBElLMPCUOAvBhdf2rRlSaO5M4erJ6g4Fyy7YTXTpcmfFsKyxEA==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@pnpm/exe.linux-ppc64@12.18.0':
|
||||
resolution: {integrity: sha512-BBOOOfNJ2QwIIya3eKqOjiN4WNTszfRz7HCvw9XggcT7+ftMjNP8XJ/GfW+ltCBeUFR9d8WBVsr2m/NLjX2CZQ==}
|
||||
'@pnpm/exe.linux-ppc64@12.21.0':
|
||||
resolution: {integrity: sha512-s2o7rdSDeUTBFsNqxptpZXlTgT6cojmMVUOvTQvFNSv6Easian02ha4tR32fwwD97Au4YzIIjMCwywCF4D82Sw==}
|
||||
cpu: [ppc64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@pnpm/exe.linux-riscv64@12.18.0':
|
||||
resolution: {integrity: sha512-7kMN77xSOYJX8GPSH5RbNAc5oM61LMmcSUukDDUwllnZPXm8GRPskCNsTWy8SCw01Kr1FB+5SwGNMiTdiziLNQ==}
|
||||
'@pnpm/exe.linux-riscv64@12.21.0':
|
||||
resolution: {integrity: sha512-EYv3GzxeBTITCuM3yGHHbpRFpUvyulkXpQ6LsjKAQNL3iaba1E6h9iDmlouLb3Io4AMMsfdk0/uG6poQ41uewA==}
|
||||
cpu: [riscv64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@pnpm/exe.linux-s390x@12.18.0':
|
||||
resolution: {integrity: sha512-htuSCpEcmDzhKoJqXbPkvfr176dBHU0QIF5mWcRiqxRXAB/1JoYiMYotfjWpk+ztgpB9qlx4XnWlLFAf7gzc6g==}
|
||||
'@pnpm/exe.linux-s390x@12.21.0':
|
||||
resolution: {integrity: sha512-8VXGNGVNEfs7pL9GTZOzFxjFEnMt4WL3rLOADR5/kPQ7ROTV9GfpVI2DPO/zArXFSkvfc9Zad/WypHLbvzoaTQ==}
|
||||
cpu: [s390x]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@pnpm/exe.linux-x64-musl@12.18.0':
|
||||
resolution: {integrity: sha512-Uj+vzfIQ62kDP10x36yHZIXVs5ohdNtiPYwn5FhCLlNScHPo0OAI+ShGDtLofiBXKE7umu71Jmjm7N8a8zVcDw==}
|
||||
'@pnpm/exe.linux-x64-musl@12.21.0':
|
||||
resolution: {integrity: sha512-MnC5vpIXYubhDZCgCwlfJMg7Cg6HupN2IuouT9gD/tUmOfVdQYqeyYccWbthyo/Jeto8de1oQlxeRN1+1Hl2DQ==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@pnpm/exe.linux-x64@12.18.0':
|
||||
resolution: {integrity: sha512-OJ+X2wcraldCwj75pCIerWARQSRpdfj0eBTs/2ODyhfeW46ylOnjTIE/GKra6Mn6E72/gBmXS8igrUioa+F9fQ==}
|
||||
'@pnpm/exe.linux-x64@12.21.0':
|
||||
resolution: {integrity: sha512-8eufCjHXspKbNS/kh8q4Q0gqJoOuvC4Q5pgos6XS8By/nAMtP+jf8F1Cw9er840kfAX+PJ/ts+A9qnLE91rvXQ==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@pnpm/exe.win32-arm64@12.18.0':
|
||||
resolution: {integrity: sha512-wEY6jiACGcbhhi5yD59doHqNTndS7AaujaPmtWAu1DKkHru2hy5fJ9yUGecW72Ypaw2/I3BEprfMOopap2NQtw==}
|
||||
'@pnpm/exe.netbsd-x64@12.21.0':
|
||||
resolution: {integrity: sha512-eyh1M8hQZCkLWxuva7S/fc1SbFbgqg0/5di0dgWmyiuc2Io3dbWVihDun8X+XM8zsR5uhIDvvZpbS9aZQbCovg==}
|
||||
cpu: [x64]
|
||||
os: [netbsd]
|
||||
|
||||
'@pnpm/exe.win32-arm64@12.21.0':
|
||||
resolution: {integrity: sha512-7xTxxUXo/grRLivSeIl6B21gnsz7ooe5EMPcJmQqwxc8WLJVReN8MzrlHru8bqXfVr4X3+6ZGZscntKenlCBqQ==}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
'@pnpm/exe.win32-x64@12.18.0':
|
||||
resolution: {integrity: sha512-5FJkghO7RLRkQpWxeVEygW9XsmnNuxzPfXbgwFWCHsFyFhpDn/vOdL88ToQEM0Kt5igdW5s6U0/IDH8Dvkt3pg==}
|
||||
'@pnpm/exe.win32-x64@12.21.0':
|
||||
resolution: {integrity: sha512-9TpkJemVApxJ1Z1w0ZFGN+AuSx4nJOqXSJUqMqDvaXTYwGOzvBiiWdFP9GN0ketiWCQS1Q0/pza2E7I3pP0OBQ==}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
pnpm@12.18.0:
|
||||
resolution: {integrity: sha512-nXiC1dyCFH7PxOBiqjSDTgrQKWcQoYN6ERWuASEn02txCeMhrBWYod0KZVl2gbHpmRfhLtDXSerpEYeUM2O+sw==}
|
||||
pnpm@12.21.0:
|
||||
resolution: {integrity: sha512-Zv2CeO4ok1zpUXktNDZ/869cQyonVkRYIwKVM4NbjaUpu+C+UTCv1W7QcT+4eJ5Hutgtk71a4v5UsVVi1idu8A==}
|
||||
engines: {node: '>=18'}
|
||||
hasBin: true
|
||||
|
||||
snapshots:
|
||||
|
||||
'@pnpm/exe.android-arm64@12.18.0':
|
||||
'@pnpm/exe.android-arm64@12.21.0':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.android-x64@12.18.0':
|
||||
'@pnpm/exe.android-x64@12.21.0':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.darwin-arm64@12.18.0':
|
||||
'@pnpm/exe.darwin-arm64@12.21.0':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.darwin-x64@12.18.0':
|
||||
'@pnpm/exe.darwin-x64@12.21.0':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.freebsd-x64@12.18.0':
|
||||
'@pnpm/exe.freebsd-x64@12.21.0':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.linux-arm64-musl@12.18.0':
|
||||
'@pnpm/exe.linux-arm64-musl@12.21.0':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.linux-arm64@12.18.0':
|
||||
'@pnpm/exe.linux-arm64@12.21.0':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.linux-ppc64@12.18.0':
|
||||
'@pnpm/exe.linux-ppc64@12.21.0':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.linux-riscv64@12.18.0':
|
||||
'@pnpm/exe.linux-riscv64@12.21.0':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.linux-s390x@12.18.0':
|
||||
'@pnpm/exe.linux-s390x@12.21.0':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.linux-x64-musl@12.18.0':
|
||||
'@pnpm/exe.linux-x64-musl@12.21.0':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.linux-x64@12.18.0':
|
||||
'@pnpm/exe.linux-x64@12.21.0':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.win32-arm64@12.18.0':
|
||||
'@pnpm/exe.netbsd-x64@12.21.0':
|
||||
optional: true
|
||||
|
||||
'@pnpm/exe.win32-x64@12.18.0':
|
||||
'@pnpm/exe.win32-arm64@12.21.0':
|
||||
optional: true
|
||||
|
||||
pnpm@12.18.0:
|
||||
'@pnpm/exe.win32-x64@12.21.0':
|
||||
optional: true
|
||||
|
||||
pnpm@12.21.0:
|
||||
optionalDependencies:
|
||||
'@pnpm/exe.android-arm64': 12.18.0
|
||||
'@pnpm/exe.android-x64': 12.18.0
|
||||
'@pnpm/exe.darwin-arm64': 12.18.0
|
||||
'@pnpm/exe.darwin-x64': 12.18.0
|
||||
'@pnpm/exe.freebsd-x64': 12.18.0
|
||||
'@pnpm/exe.linux-arm64': 12.18.0
|
||||
'@pnpm/exe.linux-arm64-musl': 12.18.0
|
||||
'@pnpm/exe.linux-ppc64': 12.18.0
|
||||
'@pnpm/exe.linux-riscv64': 12.18.0
|
||||
'@pnpm/exe.linux-s390x': 12.18.0
|
||||
'@pnpm/exe.linux-x64': 12.18.0
|
||||
'@pnpm/exe.linux-x64-musl': 12.18.0
|
||||
'@pnpm/exe.win32-arm64': 12.18.0
|
||||
'@pnpm/exe.win32-x64': 12.18.0
|
||||
'@pnpm/exe.android-arm64': 12.21.0
|
||||
'@pnpm/exe.android-x64': 12.21.0
|
||||
'@pnpm/exe.darwin-arm64': 12.21.0
|
||||
'@pnpm/exe.darwin-x64': 12.21.0
|
||||
'@pnpm/exe.freebsd-x64': 12.21.0
|
||||
'@pnpm/exe.linux-arm64': 12.21.0
|
||||
'@pnpm/exe.linux-arm64-musl': 12.21.0
|
||||
'@pnpm/exe.linux-ppc64': 12.21.0
|
||||
'@pnpm/exe.linux-riscv64': 12.21.0
|
||||
'@pnpm/exe.linux-s390x': 12.21.0
|
||||
'@pnpm/exe.linux-x64': 12.21.0
|
||||
'@pnpm/exe.linux-x64-musl': 12.21.0
|
||||
'@pnpm/exe.netbsd-x64': 12.21.0
|
||||
'@pnpm/exe.win32-arm64': 12.21.0
|
||||
'@pnpm/exe.win32-x64': 12.21.0
|
||||
|
||||
---
|
||||
lockfileVersion: '9.0'
|
||||
|
||||
@@ -77,7 +77,7 @@ tauri-plugin-dialog = "2.8.4"
|
||||
tauri-plugin-fs = "2.7.1"
|
||||
tauri-plugin-deep-link = "2.6.3"
|
||||
tauri-plugin-window-state = "2.5.0"
|
||||
zip = "9.6.0"
|
||||
zip = "9.7.0"
|
||||
flate2 = "1.1.11"
|
||||
reqwest_dav = "0.3.3"
|
||||
aes-gcm = { version = "0.11.1" }
|
||||
@@ -91,7 +91,7 @@ backon = { version = "1.6.0", features = ["tokio-sleep"] }
|
||||
tauri-plugin-http = "2.9.0"
|
||||
tracing = { workspace = true }
|
||||
tauri-plugin-devtools = { version = "2.2.3", optional = true }
|
||||
tauri-plugin-mihomo = { git = "https://github.com/clash-verge-rev/tauri-plugin-mihomo", rev = "e49bbedcc67d60da2c10e81bc6433b0f8e8fa232" }
|
||||
tauri-plugin-mihomo = { git = "https://github.com/clash-verge-rev/tauri-plugin-mihomo", rev = "7e4fa8642cf6c394ed88b5a969420d8eab60087f" }
|
||||
async-trait = "0.1.92"
|
||||
clash_verge_service_ipc = { git = "https://github.com/clash-verge-rev/clash-verge-service-ipc.git", tag = "v2.8.1", version = "2.8.1", features = [
|
||||
"client",
|
||||
@@ -101,7 +101,7 @@ tokio-rustls = "0.26.6"
|
||||
rustls = { version = "0.23.46", features = ["ring"] }
|
||||
webpki-roots = "1.0.12"
|
||||
dark-light = "3.0.0"
|
||||
bytes = "1.12.1"
|
||||
bytes = "1.12.2"
|
||||
tokio-util = { version = "0.7.20", features = ["time"] }
|
||||
specta = { version = "=2.0.0-rc.26", features = ["derive", "function", "serde_json"] }
|
||||
tauri-specta = { version = "=2.0.0-rc.26", features = ["derive", "typescript"] }
|
||||
|
||||
@@ -34,6 +34,9 @@ pub(crate) struct Config {
|
||||
|
||||
static CONFIG_WRITE_LOCK: Mutex<()> = Mutex::const_new(());
|
||||
|
||||
static RUNTIME_YAML_CACHE: parking_lot::Mutex<Option<(u64, std::sync::Arc<std::string::String>)>> =
|
||||
parking_lot::Mutex::new(None);
|
||||
|
||||
impl Config {
|
||||
async fn global() -> &'static Self {
|
||||
static CONFIG: OnceCell<Config> = OnceCell::const_new();
|
||||
@@ -205,7 +208,7 @@ impl Config {
|
||||
Self::write_runtime_file(&yaml).await
|
||||
}
|
||||
|
||||
pub(crate) async fn runtime_config_yaml() -> Result<std::string::String> {
|
||||
pub(crate) async fn runtime_config_yaml() -> Result<std::sync::Arc<std::string::String>> {
|
||||
let runtime = Self::runtime().await;
|
||||
AsyncHandler::spawn_blocking(move || {
|
||||
let runtime_lastest = runtime.latest_arc();
|
||||
@@ -215,7 +218,16 @@ impl Config {
|
||||
.as_ref()
|
||||
.or_else(|| runtime_data.config.as_ref())
|
||||
.ok_or_else(|| anyhow!("failed to generate runtime config, might need to restart application"))?;
|
||||
let yaml_str = serde_yaml_ng::to_string(config)?;
|
||||
let mut hasher = std::collections::hash_map::DefaultHasher::new();
|
||||
std::hash::Hash::hash(config, &mut hasher);
|
||||
let key = std::hash::Hasher::finish(&hasher);
|
||||
if let Some((cached_key, cached)) = RUNTIME_YAML_CACHE.lock().as_ref()
|
||||
&& *cached_key == key
|
||||
{
|
||||
return Ok(std::sync::Arc::clone(cached));
|
||||
}
|
||||
let yaml_str = std::sync::Arc::new(serde_yaml_ng::to_string(config)?);
|
||||
*RUNTIME_YAML_CACHE.lock() = Some((key, std::sync::Arc::clone(&yaml_str)));
|
||||
Ok(yaml_str)
|
||||
})
|
||||
.await
|
||||
|
||||
@@ -3,17 +3,22 @@ use crate::{
|
||||
config::PrfItem,
|
||||
utils::{dirs, help},
|
||||
};
|
||||
use parking_lot::Mutex;
|
||||
use serde_yaml_ng::Mapping;
|
||||
use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::{Arc, LazyLock};
|
||||
use std::time::SystemTime;
|
||||
use tokio::fs;
|
||||
use tristr::alias::String;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug)]
|
||||
pub struct ChainItem {
|
||||
pub uid: String,
|
||||
pub data: ChainType,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug)]
|
||||
pub enum ChainType {
|
||||
Merge(Mapping),
|
||||
Script(String),
|
||||
@@ -22,26 +27,39 @@ pub enum ChainType {
|
||||
Groups(SeqMap),
|
||||
}
|
||||
|
||||
// Helper trait to allow async conversion
|
||||
pub trait AsyncChainItemFrom {
|
||||
async fn from_async(item: &PrfItem) -> Option<ChainItem>;
|
||||
struct CachedChain {
|
||||
mtime: SystemTime,
|
||||
len: u64,
|
||||
item: Arc<ChainItem>,
|
||||
}
|
||||
|
||||
impl AsyncChainItemFrom for Option<ChainItem> {
|
||||
static CHAIN_CACHE: LazyLock<Mutex<HashMap<PathBuf, CachedChain>>> = LazyLock::new(|| Mutex::new(HashMap::new()));
|
||||
|
||||
// Helper trait to allow async conversion
|
||||
pub trait AsyncChainItemFrom {
|
||||
async fn from_async(item: &PrfItem) -> Option<Arc<ChainItem>>;
|
||||
}
|
||||
|
||||
impl AsyncChainItemFrom for Option<Arc<ChainItem>> {
|
||||
async fn from_async(item: &PrfItem) -> Self {
|
||||
let itype = item.itype.as_ref()?.as_str();
|
||||
let file = item.file.clone()?;
|
||||
let uid = item.uid.clone().unwrap_or_else(|| "".into());
|
||||
let path = dirs::app_profiles_dir().ok()?.join(file.as_str());
|
||||
|
||||
if !path.exists() {
|
||||
return None;
|
||||
let meta = fs::metadata(&path).await.ok()?;
|
||||
let (mtime, len) = (meta.modified().ok()?, meta.len());
|
||||
if let Some(cached) = CHAIN_CACHE.lock().get(&path)
|
||||
&& cached.mtime == mtime
|
||||
&& cached.len == len
|
||||
{
|
||||
return Some(Arc::clone(&cached.item));
|
||||
}
|
||||
|
||||
match itype {
|
||||
let loaded = Arc::new(match itype {
|
||||
"script" => Some(ChainItem {
|
||||
uid,
|
||||
data: ChainType::Script(fs::read_to_string(path).await.ok()?.into()),
|
||||
data: ChainType::Script(fs::read_to_string(&path).await.ok()?.as_str().into()),
|
||||
}),
|
||||
"merge" => Some(ChainItem {
|
||||
uid,
|
||||
@@ -57,6 +75,16 @@ impl AsyncChainItemFrom for Option<ChainItem> {
|
||||
Some(ChainItem { uid, data })
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}?);
|
||||
|
||||
CHAIN_CACHE.lock().insert(
|
||||
path,
|
||||
CachedChain {
|
||||
mtime,
|
||||
len,
|
||||
item: Arc::clone(&loaded),
|
||||
},
|
||||
);
|
||||
Some(loaded)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ use parking_lot::Mutex;
|
||||
use serde_yaml_ng::{Mapping, Value};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::hash::{Hash as _, Hasher as _};
|
||||
use std::sync::Arc;
|
||||
use tokio::fs;
|
||||
use tristr::alias::String;
|
||||
|
||||
@@ -51,13 +52,13 @@ struct ConfigValues {
|
||||
#[derive(Debug)]
|
||||
struct ProfileItems {
|
||||
config: Mapping,
|
||||
merge_item: ChainItem,
|
||||
script_item: ChainItem,
|
||||
rules_item: ChainItem,
|
||||
proxies_item: ChainItem,
|
||||
groups_item: ChainItem,
|
||||
global_merge: ChainItem,
|
||||
global_script: ChainItem,
|
||||
merge_item: Arc<ChainItem>,
|
||||
script_item: Arc<ChainItem>,
|
||||
rules_item: Arc<ChainItem>,
|
||||
proxies_item: Arc<ChainItem>,
|
||||
groups_item: Arc<ChainItem>,
|
||||
global_merge: Arc<ChainItem>,
|
||||
global_script: Arc<ChainItem>,
|
||||
profile_name: String,
|
||||
}
|
||||
|
||||
@@ -66,41 +67,46 @@ impl Default for ProfileItems {
|
||||
Self {
|
||||
config: Default::default(),
|
||||
profile_name: Default::default(),
|
||||
merge_item: ChainItem {
|
||||
merge_item: Arc::new(ChainItem {
|
||||
uid: "".into(),
|
||||
data: ChainType::Merge(Mapping::new()),
|
||||
},
|
||||
script_item: ChainItem {
|
||||
}),
|
||||
script_item: Arc::new(ChainItem {
|
||||
uid: "".into(),
|
||||
data: ChainType::Script(tmpl::ITEM_SCRIPT.into()),
|
||||
},
|
||||
rules_item: ChainItem {
|
||||
}),
|
||||
rules_item: Arc::new(ChainItem {
|
||||
uid: "".into(),
|
||||
data: ChainType::Rules(SeqMap::default()),
|
||||
},
|
||||
proxies_item: ChainItem {
|
||||
}),
|
||||
proxies_item: Arc::new(ChainItem {
|
||||
uid: "".into(),
|
||||
data: ChainType::Proxies(SeqMap::default()),
|
||||
},
|
||||
groups_item: ChainItem {
|
||||
}),
|
||||
groups_item: Arc::new(ChainItem {
|
||||
uid: "".into(),
|
||||
data: ChainType::Groups(SeqMap::default()),
|
||||
},
|
||||
global_merge: ChainItem {
|
||||
}),
|
||||
global_merge: Arc::new(ChainItem {
|
||||
uid: "Merge".into(),
|
||||
data: ChainType::Merge(Mapping::new()),
|
||||
},
|
||||
global_script: ChainItem {
|
||||
}),
|
||||
global_script: Arc::new(ChainItem {
|
||||
uid: "Script".into(),
|
||||
data: ChainType::Script(tmpl::ITEM_SCRIPT.into()),
|
||||
},
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn chain_item_or_default(item: Option<&PrfItem>, default_item: impl FnOnce() -> ChainItem) -> ChainItem {
|
||||
async fn chain_item_or_default(
|
||||
item: Option<&PrfItem>,
|
||||
default_item: impl FnOnce() -> Arc<ChainItem>,
|
||||
) -> Arc<ChainItem> {
|
||||
if let Some(item) = item {
|
||||
<Option<ChainItem>>::from_async(item).await.unwrap_or_else(default_item)
|
||||
<Option<Arc<ChainItem>>>::from_async(item)
|
||||
.await
|
||||
.unwrap_or_else(default_item)
|
||||
} else {
|
||||
default_item()
|
||||
}
|
||||
@@ -235,28 +241,28 @@ async fn process_override_items(
|
||||
mut config: Mapping,
|
||||
mut exists_keys: Vec<String>,
|
||||
mut result_map: HashMap<String, ResultLog>,
|
||||
merge_item: ChainItem,
|
||||
script_item: ChainItem,
|
||||
merge_item: Arc<ChainItem>,
|
||||
script_item: Arc<ChainItem>,
|
||||
profile_name: &str,
|
||||
authoritative: &AuthoritativeFields,
|
||||
) -> (Mapping, Vec<String>, HashMap<String, ResultLog>) {
|
||||
if let ChainType::Merge(merge) = merge_item.data {
|
||||
exists_keys.extend(use_keys(&merge));
|
||||
if let ChainType::Merge(merge) = &merge_item.data {
|
||||
exists_keys.extend(use_keys(merge));
|
||||
let before = authoritative.current(&config);
|
||||
config = use_merge(merge, config);
|
||||
config = use_merge(merge.clone(), config);
|
||||
let notes: ResultLog = authoritative
|
||||
.overridden(&before, &authoritative.current(&config))
|
||||
.into_iter()
|
||||
.map(discarded_note)
|
||||
.collect();
|
||||
if !notes.is_empty() {
|
||||
result_map.entry(merge_item.uid).or_default().extend(notes);
|
||||
result_map.entry(merge_item.uid.clone()).or_default().extend(notes);
|
||||
}
|
||||
}
|
||||
|
||||
if let ChainType::Script(script) = script_item.data {
|
||||
if let ChainType::Script(script) = &script_item.data {
|
||||
let before = authoritative.current(&config);
|
||||
let (res_config, changed_keys, mut logs) = use_script(script, config, profile_name.into()).await;
|
||||
let (res_config, changed_keys, mut logs) = use_script(script.clone(), config, profile_name.into()).await;
|
||||
exists_keys.extend(changed_keys);
|
||||
config = res_config;
|
||||
logs.extend(
|
||||
@@ -265,7 +271,7 @@ async fn process_override_items(
|
||||
.into_iter()
|
||||
.map(discarded_note),
|
||||
);
|
||||
result_map.insert(script_item.uid, logs);
|
||||
result_map.insert(script_item.uid.clone(), logs);
|
||||
}
|
||||
|
||||
(config, exists_keys, result_map)
|
||||
@@ -273,20 +279,20 @@ async fn process_override_items(
|
||||
|
||||
fn process_seq_items(
|
||||
mut config: Mapping,
|
||||
rules_item: ChainItem,
|
||||
proxies_item: ChainItem,
|
||||
groups_item: ChainItem,
|
||||
rules_item: Arc<ChainItem>,
|
||||
proxies_item: Arc<ChainItem>,
|
||||
groups_item: Arc<ChainItem>,
|
||||
) -> Mapping {
|
||||
if let ChainType::Rules(rules) = rules_item.data {
|
||||
config = use_seq(rules, config, "rules");
|
||||
if let ChainType::Rules(rules) = &rules_item.data {
|
||||
config = use_seq(rules.clone(), config, "rules");
|
||||
}
|
||||
|
||||
if let ChainType::Proxies(proxies) = proxies_item.data {
|
||||
config = use_seq(proxies, config, "proxies");
|
||||
if let ChainType::Proxies(proxies) = &proxies_item.data {
|
||||
config = use_seq(proxies.clone(), config, "proxies");
|
||||
}
|
||||
|
||||
if let ChainType::Groups(groups) = groups_item.data {
|
||||
config = use_seq(groups, config, "proxy-groups");
|
||||
if let ChainType::Groups(groups) = &groups_item.data {
|
||||
config = use_seq(groups.clone(), config, "proxy-groups");
|
||||
}
|
||||
|
||||
config
|
||||
@@ -1397,6 +1403,7 @@ mod tests {
|
||||
process_override_items, use_keys,
|
||||
};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
fn mapping(yaml: &str) -> serde_yaml_ng::Mapping {
|
||||
serde_yaml_ng::from_str(yaml).expect("test config should be valid")
|
||||
@@ -1437,9 +1444,11 @@ mod tests {
|
||||
(profile.clone(), Mapping::new())
|
||||
};
|
||||
let authoritative = AuthoritativeFields::capture(&config, &[], dns_settings);
|
||||
let merge_item = |uid: &str| ChainItem {
|
||||
uid: uid.into(),
|
||||
data: ChainType::Merge(merge.clone()),
|
||||
let merge_item = |uid: &str| {
|
||||
Arc::new(ChainItem {
|
||||
uid: uid.into(),
|
||||
data: ChainType::Merge(merge.clone()),
|
||||
})
|
||||
};
|
||||
let profile_name = "test-profile";
|
||||
let (config, keys, logs) = process_override_items(
|
||||
@@ -1447,10 +1456,10 @@ mod tests {
|
||||
vec![],
|
||||
HashMap::new(),
|
||||
merge_item("global-merge"),
|
||||
ChainItem {
|
||||
Arc::new(ChainItem {
|
||||
uid: "global-script".into(),
|
||||
data: ChainType::Script(script.into()),
|
||||
},
|
||||
}),
|
||||
profile_name,
|
||||
&authoritative,
|
||||
)
|
||||
@@ -1460,10 +1469,10 @@ mod tests {
|
||||
keys,
|
||||
logs,
|
||||
merge_item("profile-merge"),
|
||||
ChainItem {
|
||||
Arc::new(ChainItem {
|
||||
uid: "profile-script".into(),
|
||||
data: ChainType::Script(script.into()),
|
||||
},
|
||||
}),
|
||||
profile_name,
|
||||
&authoritative,
|
||||
)
|
||||
@@ -1500,15 +1509,15 @@ mod tests {
|
||||
let exists_keys = use_keys(&config).collect();
|
||||
config.insert("application-only".into(), true.into());
|
||||
|
||||
let global_merge = ChainItem {
|
||||
let global_merge = Arc::new(ChainItem {
|
||||
uid: "Merge".into(),
|
||||
data: ChainType::Merge(mapping(
|
||||
r"{global-merge-wins: global-merge, global-script-wins: global-merge,
|
||||
profile-merge-wins: global-merge, profile-script-wins: global-merge,
|
||||
nested: {winner: global-merge}, dns: {enable: false}, tun: {enable: false}}",
|
||||
)),
|
||||
};
|
||||
let global_script = ChainItem {
|
||||
});
|
||||
let global_script = Arc::new(ChainItem {
|
||||
uid: "Script".into(),
|
||||
data: ChainType::Script(
|
||||
r#"function main(config) {
|
||||
@@ -1520,15 +1529,15 @@ mod tests {
|
||||
}"#
|
||||
.into(),
|
||||
),
|
||||
};
|
||||
let profile_merge = ChainItem {
|
||||
});
|
||||
let profile_merge = Arc::new(ChainItem {
|
||||
uid: "profile-merge".into(),
|
||||
data: ChainType::Merge(mapping(
|
||||
r"{profile-merge-wins: profile-merge, profile-script-wins: profile-merge,
|
||||
nested: {winner: profile-merge}}",
|
||||
)),
|
||||
};
|
||||
let profile_script = ChainItem {
|
||||
});
|
||||
let profile_script = Arc::new(ChainItem {
|
||||
uid: "profile-script".into(),
|
||||
data: ChainType::Script(
|
||||
r#"function main(config) {
|
||||
@@ -1538,7 +1547,7 @@ mod tests {
|
||||
}"#
|
||||
.into(),
|
||||
),
|
||||
};
|
||||
});
|
||||
|
||||
let profile_name = "test-profile";
|
||||
let authoritative = AuthoritativeFields::capture(&config, &[], Mapping::new());
|
||||
|
||||
@@ -62,7 +62,14 @@ export const SettingItem: React.FC<ItemProps> = ({
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
) : (
|
||||
<ListItem data-setting-target={searchTarget} sx={{ pt: '5px', pb: '5px' }}>
|
||||
<ListItem
|
||||
data-setting-target={searchTarget}
|
||||
sx={{
|
||||
pt: '5px',
|
||||
pb: '5px',
|
||||
'&:hover': { bgcolor: 'action.hover' },
|
||||
}}
|
||||
>
|
||||
<ListItemText primary={primary} secondary={secondary} />
|
||||
{children}
|
||||
</ListItem>
|
||||
|
||||
Reference in New Issue
Block a user