Commit graph

2 commits

Author SHA1 Message Date
b2fe586b72
fix(web): render the signed-in header on error pages (#21)
Exception handlers run outside FastAPI's dependency injection, so the error handler never resolved the session and always passed user=None, making every error page (e.g. a 404 hit while signed in) show the 'Sign In with Forgejo' header instead of the account menu.

Resolve the session by hand from the request cookie via lookup_session, degrading to None on any failure so error rendering can never itself raise. A missing or invalid cookie (a real 401) still yields None and the correct signed-out header.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-18 13:51:32 -04:00
ZTatman
a0617c6be4 refactor(web): decompose main.py into a composition root
Move page routes to routers/dashboard.py, the content-negotiated error
handler to errors.py (register_error_handlers), and the dev css-mtime
endpoint to routers/dev.py (included only when debug). main.py shrinks to
lifespan + wiring + the / landing route.

Dashboard repos now load lazily via an htmx fragment so a slow/unreachable
Forgejo instance never blocks first paint; Forgejo html_url is sanitized
against non-http(s) schemes before rendering into href.
2026-06-10 17:03:10 -04:00