feat(enhance): warn when extensions write app-owned keys

This commit is contained in:
wonfen
2026-09-21 21:22:45 +08:00
parent 07825afb1e
commit 7bf8e1dcf5
23 changed files with 153 additions and 7 deletions
@@ -14,6 +14,7 @@ vi.mock('@/hooks/use-profiles', () => ({ revalidateProfiles: vi.fn() }))
vi.mock('@/hooks/use-system-state', () => ({ runStateQueryKey: ['state'] }))
vi.mock('@/services/events', () => ({ subscribeVergeEvents: vi.fn() }))
vi.mock('@/services/cmds', () => ({
takeDiscardedKeysNotice: vi.fn().mockResolvedValue(null),
takeDnsOverrideNotice: vi.fn(),
takeServiceFallbackNotice: vi.fn().mockResolvedValue(false),
}))
@@ -64,6 +64,7 @@ export const useLayoutEvents = (
() => {
revalidateKeys(['getRuntimeState', 'getVergeConfig'])
handleNotice(['dns_override::auto_disabled', ''])
handleNotice(['enhance::discarded_keys', ''])
handleNotice(['service_core::sidecar_fallback', ''])
},
)
@@ -1,4 +1,5 @@
import {
takeDiscardedKeysNotice,
takeDnsOverrideNotice,
takeServiceFallbackNotice,
} from '@/services/cmds'
@@ -55,6 +56,22 @@ export const handleNoticeMessage = (
console.error('Failed to read the pending DNS override notice', error)
})
},
'enhance::discarded_keys': () => {
void takeDiscardedKeysNotice()
.then((keys) => {
if (keys) {
showNotice.warning('profiles.page.feedback.notices.discardedKeys', {
keys,
})
}
})
.catch((error) => {
console.error(
'Failed to read the pending discarded keys notice',
error,
)
})
},
'tun_mode::auto_disabled': () =>
showNotice.info(
'settings.sections.system.notifications.tunMode.autoDisabled',