Compare commits

...
Author SHA1 Message Date
renovate[bot]renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>Tunglies
c6ef67718e chore(deps): update cargo dependencies (#8834)
* chore(deps): update cargo dependencies

* fix(network): switch the rustls provider to aws-lc-rs

rustls 0.23.48 deprecates `rustls::crypto::ring::default_provider()`
for lacking post-quantum support, which fails `cargo clippy-all`
(`-D warnings`) on every platform, and it offers no non-deprecated
ring provider constructor.

aws-lc-rs is already compiled in through reqwest, so the delay-test
connector and the static-webpki-roots fallback gain no new build
requirement.

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Tunglies <77394545+Tunglies@users.noreply.github.com>
2026-12-06 02:50:35 +00:00
Tunglies cc074d8967 perf: reduce work in connections, proxy views, and logs (#8770)
* perf(connections): sort by column keys without building row snapshots

* perf(proxy): defer provider candidate lookup until needed

* perf(logs): index descending virtual rows without reversing the list

* perf(connections): build list row views only when mounted

* refactor(connections): align perf replay with visible row derivation

* perf(proxy): stop periodic view refresh without consumers
2026-12-06 01:36:31 +00:00
14 changed files with 182 additions and 190 deletions
Generated
+62 -62
View File
@@ -381,7 +381,7 @@ dependencies = [
"dirs 6.0.0", "dirs 6.0.0",
"os_info", "os_info",
"smappservice-rs", "smappservice-rs",
"thiserror 2.0.20", "thiserror 2.0.21",
"windows-registry", "windows-registry",
"windows-result 0.4.1", "windows-result 0.4.1",
] ]
@@ -664,7 +664,7 @@ dependencies = [
"tap", "tap",
"temporal_rs", "temporal_rs",
"thin-vec", "thin-vec",
"thiserror 2.0.20", "thiserror 2.0.21",
"time", "time",
"timezone_provider", "timezone_provider",
"xsum", "xsum",
@@ -928,7 +928,7 @@ dependencies = [
"semver 1.0.28", "semver 1.0.28",
"serde", "serde",
"serde_json", "serde_json",
"thiserror 2.0.20", "thiserror 2.0.21",
] ]
[[package]] [[package]]
@@ -1194,7 +1194,7 @@ dependencies = [
name = "clash-verge-backup-archive" name = "clash-verge-backup-archive"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"thiserror 2.0.20", "thiserror 2.0.21",
"zip", "zip",
] ]
@@ -1217,7 +1217,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"criterion", "criterion",
"parking_lot 0.13.0", "parking_lot 0.13.0",
"thiserror 2.0.20", "thiserror 2.0.21",
"tokio", "tokio",
] ]
@@ -1244,7 +1244,7 @@ dependencies = [
"flexi_logger", "flexi_logger",
"log", "log",
"parking_lot 0.13.0", "parking_lot 0.13.0",
"thiserror 2.0.20", "thiserror 2.0.21",
"tracing-estuary", "tracing-estuary",
] ]
@@ -1271,7 +1271,7 @@ dependencies = [
"serde_json", "serde_json",
"serde_yaml_ng", "serde_yaml_ng",
"specta", "specta",
"thiserror 2.0.20", "thiserror 2.0.21",
"tristr", "tristr",
] ]
@@ -1306,7 +1306,7 @@ dependencies = [
"log", "log",
"serde_yaml_ng", "serde_yaml_ng",
"sha2 0.11.2", "sha2 0.11.2",
"thiserror 2.0.20", "thiserror 2.0.21",
"tokio", "tokio",
"tristr", "tristr",
] ]
@@ -1327,7 +1327,7 @@ dependencies = [
"http", "http",
"percent-encoding", "percent-encoding",
"serde_yaml_ng", "serde_yaml_ng",
"thiserror 2.0.20", "thiserror 2.0.21",
"url", "url",
] ]
@@ -2058,7 +2058,7 @@ dependencies = [
"log", "log",
"prost-types", "prost-types",
"ringbuf", "ringbuf",
"thiserror 2.0.20", "thiserror 2.0.21",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
"tonic", "tonic",
@@ -2556,7 +2556,7 @@ dependencies = [
"log", "log",
"nu-ansi-term", "nu-ansi-term",
"regex", "regex",
"thiserror 2.0.20", "thiserror 2.0.21",
] ]
[[package]] [[package]]
@@ -2616,9 +2616,9 @@ checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
[[package]] [[package]]
name = "form_urlencoded" name = "form_urlencoded"
version = "1.2.2" version = "1.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" checksum = "afa489199eaffb1211795df1c6236ce1ad0d41a6fa45250add73e3b02420f06e"
dependencies = [ dependencies = [
"percent-encoding", "percent-encoding",
] ]
@@ -3013,7 +3013,7 @@ dependencies = [
"objc2-app-kit", "objc2-app-kit",
"once_cell", "once_cell",
"serde", "serde",
"thiserror 2.0.20", "thiserror 2.0.21",
"windows-sys 0.59.0", "windows-sys 0.59.0",
"x11rb", "x11rb",
"xkeysym", "xkeysym",
@@ -3286,9 +3286,9 @@ dependencies = [
[[package]] [[package]]
name = "http" name = "http"
version = "1.5.0" version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" checksum = "a07dc2d082802d1782faa5b3c8ac252f3a4fc89f51e76c3f37dc2d1a5b857c05"
dependencies = [ dependencies = [
"bytes", "bytes",
"itoa", "itoa",
@@ -3883,7 +3883,7 @@ dependencies = [
"jni-sys 0.4.1", "jni-sys 0.4.1",
"log", "log",
"simd_cesu8", "simd_cesu8",
"thiserror 2.0.20", "thiserror 2.0.21",
"walkdir", "walkdir",
"windows-link 0.2.1", "windows-link 0.2.1",
] ]
@@ -3959,7 +3959,7 @@ dependencies = [
"jsonptr", "jsonptr",
"serde", "serde",
"serde_json", "serde_json",
"thiserror 2.0.20", "thiserror 2.0.21",
] ]
[[package]] [[package]]
@@ -4010,7 +4010,7 @@ dependencies = [
"rand 0.10.2", "rand 0.10.2",
"serde", "serde",
"serde_json", "serde_json",
"thiserror 2.0.20", "thiserror 2.0.21",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
"tokio-util", "tokio-util",
@@ -4399,7 +4399,7 @@ dependencies = [
"objc2-foundation", "objc2-foundation",
"png", "png",
"serde", "serde",
"thiserror 2.0.20", "thiserror 2.0.21",
"windows-sys 0.61.2", "windows-sys 0.61.2",
] ]
@@ -4476,7 +4476,7 @@ dependencies = [
"cc", "cc",
"libc", "libc",
"serde", "serde",
"thiserror 2.0.20", "thiserror 2.0.21",
"winapi", "winapi",
] ]
@@ -5058,7 +5058,7 @@ dependencies = [
"objc2-osa-kit", "objc2-osa-kit",
"serde", "serde",
"serde_json", "serde_json",
"thiserror 2.0.20", "thiserror 2.0.21",
] ]
[[package]] [[package]]
@@ -5625,7 +5625,7 @@ dependencies = [
"rustc-hash", "rustc-hash",
"rustls", "rustls",
"socket2", "socket2",
"thiserror 2.0.20", "thiserror 2.0.21",
"tokio", "tokio",
"tracing", "tracing",
"web-time", "web-time",
@@ -5648,7 +5648,7 @@ dependencies = [
"rustls", "rustls",
"rustls-pki-types", "rustls-pki-types",
"slab", "slab",
"thiserror 2.0.20", "thiserror 2.0.21",
"tinyvec", "tinyvec",
"tracing", "tracing",
"web-time", "web-time",
@@ -5846,7 +5846,7 @@ checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac"
dependencies = [ dependencies = [
"getrandom 0.2.17", "getrandom 0.2.17",
"libredox", "libredox",
"thiserror 2.0.20", "thiserror 2.0.21",
] ]
[[package]] [[package]]
@@ -6209,9 +6209,9 @@ dependencies = [
[[package]] [[package]]
name = "rustls" name = "rustls"
version = "0.23.47" version = "0.23.48"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ac0e747c10d93d873fd4c50b26ef47ad92d1bfb48f6922003bb514070f6e88c" checksum = "86c8de8f13bac4bb046743409c751e2343621c0293a805c143ede57c5c95c3f8"
dependencies = [ dependencies = [
"aws-lc-rs", "aws-lc-rs",
"log", "log",
@@ -6871,7 +6871,7 @@ dependencies = [
"objc2", "objc2",
"objc2-foundation", "objc2-foundation",
"objc2-service-management", "objc2-service-management",
"thiserror 2.0.20", "thiserror 2.0.21",
] ]
[[package]] [[package]]
@@ -7166,7 +7166,7 @@ dependencies = [
"log", "log",
"serde", "serde",
"system-configuration", "system-configuration",
"thiserror 2.0.20", "thiserror 2.0.21",
"tokio", "tokio",
"url", "url",
"which 8.0.5", "which 8.0.5",
@@ -7356,7 +7356,7 @@ dependencies = [
"tauri-runtime", "tauri-runtime",
"tauri-runtime-wry", "tauri-runtime-wry",
"tauri-utils", "tauri-utils",
"thiserror 2.0.20", "thiserror 2.0.21",
"tokio", "tokio",
"tracing", "tracing",
"tray-icon", "tray-icon",
@@ -7406,7 +7406,7 @@ dependencies = [
"sha2 0.11.2", "sha2 0.11.2",
"syn 2.0.119", "syn 2.0.119",
"tauri-utils", "tauri-utils",
"thiserror 2.0.20", "thiserror 2.0.21",
"uuid", "uuid",
"walkdir", "walkdir",
] ]
@@ -7452,7 +7452,7 @@ dependencies = [
"serde_json", "serde_json",
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"thiserror 2.0.20", "thiserror 2.0.21",
] ]
[[package]] [[package]]
@@ -7481,7 +7481,7 @@ dependencies = [
"serde_json", "serde_json",
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"thiserror 2.0.20", "thiserror 2.0.21",
] ]
[[package]] [[package]]
@@ -7498,7 +7498,7 @@ dependencies = [
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"tauri-utils", "tauri-utils",
"thiserror 2.0.20", "thiserror 2.0.21",
"tracing", "tracing",
"url", "url",
"windows-registry", "windows-registry",
@@ -7546,7 +7546,7 @@ dependencies = [
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"tauri-plugin-fs", "tauri-plugin-fs",
"thiserror 2.0.20", "thiserror 2.0.21",
"url", "url",
] ]
@@ -7569,7 +7569,7 @@ dependencies = [
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"tauri-utils", "tauri-utils",
"thiserror 2.0.20", "thiserror 2.0.21",
"toml 1.2.1+spec-1.1.0", "toml 1.2.1+spec-1.1.0",
"url", "url",
] ]
@@ -7586,7 +7586,7 @@ dependencies = [
"serde_json", "serde_json",
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"thiserror 2.0.20", "thiserror 2.0.21",
] ]
[[package]] [[package]]
@@ -7608,7 +7608,7 @@ dependencies = [
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"tauri-plugin-fs", "tauri-plugin-fs",
"thiserror 2.0.20", "thiserror 2.0.21",
"tokio", "tokio",
"url", "url",
"urlpattern", "urlpattern",
@@ -7631,7 +7631,7 @@ dependencies = [
"serde_json", "serde_json",
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"thiserror 2.0.20", "thiserror 2.0.21",
"tokio", "tokio",
"tokio-tungstenite", "tokio-tungstenite",
"ts-rs", "ts-rs",
@@ -7653,7 +7653,7 @@ dependencies = [
"serde_repr", "serde_repr",
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"thiserror 2.0.20", "thiserror 2.0.21",
"time", "time",
"url", "url",
"zbus", "zbus",
@@ -7675,7 +7675,7 @@ dependencies = [
"serde_json", "serde_json",
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"thiserror 2.0.20", "thiserror 2.0.21",
"url", "url",
"windows 0.62.2", "windows 0.62.2",
"zbus", "zbus",
@@ -7699,7 +7699,7 @@ dependencies = [
"shared_child", "shared_child",
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"thiserror 2.0.20", "thiserror 2.0.21",
"tokio", "tokio",
"windows-sys 0.60.2", "windows-sys 0.60.2",
] ]
@@ -7730,7 +7730,7 @@ dependencies = [
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"tempfile", "tempfile",
"thiserror 2.0.20", "thiserror 2.0.21",
"time", "time",
"tokio", "tokio",
"url", "url",
@@ -7761,7 +7761,7 @@ dependencies = [
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"tempfile", "tempfile",
"thiserror 2.0.20", "thiserror 2.0.21",
"tokio", "tokio",
"tracing", "tracing",
"uuid", "uuid",
@@ -7783,7 +7783,7 @@ dependencies = [
"serde_json", "serde_json",
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"thiserror 2.0.20", "thiserror 2.0.21",
] ]
[[package]] [[package]]
@@ -7804,7 +7804,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"tauri-utils", "tauri-utils",
"thiserror 2.0.20", "thiserror 2.0.21",
"url", "url",
"webkit2gtk", "webkit2gtk",
"webview2-com", "webview2-com",
@@ -7853,7 +7853,7 @@ dependencies = [
"specta-util", "specta-util",
"tauri", "tauri",
"tauri-specta-macros", "tauri-specta-macros",
"thiserror 2.0.20", "thiserror 2.0.21",
] ]
[[package]] [[package]]
@@ -7899,7 +7899,7 @@ dependencies = [
"serde_json", "serde_json",
"serde_with", "serde_with",
"swift-rs", "swift-rs",
"thiserror 2.0.20", "thiserror 2.0.21",
"toml 1.2.1+spec-1.1.0", "toml 1.2.1+spec-1.1.0",
"url", "url",
"urlpattern", "urlpattern",
@@ -7924,7 +7924,7 @@ version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ed071c670382e85fc2f48ae706492d8c338f4f89bf72520d32f8abfe880aade" checksum = "9ed071c670382e85fc2f48ae706492d8c338f4f89bf72520d32f8abfe880aade"
dependencies = [ dependencies = [
"thiserror 2.0.20", "thiserror 2.0.21",
"windows 0.61.3", "windows 0.61.3",
"windows-version", "windows-version",
] ]
@@ -8048,11 +8048,11 @@ dependencies = [
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "2.0.20" version = "2.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f" checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e"
dependencies = [ dependencies = [
"thiserror-impl 2.0.20", "thiserror-impl 2.0.21",
] ]
[[package]] [[package]]
@@ -8068,9 +8068,9 @@ dependencies = [
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "2.0.20" version = "2.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af" checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -8582,7 +8582,7 @@ dependencies = [
"objc2-foundation", "objc2-foundation",
"png", "png",
"serde", "serde",
"thiserror 2.0.20", "thiserror 2.0.21",
"windows-sys 0.61.2", "windows-sys 0.61.2",
] ]
@@ -8636,7 +8636,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "756050066659291d47a554a9f558125db17428b073c5ffce1daf5dcb0f7231d8" checksum = "756050066659291d47a554a9f558125db17428b073c5ffce1daf5dcb0f7231d8"
dependencies = [ dependencies = [
"serde_json", "serde_json",
"thiserror 2.0.20", "thiserror 2.0.21",
"ts-rs-macros", "ts-rs-macros",
] ]
@@ -8665,7 +8665,7 @@ dependencies = [
"log", "log",
"rand 0.9.5", "rand 0.9.5",
"sha1 0.10.7", "sha1 0.10.7",
"thiserror 2.0.20", "thiserror 2.0.21",
"utf-8", "utf-8",
] ]
@@ -8758,9 +8758,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]] [[package]]
name = "url" name = "url"
version = "2.5.8" version = "2.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" checksum = "f00cd2407bb42c0ef17be88d4cf020f5cceffd121665bac9b8b9493a369b3b1a"
dependencies = [ dependencies = [
"form_urlencoded", "form_urlencoded",
"idna", "idna",
@@ -9198,7 +9198,7 @@ version = "0.39.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3a07132775117d6065853d9d1178157b8c90e228de47129d6bce2c7edebedfb" checksum = "b3a07132775117d6065853d9d1178157b8c90e228de47129d6bce2c7edebedfb"
dependencies = [ dependencies = [
"thiserror 2.0.20", "thiserror 2.0.21",
"windows 0.62.2", "windows 0.62.2",
"windows-core 0.62.2", "windows-core 0.62.2",
] ]
@@ -10062,7 +10062,7 @@ dependencies = [
"log", "log",
"os_pipe", "os_pipe",
"rustix 1.1.4", "rustix 1.1.4",
"thiserror 2.0.20", "thiserror 2.0.21",
"tree_magic_mini", "tree_magic_mini",
"wayland-backend", "wayland-backend",
"wayland-client", "wayland-client",
@@ -10114,7 +10114,7 @@ dependencies = [
"sha2 0.11.2", "sha2 0.11.2",
"soup3", "soup3",
"tao-macros", "tao-macros",
"thiserror 2.0.20", "thiserror 2.0.21",
"tracing", "tracing",
"url", "url",
"webkit2gtk", "webkit2gtk",
+1 -1
View File
@@ -83,7 +83,7 @@ tauri = { version = "2.13.0" }
tauri-plugin-clipboard-manager = "2.5.0" tauri-plugin-clipboard-manager = "2.5.0"
parking_lot = "0.13.0" parking_lot = "0.13.0"
anyhow = "1.0.105" anyhow = "1.0.105"
thiserror = "2.0.20" thiserror = "2.0.21"
zip = "9.9.0" zip = "9.9.0"
boa_engine = "0.22.0" boa_engine = "0.22.0"
futures = "0.3.34" futures = "0.3.34"
+2 -2
View File
@@ -5,10 +5,10 @@ edition = "2024"
[dependencies] [dependencies]
thiserror = { workspace = true } thiserror = { workspace = true }
http = "1" http = "1.6.0"
percent-encoding = "2.3.2" percent-encoding = "2.3.2"
serde_yaml_ng = { workspace = true } serde_yaml_ng = { workspace = true }
url = "2.5" url = "2.5.9"
[lints] [lints]
workspace = true workspace = true
+4 -6
View File
@@ -6,8 +6,7 @@ import { createRoot } from 'react-dom/client'
import { SWRConfig } from 'swr' import { SWRConfig } from 'swr'
import { VirtualList } from '../../src/components/base/virtual-list' import { VirtualList } from '../../src/components/base/virtual-list'
import { ConnectionRowItem } from '../../src/components/connection/connection-row-item' import { VisibleConnectionRowItem } from '../../src/components/connection/connection-row-item'
import { useConnectionRowViews } from '../../src/components/connection/connection-row-view'
import LogItem from '../../src/components/log/log-item' import LogItem from '../../src/components/log/log-item'
import { initializeLanguage } from '../../src/services/i18n' import { initializeLanguage } from '../../src/services/i18n'
import { setPreloadConfig } from '../../src/services/preload' import { setPreloadConfig } from '../../src/services/preload'
@@ -35,10 +34,9 @@ export function Components() {
}), }),
[], [],
) )
const rows = useConnectionRowViews(connections)
return ( return (
<VirtualList <VirtualList
count={scenario === 'logs' ? logs.length : rows.length} count={scenario === 'logs' ? logs.length : connections.length}
estimateSize={scenario === 'logs' ? 50 : 56} estimateSize={scenario === 'logs' ? 50 : 56}
style={{ height: 640, margin: 24 }} style={{ height: 640, margin: 24 }}
renderItem={(index) => renderItem={(index) =>
@@ -48,8 +46,8 @@ export function Components() {
searchState={searchState} searchState={searchState}
/> />
) : ( ) : (
<ConnectionRowItem <VisibleConnectionRowItem
row={rows[index]} connection={connections[index]}
closed={false} closed={false}
onShowDetail={() => {}} onShowDetail={() => {}}
/> />
+1 -1
View File
@@ -100,7 +100,7 @@ async-trait = "0.1.92"
clash_verge_service_ipc = { workspace = true, features = ["client"] } clash_verge_service_ipc = { workspace = true, features = ["client"] }
arc-swap = "1.9.5" arc-swap = "1.9.5"
tokio-rustls = "0.26.6" tokio-rustls = "0.26.6"
rustls = { version = "0.23.47", features = ["ring"] } rustls = { version = "0.23.48", features = ["aws_lc_rs"] }
webpki-roots = "1.0.12" webpki-roots = "1.0.12"
dark-light = "3.0.0" dark-light = "3.0.0"
bytes = "1.12.2" bytes = "1.12.2"
+2 -1
View File
@@ -49,9 +49,10 @@ enum TlsRootMode {
} }
/// ALPN stays unset: raw TLS connectors offer none, while reqwest needs the h2 offer. /// ALPN stays unset: raw TLS connectors offer none, while reqwest needs the h2 offer.
/// The provider is passed explicitly: both rustls providers are compiled in, so the process default may vary.
pub(crate) fn build_webpki_rooted_tls_config() -> Result<rustls::ClientConfig> { pub(crate) fn build_webpki_rooted_tls_config() -> Result<rustls::ClientConfig> {
let root_store = rustls::RootCertStore::from_iter(webpki_roots::TLS_SERVER_ROOTS.iter().cloned()); let root_store = rustls::RootCertStore::from_iter(webpki_roots::TLS_SERVER_ROOTS.iter().cloned());
let config = rustls::ClientConfig::builder_with_provider(Arc::new(rustls::crypto::ring::default_provider())) let config = rustls::ClientConfig::builder_with_provider(Arc::new(rustls::crypto::aws_lc_rs::default_provider()))
.with_safe_default_protocol_versions()? .with_safe_default_protocol_versions()?
.with_root_certificates(root_store) .with_root_certificates(root_store)
.with_no_client_auth(); .with_no_client_auth();
@@ -1,12 +1,15 @@
import { CloseRounded } from '@mui/icons-material' import { CloseRounded } from '@mui/icons-material'
import { IconButton } from '@mui/material' import { IconButton } from '@mui/material'
import { useLockFn } from 'ahooks' import { useLockFn } from 'ahooks'
import { memo, useCallback } from 'react' import { memo, useCallback, useMemo } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { closeConnection } from 'tauri-plugin-mihomo-api' import { closeConnection } from 'tauri-plugin-mihomo-api'
import { RelativeTime } from './connection-relative-time' import { RelativeTime } from './connection-relative-time'
import type { ConnectionRowView } from './connection-row-view' import {
createConnectionRowView,
type ConnectionRowView,
} from './connection-row-view'
import type { ConnectionRuleKind } from './connection-rule' import type { ConnectionRuleKind } from './connection-rule'
interface Props { interface Props {
@@ -70,7 +73,7 @@ const actionStyle = {
transform: 'translateY(-50%)', transform: 'translateY(-50%)',
} as const } as const
export const ConnectionRowItem = memo( const ConnectionRowItem = memo(
function ConnectionRowItem({ row, closed, onShowDetail }: Props) { function ConnectionRowItem({ row, closed, onShowDetail }: Props) {
const { t } = useTranslation() const { t } = useTranslation()
const onDelete = useLockFn(async () => closeConnection(row.id)) const onDelete = useLockFn(async () => closeConnection(row.id))
@@ -129,3 +132,11 @@ export const ConnectionRowItem = memo(
prev.closed === next.closed && prev.closed === next.closed &&
prev.onShowDetail === next.onShowDetail, prev.onShowDetail === next.onShowDetail,
) )
export const VisibleConnectionRowItem = memo(function VisibleConnectionRowItem({
connection,
...props
}: Omit<Props, 'row'> & { connection: IConnectionsItem }) {
const row = useMemo(() => createConnectionRowView(connection), [connection])
return <ConnectionRowItem row={row} {...props} />
})
@@ -1,5 +1,3 @@
import { useMemo, useRef } from 'react'
const TRAFFIC_UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] const TRAFFIC_UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
export interface ConnectionRowView { export interface ConnectionRowView {
@@ -85,7 +83,7 @@ export const getConnectionTypeLabel = (connection: IConnectionsItem) => {
export const getConnectionStartTime = (connection: IConnectionsItem) => export const getConnectionStartTime = (connection: IConnectionsItem) =>
Date.parse(connection.start || '') || 0 Date.parse(connection.start || '') || 0
const createConnectionRowView = (connection: IConnectionsItem) => { export const createConnectionRowView = (connection: IConnectionsItem) => {
const uploadSpeed = connection.curUpload ?? 0 const uploadSpeed = connection.curUpload ?? 0
const downloadSpeed = connection.curDownload ?? 0 const downloadSpeed = connection.curDownload ?? 0
@@ -114,66 +112,3 @@ const createConnectionRowView = (connection: IConnectionsItem) => {
searchableProcess: connection.metadata.process || '', searchableProcess: connection.metadata.process || '',
} satisfies ConnectionRowView } satisfies ConnectionRowView
} }
const sameConnectionRowView = (
left: ConnectionRowView,
right: ConnectionRowView,
) =>
left.host === right.host &&
left.process === right.process &&
left.network === right.network &&
left.type === right.type &&
left.chains === right.chains &&
left.rule === right.rule &&
left.time === right.time &&
left.source === right.source &&
left.destination === right.destination &&
left.uploadText === right.uploadText &&
left.downloadText === right.downloadText &&
left.uploadSpeedText === right.uploadSpeedText &&
left.downloadSpeedText === right.downloadSpeedText &&
left.upload === right.upload &&
left.download === right.download &&
left.uploadSpeed === right.uploadSpeed &&
left.downloadSpeed === right.downloadSpeed &&
left.searchableHost === right.searchableHost &&
left.searchableDestinationIP === right.searchableDestinationIP &&
left.searchableProcess === right.searchableProcess
export const useConnectionRowViews = (connections: IConnectionsItem[]) => {
const previousRowsRef = useRef(new Map<string, ConnectionRowView>())
const previousConnectionsRef = useRef(new Map<string, IConnectionsItem>())
return useMemo(() => {
const previousRows = previousRowsRef.current
const previousConnections = previousConnectionsRef.current
const nextRows = new Map<string, ConnectionRowView>()
const nextConnections = new Map<string, IConnectionsItem>()
const rows: ConnectionRowView[] = []
connections.forEach((connection) => {
nextConnections.set(connection.id, connection)
const previousRow = previousRows.get(connection.id)
const previousConnection = previousConnections.get(connection.id)
let row: ConnectionRowView
if (previousRow && previousConnection === connection) {
row = previousRow
} else {
const nextRow = createConnectionRowView(connection)
row =
previousRow && sameConnectionRowView(previousRow, nextRow)
? previousRow
: nextRow
}
nextRows.set(connection.id, row)
rows.push(row)
})
previousRowsRef.current = nextRows
previousConnectionsRef.current = nextConnections
return rows
}, [connections])
}
+58 -18
View File
@@ -232,11 +232,51 @@ const getConnectionCellValue = (
} }
} }
const compareConnectionCellValue = ( type TrafficSortField = 'download' | 'upload' | 'dlSpeed' | 'ulSpeed'
field: ColumnField, type DisplaySortField = Exclude<ColumnField, TrafficSortField>
const connectionSortKey = (field: DisplaySortField, row: IConnectionsItem) => {
switch (field) {
case 'host':
return getConnectionHost(row)
case 'process':
return getConnectionProcess(row)
case 'source':
return getConnectionSource(row)
case 'remoteDestination':
return getConnectionDestination(row)
case 'chains':
return formatConnectionChains(row.chains)
case 'rule':
return getConnectionRule(row)
case 'type':
return getConnectionTypeLabel(row)
case 'time':
return getConnectionStartTime(row)
}
}
const sortByConnectionKey = (
connections: IConnectionsItem[],
field: DisplaySortField,
direction: number,
) => {
return connections
.map((row) => ({ row, key: connectionSortKey(field, row) }))
.sort((a, b) => {
const order =
typeof a.key === 'number'
? (Number(a.key) || 0) - (Number(b.key) || 0)
: String(a.key).localeCompare(String(b.key))
return order * direction
})
.map(({ row }) => row)
}
const compareConnectionTraffic = (
field: TrafficSortField,
left: IConnectionsItem, left: IConnectionsItem,
right: IConnectionsItem, right: IConnectionsItem,
getSnapshot: (row: IConnectionsItem) => TableRowSnapshot,
) => { ) => {
switch (field) { switch (field) {
case 'download': case 'download':
@@ -248,14 +288,6 @@ const compareConnectionCellValue = (
case 'ulSpeed': case 'ulSpeed':
return (left.curUpload ?? 0) - (right.curUpload ?? 0) return (left.curUpload ?? 0) - (right.curUpload ?? 0)
} }
const leftValue = getConnectionCellValue(field, getSnapshot(left))
const rightValue = getConnectionCellValue(field, getSnapshot(right))
if (typeof leftValue === 'number' || typeof rightValue === 'number') {
return (Number(leftValue) || 0) - (Number(rightValue) || 0)
}
return String(leftValue ?? '').localeCompare(String(rightValue ?? ''))
} }
const renderCell = ( const renderCell = (
@@ -589,13 +621,21 @@ export const ConnectionTable = (props: Props) => {
const sortedConnections = useMemo(() => { const sortedConnections = useMemo(() => {
if (!sorting) return connections if (!sorting) return connections
const direction = sorting.desc ? -1 : 1 const { id, desc } = sorting
return [...connections].sort( const direction = desc ? -1 : 1
(left, right) => if (
compareConnectionCellValue(sorting.id, left, right, getRowSnapshot) * id === 'download' ||
direction, id === 'upload' ||
) id === 'dlSpeed' ||
}, [connections, sorting, getRowSnapshot]) id === 'ulSpeed'
) {
return [...connections].sort(
(left, right) => compareConnectionTraffic(id, left, right) * direction,
)
}
return sortByConnectionKey(connections, id, direction)
}, [connections, sorting])
const tableWidth = useMemo( const tableWidth = useMemo(
() => visibleColumns.reduce((total, column) => total + column.size, 0), () => visibleColumns.reduce((total, column) => total + column.size, 0),
@@ -118,7 +118,7 @@ export const TunnelsViewer = forwardRef<TunnelsViewerRef>((_, ref) => {
}) })
}, [draftTunnels]) }, [draftTunnels])
const { proxyView } = useProxiesData() const { proxyView } = useProxiesData(open)
const proxyGroups = useMemo(() => proxyView?.groups ?? [], [proxyView]) const proxyGroups = useMemo(() => proxyView?.groups ?? [], [proxyView])
+5 -12
View File
@@ -30,11 +30,8 @@ import {
ConnectionDetail, ConnectionDetail,
ConnectionDetailRef, ConnectionDetailRef,
} from '@/components/connection/connection-detail' } from '@/components/connection/connection-detail'
import { ConnectionRowItem } from '@/components/connection/connection-row-item' import { VisibleConnectionRowItem } from '@/components/connection/connection-row-item'
import { import { getConnectionStartTime } from '@/components/connection/connection-row-view'
getConnectionStartTime,
useConnectionRowViews,
} from '@/components/connection/connection-row-view'
import type { ConnectionRuleKind } from '@/components/connection/connection-rule' import type { ConnectionRuleKind } from '@/components/connection/connection-rule'
import { ConnectionTable } from '@/components/connection/connection-table' import { ConnectionTable } from '@/components/connection/connection-table'
import { useConnectionData } from '@/hooks/use-connection-data' import { useConnectionData } from '@/hooks/use-connection-data'
@@ -145,10 +142,6 @@ const ConnectionsPage = () => {
curOrderOpt, curOrderOpt,
]) ])
const displayRows = useConnectionRowViews(
isTableLayout ? EMPTY_CONNECTIONS : filterConn,
)
const detailRef = useRef<ConnectionDetailRef>(null!) const detailRef = useRef<ConnectionDetailRef>(null!)
const selectConnectionsType = useCallback( const selectConnectionsType = useCallback(
@@ -339,11 +332,11 @@ const ConnectionsPage = () => {
) : ( ) : (
<VirtualList <VirtualList
key={connectionsType} key={connectionsType}
count={displayRows.length} count={filterConn.length}
estimateSize={56} estimateSize={56}
renderItem={(i) => ( renderItem={(i) => (
<ConnectionRowItem <VisibleConnectionRowItem
row={displayRows[i]} connection={filterConn[i]}
closed={connectionsType === 'closed'} closed={connectionsType === 'closed'}
onShowDetail={showDetailById} onShowDetail={showDetailById}
/> />
+8 -10
View File
@@ -52,21 +52,16 @@ const LogPage = () => {
}) })
}, [logData, logState, match, searchState.text]) }, [logData, logState, match, searchState.text])
const filteredLogs = useMemo(
() => (isDescending ? [...filterLogs].reverse() : filterLogs),
[filterLogs, isDescending],
)
const scrollRef = useRef({ isNearBottom: true }) const scrollRef = useRef({ isNearBottom: true })
const virtuosoRef = useRef<VirtualListHandle>(null) const virtuosoRef = useRef<VirtualListHandle>(null)
useEffect(() => { useEffect(() => {
if (!isDescending && scrollRef.current.isNearBottom) { if (!isDescending && scrollRef.current.isNearBottom) {
virtuosoRef.current?.scrollToIndex(filteredLogs.length - 1, { virtuosoRef.current?.scrollToIndex(filterLogs.length - 1, {
behavior: 'smooth', behavior: 'smooth',
}) })
} }
}, [isDescending, filteredLogs.length]) }, [isDescending, filterLogs.length])
const handleLogLevelChange = (newLevel: LogFilter) => { const handleLogLevelChange = (newLevel: LogFilter) => {
setClashLog((pre) => ({ ...pre!, logFilter: newLevel })) setClashLog((pre) => ({ ...pre!, logFilter: newLevel }))
@@ -176,13 +171,16 @@ const LogPage = () => {
/> />
</Box> </Box>
{filteredLogs.length > 0 ? ( {filterLogs.length > 0 ? (
<VirtualList <VirtualList
ref={virtuosoRef} ref={virtuosoRef}
count={filteredLogs.length} count={filterLogs.length}
estimateSize={50} estimateSize={50}
renderItem={(i) => ( renderItem={(i) => (
<LogItem value={filteredLogs[i]} searchState={searchState} /> <LogItem
value={filterLogs[isDescending ? filterLogs.length - 1 - i : i]}
searchState={searchState}
/>
)} )}
onScroll={(event) => { onScroll={(event) => {
const element = event.currentTarget as HTMLDivElement const element = event.currentTarget as HTMLDivElement
+14 -4
View File
@@ -1,4 +1,4 @@
import { Context, createContext, use } from 'react' import { Context, createContext, use, useEffect } from 'react'
import { BaseConfig, Rule, RuleProvider } from 'tauri-plugin-mihomo-api' import { BaseConfig, Rule, RuleProvider } from 'tauri-plugin-mihomo-api'
import type { ProxyViewV1 } from '@/types/proxy-view' import type { ProxyViewV1 } from '@/types/proxy-view'
@@ -39,7 +39,9 @@ export interface RefreshersContextType {
refreshAll: () => Promise<unknown> refreshAll: () => Promise<unknown>
} }
export const ProxiesContext = createContext<ProxiesContextType | null>(null) export const ProxiesContext = createContext<
(ProxiesContextType & { registerConsumer: () => () => void }) | null
>(null)
export const RulesContext = createContext<RulesContextType | null>(null) export const RulesContext = createContext<RulesContextType | null>(null)
export const ClashConfigContext = createContext<ClashConfigContextType | null>( export const ClashConfigContext = createContext<ClashConfigContextType | null>(
null, null,
@@ -57,8 +59,16 @@ const useCtx = <T>(ctx: Context<T | null>, hookName: string): T => {
return v return v
} }
export const useProxiesData = (): ProxiesContextType => export const useProxiesData = (active = true): ProxiesContextType => {
useCtx(ProxiesContext, 'useProxiesData') const data = useCtx(ProxiesContext, 'useProxiesData')
const { registerConsumer } = data
useEffect(() => {
if (active) return registerConsumer()
}, [active, registerConsumer])
return data
}
export const useRulesData = () => { export const useRulesData = () => {
const { rules, ruleProviders } = useCtx(RulesContext, 'useRulesData') const { rules, ruleProviders } = useCtx(RulesContext, 'useRulesData')
+9 -3
View File
@@ -1,4 +1,4 @@
import React, { useCallback, useMemo, useRef } from 'react' import React, { useCallback, useMemo, useRef, useState } from 'react'
import { import {
getBaseConfig, getBaseConfig,
getRuleProviders, getRuleProviders,
@@ -53,6 +53,11 @@ export const AppDataProvider = ({
const { verge } = useVerge() const { verge } = useVerge()
const { data: runtimeConfig } = useRuntimeConfig() const { data: runtimeConfig } = useRuntimeConfig()
const { clashInfo } = useClashInfo() const { clashInfo } = useClashInfo()
const [proxyViewConsumers, setProxyViewConsumers] = useState(0)
const registerProxyViewConsumer = useCallback(() => {
setProxyViewConsumers((count) => count + 1)
return () => setProxyViewConsumers((count) => count - 1)
}, [])
const { const {
data: proxyView, data: proxyView,
@@ -62,7 +67,7 @@ export const AppDataProvider = ({
} = useQuery({ } = useQuery({
queryKey: ['getProxyView'], queryKey: ['getProxyView'],
queryFn: getProxyView, queryFn: getProxyView,
refetchInterval: 15000, refetchInterval: proxyViewConsumers > 0 ? 15000 : false,
refetchIntervalInBackground: false, refetchIntervalInBackground: false,
...TQ_MIHOMO, ...TQ_MIHOMO,
}) })
@@ -128,8 +133,9 @@ export const AppDataProvider = ({
proxyView, proxyView,
isProxyViewPending, isProxyViewPending,
isProxyViewError: Boolean(proxyViewError), isProxyViewError: Boolean(proxyViewError),
registerConsumer: registerProxyViewConsumer,
}), }),
[proxyView, isProxyViewPending, proxyViewError], [proxyView, isProxyViewPending, proxyViewError, registerProxyViewConsumer],
) )
const rulesValue = useMemo( const rulesValue = useMemo(