agent page: assemble forge URL backend-side

Per review: build the full forge profile URL in the harness instead
of the client. /api/state now returns forge_url: Option<String>
(assembled from the request Host header — resolves against whatever
host the operator reached the page on), replacing the forge_present
bool. The JS just links forge_url when present — no client-side URL
construction.
This commit is contained in:
iris 2026-05-21 20:23:26 +02:00 committed by Mara
parent 6ab667901d
commit fc3490086b
3 changed files with 33 additions and 15 deletions

View file

@ -677,12 +677,12 @@
// Show the screen link when the weston VNC compositor is enabled.
const screenLink = $('screen-link');
if (screenLink) screenLink.style.display = s.gui_enabled ? '' : 'none';
// Show the forge profile link when this agent has a forge account.
// The forge runs on :3000 of the same host; the user is the label.
// Forge profile link — the backend hands us the full URL (or
// null when this agent has no forge account).
const forgeLink = $('forge-link');
if (forgeLink) {
if (s.forge_present) {
forgeLink.href = `http://${window.location.hostname}:3000/${s.label}`;
if (s.forge_url) {
forgeLink.href = s.forge_url;
forgeLink.style.display = '';
} else {
forgeLink.style.display = 'none';