fix: serve lan-client from backend at /lan on port 8080
- Mount lan-client/ as static files at /lan with html=True - Mount precon-decks/ at /precon-decks/ for direct .dck access - ai-bridge.js: use same-origin (empty URLs, auto-detect from window.location) - engine.js: simplify deck fetch to use /api/lab/precons/deck endpoint + /precon-decks/ static fallback - Eliminates cross-origin issues by serving everything from localhost:8080 Access the LAN battlefield at http://localhost:8080/lan/
This commit is contained in:
1 parent
bf701397b0
commit
e90efe1654
3 files changed
+38
-30
No files matched your search
+10
@@ -152,8 +152,18 @@ async def health_check():
|
||||
# ── Static UI (MUST come after all @app.get routes) ──────────────────────────────────────────
|
||||
from pathlib import Path as _Path
|
||||
_legacy_ui_dir = _Path(__file__).parent / "ui"
|
||||
_lan_client_dir = _Path(__file__).parent / "lan-client"
|
||||
_precon_decks_dir = _Path(__file__).parent / "precon-decks"
|
||||
_spa_dir = _Path(__file__).parent / "frontend" / "commander-ai-lab-ui" / "dist"
|
||||
|
||||
# Mount LAN client at /lan (served before the root catch-all)
|
||||
if _lan_client_dir.exists():
|
||||
app.mount("/lan", StaticFiles(directory=str(_lan_client_dir), html=True), name="lan-client")
|
||||
|
||||
# Mount precon-decks/ so .dck files are fetchable at /precon-decks/{file}.dck
|
||||
if _precon_decks_dir.exists():
|
||||
app.mount("/precon-decks", StaticFiles(directory=str(_precon_decks_dir)), name="precon-decks")
|
||||
|
||||
if _legacy_ui_dir.exists():
|
||||
app.mount("/", StaticFiles(directory=str(_legacy_ui_dir), html=True), name="ui")
|
||||
elif _spa_dir.exists():
|
||||
|
||||
Reference in new issue
Block a user