dashboard: hide forge links instead of guessing <hostname>:3000

Adds services.hyperhive.forge.publicUrl (defaults to the gateway vhost
URL when behindGateway=true, null otherwise). HIVE_FORGE_PUBLIC_URL is
now sourced from it instead of hardcoding https://${forge.domain}
whenever behindGateway is on.

The 4 frontend call sites that built a forge link from
state.forge_public_url now hide the link when that's absent, rather
than guessing http://<browser-hostname>:3000 — a guess that's only
correct by accident once the operator isn't on plain localhost. Fixes
the dashboard H0M3 tile, per-agent-row forge links + agent menu, the
approval-queue PR link, and the per-agent page's own meta-nav forge
link (found during this pass, same defect, not in the original
3-site inventory).

Docs + doc-comments updated to match.
This commit is contained in:
iris 2026-08-03 00:30:22 +02:00 committed by mara
commit 3512e4b019
10 changed files with 96 additions and 42 deletions

View file

@ -35,7 +35,10 @@ through. Three flex columns:
Each `NavLink.kind` resolves
differently in the frontend: `Container` → same-origin path
(the agent page is itself container-local); `Forge`
`http://<host>:3000<url>`; `External` → already absolute.
`state.forge_public_url + url` (sourced from
`services.hyperhive.forge.publicUrl`), and the link is omitted
entirely when that's unset — never guessed from `<host>:3000`;
`External` → already absolute.
All anchors are built via `el()` — agent-declared icon /
label / url strings never reach `innerHTML` (XSS-safe by
construction).

View file

@ -728,11 +728,14 @@ is a pure portal with no tab-bar or SSE subscriptions. Typography + colours
inherit from the shared theme (Catppuccin Mocha via `common.css` + `theme.css`).
Optional tiles are hidden until `home.js` confirms their availability:
Matrix is hidden until `home.js` confirms `matrix_gui_enabled` (same gating as
the dashboard's M4TR1X tab); Forge is hidden until `home.js` confirms
`state.forge_present` and fills the href from `state.forge_public_url` (the
gateway-served public URL when `services.hyperhive.forge.behindGateway=true`)
or falls back to the direct `:3000` port. Operators without matrix or forge
enabled never see dead links. `home.js` also fills the swarm/hive identity
the dashboard's M4TR1X tab); Forge is hidden until `home.js` confirms both
`state.forge_present` **and** `state.forge_public_url` (sourced from
`services.hyperhive.forge.publicUrl`, which defaults to the gateway vhost URL
when `behindGateway=true` and is `null` otherwise) and fills the href from the
latter — never guessed from the operator's browser hostname + a container
port, which is only right by accident off plain localhost. Operators without
matrix or forge enabled — or with forge on but no public URL configured —
never see a dead or wrong link. `home.js` also fills the swarm/hive identity
line at the top. Dashboard is now served at `/dashboard.html` (route swap
completed in #1464 step 2); the home page at `/` replaces the old dashboard
root. All dashboard sub-pages include a `← Home` back-link for navigation.
@ -835,7 +838,9 @@ fetch entirely.
`docs/gateway.md::Per-agent unix-socket upstream`).
Gateway-off (legacy / local dev): base URL is
`http://<host>:<container.port>` (direct TCP fallback). Forge
links resolve against `http://<host>:3000`, external links are
links resolve against `state.forge_public_url` (sourced from
`services.hyperhive.forge.publicUrl`) and are omitted entirely when
that's unset — never guessed from `<host>:3000`. External links are
already absolute. The same base URL drives the primary agent-name
link + favicon fetch, so the whole row routes through the gateway
as a unit.