refactor(backend): specta ipc bindings (#8195)

* refactor(ipc): generate bindings with Specta

* fix(profile): project IPC inputs to consumed fields

* fix(events): remove unused refresh payloads

* fix(webdav): return only consumed backup metadata

* fix(network): trim unused interface metadata

* fix(sysinfo): return only displayed system fields

* chore(knip): check generated runtime exports

* fix(proxy): confirm runtime chain updates before UI changes

* fix(clipboard): propagate proxy environment copy failures

* refactor(dns): remove ignored runtime patch

* refactor(core): trim unused upgrade response fields

* refactor(ipc): avoid redundant response copies

* refactor(proxy): clarify automatic proxy query naming

* chore(tests): remove added IPC regression tests

* refactor(ipc): enforce typed command boundaries

* chore(contract): check generated bindings before push

* refactor(ipc): remove unused proxy liveness payloads
This commit is contained in:
Tunglies
2026-10-12 06:16:05 +00:00
committed by GitHub
parent 27efaf34f4
commit 6e08a77a84
89 changed files with 2714 additions and 1354 deletions
+3 -2
View File
@@ -1,5 +1,6 @@
import { useCallback, useEffect, useRef } from 'react'
import type { ProfilePatch, ProfileSelection } from '@/services/bindings'
import { getProfiles, patchProfile, patchProfilesConfig } from '@/services/cmds'
import { mutate } from '@/services/mutate'
import { migrateProfileTestUrls } from '@/services/proxy-test-url'
@@ -46,7 +47,7 @@ export const useProfiles = () => {
}, [])
const patchProfiles = useCallback(
async (value: Partial<IProfilesConfig>) => {
async (value: ProfileSelection) => {
try {
const result = await mutate(() => patchProfilesConfig(value), {
id: 'patch-profiles-config',
@@ -77,7 +78,7 @@ export const useProfiles = () => {
)
const patchCurrent = useCallback(
async (value: Partial<IProfileItem>) => {
async (value: ProfilePatch) => {
if (profiles?.current) {
const uid = profiles.current
await mutate(() => patchProfile(uid, value), {
+2 -2
View File
@@ -166,10 +166,10 @@ export const useProxySelection = (options: ProxySelectionOptions = {}) => {
const handleProxyGroupChange = useCallback(
(
group: { name: string; now?: string; fixed?: string },
group: { name: string; now?: string | null; fixed?: string | null },
proxy: { name: string },
) => {
changeProxy(group.name, proxy.name, group.now, group.fixed)
changeProxy(group.name, proxy.name, group.now!, group.fixed!)
},
[changeProxy],
)
+6 -6
View File
@@ -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,