mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-26 17:09:28 +08:00
refactor(panel): complete shared single-source rules, isolate per-module bundle scopes, and purify scoped selector
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
export const WINDOW_BRIDGE_KEY = '__AGUsageMonitorBridge';
|
||||
export const WINDOW_BRIDGE_ROUTE_KEY = 'hostRouteCascadeId';
|
||||
export const WINDOW_OVERLAY_KEY = '__AGUsageMonitorOverlay';
|
||||
export const CONTEXT_WINDOWS_GLOBAL_KEY = '__AGUsageMonitorContextWindows';
|
||||
|
||||
export const WINDOW_OVERLAY_METHODS = Object.freeze({
|
||||
ensureAlive: 'ensureAlive',
|
||||
@@ -13,6 +14,20 @@ export const WINDOW_OVERLAY_METHODS = Object.freeze({
|
||||
dispose: 'dispose',
|
||||
});
|
||||
|
||||
export const BRIDGE_API_ROUTE_DEFS = Object.freeze([
|
||||
Object.freeze({ path: '/api/telemetry', method: 'GET', action: 'telemetry' }),
|
||||
Object.freeze({ path: '/api/settings', method: 'POST', action: 'settings' }),
|
||||
Object.freeze({ path: '/api/accounts', method: 'GET', action: 'accounts_get' }),
|
||||
Object.freeze({ path: '/api/accounts/update', method: 'POST', action: 'accounts_update' }),
|
||||
Object.freeze({ path: '/api/context-window', method: 'POST', action: 'context_window' }),
|
||||
Object.freeze({ path: '/api/settings/reset', method: 'POST', action: 'settings_reset' }),
|
||||
Object.freeze({ path: '/api/cache/rebuild', method: 'POST', action: 'cache_rebuild' }),
|
||||
Object.freeze({ path: '/api/cloud-sync', method: 'POST', action: 'cloud_sync' }),
|
||||
Object.freeze({ path: '/api/plugin-update', method: 'POST', action: 'plugin_update' }),
|
||||
]);
|
||||
|
||||
export const BRIDGE_API_PATHS = Object.freeze(BRIDGE_API_ROUTE_DEFS.map((r) => r.path));
|
||||
|
||||
export function readInjectedWindowBridge() {
|
||||
return typeof window === 'undefined' ? undefined : window[WINDOW_BRIDGE_KEY];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user