api: Cache-Control no-store on /api/history (mutable JSON must not be cached)

This commit is contained in:
jozamudi committed 2026-08-19 17:38:04 +00:00
1 parent 0a86e70a54
commit ca86daf9a6
1 file changed
+5 -1
+5 -1
View File
@@ -136,7 +136,11 @@ def _save_hist(user: str, entries):
@app.get("/api/history") @app.get("/api/history")
def api_history(request: Request): 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") @app.post("/api/history")