Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui, hive dashboard, agent page: one profile menu with the signed-in user, avatar and authelia links

The swarm UI's user menu moves to @hive/shared and takes the whoami URL and
authelia's URL as props; the swarm UI keeps a thin wrapper, and the hive
dashboard and the per-agent page mount the same component. The dashboard's
nginx vhost proxies /api/whoami to authelia (the agent page is served from
the same vhost), and hive-c0re's state carries authelia_public_url, set from
services.hyperhive.swarm.authelia.url. The agent page shows the menu only
behind the gateway.
This commit is contained in:
iris 2026-10-25 15:05:35 +01:00 • committed by mara
commit cd41e1d510
19 changed files with 417 additions and 154 deletions

View file

@ -122,6 +122,12 @@ in
# a reading no correctly-built hive should ever have to make.
HIVE_RESERVED_NAMES = lib.concatStringsSep " " (import ../../reserved-names.nix);
}
// {
# Browser URL of the swarm's SSO provider. The dashboard's and the agent
# page's profile menu link authelia's settings and sign-out pages from it.
# Always set: `swarm.authelia.url` has a default.
HIVE_AUTHELIA_PUBLIC_URL = config.services.hyperhive.swarm.authelia.url;
}
// lib.optionalAttrs (config.services.hyperhive.swarm.matrix.gatewayHost != null) {
# Matrix homeserver URL for each agent's hive-matrix-daemon — the
# gateway vhost (`chat.<swarm-domain>`). Forwarded to agents by meta.rs

View file

@ -133,6 +133,25 @@ let
};
};
# Who is signed in, for the profile menu of the dashboard and the agent page
# (both are served from this vhost, so one location covers both). Authelia
# answers with the session's display name and e-mail; the swarm UI's
# `/api/whoami` (../swarm-ui.nix) is the same location. `=` exact match, so
# the `proxy_pass` URI replaces the request's, and it wins over `/api/`.
whoamiLocation = {
"= /api/whoami" = {
proxyPass = "https://${autheliaDomain}/api/user/info";
# nixpkgs appends its OWN `Host $host` after extraConfig, which would
# override verifiedProxyTo's — see the comment on verifiedProxyTo in
# ../hive-gateway/vhost-lib.nix.
recommendedProxySettings = false;
extraConfig = ''
${dashboardAuth}
${gatewayCfg.lib.verifiedProxyTo autheliaDomain}
'';
};
};
# The subrequest `dashboardAuth` makes, the same as the swarm UI's
# (../swarm-ui.nix), which documents the header set.
autheliaLocation = {
@ -182,7 +201,12 @@ in
# `auth_request` cannot read.
${dashboardDomain} = {
forceSSL = true;
locations = agentLocations // dashboardProxyLocation // swaggerUiLocations // autheliaLocation;
locations =
agentLocations
// dashboardProxyLocation
// whoamiLocation
// swaggerUiLocations
// autheliaLocation;
# Per-agent location blocks, generated at runtime by
# hive-c0re and written to /var/lib/hive-gateway/conf/agents.conf
# on the host — the same machine nginx runs on. nginx parses