diff --git a/app/main.py b/app/main.py index fb6fcbf..6f1e587 100644 --- a/app/main.py +++ b/app/main.py @@ -49,6 +49,15 @@ app.include_router(ws_router) # Statische Web-UI (same-origin -> kein CORS). Muss NACH allen API-/WS-Routen # gemountet werden, damit "/" nur die uebrigen Pfade abfaengt. +class _NoCacheStaticFiles(StaticFiles): + """Liefert die UI ohne Caching aus -> Aenderungen sind sofort sichtbar (kein Safari-Cache).""" + + def file_response(self, *args, **kwargs): + response = super().file_response(*args, **kwargs) + response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate" + return response + + _WEB_DIR = Path(__file__).resolve().parent / "web" if _WEB_DIR.is_dir(): - app.mount("/", StaticFiles(directory=str(_WEB_DIR), html=True), name="web") + app.mount("/", _NoCacheStaticFiles(directory=str(_WEB_DIR), html=True), name="web") diff --git a/app/web/index.html b/app/web/index.html index c287c68..deafe81 100644 --- a/app/web/index.html +++ b/app/web/index.html @@ -4,7 +4,7 @@ Voice Assistant - +
@@ -31,6 +31,6 @@
- +