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