chore: update dependencies and improve IPC request handling
This commit is contained in:
74
src-tauri/Cargo.lock
generated
74
src-tauri/Cargo.lock
generated
@@ -721,7 +721,7 @@ dependencies = [
|
|||||||
"static_assertions",
|
"static_assertions",
|
||||||
"tap",
|
"tap",
|
||||||
"thin-vec",
|
"thin-vec",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
"time",
|
"time",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -945,7 +945,7 @@ dependencies = [
|
|||||||
"semver 1.0.26",
|
"semver 1.0.26",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2635,7 +2635,7 @@ dependencies = [
|
|||||||
"objc2-app-kit",
|
"objc2-app-kit",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.59.0",
|
||||||
"x11rb",
|
"x11rb",
|
||||||
"xkeysym",
|
"xkeysym",
|
||||||
@@ -3666,9 +3666,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kode-bridge"
|
name = "kode-bridge"
|
||||||
version = "0.2.0"
|
version = "0.2.1-rc1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5416db0fac4129918564e1490e8128458709a473e4ed0166ba115f021d8f3ea9"
|
checksum = "9fd493b32ae4bae43f8ba30d6d4bfe28675c3468e6676bb5823c0a8b7ab6f4cc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures",
|
"futures",
|
||||||
@@ -3680,7 +3680,7 @@ dependencies = [
|
|||||||
"rand 0.9.2",
|
"rand 0.9.2",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-stream",
|
"tokio-stream",
|
||||||
"tokio-util",
|
"tokio-util",
|
||||||
@@ -4091,7 +4091,7 @@ dependencies = [
|
|||||||
"once_cell",
|
"once_cell",
|
||||||
"png",
|
"png",
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -4185,7 +4185,7 @@ dependencies = [
|
|||||||
"cc",
|
"cc",
|
||||||
"libc",
|
"libc",
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -4764,7 +4764,7 @@ dependencies = [
|
|||||||
"objc2-osa-kit",
|
"objc2-osa-kit",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4872,7 +4872,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "1db05f56d34358a8b1066f67cbb203ee3e7ed2ba674a6263a1d5ec6db2204323"
|
checksum = "1db05f56d34358a8b1066f67cbb203ee3e7ed2ba674a6263a1d5ec6db2204323"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
"ucd-trie",
|
"ucd-trie",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -5440,7 +5440,7 @@ dependencies = [
|
|||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
"rustls",
|
"rustls",
|
||||||
"socket2 0.5.10",
|
"socket2 0.5.10",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
"web-time",
|
"web-time",
|
||||||
@@ -5461,7 +5461,7 @@ dependencies = [
|
|||||||
"rustls",
|
"rustls",
|
||||||
"rustls-pki-types",
|
"rustls-pki-types",
|
||||||
"slab",
|
"slab",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
"tinyvec",
|
"tinyvec",
|
||||||
"tracing",
|
"tracing",
|
||||||
"web-time",
|
"web-time",
|
||||||
@@ -5666,7 +5666,7 @@ checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.2.16",
|
"getrandom 0.2.16",
|
||||||
"libredox",
|
"libredox",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -6910,7 +6910,7 @@ dependencies = [
|
|||||||
"tauri-runtime",
|
"tauri-runtime",
|
||||||
"tauri-runtime-wry",
|
"tauri-runtime-wry",
|
||||||
"tauri-utils",
|
"tauri-utils",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tray-icon",
|
"tray-icon",
|
||||||
@@ -6964,7 +6964,7 @@ dependencies = [
|
|||||||
"sha2 0.10.9",
|
"sha2 0.10.9",
|
||||||
"syn 2.0.104",
|
"syn 2.0.104",
|
||||||
"tauri-utils",
|
"tauri-utils",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
"time",
|
"time",
|
||||||
"url",
|
"url",
|
||||||
"uuid",
|
"uuid",
|
||||||
@@ -7013,7 +7013,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"tauri",
|
"tauri",
|
||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -7028,7 +7028,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"tauri",
|
"tauri",
|
||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -7044,7 +7044,7 @@ dependencies = [
|
|||||||
"tauri",
|
"tauri",
|
||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"tauri-utils",
|
"tauri-utils",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
"tracing",
|
"tracing",
|
||||||
"url",
|
"url",
|
||||||
"windows-registry",
|
"windows-registry",
|
||||||
@@ -7092,7 +7092,7 @@ dependencies = [
|
|||||||
"tauri",
|
"tauri",
|
||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"tauri-plugin-fs",
|
"tauri-plugin-fs",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -7113,7 +7113,7 @@ dependencies = [
|
|||||||
"tauri",
|
"tauri",
|
||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"tauri-utils",
|
"tauri-utils",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
"toml 0.8.23",
|
"toml 0.8.23",
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
@@ -7130,7 +7130,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"tauri",
|
"tauri",
|
||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -7147,7 +7147,7 @@ dependencies = [
|
|||||||
"serde_repr",
|
"serde_repr",
|
||||||
"tauri",
|
"tauri",
|
||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
"time",
|
"time",
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
@@ -7179,7 +7179,7 @@ dependencies = [
|
|||||||
"shared_child",
|
"shared_child",
|
||||||
"tauri",
|
"tauri",
|
||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -7207,7 +7207,7 @@ dependencies = [
|
|||||||
"tauri",
|
"tauri",
|
||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
"time",
|
"time",
|
||||||
"tokio",
|
"tokio",
|
||||||
"url",
|
"url",
|
||||||
@@ -7227,7 +7227,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"tauri",
|
"tauri",
|
||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -7248,7 +7248,7 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"tauri-utils",
|
"tauri-utils",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
"url",
|
"url",
|
||||||
"webkit2gtk",
|
"webkit2gtk",
|
||||||
"webview2-com",
|
"webview2-com",
|
||||||
@@ -7313,7 +7313,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_with",
|
"serde_with",
|
||||||
"swift-rs",
|
"swift-rs",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
"toml 0.9.5",
|
"toml 0.9.5",
|
||||||
"url",
|
"url",
|
||||||
"urlpattern",
|
"urlpattern",
|
||||||
@@ -7339,7 +7339,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "0b1e66e07de489fe43a46678dd0b8df65e0c973909df1b60ba33874e297ba9b9"
|
checksum = "0b1e66e07de489fe43a46678dd0b8df65e0c973909df1b60ba33874e297ba9b9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quick-xml 0.37.5",
|
"quick-xml 0.37.5",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
"windows 0.61.3",
|
"windows 0.61.3",
|
||||||
"windows-version",
|
"windows-version",
|
||||||
]
|
]
|
||||||
@@ -7439,11 +7439,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "thiserror"
|
||||||
version = "2.0.14"
|
version = "2.0.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0b0949c3a6c842cbde3f1686d6eea5a010516deb7085f79db747562d4102f41e"
|
checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror-impl 2.0.14",
|
"thiserror-impl 2.0.16",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -7459,9 +7459,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror-impl"
|
name = "thiserror-impl"
|
||||||
version = "2.0.14"
|
version = "2.0.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cc5b44b4ab9c2fdd0e0512e6bece8388e214c0749f5862b114cc5b7a25daf227"
|
checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -8027,7 +8027,7 @@ dependencies = [
|
|||||||
"once_cell",
|
"once_cell",
|
||||||
"png",
|
"png",
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -8637,7 +8637,7 @@ version = "0.38.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "36695906a1b53a3bf5c4289621efedac12b73eeb0b89e7e1a89b517302d5d75c"
|
checksum = "36695906a1b53a3bf5c4289621efedac12b73eeb0b89e7e1a89b517302d5d75c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
"windows 0.61.3",
|
"windows 0.61.3",
|
||||||
"windows-core 0.61.2",
|
"windows-core 0.61.2",
|
||||||
]
|
]
|
||||||
@@ -9261,7 +9261,7 @@ dependencies = [
|
|||||||
"os_pipe",
|
"os_pipe",
|
||||||
"rustix 0.38.44",
|
"rustix 0.38.44",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
"tree_magic_mini",
|
"tree_magic_mini",
|
||||||
"wayland-backend",
|
"wayland-backend",
|
||||||
"wayland-client",
|
"wayland-client",
|
||||||
@@ -9321,7 +9321,7 @@ dependencies = [
|
|||||||
"sha2 0.10.9",
|
"sha2 0.10.9",
|
||||||
"soup3",
|
"soup3",
|
||||||
"tao-macros",
|
"tao-macros",
|
||||||
"thiserror 2.0.14",
|
"thiserror 2.0.16",
|
||||||
"tracing",
|
"tracing",
|
||||||
"url",
|
"url",
|
||||||
"webkit2gtk",
|
"webkit2gtk",
|
||||||
|
|||||||
@@ -73,10 +73,10 @@ hmac = "0.12.1"
|
|||||||
sha2 = "0.10.9"
|
sha2 = "0.10.9"
|
||||||
hex = "0.4.3"
|
hex = "0.4.3"
|
||||||
scopeguard = "1.2.0"
|
scopeguard = "1.2.0"
|
||||||
kode-bridge = "0.2.0"
|
kode-bridge = "0.2.1-rc1"
|
||||||
dashmap = "6.1.0"
|
dashmap = "6.1.0"
|
||||||
tauri-plugin-notification = "2.3.0"
|
tauri-plugin-notification = "2.3.0"
|
||||||
console-subscriber = {version = "0.4.1", optional = true}
|
console-subscriber = { version = "0.4.1", optional = true }
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
runas = "=1.2.0"
|
runas = "=1.2.0"
|
||||||
@@ -169,19 +169,19 @@ large_const_arrays = "warn"
|
|||||||
#default_numeric_fallback = "warn"
|
#default_numeric_fallback = "warn"
|
||||||
|
|
||||||
# Mutex and async lints - strict control
|
# Mutex and async lints - strict control
|
||||||
async_yields_async = "deny" # Prevents missing await in async blocks
|
async_yields_async = "deny" # Prevents missing await in async blocks
|
||||||
mutex_atomic = "deny" # Use atomics instead of Mutex<bool/int>
|
mutex_atomic = "deny" # Use atomics instead of Mutex<bool/int>
|
||||||
mutex_integer = "deny" # Use AtomicInt instead of Mutex<int>
|
mutex_integer = "deny" # Use AtomicInt instead of Mutex<int>
|
||||||
rc_mutex = "deny" # Single-threaded Rc with Mutex is wrong
|
rc_mutex = "deny" # Single-threaded Rc with Mutex is wrong
|
||||||
unused_async = "deny" # Too many false positives in Tauri/framework code
|
unused_async = "deny" # Too many false positives in Tauri/framework code
|
||||||
await_holding_lock = "deny"
|
await_holding_lock = "deny"
|
||||||
large_futures = "deny"
|
large_futures = "deny"
|
||||||
future_not_send = "deny"
|
future_not_send = "deny"
|
||||||
|
|
||||||
# Common style improvements
|
# Common style improvements
|
||||||
redundant_else = "deny" # Too many in existing code
|
redundant_else = "deny" # Too many in existing code
|
||||||
needless_continue = "deny" # Too many in existing code
|
needless_continue = "deny" # Too many in existing code
|
||||||
needless_raw_string_hashes = "deny" # Too many in existing code
|
needless_raw_string_hashes = "deny" # Too many in existing code
|
||||||
|
|
||||||
# Disable noisy categories for existing codebase but keep them available
|
# Disable noisy categories for existing codebase but keep them available
|
||||||
#style = { level = "allow", priority = -1 }
|
#style = { level = "allow", priority = -1 }
|
||||||
@@ -190,4 +190,3 @@ needless_raw_string_hashes = "deny" # Too many in existing code
|
|||||||
#pedantic = { level = "allow", priority = -1 }
|
#pedantic = { level = "allow", priority = -1 }
|
||||||
#nursery = { level = "allow", priority = -1 }
|
#nursery = { level = "allow", priority = -1 }
|
||||||
#restriction = { level = "allow", priority = -1 }
|
#restriction = { level = "allow", priority = -1 }
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,6 @@ impl IpcManager {
|
|||||||
path: &str,
|
path: &str,
|
||||||
body: Option<&serde_json::Value>,
|
body: Option<&serde_json::Value>,
|
||||||
) -> AnyResult<LegacyResponse> {
|
) -> AnyResult<LegacyResponse> {
|
||||||
// let client = IpcHttpClient::new(&self.ipc_path)?;
|
|
||||||
let client = IpcHttpClient::with_config(&self.ipc_path, self.config.clone())?;
|
let client = IpcHttpClient::with_config(&self.ipc_path, self.config.clone())?;
|
||||||
client.request(method, path, body).await
|
client.request(method, path, body).await
|
||||||
}
|
}
|
||||||
@@ -97,11 +96,10 @@ impl IpcManager {
|
|||||||
Ok(response.json()?)
|
Ok(response.json()?)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"PUT" => {
|
"PUT" | "DELETE" => {
|
||||||
if response.status == 204 {
|
if response.status == 204 {
|
||||||
Ok(serde_json::json!({"code": 204}))
|
Ok(serde_json::json!({"code": 204}))
|
||||||
} else {
|
} else {
|
||||||
// 尝试解析JSON,如果失败则返回错误信息
|
|
||||||
match response.json() {
|
match response.json() {
|
||||||
Ok(json) => Ok(json),
|
Ok(json) => Ok(json),
|
||||||
Err(_) => Ok(serde_json::json!({
|
Err(_) => Ok(serde_json::json!({
|
||||||
@@ -112,7 +110,14 @@ impl IpcManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => Ok(response.json()?),
|
_ => match response.json() {
|
||||||
|
Ok(json) => Ok(json),
|
||||||
|
Err(_) => Ok(serde_json::json!({
|
||||||
|
"code": response.status,
|
||||||
|
"message": response.body,
|
||||||
|
"error": "failed to parse response as JSON"
|
||||||
|
})),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,8 +294,8 @@ impl IpcManager {
|
|||||||
"name": proxy
|
"name": proxy
|
||||||
});
|
});
|
||||||
|
|
||||||
let response = match self.send_request("PUT", &url, Some(&payload)).await {
|
match self.send_request("PUT", &url, Some(&payload)).await {
|
||||||
Ok(resp) => resp,
|
Ok(_) => return Ok(()),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
logging!(
|
logging!(
|
||||||
error,
|
error,
|
||||||
@@ -299,31 +304,8 @@ impl IpcManager {
|
|||||||
"IPC: updateProxy encountered error: {} (ignored, always returning true)",
|
"IPC: updateProxy encountered error: {} (ignored, always returning true)",
|
||||||
e
|
e
|
||||||
);
|
);
|
||||||
// Always return a successful response as serde_json::Value
|
return Ok(());
|
||||||
serde_json::json!({"code": 204})
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
if response["code"] == 204 {
|
|
||||||
Ok(())
|
|
||||||
} else {
|
|
||||||
let error_msg = response["message"].as_str().unwrap_or_else(|| {
|
|
||||||
if let Some(error) = response.get("error") {
|
|
||||||
error.as_str().unwrap_or("unknown error")
|
|
||||||
} else {
|
|
||||||
"failed to update proxy"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
logging!(
|
|
||||||
error,
|
|
||||||
crate::utils::logging::Type::Ipc,
|
|
||||||
true,
|
|
||||||
"IPC: updateProxy failed: {}",
|
|
||||||
error_msg
|
|
||||||
);
|
|
||||||
|
|
||||||
Err(create_error(error_msg.to_string()))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -137,7 +137,10 @@ export async function getProxyDelay(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function updateProxy(group: string, proxy: string) {
|
export async function updateProxy(group: string, proxy: string) {
|
||||||
return await invoke<void>("update_proxy_choice", { group, proxy });
|
// const start = Date.now();
|
||||||
|
await invoke<void>("update_proxy_choice", { group, proxy });
|
||||||
|
// const duration = Date.now() - start;
|
||||||
|
// console.log(`[API] updateProxy 耗时: ${duration}ms`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getProxies(): Promise<{
|
export async function getProxies(): Promise<{
|
||||||
@@ -321,7 +324,7 @@ export async function getMemoryData() {
|
|||||||
usage_percent?: number;
|
usage_percent?: number;
|
||||||
last_updated?: number;
|
last_updated?: number;
|
||||||
}>("get_memory_data");
|
}>("get_memory_data");
|
||||||
console.log("[Memory][Service] get_memory_data 返回结果:", result);
|
// console.debug("[Memory][Service] get_memory_data 返回结果:", result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,10 +333,10 @@ export async function getFormattedTrafficData() {
|
|||||||
const result = await invoke<IFormattedTrafficData>(
|
const result = await invoke<IFormattedTrafficData>(
|
||||||
"get_formatted_traffic_data",
|
"get_formatted_traffic_data",
|
||||||
);
|
);
|
||||||
console.log(
|
// console.debug(
|
||||||
"[Traffic][Service] get_formatted_traffic_data 返回结果:",
|
// "[Traffic][Service] get_formatted_traffic_data 返回结果:",
|
||||||
result,
|
// result,
|
||||||
);
|
// );
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,7 +345,7 @@ export async function getFormattedMemoryData() {
|
|||||||
const result = await invoke<IFormattedMemoryData>(
|
const result = await invoke<IFormattedMemoryData>(
|
||||||
"get_formatted_memory_data",
|
"get_formatted_memory_data",
|
||||||
);
|
);
|
||||||
console.log("[Memory][Service] get_formatted_memory_data 返回结果:", result);
|
// console.debug("[Memory][Service] get_formatted_memory_data 返回结果:", result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,10 +354,10 @@ export async function getSystemMonitorOverview() {
|
|||||||
const result = await invoke<ISystemMonitorOverview>(
|
const result = await invoke<ISystemMonitorOverview>(
|
||||||
"get_system_monitor_overview",
|
"get_system_monitor_overview",
|
||||||
);
|
);
|
||||||
console.log(
|
// console.debug(
|
||||||
"[Monitor][Service] get_system_monitor_overview 返回结果:",
|
// "[Monitor][Service] get_system_monitor_overview 返回结果:",
|
||||||
result,
|
// result,
|
||||||
);
|
// );
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -555,9 +558,11 @@ export async function cmdGetProxyDelay(
|
|||||||
|
|
||||||
/// 用于profile切换等场景
|
/// 用于profile切换等场景
|
||||||
export async function forceRefreshProxies() {
|
export async function forceRefreshProxies() {
|
||||||
|
const start = Date.now();
|
||||||
console.log("[API] 强制刷新代理缓存");
|
console.log("[API] 强制刷新代理缓存");
|
||||||
const result = await invoke<any>("force_refresh_proxies");
|
const result = await invoke<any>("force_refresh_proxies");
|
||||||
console.log("[API] 代理缓存刷新完成");
|
const duration = Date.now() - start;
|
||||||
|
console.log(`[API] 代理缓存刷新完成,耗时: ${duration}ms`);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user