ci / rust (push) Successful in 4m36s
Earlier today I picked option 1 from NAP-231's open question (run `maestro-registry` locally on a different port). That was wrong: the user-facing framing is "local web UI", and option 2 — a thin front-end that serves the web bundle and reverse-proxies `/api/*` to whatever registry the daemon is already registered with — is what actually delivers that. What the new crate does: - `crates/maestro-web` ships a single binary `maestro-web`. - It embeds the web bundle the same way `maestro-registry` does (rust-embed against `web/dist/`). - Mounts the bundle at `/` and a reverse proxy at `/api/*` (catch-all). - HTTP proxy via `reqwest` — forwards method, headers (minus hop-by-hop), body, and passes upstream response headers (including `Set-Cookie`) back to the browser. - WS proxy upgrades both sides and shuttles frames with `tokio::select!`. Cookies on the initial `WebSocket` upgrade headers are forwarded so the registry sees the same browser session. - Reads `MAESTRO_REGISTRY` (upstream URL) and `MAESTRO_WEB_BIND_ADDR` (default `127.0.0.1:8888`) from env. - An integration test (`tests/proxy.rs`) stands up a mock upstream, proxies an HTTP request with cookies through, and round-trips a text WebSocket frame to verify the WS path. Installer changes: - Wizard now `cargo install`s `maestro-web` (not `maestro-registry`) when the user opts into the web service. - Unit template switched: `ExecStart=%h/.cargo/bin/maestro-web` plus `Environment=MAESTRO_REGISTRY=<upstream>` + `Environment=MAESTRO_WEB_BIND_ADDR=<bind>`. - New `--web-registry <URL>` flag. Default in interactive mode: read `registry_url` straight out of `~/.config/maestrod/config.toml`, so the proxy lines up with what the daemon is using without further prompting. Non-interactive runs without either of those error out rather than guess. Docs: - `docs/INSTALL.md` updated unit body + flag table. - `CLAUDE.md` repo-layout block now lists `maestro-web`. 148 tests pass workspace-wide (9 new in maestro-web, including the proxy integration test; 15 in installer).
30 lines
842 B
TOML
30 lines
842 B
TOML
[package]
|
|
name = "maestro-web"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
repository.workspace = true
|
|
publish.workspace = true
|
|
description = "Thin web-UI front-end: serves the embedded web bundle and reverse-proxies /api to an upstream registry"
|
|
|
|
[lib]
|
|
path = "src/lib.rs"
|
|
|
|
[[bin]]
|
|
name = "maestro-web"
|
|
path = "src/main.rs"
|
|
|
|
[dependencies]
|
|
axum.workspace = true
|
|
futures-util.workspace = true
|
|
reqwest = { workspace = true, default-features = false, features = ["rustls-tls", "stream"] }
|
|
rust-embed.workspace = true
|
|
thiserror.workspace = true
|
|
tokio.workspace = true
|
|
tokio-tungstenite = { workspace = true, features = ["rustls-tls-webpki-roots"] }
|
|
tracing.workspace = true
|
|
tracing-subscriber.workspace = true
|
|
|
|
[dev-dependencies]
|
|
tokio = { workspace = true, features = ["macros", "rt-multi-thread", "test-util"] }
|