File size: 609 Bytes
e808ae1
ed37502
 
 
 
 
e808ae1
 
ed37502
 
 
 
 
 
 
e808ae1
ed37502
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""Web UI route — serves the single-page dashboard."""

from __future__ import annotations

from pathlib import Path

from fastapi import APIRouter
from fastapi.responses import HTMLResponse, Response

router = APIRouter(tags=["ui"])

UI_HTML_PATH = Path(__file__).parent / "ui.html"


@router.get("/", response_class=HTMLResponse)
async def dashboard():
    """Serve the main dashboard UI."""
    content = UI_HTML_PATH.read_text(encoding="utf-8")
    return Response(
        content=content,
        media_type="text/html",
        headers={"Cache-Control": "no-cache, no-store, must-revalidate"},
    )