From b500b84e34bcbbc9ba8cbfcd1527fee7f3f01fb8 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Sun, 26 Apr 2026 20:21:31 -0700 Subject: [PATCH] fix(web): hide endpoint rows when network access is disabled Co-authored-by: codex --- .../settings/ConnectionsSettings.tsx | 7 +- .../settings/SettingsPanels.browser.tsx | 70 +++++++++++++++++++ 2 files changed, 75 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/settings/ConnectionsSettings.tsx b/apps/web/src/components/settings/ConnectionsSettings.tsx index 3328952c7b..9326bdd1fa 100644 --- a/apps/web/src/components/settings/ConnectionsSettings.tsx +++ b/apps/web/src/components/settings/ConnectionsSettings.tsx @@ -1236,6 +1236,9 @@ export function ConnectionsSettings() { () => desktopPairingLinks.filter((pairingLink) => pairingLink.role === "client"), [desktopPairingLinks], ); + const visibleDesktopAdvertisedEndpoints = isLocalBackendNetworkAccessible + ? desktopAdvertisedEndpoints + : []; return ( {canManageLocalBackend ? ( @@ -1327,7 +1330,7 @@ export function ConnectionsSettings() { } /> - {desktopAdvertisedEndpoints.map((endpoint) => ( + {visibleDesktopAdvertisedEndpoints.map((endpoint) => ( ))} @@ -1380,7 +1383,7 @@ export function ConnectionsSettings() { ) : null} { .toBeInTheDocument(); }); + it("hides advertised endpoint rows when desktop network access is disabled", async () => { + window.desktopBridge = createDesktopBridgeStub({ + serverExposureState: { + mode: "local-only", + endpointUrl: null, + advertisedHost: null, + }, + advertisedEndpoints: [ + { + id: "loopback", + label: "This machine", + provider: { + id: "desktop-core", + label: "Desktop", + kind: "manual", + isAddon: false, + }, + httpBaseUrl: "http://127.0.0.1:3773/", + wsBaseUrl: "ws://127.0.0.1:3773/", + reachability: "loopback", + compatibility: { + hostedHttpsApp: "mixed-content-blocked", + desktopApp: "compatible", + }, + source: "desktop-core", + status: "available", + isDefault: true, + }, + { + id: "tailscale-ip", + label: "Tailscale IP", + provider: { + id: "tailscale", + label: "Tailscale", + kind: "private-network", + isAddon: true, + }, + httpBaseUrl: "http://100.105.39.17:3773/", + wsBaseUrl: "ws://100.105.39.17:3773/", + reachability: "private-network", + compatibility: { + hostedHttpsApp: "mixed-content-blocked", + desktopApp: "compatible", + }, + source: "desktop-addon", + status: "available", + }, + ], + }); + authAccessHarness.setSnapshot({ + pairingLinks: [], + clientSessions: [], + }); + setServerConfigSnapshot(createBaseServerConfig()); + + mounted = await render( + + + , + ); + + await expect.element(page.getByText("Limited to this machine.")).toBeInTheDocument(); + await expect + .element(page.getByRole("heading", { name: "This machine", exact: true })) + .not.toBeInTheDocument(); + await expect + .element(page.getByRole("heading", { name: "Tailscale IP", exact: true })) + .not.toBeInTheDocument(); + }); + it("shows diagnostics inside About with a single logs-folder action", async () => { setServerConfigSnapshot(createBaseServerConfig());