Closes the v0.4.x chapter — NFS works end to end. Five additions: ## Wake-on-LAN (Hosts → Bound hosts) - New core::wol module: parse any MAC form, build the 102-byte magic packet, broadcast it. No special capability needed (ephemeral source port; SO_BROADCAST). Sends to the limited broadcast (255.255.255.255) AND the server's own subnet broadcast (computed from advertised IP + detected mask) so it reaches the right VLAN. - POST /api/hosts/:mac/wol — only fires for *bound* MACs (404 otherwise) so it's not an open packet sprayer. - Bound-hosts table grows a "Wake" button with inline Waking…/Sent ✓ state. ## Webhook notifications (Advanced tab) - core::notify: NotifyConfig + NotifyStore (notify.json), one provider at a time — Slack / Discord / Teams (incoming-webhook JSON) or SMTP. SMTP password is persisted but redacted on GET behind a __keep__ sentinel the UI round-trips so the secret never leaves the box. - http-api::notify: delivery — reqwest POST for chat (provider-shaped bodies), lettre for SMTP (rustls, STARTTLS/implicit TLS, no plaintext). 10s timeout; every send is best-effort. - GET/PUT /api/notify, POST /api/notify/test. - Fired fire-and-forget on the canonical "machine is imaging" boot event and on WoL — never blocks the boot path. ## UI: Advanced tab - New nav item. Holds the webhook config card and the API reference block (relocated from the bottom of Settings). ## UI: login/setup logo (FleetDM treatment) - /api/me now returns has_custom_logo + logo_rev (public bootstrap). The login, setup, and connection-error cards render the uploaded logo full-width with the "OpenPXE" wordmark dropped — matching the sidebar. ## About: update check + licenses - "Check for updates" button → GET /api/updates/check queries the Gitea releases API (derived from CARGO_PKG_REPOSITORY) and compares to the running version. Strictly on-demand — no background polling, keeps the air-gapped promise. - License card documents the MIT OR Apache-2.0 dual license with links, plus a note on bundled components (iPXE GPLv2/UBDL, samba, wimtools). Deps: lettre (SMTP, rustls) + reqwest gains the json feature. Both rustls so the static musl binary stays OpenSSL-free. Tests: 179 passing (+notify round-trip/redaction, webhook validation, WoL-unbound-404, WoL packet loopback, version-compare). clippy clean. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
28 lines
1009 B
Rust
28 lines
1009 B
Rust
//! HTTP server — single axum app that serves:
|
|
//! - `/` the web UI (static assets from `openpxe-webui`)
|
|
//! - `/api/*` JSON API for the web UI
|
|
//! - `/boot.ipxe` the generated top-level iPXE boot menu
|
|
//! - `/boot/<entry>.ipxe` per-entry iPXE scripts (one per boot target)
|
|
//! - `/ipxe/<file>` bundled iPXE binaries (for UEFI HTTP boot)
|
|
//! - `/iso/<id>.iso` raw ISO file (with Range support)
|
|
//! - `/iso/<id>/<path>` files inside the ISO (for wimboot WIM fetches
|
|
//! and Linux kernel/initrd, without having to
|
|
//! re-extract on every request)
|
|
//!
|
|
//! The `<id>/<path>` handler uses a read-only ISO9660 shim (see `iso_fs`)
|
|
//! that lseeks into the ISO on disk — so we never keep extracted copies.
|
|
#![forbid(unsafe_code)]
|
|
|
|
pub mod app;
|
|
pub mod auth;
|
|
pub mod ipxe_script;
|
|
pub mod iso_fs;
|
|
pub mod log_stream;
|
|
pub mod notify;
|
|
pub mod state;
|
|
pub mod terminal;
|
|
pub mod uploads;
|
|
|
|
pub use app::build_router;
|
|
pub use state::AppState;
|