Watch
0
0
Fork
You've already forked hyperhive
0

remove the agent's stats page and its endpoint

This commit is contained in:
iris 2026-11-16 19:00:52 +01:00
commit 6ed714a0a7

View file

@ -1,4 +1,4 @@
//! `/api/state` (the agent's name, for the stats and screen pages) and
//! `/api/state` (the agent's name, for the screen page) and
//! `/api/dashboard-state` (what the hive dashboard's card reads).
use axum::extract::State;
@ -6,7 +6,7 @@ use serde::Serialize;
use super::AppState;
/// What the stats and screen pages read of the agent: its name, for the title
/// What the screen page reads of the agent: its name, for the title
/// and the screen's login, and the port of the hive dashboard for the way back.
#[derive(Serialize)]
pub(super) struct Identity {
@ -67,8 +67,8 @@ struct AgentLink {
#[derive(Serialize, Clone, Copy)]
#[serde(rename_all = "snake_case")]
enum AgentLinkKind {
/// `url` is a path on the agent's container web UI (`/stats`,
/// `/screen`). Agent page: same-origin path. Dashboard:
/// `url` is a path on the agent's container web UI
/// (`/screen`). Agent page: same-origin path. Dashboard:
/// `http://<host>:<container.port><url>`.
Container,
/// `url` is already a fully-qualified absolute URL — use as-is.
@ -137,13 +137,6 @@ fn read_own_status() -> (Option<String>, Option<i64>) {
fn agent_links(gui_enabled: bool) -> Vec<AgentLink> {
let mut links = Vec::new();
links.push(AgentLink {
url: "stats.html".to_owned(),
icon: "📊".to_owned(),
label: "stats".to_owned(),
kind: AgentLinkKind::Container,
});
if gui_enabled {
links.push(AgentLink {
url: "screen.html".to_owned(),
@ -195,7 +188,7 @@ mod tests {
keys
}
/// `GET /api/state` carries exactly what the stats and screen pages read.
/// `GET /api/state` carries exactly what the screen page reads.
#[test]
fn the_identity_serialises_exactly_its_read_fields() {
let identity = super::Identity {