Add read-only sharing, API tokens and OpenAPI spec

- Share a note as a live read-only page at /s/{token} with optional password and expiry
- Share page renders with the shared parser (TOC, footnotes, math, Mermaid, code highlighting)
  and only serves images from the note's own .assets directory
- Shares follow renames made through the API or externally
- Manage shares and API tokens from the command palette and file tree
- Accept read/write API tokens as Bearer credentials; management endpoints require a session
- Serve a hand-written openapi.json, checked against the route table in tests
This commit is contained in:
eezd committed 2026-10-17 15:21:47 +08:00
1 parent 7b076346a4
commit 5ac01894e6
26 files changed
+3147 -52

No files matched your search

+2 -1
View File
@@ -94,8 +94,9 @@ func run(addr string) error {
}
go cleanupSessions(ctx, st)
srv := api.New(v, am, hub, idx)
srv := api.New(v, am, st, hub, idx)
srv.OnSetup = func() { os.Remove(codeFile) }
go srv.FollowMoves(ctx)
httpServer := &http.Server{
Addr: addr,
Handler: srv.Handler(web.Dist()),