Add rendering routes and share UI to web server

The web UI was linking to /v1/ REST API paths that aren't served
through nginx. Added SVG/JPG/PDF rendering and share link endpoints
directly to the web server so everything works through port 443.

- Add render.go with SVG, JPG, PDF handlers for auth and share paths
- Register render routes and share management routes in web server
- Update template links from /v1/... to /notebooks/... paths
- Add share link creation, display, and revocation to notebook view

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-25 09:22:07 -07:00
parent ab2884a8e9
commit aeb12d9f50
4 changed files with 297 additions and 7 deletions

View File

@@ -98,6 +98,9 @@ func Start(cfg Config) (*http.Server, error) {
// Share routes (no auth)
r.Get("/s/{token}", ws.handleShareNotebook)
r.Get("/s/{token}/pages/{num}", ws.handleSharePage)
r.Get("/s/{token}/pages/{num}/svg", ws.handleSharePageSVG)
r.Get("/s/{token}/pages/{num}/jpg", ws.handleSharePageJPG)
r.Get("/s/{token}/pdf", ws.handleSharePDF)
// Authenticated routes
r.Group(func(r chi.Router) {
@@ -106,6 +109,11 @@ func Start(cfg Config) (*http.Server, error) {
r.Get("/notebooks", ws.handleNotebooks)
r.Get("/notebooks/{id}", ws.handleNotebook)
r.Get("/notebooks/{id}/pages/{num}", ws.handlePage)
r.Get("/notebooks/{id}/pages/{num}/svg", ws.handlePageSVG)
r.Get("/notebooks/{id}/pages/{num}/jpg", ws.handlePageJPG)
r.Get("/notebooks/{id}/pdf", ws.handleNotebookPDF)
r.Post("/notebooks/{id}/share", ws.handleCreateShare)
r.Post("/notebooks/{id}/share/revoke", ws.handleRevokeShare)
r.Get("/logout", ws.handleLogout)
// WebAuthn authenticated routes (registration + key management)