Documentation
¶
Overview ¶
Package devgw serves notesd's RPC over a WebSocket on loopback, so the UI can be developed in an ordinary browser against a real notesd (docs/specs/rpc-protocol.md, Transports). notesd serves it only with -devgw. Browsers do not apply CORS to WebSockets, so every connection must carry the token and come from an allowed Origin.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotLoopback = errors.New("devgw: listen address must be loopback")
ErrNotLoopback means the gateway was asked to listen beyond this machine.
var Origins = []string{"http://127.0.0.1:5173", "http://localhost:5173"}
Origins are the pages allowed to connect: the Vite dev server.
Functions ¶
func BlobHandler ¶
BlobHandler serves vault files' contents by their hash, so the UI in a browser shows images, audio and video as the desktop app does through notesblob:// (ADR-0023). A request is GET /blobs/<sha256>.<ext> with the gateway's token as ?token=, since an <img> sends no header the page sets; the extension only names the content type. It answers Range, as audio and video ask (blobhttp).
func ContentType ¶
ContentType returns the media type the app serves a vault file with, by its lower-cased extension (blobhttp.ContentType).
Types ¶
This section is empty.