diff --git a/package.json b/package.json index b75dca1..1f1b5a6 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "private": true, "author": "leizi97", "description": "A simple network initiator based on Easytier", - "version": "1.4.4", + "version": "1.4.5", "scripts": { "dev": "nuxt dev --dotenv env/.env.dev --host 0.0.0.0", "build": "nuxt generate --dotenv env/.env.prod", diff --git a/pages/member.vue b/pages/member.vue index 77ae7bf..1dae5d6 100644 --- a/pages/member.vue +++ b/pages/member.vue @@ -54,9 +54,11 @@ prop="lat_ms" width="100" label="延迟/ms" + :sort-method="sortLatMs" + :sort-orders="['ascending', 'descending', null]" > { + const getLatencyValue = (row: any): number => { + const latMs = row.lat_ms; + + if (latMs === null || latMs === undefined || latMs === "") { + return Infinity; + } + + const num = Number(latMs); + if (isNaN(num) || num < 0) { + return Infinity; + } + + return Math.floor(num); + }; + + const valueA = getLatencyValue(a); + const valueB = getLatencyValue(b); + + if (valueA === Infinity && valueB === Infinity) { + return 0; + } + + return valueA - valueB; + }; + + // 格式化延迟显示 + const formatLatency = (latMs: any): string => { + if (latMs === null || latMs === undefined || latMs === "") { + return "-"; + } + + const num = Number(latMs); + if (isNaN(num)) { + return "-"; + } + + if (num < 0) { + return "-"; + } + + return num.toFixed(0); + }; + const _showTableHeader = [ ["hostname", "主机名"], ["cost", "路由"], diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index a2c78a3..e315ef6 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -1253,11 +1253,10 @@ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" [[package]] name = "easytier-game" -version = "1.4.4" +version = "1.4.5" dependencies = [ "hashbrown 0.15.2", "log", - "planif", "rand 0.9.0", "reqwest", "serde", @@ -3496,14 +3495,6 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" -[[package]] -name = "planif" -version = "1.0.0" -source = "git+https://github.com/mattrobineau/planif?tag=1.0.1#90e228e2bc0f142b16a0ba415ec242e1c836cc35" -dependencies = [ - "windows 0.48.0", -] - [[package]] name = "plist" version = "1.7.0" @@ -5999,15 +5990,6 @@ dependencies = [ "windows-version", ] -[[package]] -name = "windows" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" -dependencies = [ - "windows-targets 0.48.5", -] - [[package]] name = "windows" version = "0.57.0" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index e309a8b..24120eb 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "easytier-game" -version = "1.4.4" +version = "1.4.5" homepage = "https://github.com/EasyTier/EasyTier" repository = "https://github.com/EasyTier/EasytierGame" description = "A simple network initiator based on Easytier" @@ -39,7 +39,7 @@ tauri-plugin-shell = "2.2.1" reqwest = { version = "0.12.12", features = ["json"] } zip = "2.2.3" sysinfo = '0.33.1' -planif = { git = "https://github.com/mattrobineau/planif", tag = "1.0.1" } +# planif = { git = "https://github.com/mattrobineau/planif", tag = "1.0.1" } whoami = "1.5.2" tauri-plugin-fs = "2.3.0" tauri-plugin-clipboard-manager = "2.2.2" diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 01f9516..2a0e2b5 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -13,7 +13,7 @@ use sysinfo::System; use tauri::tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent}; use tauri::Emitter; use tauri::Manager; -use windows::core::{BSTR, VARIANT}; +use windows::core::{Interface, BSTR, VARIANT}; use windows::Win32::Foundation::VARIANT_BOOL; use windows::Win32::NetworkManagement::IpHelper::{ GetAdaptersAddresses, GAA_FLAG_INCLUDE_PREFIX, IP_ADAPTER_ADDRESSES_LH, @@ -738,29 +738,62 @@ fn autostart(enabled: bool) -> std::result::Result<(), Box