From ca86daf9a692c8d7294aab7565beb479eb3c628c Mon Sep 17 00:00:00 2001 From: Josue Zamudio Date: Wed, 19 Aug 2026 17:38:04 +0000 Subject: [PATCH] api: Cache-Control no-store on /api/history (mutable JSON must not be cached) --- server/app.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/app.py b/server/app.py index 24e775c..4cb0cd0 100644 --- a/server/app.py +++ b/server/app.py @@ -136,7 +136,11 @@ def _save_hist(user: str, entries): @app.get("/api/history") def api_history(request: Request): - return sorted(_load_hist(request.state.user), key=lambda e: e.get("t", 0), reverse=True)[:5] + # no-store: this JSON mutates while a tab is open (position saves); + # a stale copy has caused "poster gone" confusion before + return JSONResponse( + sorted(_load_hist(request.state.user), key=lambda e: e.get("t", 0), reverse=True)[:5], + headers={"Cache-Control": "no-store"}) @app.post("/api/history")