chore: bump dependencies

Bump tauri-plugin-mihomo to 0.5.0 and update frontend dependency locks.

Adapt the traffic websocket stream parser to the new raw text byte callback API.
This commit is contained in:
Tunglies
2026-05-26 13:30:37 +08:00
parent 435d611114
commit c7cdc62512
4 changed files with 808 additions and 872 deletions
Generated
+5 -5
View File
@@ -1292,7 +1292,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"
dependencies = [
"lazy_static",
"windows-sys 0.59.0",
"windows-sys 0.48.0",
]
[[package]]
@@ -4971,7 +4971,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967"
dependencies = [
"libc",
"windows-sys 0.61.2",
"windows-sys 0.48.0",
]
[[package]]
@@ -7751,8 +7751,8 @@ dependencies = [
[[package]]
name = "tauri-plugin-mihomo"
version = "0.3.0"
source = "git+https://github.com/clash-verge-rev/tauri-plugin-mihomo#e8f46f631f40259bcbe252f14dd49efd1afdc2f0"
version = "0.5.0"
source = "git+https://github.com/clash-verge-rev/tauri-plugin-mihomo#a075343271cb1edfe65a4c9676e430ace24e3c58"
dependencies = [
"base64 0.22.1",
"bytes",
@@ -9482,7 +9482,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
"windows-sys 0.61.2",
"windows-sys 0.48.0",
]
[[package]]
+36 -36
View File
@@ -41,60 +41,60 @@
"@emotion/styled": "^11.14.1",
"@juggle/resize-observer": "^3.4.0",
"@monaco-editor/react": "^4.7.0",
"@mui/icons-material": "^9.0.0",
"@mui/material": "^9.0.0",
"@tanstack/react-query": "^5.96.1",
"@mui/icons-material": "^9.0.1",
"@mui/material": "^9.0.1",
"@tanstack/react-query": "^5.100.14",
"@tanstack/react-table": "^8.21.3",
"@tanstack/react-virtual": "^3.13.23",
"@tanstack/react-virtual": "^3.13.25",
"@tauri-apps/api": "2.11.0",
"@tauri-apps/plugin-clipboard-manager": "^2.3.2",
"@tauri-apps/plugin-dialog": "^2.6.0",
"@tauri-apps/plugin-fs": "^2.4.5",
"@tauri-apps/plugin-http": "~2.5.7",
"@tauri-apps/plugin-dialog": "^2.7.1",
"@tauri-apps/plugin-fs": "^2.5.1",
"@tauri-apps/plugin-http": "~2.5.9",
"@tauri-apps/plugin-process": "^2.3.1",
"@tauri-apps/plugin-shell": "2.3.5",
"@tauri-apps/plugin-updater": "2.10.1",
"ahooks": "^3.9.6",
"ahooks": "^3.9.7",
"cidr-block": "^2.3.0",
"dayjs": "1.11.20",
"foxact": "^0.3.0",
"foxts": "^5.3.0",
"foxact": "^0.3.4",
"foxts": "^5.4.2",
"i18next": "^26.2.0",
"js-yaml": "^4.1.1",
"lodash-es": "^4.17.23",
"meta-json-schema": "^1.19.21",
"lodash-es": "^4.18.1",
"meta-json-schema": "^1.19.25",
"monaco-editor": "^0.55.1",
"monaco-yaml": "^5.4.1",
"nanoid": "^5.1.7",
"monaco-yaml": "^5.5.0",
"nanoid": "^5.1.11",
"qrcode.react": "^4.2.0",
"react": "19.2.6",
"react-dom": "19.2.6",
"react-error-boundary": "6.1.1",
"react-hook-form": "^7.72.0",
"react-hook-form": "^7.76.1",
"react-i18next": "17.0.8",
"react-markdown": "10.1.0",
"react-router": "^7.13.1",
"react-router": "^7.15.1",
"rehype-raw": "^7.0.0",
"tauri-plugin-mihomo-api": "github:clash-verge-rev/tauri-plugin-mihomo",
"types-pac": "^1.0.3",
"validator": "^13.15.26"
"validator": "^13.15.35"
},
"devDependencies": {
"@actions/github": "^9.0.0",
"@biomejs/biome": "^2.4.10",
"@eslint-react/eslint-plugin": "^5.0.0",
"@actions/github": "^9.1.1",
"@biomejs/biome": "^2.4.15",
"@eslint-react/eslint-plugin": "^5.8.5",
"@eslint/js": "^10.0.1",
"@tauri-apps/cli": "2.11.2",
"@types/js-yaml": "^4.0.9",
"@types/lodash-es": "^4.17.12",
"@types/node": "^24.12.0",
"@types/node": "^24.12.4",
"@types/react": "19.2.15",
"@types/react-dom": "19.2.3",
"@types/validator": "^13.15.10",
"@vitejs/plugin-legacy": "^8.0.0",
"@vitejs/plugin-react": "^6.0.1",
"adm-zip": "^0.5.16",
"axios": "^1.13.6",
"@vitejs/plugin-legacy": "^8.0.2",
"@vitejs/plugin-react": "^6.0.2",
"adm-zip": "^0.5.17",
"axios": "^1.16.1",
"cli-color": "^2.0.4",
"commander": "^14.0.3",
"cross-env": "^10.1.0",
@@ -102,24 +102,24 @@
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-import-x": "^4.16.2",
"eslint-plugin-react-compiler": "19.1.0-rc.2",
"eslint-plugin-react-hooks": "^7.0.1",
"eslint-plugin-react-hooks": "^7.1.1",
"eslint-plugin-react-refresh": "^0.5.2",
"eslint-plugin-sukka": "^9.5.0",
"eslint-plugin-unused-imports": "^4.4.1",
"glob": "^13.0.6",
"globals": "^17.4.0",
"globals": "^17.6.0",
"https-proxy-agent": "^9.0.0",
"husky": "^9.1.7",
"jiti": "^2.6.1",
"lint-staged": "^17.0.0",
"jiti": "^2.7.0",
"lint-staged": "^17.0.5",
"node-fetch": "^3.3.2",
"sass": "^1.98.0",
"tar": "^7.5.12",
"terser": "^5.46.1",
"typescript": "^6.0.0",
"typescript-eslint": "^8.57.1",
"vite": "^8.0.1",
"vite-plugin-svgr": "^5.0.0"
"sass": "^1.100.0",
"tar": "^7.5.15",
"terser": "^5.48.0",
"typescript": "^6.0.3",
"typescript-eslint": "^8.59.4",
"vite": "^8.0.14",
"vite-plugin-svgr": "^5.2.0"
},
"lint-staged": {
"*.{ts,tsx,js,mjs}": [
+758 -803
View File
File diff suppressed because it is too large Load Diff
+9 -28
View File
@@ -1,9 +1,8 @@
use crate::{Type, core::handle, logging};
use anyhow::Result;
use serde::Deserialize;
use serde_json::Value;
use std::time::Duration;
use tauri_plugin_mihomo::models::{ConnectionId, WebSocketMessage};
use tauri_plugin_mihomo::models::ConnectionId;
use tokio::sync::mpsc;
use tokio::time::Instant;
@@ -33,7 +32,6 @@ pub enum StreamConsumeState<T> {
enum InternalWsEvent<T> {
Data(T),
Closed,
}
/// Mihomo WebSocket 订阅句柄(通用事件流)。
@@ -52,29 +50,12 @@ struct TrafficPayload {
down: u64,
}
fn parse_traffic_event(data: Value) -> Option<InternalWsEvent<TrafficSpeedEvent>> {
if let Ok(payload) = serde_json::from_value::<TrafficPayload>(data.clone()) {
return Some(InternalWsEvent::Data(TrafficSpeedEvent {
up: payload.up,
down: payload.down,
}));
}
if let Ok(ws_message) = WebSocketMessage::deserialize(&data) {
match ws_message {
WebSocketMessage::Text(text) => {
let payload = serde_json::from_str::<TrafficPayload>(&text).ok()?;
Some(InternalWsEvent::Data(TrafficSpeedEvent {
up: payload.up,
down: payload.down,
}))
}
WebSocketMessage::Close(_) => Some(InternalWsEvent::Closed),
_ => None,
}
} else {
None
}
fn parse_traffic_event(data: &[u8]) -> Option<InternalWsEvent<TrafficSpeedEvent>> {
let payload = serde_json::from_slice::<TrafficPayload>(data).ok()?;
Some(InternalWsEvent::Data(TrafficSpeedEvent {
up: payload.up,
down: payload.down,
}))
}
fn try_send_internal_event<T>(message_tx: &mpsc::Sender<InternalWsEvent<T>>, event: InternalWsEvent<T>) {
@@ -98,7 +79,7 @@ pub async fn connect_traffic_stream() -> Result<MihomoWsEventStream<TrafficSpeed
.ws_traffic({
let message_tx = message_tx.clone();
move |message| {
if let Some(event) = parse_traffic_event(message) {
if let Some(event) = parse_traffic_event(&message) {
try_send_internal_event(&message_tx, event);
}
}
@@ -144,7 +125,7 @@ impl<T> MihomoWsEventStream<T> {
sleep.as_mut().reset(self.last_valid_event_at + stale_timeout);
return StreamConsumeState::Event(event);
}
Some(InternalWsEvent::Closed) | None => return StreamConsumeState::Closed,
None => return StreamConsumeState::Closed,
}
}
_ = &mut sleep => {