mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-26 17:09:28 +08:00
feat(panel): add Antigravity host UI localization and language packs
- Add standalone host-i18n language pack manager with GitHub/jsDelivr download, SHA-256 integrity checks, offline light/deep tier switching, and lossless DOM translation over the CDP window bridge - Add Settings -> General host interface language controls, untranslated UI string collector, and loopback-only /api/host-i18n endpoints - Include zh-CN layered language pack assets and source/audit/build scripts under host-i18n/ while keeping the Release ZIP runtime whitelist isolated
This commit is contained in:
@@ -538,6 +538,24 @@ export function createStandaloneWebServer(options = {}) {
|
||||
);
|
||||
return;
|
||||
}
|
||||
const remoteAddr = String(req.socket?.remoteAddress || '').trim();
|
||||
const isLoopbackClient =
|
||||
!remoteAddr ||
|
||||
remoteAddr === '127.0.0.1' ||
|
||||
remoteAddr === '::1' ||
|
||||
remoteAddr === '::ffff:127.0.0.1';
|
||||
if (pathname === '/api/host-i18n' && method === 'POST' && !isLoopbackClient) {
|
||||
sendResponse(
|
||||
res,
|
||||
403,
|
||||
'application/json; charset=utf-8',
|
||||
JSON.stringify({
|
||||
ok: false,
|
||||
error: 'Host I18n mutations are only allowed from loopback clients',
|
||||
})
|
||||
);
|
||||
return;
|
||||
}
|
||||
let data = undefined;
|
||||
if (method === 'GET') {
|
||||
data = Object.fromEntries(urlObj.searchParams.entries());
|
||||
@@ -559,6 +577,25 @@ export function createStandaloneWebServer(options = {}) {
|
||||
} else {
|
||||
data = {};
|
||||
}
|
||||
if (
|
||||
pathname === '/api/settings' &&
|
||||
data &&
|
||||
typeof data === 'object' &&
|
||||
typeof data.__hostI18nAction === 'string' &&
|
||||
data.__hostI18nAction !== 'get' &&
|
||||
!isLoopbackClient
|
||||
) {
|
||||
sendResponse(
|
||||
res,
|
||||
403,
|
||||
'application/json; charset=utf-8',
|
||||
JSON.stringify({
|
||||
ok: false,
|
||||
error: 'Host I18n mutations are only allowed from loopback clients',
|
||||
})
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (
|
||||
pathname === '/api/settings' &&
|
||||
data &&
|
||||
|
||||
Reference in New Issue
Block a user