mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-08 11:02:08 +08:00
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:
@@ -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)
|
||||
}
|
||||
}, [])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user