From f018f33f698b71a811596d0403238c3438ee84ec Mon Sep 17 00:00:00 2001 From: Scarriffle Date: Sun, 31 May 2026 16:42:21 +0200 Subject: [PATCH] fix: JS/CSS immer revalidieren (no-cache) + Version v24 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bisher bekamen /static/js und /static/css max-age=7200. Da index.html no-cache ist, konnte eine frische HTML mit 2h-altem, gecachtem JS/CSS gepaart werden — neue Features (z.B. Gruppen-Button) ohne passenden Handler. JS/CSS revalidieren jetzt bei jedem Load (304 wenn unveraendert); Icons & uebrige Assets behalten 2h. Deploys greifen so sofort beim Reload. Co-Authored-By: Claude Opus 4.8 --- backend/main.py | 7 ++++++- frontend/js/version.js | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/main.py b/backend/main.py index 562fa3a..8d017ca 100644 --- a/backend/main.py +++ b/backend/main.py @@ -179,7 +179,12 @@ async def add_cache_headers(request: Request, call_next): response.headers["Cache-Control"] = NO_CACHE response.headers["Pragma"] = "no-cache" response.headers["Expires"] = "0" - # 2h cache for the rest of the frontend (JS/CSS/icons/etc.) + # JS/CSS must revalidate on every load so a deploy takes effect on the next + # reload (returns a cheap 304 when unchanged). Without this, a fresh + # no-cache index.html could pair with stale 2h-cached scripts. + elif path.startswith("/static/js/") or path.startswith("/static/css/"): + response.headers["Cache-Control"] = NO_CACHE + # 2h cache for the rest of the frontend (icons, fonts, images, …) elif path.startswith("/static/") or path.startswith("/icons/"): response.headers["Cache-Control"] = STATIC_CACHE # SPA fallback (everything else that isn't an API route) returns HTML; diff --git a/frontend/js/version.js b/frontend/js/version.js index bb0b7ed..eea63e6 100644 --- a/frontend/js/version.js +++ b/frontend/js/version.js @@ -1,2 +1,2 @@ // Increment APP_VERSION with every code change -export const APP_VERSION = 'v23'; +export const APP_VERSION = 'v24';