Spaces:
Running
Running
fix(serve): dedent root/SPA catch-all to module level — restore GREEN root route (regressed by /upgrades insertion). ADDITIVE, no change to /upgrades or v10.
Browse files
serve.py
CHANGED
|
@@ -96,12 +96,22 @@ async def upgrades_index():
|
|
| 96 |
return _UpgradesHTMLResponse(content=_UPGRADES_HTML)
|
| 97 |
|
| 98 |
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
|
| 107 |
if __name__ == "__main__":
|
|
|
|
| 96 |
return _UpgradesHTMLResponse(content=_UPGRADES_HTML)
|
| 97 |
|
| 98 |
|
| 99 |
+
# --- PRESERVED root + SPA catch-all (re-registered at module level).
|
| 100 |
+
# NOTE: previously this catch-all was indented under upgrades_index() and never
|
| 101 |
+
# registered, which 404'd the root memory-cortex landing. Dedented to module level
|
| 102 |
+
# to restore the GREEN root route. ADDITIVE/no-content-change to /upgrades or v10.
|
| 103 |
+
# Registered LAST so /api/amaru, /conduit, /upgrades all take precedence.
|
| 104 |
+
@app.get("/{path:path}")
|
| 105 |
+
async def serve_spa(path: str):
|
| 106 |
+
file_path = STATIC_DIR / path
|
| 107 |
+
if file_path.exists() and file_path.is_file():
|
| 108 |
+
return FileResponse(file_path)
|
| 109 |
+
return FileResponse(STATIC_DIR / "index.html")
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
@app.get("/")
|
| 113 |
+
async def serve_root():
|
| 114 |
+
return FileResponse(STATIC_DIR / "index.html")
|
| 115 |
|
| 116 |
|
| 117 |
if __name__ == "__main__":
|