feat: allow manually unfixing proxy nodes (#7756)

* feat(proxy): add ability to clear persisted node selection for groups

* feat(hooks): make proxy selection operations asynchronous

* chore: update tauri-plugin-mihomo deps

* refactor: rename clear_selected_node to forget_selected_node

* refactor(hooks): rename isFixed to isFixedProxy in useProxySelection

* docs: update changelog with manual node cancellation support

* chore(layout): remove dev-only mihomo websocket debugging interval
This commit is contained in:
oomeow
2026-08-18 12:16:42 +00:00
committed by GitHub
parent 9fa0e91e25
commit daadb126e0
12 changed files with 205 additions and 89 deletions
+19 -4
View File
@@ -1,6 +1,6 @@
import { useCallback } from 'react'
import { recordSelectedNode } from '@/services/cmds'
import { forgetSelectedNode, recordSelectedNode } from '@/services/cmds'
/**
* Record which node a group is on, in the profile.
@@ -20,9 +20,24 @@ import { recordSelectedNode } from '@/services/cmds'
* stale snapshot. The merge happens on the backend, against whatever the profile holds by then.
*/
export const useRecordSelection = () => {
return useCallback((groupName: string, proxyName: string) => {
recordSelectedNode(groupName, proxyName).catch((error) => {
return useCallback(async (groupName: string, proxyName: string) => {
try {
await recordSelectedNode(groupName, proxyName)
} catch (error) {
console.error('[Selection] 保存代理选择失败:', error)
})
}
}, [])
}
/**
* Forget the persisted node selection for a group after its runtime fixed node is released.
*/
export const useForgetSelection = () => {
return useCallback(async (groupName: string) => {
try {
await forgetSelectedNode(groupName)
} catch (error) {
console.error('[Selection] 清除代理选择失败:', error)
}
}, [])
}