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:
parent
320742bd63
commit
a8deb1fa8b
1 changed files with 5 additions and 2 deletions
7
api.py
7
api.py
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue