Skip to main content

Crate forgetop_server

Crate forgetop_server 

Source
Expand description

Embedded HTTP server for the forgetop web dashboard.

It’s a thin frontend over the same SectionService / health services the TUI uses — no logic fork. Wave 1 is a read-only JSON API + a placeholder page, bound to 127.0.0.1 and gated by a per-session token so no other local process or web page can reach it.

Modules§

cached
The lists the dashboard shares with the terminal UI through the on-disk cache (forgetop_core::cache::CacheStore, one cache.json per install).

Structs§

Deps
The services the dashboard reads from and writes through — the same ones the TUI is given, so connections added here show up in the TUI (and vice versa).
Server
A bound, running server: where it lives and the token needed to reach it.

Constants§

DEFAULT_PORT
Default dashboard port. 0 lets the OS pick a free one.
FETCHED_AT_HEADER
The response header naming when a cached answer’s data was fetched. Absent on a live answer.

Functions§

serve_blocking
Bind + serve until the process exits (headless --dashboard). Calls on_ready with the URL once bound so the caller can open the browser.
spawn
Bind + serve in the background, returning the URL (with token) for the caller to open. Best-effort: an Err just means “no dashboard” — the TUI should carry on regardless.