remove the agent's stats page and its endpoint
This commit is contained in:
parent
7d0641edf6
commit
6ed714a0a7
1 changed files with 49 additions and 1744 deletions
|
|
@ -1,8 +1,6 @@
|
|||
//! Per-container HTTP server: the stats and screen pages (`GET /stats`,
|
||||
//! `GET /screen`, `GET /static/*`), `GET /` redirecting to `/stats`, the small
|
||||
//! JSON the dashboard card and those pages read (`/api/state`,
|
||||
//! `/api/dashboard-state`, `/api/stats`) and the live event stream
|
||||
//! `/events/stream`.
|
||||
//! Per-container HTTP server: the screen page (`GET /screen`, `GET /static/*`),
|
||||
//! the small JSON the dashboard card and that page read (`/api/state`,
|
||||
//! `/api/dashboard-state`) and the live event stream `/events/stream`.
|
||||
//!
|
||||
//! Handlers are split by concern into the submodules below; this file owns the
|
||||
//! shared [`AppState`], the listener + router wiring in [`serve`], and the
|
||||
|
|
@ -13,7 +11,6 @@ pub(crate) use auth::force_logout;
|
|||
mod proxy;
|
||||
mod screen;
|
||||
mod state;
|
||||
mod stats;
|
||||
mod stream;
|
||||
|
||||
use std::net::SocketAddr;
|
||||
|
|
@ -23,7 +20,7 @@ use std::sync::{Arc, Mutex};
|
|||
use std::time::Duration;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use axum::{Router, response::Redirect, routing::get};
|
||||
use axum::{Router, routing::get};
|
||||
use backon::{ExponentialBuilder, Retryable};
|
||||
use tower_http::services::ServeDir;
|
||||
|
||||
|
|
@ -47,11 +44,9 @@ struct AppState {
|
|||
/// The API routes, without the extra proxies and the static fallback.
|
||||
fn routes() -> Router<AppState> {
|
||||
Router::new()
|
||||
.route("/", get(|| async { Redirect::temporary("stats") }))
|
||||
.route("/api/state", get(state::api_state))
|
||||
.route("/api/dashboard-state", get(state::api_dashboard_state))
|
||||
.route("/events/stream", get(stream::events_stream))
|
||||
.route("/api/stats", get(stats::api_stats))
|
||||
.route("/screen/ws", get(screen::screen_ws))
|
||||
.route("/icon", get(screen::serve_icon))
|
||||
}
|
||||
|
|
@ -92,11 +87,9 @@ pub async fn serve(label: String, port: u16, bus: Bus) -> Result<()> {
|
|||
// Mount any `services.hyperhive.agent.extraWebProxies` under `/extra/<name>/` before the
|
||||
// static fallback so declared proxies win over `ServeDir`.
|
||||
let app = proxy::mount_extra_proxies(app)
|
||||
// Anything else (`/`, `/stats`, `/screen`, `/static/*`)
|
||||
// falls through to the merged dist. ServeDir auto-appends
|
||||
// `.html` when the URL is a bare path that matches a file
|
||||
// (so `/stats` → `dist/stats.html`, `/screen` → `dist/
|
||||
// screen.html`). Per-agent `extraFiles` additions are
|
||||
// Anything else (`/screen`, `/static/*`) falls through to the merged
|
||||
// dist. ServeDir auto-appends `.html` when the URL is a bare path that
|
||||
// matches a file (so `/screen` → `dist/screen.html`). Per-agent `extraFiles` additions are
|
||||
// already layered into this same directory (see
|
||||
// services.hyperhive.agent.frontend.mergedDist in nix).
|
||||
.fallback_service(ServeDir::new(&static_dir))
|
||||
|
|
|
|||
Loading…
Reference in a new issue