fix(cache): bust browser cache for JS and i18n files after updates
After a container update, browsers serve stale app.js and lang/*.json from cache, causing old UI code and missing translations to appear. - serve_index() now reads the git commit hash and injects ?v=COMMIT into all static asset URLs (app.js, i18n.js, styles.css) in index.html - window.STATIC_VERSION is injected into the page so i18n.js can append the same version to lang/*.json fetch calls - index.html itself is served with Cache-Control: no-cache so the browser always revalidates it and picks up new asset URLs on next load Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -27,7 +27,8 @@ function detectLanguage() {
|
||||
async function loadLanguage(lang) {
|
||||
if (translations[lang]) return;
|
||||
try {
|
||||
const resp = await fetch(`/static/lang/${lang}.json`);
|
||||
const v = window.STATIC_VERSION ? `?v=${window.STATIC_VERSION}` : '';
|
||||
const resp = await fetch(`/static/lang/${lang}.json${v}`);
|
||||
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
|
||||
translations[lang] = await resp.json();
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user