Expand description
The embedded HTTP server — a monitoring + control API (axum) and, when the
dashboard feature is on, the React SPA (embedded via rust-embed). Behind
the server feature; another consumer of the library, like the CLI.
Auth: reads are always open; writes (control) are gated by an optional
password (None = open). The LAN access code stays server-side and never
reaches a client.
Re-exports§
pub use api::AppState;pub use api::FakeSource;pub use api::PrinterSource;pub use camera::CameraSource;pub use camera::ExternalCamera;pub use camera::LiveCamera;pub use camera::NoCamera;pub use control::Controller;pub use control::FakeController;pub use control::LiveController;pub use files::FakeFiles;pub use files::FileStore;pub use files::LiveFiles;pub use live::LiveSource;pub use start::FakeStarter;pub use start::LiveStarter;pub use start::Starter;
Modules§
- api
- The axum router, app state, the printer-source seam + fake source, and the HTTP API (reads + control).
- camera
- The built-in (printer chamber) camera seam for the server — distinct from the
external IP-camera proxy, which is just a URL on
super::AppState. Live mode grabs a JPEG over TCP:6000 (seecrate::camera); fake / no-target mode has no built-in camera. Abstracted as a trait so the server stays testable without a real printer. - control
- Control actions (the write side of the API) and the controller seam.
- files
- File access (the printer’s storage) — list + upload, behind a seam so the API
is testable without a printer: tests and
--fakeuseFakeFiles; live mode usesLiveFiles(FTPS). Listing is a read (open); upload is a write (password-gated). Both are blocking — call fromspawn_blocking. - live
- The live printer source: bridges the blocking LAN MQTT
monitorloop into awatchchannel so the dashboard can stream the real device status the same way it streams the fake one. - start
- Starting a print (the write side, separate from simple control because it
carries file/plate/AMS parameters and needs a fresh MQTT connection). Behind
a seam so the API is testable: tests/
--fakeuseFakeStarter; live mode usesLiveStarter(project_file/gcode_file+ verify). - stream_
record - Recording a camera’s MJPEG stream to disk for the “plain” timelapse. For a
camera that exposes a real
/stream, this captures the actual continuous video instead of time-sampling/snapshot. The copy + reconnect logic is pure (the stream opener and the sink are injected), so it’s unit-tested without a network: tests feed canned readers and aVecsink, and drive the cancel signal. - timelapse
- Serve-internal per-layer timelapse capture. The dashboard’s single MQTT
connection already streams
PrinterStatusover awatchchannel, so the capture runs insidebambu serveoff that feed — no second printer connection (the A1 mini allows only one) and the lowest possible latency.
Structs§
Functions§
- serve
- Run the server (blocking; owns its own multi-thread runtime).