fix: no-cache headers on admin panel HTML so updates show up without a hard refresh

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Savsis? 2026-09-10 23:34:23 +05:00
parent 320742bd63
commit a8deb1fa8b

7
api.py
View file

@ -814,13 +814,16 @@ def admin_node_status(code: str, request: Request):
ADMIN_HTML_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "admin.html")
_NO_CACHE = {"Cache-Control": "no-cache, must-revalidate"}
@app.get("/")
def root(request: Request):
if request.headers.get("host", "").split(":")[0] == PANEL_DOMAIN:
return FileResponse(ADMIN_HTML_PATH)
return FileResponse(ADMIN_HTML_PATH, headers=_NO_CACHE)
raise HTTPException(404)
@app.get("/admin")
def admin_page():
return FileResponse(ADMIN_HTML_PATH)
return FileResponse(ADMIN_HTML_PATH, headers=_NO_CACHE)