mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-09 11:52:08 +08:00
refactor(proxy): clarify automatic proxy query naming
This commit is contained in:
@@ -5,7 +5,7 @@ import { useDisplayedMixedPort } from '@/hooks/use-displayed-mixed-port'
|
||||
import { useVerge } from '@/hooks/use-verge'
|
||||
import { useSystemData } from '@/providers/app-data-context'
|
||||
import {
|
||||
getAutotemProxy,
|
||||
getAutoProxy,
|
||||
getEmbeddedServerPort,
|
||||
patchVergeConfig,
|
||||
} from '@/services/cmds'
|
||||
@@ -21,8 +21,8 @@ export const useSystemProxyState = () => {
|
||||
const { sysproxy } = useSystemData()
|
||||
const displayedMixedPort = useDisplayedMixedPort()
|
||||
const { data: autoproxy } = useQuery({
|
||||
queryKey: ['getAutotemProxy'],
|
||||
queryFn: getAutotemProxy,
|
||||
queryKey: ['getAutoProxy'],
|
||||
queryFn: getAutoProxy,
|
||||
refetchOnWindowFocus: true,
|
||||
refetchOnReconnect: true,
|
||||
})
|
||||
@@ -99,7 +99,7 @@ export const useSystemProxyState = () => {
|
||||
}
|
||||
// Kept separate so an unreadable config cannot discard OS state that did read.
|
||||
try {
|
||||
await revalidateQueries([['getSystemProxy'], ['getAutotemProxy']])
|
||||
await revalidateQueries([['getSystemProxy'], ['getAutoProxy']])
|
||||
} catch (error) {
|
||||
console.warn(
|
||||
'[system-proxy] rereading the OS proxy after a toggle failed:',
|
||||
@@ -109,14 +109,14 @@ export const useSystemProxyState = () => {
|
||||
// rather than stay live from a stale cache.
|
||||
await Promise.all([
|
||||
removeCacheData(['getSystemProxy']),
|
||||
removeCacheData(['getAutotemProxy']),
|
||||
removeCacheData(['getAutoProxy']),
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const invalidateProxyState = () =>
|
||||
revalidateQueries([['getSystemProxy'], ['getAutotemProxy']])
|
||||
revalidateQueries([['getSystemProxy'], ['getAutoProxy']])
|
||||
|
||||
return {
|
||||
indicator,
|
||||
|
||||
@@ -72,11 +72,7 @@ export const createEventBus = (deps: BusHandlerDeps) => {
|
||||
'getRuleProviders',
|
||||
]),
|
||||
'verge://refresh-verge-config': () =>
|
||||
deps.revalidateKeys([
|
||||
'getVergeConfig',
|
||||
'getSystemProxy',
|
||||
'getAutotemProxy',
|
||||
]),
|
||||
deps.revalidateKeys(['getVergeConfig', 'getSystemProxy', 'getAutoProxy']),
|
||||
'verge://refresh-profiles': () => deps.revalidateKeys(['getProfiles']),
|
||||
'verge://refresh-proxy-config': handleRefreshProxyConfig,
|
||||
'verge://notice-message': (payload) => deps.handleNotice(payload),
|
||||
|
||||
@@ -256,7 +256,7 @@ export async function getSystemProxy() {
|
||||
return commands.getSysProxy()
|
||||
}
|
||||
|
||||
export async function getAutotemProxy() {
|
||||
export async function getAutoProxy() {
|
||||
try {
|
||||
debugLog('[API] 开始调用 get_auto_proxy')
|
||||
const result = await commands.getAutoProxy()
|
||||
|
||||
Reference in New Issue
Block a user