mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-11 13:02:22 +08:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1336b8a9e0 | ||
|
|
304a65fc36 |
Generated
+7
-6
@@ -7520,14 +7520,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-http"
|
||||
version = "2.8.3"
|
||||
version = "2.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2c57e3451553f95a1db3bfed6a358a77ce5080b6399a242c6eadac113f97abd2"
|
||||
checksum = "c278945f30912c8c32728265c66d16ca1b139509c4874d00579f5c8c5276605a"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"cookie_store",
|
||||
"data-url",
|
||||
"http",
|
||||
"percent-encoding",
|
||||
"regex",
|
||||
"reqwest 0.12.28",
|
||||
"schemars 0.8.22",
|
||||
@@ -7569,9 +7570,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-notification"
|
||||
version = "2.8.0"
|
||||
version = "2.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5bc6c194a95a535abdfbe3bc1af9a43935b8b9b29c216b8e71af8b59132703cf"
|
||||
checksum = "14a226bfb8189ec4ab2c1936e66330ad06c44d9f6c54a674338208491dee177f"
|
||||
dependencies = [
|
||||
"log",
|
||||
"notify-rust",
|
||||
@@ -7589,9 +7590,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-opener"
|
||||
version = "2.7.2"
|
||||
version = "2.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53810be1b4fed22bb6ac3f4cab5a2b80d9391d1af436bda145607532bc0bb219"
|
||||
checksum = "54592c6718b42ab198bf11bda6a428a3553ca2f2f8e506df56f6a063ec328331"
|
||||
dependencies = [
|
||||
"dunce",
|
||||
"glob",
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
|
||||
- 优化连接、规则和日志筛选:切换页面后保留过滤条件
|
||||
- 优化全局模式代理列表:仅显示 `GLOBAL` 节点,选中其中的策略组时才显示该组
|
||||
- 优化连接和规则页面的资源占用,减少连接列表更新及排序时的卡顿
|
||||
|
||||
**🍎 macOS**
|
||||
|
||||
|
||||
+2
-2
@@ -67,7 +67,7 @@
|
||||
"dayjs": "1.11.23",
|
||||
"foxact": "^0.3.12",
|
||||
"foxts": "^5.9.1",
|
||||
"i18next": "^26.4.2",
|
||||
"i18next": "^27.0.0",
|
||||
"js-yaml": "^5.4.2",
|
||||
"lodash-es": "^4.18.1",
|
||||
"meta-json-schema": "^1.19.31",
|
||||
@@ -79,7 +79,7 @@
|
||||
"react-dom": "19.3.1",
|
||||
"react-error-boundary": "6.1.6",
|
||||
"react-hook-form": "^7.88.0",
|
||||
"react-i18next": "17.1.13",
|
||||
"react-i18next": "18.0.1",
|
||||
"react-markdown": "10.1.0",
|
||||
"react-router": "^8.4.0",
|
||||
"rehype-raw": "^7.0.0",
|
||||
|
||||
Generated
+18
-21
@@ -239,8 +239,8 @@ importers:
|
||||
specifier: ^5.9.1
|
||||
version: 5.9.1
|
||||
i18next:
|
||||
specifier: ^26.4.2
|
||||
version: 26.4.2(typescript@6.0.3)
|
||||
specifier: ^27.0.0
|
||||
version: 27.0.1(typescript@6.0.3)
|
||||
js-yaml:
|
||||
specifier: ^5.4.2
|
||||
version: 5.4.2
|
||||
@@ -275,8 +275,8 @@ importers:
|
||||
specifier: ^7.88.0
|
||||
version: 7.88.0(react@19.3.1)
|
||||
react-i18next:
|
||||
specifier: 17.1.13
|
||||
version: 17.1.13(i18next@26.4.2(typescript@6.0.3))(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(typescript@6.0.3)
|
||||
specifier: 18.0.1
|
||||
version: 18.0.1(@types/react@19.3.0)(i18next@27.0.1(typescript@6.0.3))(react@19.3.1)(typescript@6.0.3)
|
||||
react-markdown:
|
||||
specifier: 10.1.0
|
||||
version: 10.1.0(@types/react@19.3.0)(react@19.3.1)(supports-color@7.2.0)
|
||||
@@ -3689,8 +3689,9 @@ packages:
|
||||
engines: {node: '>=18'}
|
||||
hasBin: true
|
||||
|
||||
i18next@26.4.2:
|
||||
resolution: {integrity: sha512-RX+R0VLg13IbvRuJSxnqykUFS9vQZTl8wYpWPCIUDWVrSGjsQywB5Y+pjzrkboxGAuYfJZVH1InFTdgBdxq6ug==}
|
||||
i18next@27.0.1:
|
||||
resolution: {integrity: sha512-KaE5ozP8UUeVpOJIwMVbbnpRKpyYQuxd9ZbseJoDzezE3nvLnZZQn20pkzyIJwPI2Uet/Qs3WzPTG812f6F/Eg==}
|
||||
engines: {node: '>=22'}
|
||||
peerDependencies:
|
||||
typescript: ^5 || ^6 || ^7
|
||||
peerDependenciesMeta:
|
||||
@@ -4396,18 +4397,16 @@ packages:
|
||||
peerDependencies:
|
||||
react: ^16.8.0 || ^17 || ^18 || ^19
|
||||
|
||||
react-i18next@17.1.13:
|
||||
resolution: {integrity: sha512-ZxhOSlyKSKPtbUNPLwYMmE3w3bhoc0jaZJZ6bc7wGOT6cLbrbs//6m01HxCLtFdSjHvFpwFwoPhxxzIlHSs9cw==}
|
||||
react-i18next@18.0.1:
|
||||
resolution: {integrity: sha512-kPWXI0E/lrPj3+/umcKNzYZVnWmEedLiamMzDIHfbs+5ANf6yzvlZsjKou8f7kaGkfMMDLIZBejV+4aSN1CyBw==}
|
||||
engines: {node: '>=22'}
|
||||
peerDependencies:
|
||||
i18next: '>= 26.2.0'
|
||||
react: '>= 16.8.0'
|
||||
react-dom: '*'
|
||||
react-native: '*'
|
||||
'@types/react': '*'
|
||||
i18next: '>= 27.0.1'
|
||||
react: '>= 18.0.0'
|
||||
typescript: ^5 || ^6 || ^7
|
||||
peerDependenciesMeta:
|
||||
react-dom:
|
||||
optional: true
|
||||
react-native:
|
||||
'@types/react':
|
||||
optional: true
|
||||
typescript:
|
||||
optional: true
|
||||
@@ -8533,7 +8532,7 @@ snapshots:
|
||||
|
||||
husky@9.1.7: {}
|
||||
|
||||
i18next@26.4.2(typescript@6.0.3):
|
||||
i18next@27.0.1(typescript@6.0.3):
|
||||
optionalDependencies:
|
||||
typescript: 6.0.3
|
||||
|
||||
@@ -9357,15 +9356,13 @@ snapshots:
|
||||
dependencies:
|
||||
react: 19.3.1
|
||||
|
||||
react-i18next@17.1.13(i18next@26.4.2(typescript@6.0.3))(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(typescript@6.0.3):
|
||||
react-i18next@18.0.1(@types/react@19.3.0)(i18next@27.0.1(typescript@6.0.3))(react@19.3.1)(typescript@6.0.3):
|
||||
dependencies:
|
||||
'@babel/runtime': 7.29.7
|
||||
html-parse-stringify: 4.0.1
|
||||
i18next: 26.4.2(typescript@6.0.3)
|
||||
i18next: 27.0.1(typescript@6.0.3)
|
||||
react: 19.3.1
|
||||
use-sync-external-store: 1.7.0(react@19.3.1)
|
||||
optionalDependencies:
|
||||
react-dom: 19.3.1(react@19.3.1)
|
||||
'@types/react': 19.3.0
|
||||
typescript: 6.0.3
|
||||
|
||||
react-is@16.13.1: {}
|
||||
|
||||
@@ -72,7 +72,7 @@ sysproxy = { git = "https://github.com/clash-verge-rev/sysproxy-rs.git", branch
|
||||
] }
|
||||
network-interface = { version = "2.0.5", features = ["serde"] }
|
||||
tauri-plugin-shell = "2.6.0"
|
||||
tauri-plugin-opener = "2.7.2"
|
||||
tauri-plugin-opener = "2.7.3"
|
||||
tauri-plugin-dialog = "2.8.4"
|
||||
tauri-plugin-fs = "2.7.1"
|
||||
tauri-plugin-deep-link = "2.6.3"
|
||||
@@ -87,9 +87,9 @@ getrandom = "0.4.3"
|
||||
futures = "0.3.34"
|
||||
gethostname = "1.1.0"
|
||||
scopeguard = "1.2.0"
|
||||
tauri-plugin-notification = "2.8.0"
|
||||
tauri-plugin-notification = "2.8.1"
|
||||
backon = { version = "1.6.0", features = ["tokio-sleep"] }
|
||||
tauri-plugin-http = "2.8.3"
|
||||
tauri-plugin-http = "2.9.0"
|
||||
tracing = { workspace = true }
|
||||
tauri-plugin-devtools = { version = "2.2.3", optional = true }
|
||||
tauri-plugin-mihomo = { git = "https://github.com/clash-verge-rev/tauri-plugin-mihomo", rev = "7a03d16f4d39b1bb885b7babe66b9e153e34b615" }
|
||||
|
||||
@@ -8,7 +8,7 @@ let timerId: number | null = null
|
||||
const listeners = new Set<RelativeTimeListener>()
|
||||
|
||||
const startTimer = () => {
|
||||
if (timerId !== null || document.hidden || listeners.size === 0) return
|
||||
if (timerId !== null) return
|
||||
|
||||
currentTime = Date.now()
|
||||
timerId = window.setInterval(() => {
|
||||
@@ -18,34 +18,19 @@ const startTimer = () => {
|
||||
}
|
||||
|
||||
const stopTimer = () => {
|
||||
if (timerId === null) return
|
||||
if (listeners.size > 0 || timerId === null) return
|
||||
|
||||
window.clearInterval(timerId)
|
||||
timerId = null
|
||||
}
|
||||
|
||||
const handleVisibilityChange = () => {
|
||||
if (document.hidden) {
|
||||
stopTimer()
|
||||
} else {
|
||||
startTimer()
|
||||
listeners.forEach((listener) => listener())
|
||||
}
|
||||
}
|
||||
|
||||
const subscribeRelativeTime = (listener: RelativeTimeListener) => {
|
||||
listeners.add(listener)
|
||||
if (listeners.size === 1) {
|
||||
document.addEventListener('visibilitychange', handleVisibilityChange)
|
||||
}
|
||||
startTimer()
|
||||
|
||||
return () => {
|
||||
listeners.delete(listener)
|
||||
if (listeners.size === 0) {
|
||||
stopTimer()
|
||||
document.removeEventListener('visibilitychange', handleVisibilityChange)
|
||||
}
|
||||
stopTimer()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -223,16 +223,6 @@ const compareConnectionCellValue = (
|
||||
right: IConnectionsItem,
|
||||
getSnapshot: (row: IConnectionsItem) => TableRowSnapshot,
|
||||
) => {
|
||||
switch (field) {
|
||||
case 'download':
|
||||
return (left.download ?? 0) - (right.download ?? 0)
|
||||
case 'upload':
|
||||
return (left.upload ?? 0) - (right.upload ?? 0)
|
||||
case 'dlSpeed':
|
||||
return (left.curDownload ?? 0) - (right.curDownload ?? 0)
|
||||
case 'ulSpeed':
|
||||
return (left.curUpload ?? 0) - (right.curUpload ?? 0)
|
||||
}
|
||||
const leftValue = getConnectionCellValue(field, getSnapshot(left))
|
||||
const rightValue = getConnectionCellValue(field, getSnapshot(right))
|
||||
|
||||
@@ -501,8 +491,6 @@ export const ConnectionTable = (props: Props) => {
|
||||
const [sorting, setSorting] = useState<SortingState | null>(null)
|
||||
const [viewport, setViewport] = useState({ scrollTop: 0, height: 0 })
|
||||
const scrollContainerRef = useRef<HTMLDivElement | null>(null)
|
||||
const resizeCleanupRef = useRef<(() => void) | null>(null)
|
||||
useEffect(() => () => resizeCleanupRef.current?.(), [])
|
||||
const rowSnapshotCacheRef = useRef(new Map<string, TableRowSnapshot>())
|
||||
const getRowSnapshot = useCallback((row: IConnectionsItem) => {
|
||||
const cache = rowSnapshotCacheRef.current
|
||||
@@ -676,7 +664,6 @@ export const ConnectionTable = (props: Props) => {
|
||||
minWidth: number,
|
||||
maxWidth: number | undefined,
|
||||
) => {
|
||||
resizeCleanupRef.current?.()
|
||||
const handleMove = (clientX: number) => {
|
||||
const nextWidth = Math.max(
|
||||
minWidth,
|
||||
@@ -699,10 +686,8 @@ export const ConnectionTable = (props: Props) => {
|
||||
window.removeEventListener('touchmove', handleTouchMove)
|
||||
window.removeEventListener('touchend', cleanup)
|
||||
window.removeEventListener('touchcancel', cleanup)
|
||||
resizeCleanupRef.current = null
|
||||
}
|
||||
|
||||
resizeCleanupRef.current = cleanup
|
||||
window.addEventListener('mousemove', handleMouseMove)
|
||||
window.addEventListener('mouseup', cleanup)
|
||||
window.addEventListener('touchmove', handleTouchMove, { passive: true })
|
||||
|
||||
@@ -16,8 +16,7 @@ const COLOR = [
|
||||
]
|
||||
|
||||
interface Props {
|
||||
value: Rule
|
||||
lineNo: number
|
||||
value: Rule & { lineNo: number }
|
||||
}
|
||||
|
||||
const parseColor = (text: string) => {
|
||||
@@ -32,7 +31,7 @@ const parseColor = (text: string) => {
|
||||
}
|
||||
|
||||
const RuleItem = (props: Props) => {
|
||||
const { value, lineNo } = props
|
||||
const { value } = props
|
||||
|
||||
return (
|
||||
<Item sx={{ borderBottom: '1px solid var(--divider-color)' }}>
|
||||
@@ -41,7 +40,7 @@ const RuleItem = (props: Props) => {
|
||||
variant="body2"
|
||||
sx={{ lineHeight: 2, minWidth: 30, mr: 2.25, textAlign: 'center' }}
|
||||
>
|
||||
{lineNo}
|
||||
{value.lineNo}
|
||||
</Typography>
|
||||
|
||||
<Box sx={{ userSelect: 'text' }}>
|
||||
|
||||
@@ -150,49 +150,25 @@ const mergeConnectionSnapshot = (
|
||||
const nextConnections = payload.connections ?? []
|
||||
const previousActive = previous.activeConnections ?? []
|
||||
const previousClosed = previous.closedConnections ?? []
|
||||
const sameOrder =
|
||||
nextConnections.length === previousActive.length &&
|
||||
nextConnections.every(
|
||||
(connection, i) => connection.id === previousActive[i].id,
|
||||
)
|
||||
let previousActiveById: Map<string, IConnectionsItem> | undefined
|
||||
const previousActiveById = new Map<string, IConnectionsItem>()
|
||||
|
||||
if (!sameOrder) {
|
||||
previousActiveById = new Map()
|
||||
for (let i = 0; i < previousActive.length; i++) {
|
||||
const previousConnection = previousActive[i]
|
||||
previousActiveById.set(previousConnection.id, previousConnection)
|
||||
}
|
||||
for (let i = 0; i < previousActive.length; i++) {
|
||||
const previousConnection = previousActive[i]
|
||||
previousActiveById.set(previousConnection.id, previousConnection)
|
||||
}
|
||||
|
||||
let activeConnections = sameOrder ? previousActive : []
|
||||
const activeConnections: IConnectionsItem[] = []
|
||||
for (let i = 0; i < nextConnections.length; i++) {
|
||||
const connection = nextConnections[i]
|
||||
const previousConnection = sameOrder
|
||||
? previousActive[i]
|
||||
: previousActiveById?.get(connection.id)
|
||||
previousActiveById?.delete(connection.id)
|
||||
const normalized = normalizeConnection(connection, previousConnection)
|
||||
if (activeConnections[i] === normalized) continue
|
||||
if (activeConnections === previousActive) {
|
||||
activeConnections = previousActive.slice()
|
||||
}
|
||||
activeConnections[i] = normalized
|
||||
const previousConnection = previousActiveById.get(connection.id)
|
||||
if (previousConnection) previousActiveById.delete(connection.id)
|
||||
activeConnections.push(normalizeConnection(connection, previousConnection))
|
||||
}
|
||||
|
||||
const uploadTotal = payload.uploadTotal ?? 0
|
||||
const downloadTotal = payload.downloadTotal ?? 0
|
||||
if (!previousActiveById?.size) {
|
||||
if (
|
||||
activeConnections === previousActive &&
|
||||
uploadTotal === previous.uploadTotal &&
|
||||
downloadTotal === previous.downloadTotal
|
||||
) {
|
||||
return previous
|
||||
}
|
||||
if (previousActiveById.size === 0) {
|
||||
return {
|
||||
uploadTotal,
|
||||
downloadTotal,
|
||||
uploadTotal: payload.uploadTotal ?? 0,
|
||||
downloadTotal: payload.downloadTotal ?? 0,
|
||||
activeConnections,
|
||||
closedConnections: previousClosed,
|
||||
}
|
||||
@@ -222,8 +198,8 @@ const mergeConnectionSnapshot = (
|
||||
}
|
||||
|
||||
return {
|
||||
uploadTotal,
|
||||
downloadTotal,
|
||||
uploadTotal: payload.uploadTotal ?? 0,
|
||||
downloadTotal: payload.downloadTotal ?? 0,
|
||||
activeConnections,
|
||||
closedConnections,
|
||||
}
|
||||
@@ -251,9 +227,7 @@ const flushPendingMessage = () => {
|
||||
|
||||
lastFlushAt = Date.now()
|
||||
|
||||
const nextData = mergeConnectionSnapshot(payload, connectionData)
|
||||
if (nextData === connectionData) return
|
||||
connectionData = nextData
|
||||
connectionData = mergeConnectionSnapshot(payload, connectionData)
|
||||
notifyConnectionListeners()
|
||||
}
|
||||
|
||||
|
||||
+8
-11
@@ -34,11 +34,13 @@ const RulesPage = () => {
|
||||
}, [refreshRules, refreshRuleProviders, pageVisible])
|
||||
|
||||
const filteredRules = useMemo(() => {
|
||||
const indices: number[] = []
|
||||
for (let i = 0; i < rules.length; i++) {
|
||||
if (match(rules[i].payload ?? '')) indices.push(i)
|
||||
}
|
||||
return indices
|
||||
const rulesWithLineNo = rules.map((item, index) => ({
|
||||
...item,
|
||||
// UI-only derived data; keep app context/SWR data immutable
|
||||
lineNo: index + 1,
|
||||
}))
|
||||
|
||||
return rulesWithLineNo.filter((item) => match(item.payload ?? ''))
|
||||
}, [rules, match])
|
||||
|
||||
const handleScroll = useCallback((e: Event) => {
|
||||
@@ -88,12 +90,7 @@ const RulesPage = () => {
|
||||
ref={virtuosoRef}
|
||||
count={filteredRules.length}
|
||||
estimateSize={40}
|
||||
renderItem={(i) => (
|
||||
<RuleItem
|
||||
value={rules[filteredRules[i]]}
|
||||
lineNo={filteredRules[i] + 1}
|
||||
/>
|
||||
)}
|
||||
renderItem={(i) => <RuleItem value={filteredRules[i]} />}
|
||||
style={{ flex: 1 }}
|
||||
onScroll={handleScroll}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user