mud_server.web.routes

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/<world_id>/*. - 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

ADMIN_ASSET_VERSION

PLAY_ASSET_VERSION

APP_VERSION

templates

Functions

build_admin_router()

Build the admin WebUI router for serving the HTML shell.

build_play_router()

Build the play WebUI router for serving the play shell.

build_web_router()

Backwards-compatible wrapper that returns the admin router.

register_web_routes(app)

Register WebUI routes and static assets on the FastAPI app.

Module Contents

mud_server.web.routes.ADMIN_ASSET_VERSION = '20260315a'
mud_server.web.routes.PLAY_ASSET_VERSION = '20260226c'
mud_server.web.routes.APP_VERSION
mud_server.web.routes.templates
mud_server.web.routes.build_admin_router()[source]

Build the admin WebUI router for serving the HTML shell.

Returns:

APIRouter configured to serve the admin dashboard shell.

Return type:

fastapi.APIRouter

mud_server.web.routes.build_play_router()[source]

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/<world_id>/rooms/…

mud_server.web.routes.build_web_router()[source]

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.

mud_server.web.routes.register_web_routes(app)[source]

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.