Skip to content

feat(gateway): send the gui plane's index to the harbor's SWITCH tab - #288

Merged
T-Crypt merged 3 commits into
nextfrom
T-Crypt/gui-index-to-switch
Nov 2, 2026
Merged

T-Crypt merged 3 commits into
nextfrom
T-Crypt/gui-index-to-switch

Conversation

@T-Crypt

@T-Crypt T-Crypt commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Step 7 of the switchboard plan. With berth gateway --harbor URL, the gateway's /gui/ index and / answer 302 to URL/#switch, so an old bookmark of the engine list lands on the harbor's SWITCH tab. That leaves one board.

What stays

The per-engine wake pages (/gui/NAME), their state (/gui/NAME/state), the wake POST and /gui/state answer as before. They are bookmarks to an engine's own web UI, and the harbor does not replace them. Without --harbor nothing changes, because a user who does not run the harbor still needs the index.

How

  • GUIHandler picks the index handler once. With a harbor set, it is a redirect to URL/#switch, and / points at the same place. guiGuard stays in front of every route.
  • --harbor is checked when the gateway starts. It must be an http or https address with a host, or the gateway exits 1 with --harbor "ftp://x" is not an http or https address. A trailing / is trimmed, and a pasted #switch is dropped.
  • Docs: the /gui/ section of docs/gateway.md, the SWITCH section of docs/harbor.md, and a comment in contrib/berth-gateway.service. The wake page's Host paragraph in docs/gateway.md now also says that a wake page opened by a tailnet name needs that name in --allow-host and its own tailscale serve forwarder.

Proof

  • TestGUIPlaneIndexToSwitch asserts the status and the exact Location for /gui/ and /, with and without a harbor. TestGUIPlaneWakeAndStateWithHarbor checks that the wake page and /gui/state still answer with a harbor set. TestGatewayHarborBase and TestGatewayHarborFlag cover the flag's accepted and refused values and the exit code.
  • Removing the redirect, removing only the / redirect, or removing the flag check each fails a test.
  • A gateway built from this branch, run with an empty config and no berthd, answered /gui/ and / with 302 to https://aphotic.tail2a8bb.ts.net:9798/#switch, and /gui/state with 200. --harbor ftp://x was refused.
  • go build, gofmt, go vet, go test ./..., the Windows build and vet, and golangci-lint (0 issues) pass locally.

--harbor URL makes /gui/ and / answer 302 to URL/#switch, so an old bookmark
lands on the harbor's board. The wake pages, their state endpoints and the
wake POST keep answering: an engine's own bookmark still works. Without the
flag both index URLs serve the index page, as before.
@T-Crypt
T-Crypt merged commit 60c73e2 into next Nov 2, 2026
4 checks passed
@T-Crypt
T-Crypt deleted the T-Crypt/gui-index-to-switch branch November 2, 2026 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant