Fix control SPA refresh 404 on /stats by serving index.html.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -59,16 +59,15 @@ if (_DIST / "assets").is_dir():
|
|||||||
|
|
||||||
@app.get("/")
|
@app.get("/")
|
||||||
@app.get("/monitor")
|
@app.get("/monitor")
|
||||||
|
@app.get("/stats")
|
||||||
@app.get("/settings")
|
@app.get("/settings")
|
||||||
@app.get("/login")
|
@app.get("/login")
|
||||||
async def spa(full_path: str = ""):
|
async def spa():
|
||||||
index = _DIST / "index.html"
|
index = _DIST / "index.html"
|
||||||
if index.exists():
|
if index.exists():
|
||||||
return FileResponse(index)
|
return FileResponse(index)
|
||||||
if Path(__file__).name:
|
return {
|
||||||
return {
|
"ok": True,
|
||||||
"ok": True,
|
"msg": "control frontend not built; cd control/frontend && npm ci && npm run build",
|
||||||
"msg": "control frontend not built; cd control/frontend && npm ci && npm run build",
|
"health": "/health",
|
||||||
"health": "/health",
|
}
|
||||||
}
|
|
||||||
raise HTTPException(status_code=404, detail="frontend missing")
|
|
||||||
|
|||||||
Reference in New Issue
Block a user