Restore home page with README display

Instead of redirecting to /runs, show the home page with stats and README.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
giles
2026-01-11 12:54:50 +00:00
parent a34fff3aaa
commit f0db4f4ea6
2 changed files with 26 additions and 7 deletions

View File

@@ -2,6 +2,9 @@
Home and root routes for L1 server.
"""
from pathlib import Path
import markdown
from fastapi import APIRouter, Request, Depends
from fastapi.responses import HTMLResponse, RedirectResponse
@@ -16,16 +19,26 @@ router = APIRouter()
@router.get("/")
async def home(request: Request):
"""
Home page - redirect to runs if authenticated, show landing otherwise.
Home page - show README and stats.
"""
user = await get_current_user(request)
if user:
return RedirectResponse(url="/runs", status_code=302)
# Load README
readme_html = ""
try:
readme_path = Path(__file__).parent.parent.parent / "README.md"
if readme_path.exists():
readme_html = markdown.markdown(readme_path.read_text())
except Exception:
pass
# For now, redirect to login at L2
# TODO: Show a landing page with login link
return RedirectResponse(url="/runs", status_code=302)
templates = get_templates(request)
return render(templates, "home.html", request,
user=user,
readme_html=readme_html,
stats={},
active_tab="home",
)
@router.get("/login")