Loading…
""" Hub web application — serves the MeshBay web client at /. The web client (HTML/JS) is a single-page app that: - Logs in via the hub API - Discovers public groups - Connects to a node URL entered by the user - Browses the node's file index - Downloads or streams files via the node HTTP API Static files are served from meshbay_hub/static/. API routes remain at /v1/*. """ from pathlib import Path from fastapi import APIRouter from fastapi.responses import FileResponse, HTMLResponse STATIC_DIR = Path(__file__).parent.parent / "static" router = APIRouter(tags=["webapp"]) @router.get("/app.js") async def app_js(): return FileResponse(STATIC_DIR / "app.js", media_type="application/javascript") @router.get("/transport.js") async def transport_js(): return FileResponse(STATIC_DIR / "transport.js", media_type="application/javascript") @router.get("/crypto.js") async def crypto_js(): return FileResponse(STATIC_DIR / "crypto.js", media_type="application/javascript") @router.get("/webrtc-test.html") async def webrtc_test(): return FileResponse(STATIC_DIR / "webrtc-test.html", media_type="text/html") @router.get("/", response_class=HTMLResponse) async def index(): return HTMLResponse(_HTML) _HTML = """\
Loading…