From 3af72158541198231eeacdc5c0aec1c0fa57209d Mon Sep 17 00:00:00 2001 From: Codex Date: Sat, 26 Sep 2026 02:13:37 -0500 Subject: [PATCH] Update Site source --- scripts/build.mjs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/build.mjs b/scripts/build.mjs index cfbc3d1..0fca749 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -9,7 +9,13 @@ await rm(dist, { recursive: true, force: true }); await Promise.all([mkdir(server, { recursive: true }), mkdir(meta, { recursive: true })]); const [rawIndexHtml, addonsJs, i18nJs, i18nRenderersJs] = await Promise.all([text("index.html"), text("addons.js"), text("i18n.js"), text("i18n-renderers.js")]); const release = "1.1.0"; -const indexHtml = rawIndexHtml.replace('src="addons.js"', `src="addons.js?v=${release}"`); +// The original single-file prototype carried an obsolete English-to-Chinese +// DOM replacement block. Runtime localisation now lives in i18n.js and +// i18n-renderers.js, so exclude that dead block from the deployed document. +const withoutLegacyI18n = rawIndexHtml + .replace(/const ZH=.*?function browserLanguage/s, 'function browserLanguage') + .replace(/function localizeDynamicText.*?function i18n\(key,fallback=key\)\{return lang\(\)===\'zh\'\?\(ZH\[key\]\|\|key\):fallback\}/s, 'function i18n(key,fallback=key){return fallback}'); +const indexHtml = withoutLegacyI18n.replace('src="addons.js"', `src="addons.js?v=${release}"`); await writeFile(new URL("assets.js", server), `export const indexHtml=${JSON.stringify(indexHtml)};\nexport const addonsJs=${JSON.stringify(addonsJs)};\nexport const i18nJs=${JSON.stringify(i18nJs)};\nexport const i18nRenderersJs=${JSON.stringify(i18nRenderersJs)};\n`); await copyFile(new URL("../worker/index.js", import.meta.url), new URL("index.js", server)); await copyFile(new URL("../.openai/hosting.json", import.meta.url), new URL("hosting.json", meta));