@devries-cameron20 / t3code-1 / commits / 0d51d5bf6d
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): a server published through Tailscale Serve no longer reports itself as local-only (#35543)

Julius Marminge committed Nov 12, 2026 at 13:11 UTC 0d51d5bf6de6a87544eb67a21f535c9f2ce13d48
3 files changed +31 -2
apps/web/src/components/settings/ConnectionsSettings.logic.test.ts
+14
@@ -2,6 +2,7 @@ import { type DesktopWslState, EnvironmentId } from "@t3tools/contracts";
2 import { describe, expect, it, vi } from "vite-plus/test";
3 import {
4 applyWslEnableSelection,
5 + isServerNetworkAccessible,
6 resolveAccessEnvironmentId,
7 resolveTailscaleServeBaseUrl,
8 selectQrEndpointOption,
@@ -201,3 +202,16 @@ describe("resolveAccessEnvironmentId", () => {
202 );
203 });
204 });
205 +
206 +describe("isServerNetworkAccessible", () => {
207 + const served = [{ kind: "tailnet", httpBaseUrl: "https://host.example.ts.net:8443/" }] as const;
208 + it.each([
209 + { authPolicy: "remote-reachable", directEndpoints: undefined, expected: true },
210 + { authPolicy: "loopback-browser", directEndpoints: undefined, expected: false },
211 + { authPolicy: "loopback-browser", directEndpoints: [], expected: false },
212 + { authPolicy: "loopback-browser", directEndpoints: served, expected: true },
213 + { authPolicy: null, directEndpoints: served, expected: false },
214 + ] as const)("$authPolicy with $directEndpoints.length endpoints", (row) => {
215 + expect(isServerNetworkAccessible(row)).toBe(row.expected);
216 + });
217 +});
apps/web/src/components/settings/ConnectionsSettings.logic.ts
+11
@@ -20,6 +20,8 @@ import {
20 type DesktopUpdateState,
21 type DesktopWslState,
22 type EnvironmentId,
23 + type ServerAuthPolicy,
24 + type ServerDirectEndpoint,
25 } from "@t3tools/contracts";
26 import {
27 getDesktopUpdateDownloadedVersion,
@@ -369,6 +371,15 @@ export function selectPairingEndpoint(
371 );
372 }
373
374 +/** A loopback server advertises a direct endpoint only once its Tailscale Serve URL answers. */
375 +export function isServerNetworkAccessible(input: {
376 + readonly authPolicy: ServerAuthPolicy | null;
377 + readonly directEndpoints: ReadonlyArray<ServerDirectEndpoint> | undefined;
378 +}): boolean {
379 + if (input.authPolicy === "remote-reachable") return true;
380 + return input.authPolicy === "loopback-browser" && (input.directEndpoints?.length ?? 0) > 0;
381 +}
382 +
383 export function isTailscaleHttpsEndpoint(endpoint: AdvertisedEndpoint): boolean {
384 return endpoint.id.startsWith("tailscale-magicdns:");
385 }
apps/web/src/components/settings/ConnectionsSettings.tsx
+6 -2
@@ -122,6 +122,7 @@ import {
122 toDesktopPairingLinkRecord,
123 toDesktopClientSessionRecord,
124 selectPairingEndpoint,
125 + isServerNetworkAccessible,
126 isTailscaleHttpsEndpoint,
127 endpointDefaultPreferenceKey,
128 } from "./ConnectionsSettings.logic";
@@ -439,7 +440,10 @@ function ConnectionsSettingsContent({
440 })();
441 const isLocalBackendNetworkAccessible = desktopBridge
442 ? desktopServerExposureState?.mode === "network-accessible"
442 - : currentAuthPolicy === "remote-reachable";
443 + : isServerNetworkAccessible({
444 + authPolicy: currentAuthPolicy,
445 + directEndpoints: accessEnvironment?.serverConfig?.directEndpoints,
446 + });
447 const trimmedTailscaleServePortInput = tailscaleServePortInput.trim();
448 const parsedTailscaleServePort = Number(trimmedTailscaleServePortInput);
449 const isTailscaleServePortValid =
@@ -1098,7 +1102,7 @@ function ConnectionsSettingsContent({
1102 description={
1103 desktopBridge
1104 ? "This connection cannot view or change network exposure."
1101 - : currentAuthPolicy === "remote-reachable"
1105 + : isLocalBackendNetworkAccessible
1106 ? "Remote access is already configured. Change network exposure where the server starts."
1107 : currentAuthPolicy === "loopback-browser"
1108 ? "Only this machine can connect. Restart with a non-loopback host for remote pairing."