mud_server.web.routes ===================== .. py:module:: mud_server.web.routes .. autoapi-nested-parse:: WebUI routes for serving the admin dashboard shell, play shell, and static assets. This module intentionally keeps server-side logic minimal: - Serves a single HTML shell for `/admin` and `/admin/*`. - Serves a single HTML shell for `/play` and `/play//*`. - Delegates all application behavior to client-side JS. - Uses FastAPI's StaticFiles to serve CSS/JS assets. No authentication logic lives here; the client authenticates against existing API endpoints and enforces role checks. Server-side role checks remain in the API layer. Attributes ---------- .. autoapisummary:: mud_server.web.routes.ADMIN_ASSET_VERSION mud_server.web.routes.PLAY_ASSET_VERSION mud_server.web.routes.APP_VERSION mud_server.web.routes.templates Functions --------- .. autoapisummary:: mud_server.web.routes.build_admin_router mud_server.web.routes.build_play_router mud_server.web.routes.build_web_router mud_server.web.routes.register_web_routes Module Contents --------------- .. py:data:: ADMIN_ASSET_VERSION :value: '20260315a' .. py:data:: PLAY_ASSET_VERSION :value: '20260226c' .. py:data:: APP_VERSION .. py:data:: templates .. py:function:: build_admin_router() Build the admin WebUI router for serving the HTML shell. :returns: APIRouter configured to serve the admin dashboard shell. .. py:function:: build_play_router() Build the play WebUI router for serving the play shell. The play UI is a single-page shell. Client-side routing handles specific subpaths like /play//rooms/... .. py:function:: build_web_router() Backwards-compatible wrapper that returns the admin router. Historically, tests and callers referenced build_web_router. Keep it as a thin wrapper to avoid breaking imports. .. py:function:: register_web_routes(app) Register WebUI routes and static assets on the FastAPI app. Static files must be mounted on the FastAPI app (not an APIRouter), otherwise Starlette will not serve the assets correctly.