The best way to control Claude Code, Codex and more from any computer or phone
fix(web): pairing links never use the desktop app's t3code:// address (#38442)
Julius Marminge committed
Nov 17, 2026 at 21:12 UTC
c48825322df347d266ab7465332ad490b3bf2aaf
3 files changed
+26
-6
apps/web/src/components/settings/AuthorizedClientsSettings.tsx
+3
-4
@@ -53,7 +53,6 @@ import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
53
import { Button } from "../ui/button";
54
import { Textarea } from "../ui/textarea";
55
import {
56
- isLoopbackHostname,
56
type ServerClientSessionRecord,
57
type ServerPairingLinkRecord,
58
} from "~/environments/primary";
@@ -208,9 +207,9 @@ const PairingLinkListRow = memo(function PairingLinkListRow({
207
endpointPairingUrl ??
208
(credential && endpointUrl != null && endpointUrl !== ""
209
? (hostedPairingUrl ?? resolveDesktopPairingUrl(endpointUrl, credential))
211
- : !servedByEnvironment || isLoopbackHostname(window.location.hostname)
212
- ? null
213
- : currentOriginPairingUrl);
210
+ : servedByEnvironment
211
+ ? currentOriginPairingUrl
212
+ : null);
213
const [failedCopyValue, setFailedCopyValue] = useState<string | null>(null);
214
const revealValue = failedCopyValue ?? shareablePairingUrl ?? credential ?? "";
215
const isRevealValueUrl = revealValue !== credential;
apps/web/src/components/settings/ConnectionsSettings.logic.test.ts
+13
@@ -5,6 +5,7 @@ import {
5
isServerNetworkAccessible,
6
parseManualDesktopSshTarget,
7
resolveAccessEnvironmentId,
8
+ resolveCurrentOriginPairingUrl,
9
resolveTailscaleServeBaseUrl,
10
selectQrEndpointOption,
11
togglePairingScopeSelection,
@@ -53,6 +54,18 @@ describe("parseManualDesktopSshTarget", () => {
54
});
55
});
56
57
+describe("resolveCurrentOriginPairingUrl", () => {
58
+ it.each([
59
+ ["t3code://app/settings/connections", null],
60
+ ["http://127.0.0.1:3774/settings", null],
61
+ ["http://localhost:5173/", null],
62
+ ["https://host.example.ts.net/settings", "https://host.example.ts.net/pair#token=abc"],
63
+ ["http://192.168.1.20:3773/", "http://192.168.1.20:3773/pair#token=abc"],
64
+ ])("from %s", (href, expected) => {
65
+ expect(resolveCurrentOriginPairingUrl("abc", href)).toBe(expected);
66
+ });
67
+});
68
+
69
describe("resolveTailscaleServeBaseUrl", () => {
70
it.each([
71
["https://host.tail.ts.net:441/", 443, "https://host.tail.ts.net"],
apps/web/src/components/settings/ConnectionsSettings.logic.ts
+10
-2
@@ -7,6 +7,7 @@ import { getPairingTokenFromUrl, setPairingTokenOnUrl } from "@t3tools/shared/re
7
import { readHostedPairingRequest } from "../../hostedPairing";
8
import { m, type MessageResolver } from "../../i18n/messages";
9
import {
10
+ isLoopbackHostname,
11
type ServerClientSessionRecord,
12
type ServerPairingLinkRecord,
13
} from "~/environments/primary";
@@ -448,8 +449,15 @@ export function resolveAdvertisedEndpointPairingUrl(
449
return resolveDesktopPairingUrl(endpoint.httpBaseUrl, credential);
450
}
451
451
-export function resolveCurrentOriginPairingUrl(credential: string): string {
452
- const url = new URL("/pair", window.location.href);
452
+export function resolveCurrentOriginPairingUrl(
453
+ credential: string,
454
+ currentHref: string = window.location.href,
455
+): string | null {
456
+ const url = new URL("/pair", currentHref);
457
+ // The packaged desktop window loads from t3code://app, which no other device can open.
458
+ if ((url.protocol !== "http:" && url.protocol !== "https:") || isLoopbackHostname(url.hostname)) {
459
+ return null;
460
+ }
461
return setPairingTokenOnUrl(url, credential).toString();
462
}
463