From bff64a3f19bf7e6337b346bc14454bf6479630a4 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Mon, 27 Apr 2026 23:54:23 -0700 Subject: [PATCH] Harden pairing and SSH prompt flows - Preserve Tailscale Serve port when toggling exposure - Prevent reused hosted pairing tokens and double SSH responses - Refine endpoint compatibility for HTTP custom URLs --- apps/desktop/src/desktopSettings.test.ts | 21 + apps/desktop/src/desktopSettings.ts | 5 +- apps/desktop/src/main.ts | 19 +- apps/desktop/src/serverExposure.test.ts | 25 +- apps/desktop/src/serverExposure.ts | 8 +- .../components/auth/PairingRouteSurface.tsx | 28 +- .../desktop/SshPasswordPromptDialog.tsx | 92 +- .../settings/ConnectionsSettings.tsx | 1009 ++++++----------- 8 files changed, 466 insertions(+), 741 deletions(-) diff --git a/apps/desktop/src/desktopSettings.test.ts b/apps/desktop/src/desktopSettings.test.ts index c012e39b5f..cc58dc810e 100644 --- a/apps/desktop/src/desktopSettings.test.ts +++ b/apps/desktop/src/desktopSettings.test.ts @@ -105,6 +105,27 @@ describe("desktopSettings", () => { }); }); + it("preserves the configured Tailscale Serve port when no new port is requested", () => { + expect( + setDesktopTailscaleServePreference( + { + serverExposureMode: "local-only", + tailscaleServeEnabled: false, + tailscaleServePort: 8443, + updateChannel: "latest", + updateChannelConfiguredByUser: false, + }, + { enabled: true }, + ), + ).toEqual({ + serverExposureMode: "local-only", + tailscaleServeEnabled: true, + tailscaleServePort: 8443, + updateChannel: "latest", + updateChannelConfiguredByUser: false, + }); + }); + it("persists the requested nightly update channel", () => { expect( setDesktopUpdateChannelPreference( diff --git a/apps/desktop/src/desktopSettings.ts b/apps/desktop/src/desktopSettings.ts index 854c363e09..5a61faef80 100644 --- a/apps/desktop/src/desktopSettings.ts +++ b/apps/desktop/src/desktopSettings.ts @@ -45,7 +45,10 @@ export function setDesktopTailscaleServePreference( settings: DesktopSettings, input: { readonly enabled: boolean; readonly port?: number }, ): DesktopSettings { - const port = normalizeTailscaleServePort(input.port); + const port = + input.port === undefined + ? settings.tailscaleServePort + : normalizeTailscaleServePort(input.port); return settings.tailscaleServeEnabled === input.enabled && settings.tailscaleServePort === port ? settings : { diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts index f80f34b264..005cc1e43f 100644 --- a/apps/desktop/src/main.ts +++ b/apps/desktop/src/main.ts @@ -38,6 +38,7 @@ import { RotatingFileSink } from "@t3tools/shared/logging"; import { parsePersistedServerObservabilitySettings } from "@t3tools/shared/serverSettings"; import { DEFAULT_DESKTOP_BACKEND_PORT, resolveDesktopBackendPort } from "./backendPort.ts"; import { + type DesktopSettings, DEFAULT_DESKTOP_SETTINGS, readDesktopSettings, setDesktopServerExposurePreference, @@ -402,13 +403,14 @@ async function applyDesktopServerExposureMode( return getDesktopServerExposureState(); } -async function applyDesktopTailscaleServeEnabled(input: { - readonly enabled: boolean; - readonly port?: number; -}): Promise { - desktopSettings = setDesktopTailscaleServePreference(desktopSettings, input); +async function applyDesktopTailscaleServeEnabled( + nextSettings: DesktopSettings, +): Promise { + desktopSettings = nextSettings; writeDesktopSettings(DESKTOP_SETTINGS_PATH, desktopSettings); - relaunchDesktopApp(input.enabled ? "tailscale-serve-enabled" : "tailscale-serve-disabled"); + relaunchDesktopApp( + desktopSettings.tailscaleServeEnabled ? "tailscale-serve-enabled" : "tailscale-serve-disabled", + ); return getDesktopServerExposureState(); } @@ -1751,10 +1753,7 @@ function registerIpcHandlers(): void { if (nextSettings === desktopSettings) { return getDesktopServerExposureState(); } - return applyDesktopTailscaleServeEnabled({ - enabled: input.enabled, - port: nextSettings.tailscaleServePort, - }); + return applyDesktopTailscaleServeEnabled(nextSettings); }); ipcMain.removeHandler(GET_ADVERTISED_ENDPOINTS_CHANNEL); diff --git a/apps/desktop/src/serverExposure.test.ts b/apps/desktop/src/serverExposure.test.ts index 86e9d3a655..3c101628e0 100644 --- a/apps/desktop/src/serverExposure.test.ts +++ b/apps/desktop/src/serverExposure.test.ts @@ -101,7 +101,10 @@ describe("resolveDesktopCoreAdvertisedEndpoints", () => { resolveDesktopCoreAdvertisedEndpoints({ port: 3773, exposure, - customHttpsEndpointUrls: ["https://desktop.example.ts.net"], + customHttpsEndpointUrls: [ + "https://desktop.example.ts.net", + "http://desktop.example.test:3773", + ], }), ).toEqual([ { @@ -165,6 +168,26 @@ describe("resolveDesktopCoreAdvertisedEndpoints", () => { status: "unknown", description: "User-configured HTTPS endpoint for this desktop backend.", }, + { + id: "manual:http://desktop.example.test:3773", + label: "Custom HTTPS", + provider: { + id: "manual", + label: "Manual", + kind: "manual", + isAddon: false, + }, + httpBaseUrl: "http://desktop.example.test:3773/", + wsBaseUrl: "ws://desktop.example.test:3773/", + reachability: "public", + compatibility: { + hostedHttpsApp: "mixed-content-blocked", + desktopApp: "compatible", + }, + source: "user", + status: "unknown", + description: "User-configured HTTPS endpoint for this desktop backend.", + }, ]); }); }); diff --git a/apps/desktop/src/serverExposure.ts b/apps/desktop/src/serverExposure.ts index fb6b284b9e..332f34cfee 100644 --- a/apps/desktop/src/serverExposure.ts +++ b/apps/desktop/src/serverExposure.ts @@ -49,6 +49,10 @@ const normalizeOptionalHost = (value: string | undefined): string | undefined => const isUsableLanIpv4Address = (address: string): boolean => !address.startsWith("127.") && !address.startsWith("169.254."); +function isHttpsEndpointUrl(value: string): boolean { + return new URL(value).protocol === "https:"; +} + export function resolveLanAdvertisedHost( networkInterfaces: NodeJS.Dict, explicitHost: string | undefined, @@ -162,7 +166,9 @@ export function resolveDesktopCoreAdvertisedEndpoints( label: "Custom HTTPS", httpBaseUrl: customEndpointUrl, reachability: "public", - hostedHttpsCompatibility: "compatible", + ...(isHttpsEndpointUrl(customEndpointUrl) + ? ({ hostedHttpsCompatibility: "compatible" } as const) + : {}), status: "unknown", description: "User-configured HTTPS endpoint for this desktop backend.", }), diff --git a/apps/web/src/components/auth/PairingRouteSurface.tsx b/apps/web/src/components/auth/PairingRouteSurface.tsx index 46349ca1fa..d301d6f410 100644 --- a/apps/web/src/components/auth/PairingRouteSurface.tsx +++ b/apps/web/src/components/auth/PairingRouteSurface.tsx @@ -166,6 +166,7 @@ export function HostedPairingRouteSurface() { const [status, setStatus] = useState<"pairing" | "paired" | "error">("pairing"); const [message, setMessage] = useState("Connecting to this backend."); const submitAttemptedRef = useRef(false); + const tokenSubmittedRef = useRef(false); const submitHostedPairingRequest = useCallback(async () => { const request = hostedPairingRequestRef.current; @@ -176,8 +177,15 @@ export function HostedPairingRouteSurface() { return; } + if (tokenSubmittedRef.current) { + setStatus("error"); + setMessage("This one-time pairing token was already submitted. Request a new pairing link."); + return; + } + setStatus("pairing"); setMessage("Connecting to this backend."); + tokenSubmittedRef.current = true; try { const record = await addSavedEnvironment({ @@ -189,7 +197,9 @@ export function HostedPairingRouteSurface() { setMessage(`${record.label} is saved in this browser.`); } catch (error) { setStatus("error"); - setMessage(errorMessageFromUnknown(error)); + setMessage( + `${errorMessageFromUnknown(error)} Request a new pairing link before trying again.`, + ); } }, []); @@ -240,13 +250,15 @@ export function HostedPairingRouteSurface() { ) : null}
- + {status === "pairing" ? ( + + ) : !tokenSubmittedRef.current ? ( + + ) : null} {status === "paired" ? ( - - +
{ + event.preventDefault(); + void respond(password); + }} + > + + SSH Password Required + + T3 needs your SSH password to connect to{" "} + {target ? {target} : "the remote host"}. The password is passed to the + local SSH process for this connection attempt and is not saved by T3 Code. + + + +
+

{currentRequest?.prompt}

+ setPassword(event.target.value)} + /> +
+

+ Use SSH keys to avoid repeated password prompts on new SSH sessions. +

+
+ + + + +
); diff --git a/apps/web/src/components/settings/ConnectionsSettings.tsx b/apps/web/src/components/settings/ConnectionsSettings.tsx index 41ab20310b..033c8a45b4 100644 --- a/apps/web/src/components/settings/ConnectionsSettings.tsx +++ b/apps/web/src/components/settings/ConnectionsSettings.tsx @@ -1,17 +1,5 @@ -import { - ChevronDownIcon, - PlusIcon, - QrCodeIcon, - RefreshCwIcon, -} from "lucide-react"; -import { - type ReactNode, - memo, - useCallback, - useEffect, - useMemo, - useState, -} from "react"; +import { ChevronDownIcon, PlusIcon, QrCodeIcon, RefreshCwIcon } from "lucide-react"; +import { type ReactNode, memo, useCallback, useEffect, useMemo, useState } from "react"; import { type AuthClientSession, type AuthPairingLink, @@ -25,14 +13,8 @@ import { DateTime } from "effect"; import { useCopyToClipboard } from "../../hooks/useCopyToClipboard"; import { cn } from "../../lib/utils"; -import { - formatElapsedDurationLabel, - formatExpiresInLabel, -} from "../../timestampFormat"; -import { - resolveDesktopPairingUrl, - resolveHostedPairingUrl, -} from "./pairingUrls"; +import { formatElapsedDurationLabel, formatExpiresInLabel } from "../../timestampFormat"; +import { resolveDesktopPairingUrl, resolveHostedPairingUrl } from "./pairingUrls"; import { SettingsPageContainer, SettingsRow, @@ -132,9 +114,7 @@ function ConnectionStatusDot({ )} /> ) : null} - + ); @@ -160,10 +140,7 @@ function ConnectionStatusDot({ return ( - + {tooltipText} @@ -179,9 +156,7 @@ function getSavedBackendStatusTooltip( if (connectionState === "connected") { const connectedAt = runtime?.connectedAt ?? record.lastConnectedAt; - return connectedAt - ? `Connected for ${formatElapsedDurationLabel(connectedAt, nowMs)}` - : null; + return connectedAt ? `Connected for ${formatElapsedDurationLabel(connectedAt, nowMs)}` : null; } if (connectionState === "connecting") { @@ -197,12 +172,8 @@ function getSavedBackendStatusTooltip( : "Not connected yet."; } -function formatDesktopSshTarget( - target: NonNullable, -): string { - const authority = target.username - ? `${target.username}@${target.hostname}` - : target.hostname; +function formatDesktopSshTarget(target: NonNullable): string { + const authority = target.username ? `${target.username}@${target.hostname}` : target.hostname; return target.port ? `${authority}:${target.port}` : authority; } @@ -252,10 +223,7 @@ function parseManualDesktopSshTarget(input: { throw new Error("SSH host or alias is required."); } - if ( - port !== null && - (!Number.isInteger(port) || port <= 0 || port > 65_535) - ) { + if (port !== null && (!Number.isInteger(port) || port <= 0 || port > 65_535)) { throw new Error("SSH port must be between 1 and 65535."); } @@ -268,26 +236,19 @@ function parseManualDesktopSshTarget(input: { } /** Direct row in the card – same pattern as the Provider / ACP-agent list rows. */ -const ITEM_ROW_CLASSNAME = - "border-t border-border/60 px-4 py-4 first:border-t-0 sm:px-5"; -const ENDPOINT_ROW_CLASSNAME = - "border-t border-border/60 px-4 py-2.5 first:border-t-0 sm:px-5"; +const ITEM_ROW_CLASSNAME = "border-t border-border/60 px-4 py-4 first:border-t-0 sm:px-5"; +const ENDPOINT_ROW_CLASSNAME = "border-t border-border/60 px-4 py-2.5 first:border-t-0 sm:px-5"; const ITEM_ROW_INNER_CLASSNAME = "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between"; -function sortDesktopPairingLinks( - links: ReadonlyArray, -) { +function sortDesktopPairingLinks(links: ReadonlyArray) { return [...links].toSorted( - (left, right) => - new Date(right.createdAt).getTime() - new Date(left.createdAt).getTime(), + (left, right) => new Date(right.createdAt).getTime() - new Date(left.createdAt).getTime(), ); } -function sortDesktopClientSessions( - sessions: ReadonlyArray, -) { +function sortDesktopClientSessions(sessions: ReadonlyArray) { return [...sessions].toSorted((left, right) => { if (left.current !== right.current) { return left.current ? -1 : 1; @@ -295,15 +256,11 @@ function sortDesktopClientSessions( if (left.connected !== right.connected) { return left.connected ? -1 : 1; } - return ( - new Date(right.issuedAt).getTime() - new Date(left.issuedAt).getTime() - ); + return new Date(right.issuedAt).getTime() - new Date(left.issuedAt).getTime(); }); } -function toDesktopPairingLinkRecord( - pairingLink: AuthPairingLink, -): ServerPairingLinkRecord { +function toDesktopPairingLinkRecord(pairingLink: AuthPairingLink): ServerPairingLinkRecord { return { ...pairingLink, createdAt: DateTime.formatIso(pairingLink.createdAt), @@ -311,9 +268,7 @@ function toDesktopPairingLinkRecord( }; } -function toDesktopClientSessionRecord( - clientSession: AuthClientSession, -): ServerClientSessionRecord { +function toDesktopClientSessionRecord(clientSession: AuthClientSession): ServerClientSessionRecord { return { ...clientSession, issuedAt: DateTime.formatIso(clientSession.issuedAt), @@ -329,9 +284,7 @@ function upsertDesktopPairingLink( current: ReadonlyArray, next: ServerPairingLinkRecord, ) { - const existingIndex = current.findIndex( - (pairingLink) => pairingLink.id === next.id, - ); + const existingIndex = current.findIndex((pairingLink) => pairingLink.id === next.id); if (existingIndex === -1) { return sortDesktopPairingLinks([...current, next]); } @@ -340,10 +293,7 @@ function upsertDesktopPairingLink( return sortDesktopPairingLinks(updated); } -function removeDesktopPairingLink( - current: ReadonlyArray, - id: string, -) { +function removeDesktopPairingLink(current: ReadonlyArray, id: string) { return current.filter((pairingLink) => pairingLink.id !== id); } @@ -366,22 +316,17 @@ function removeDesktopClientSession( current: ReadonlyArray, sessionId: ServerClientSessionRecord["sessionId"], ) { - return current.filter( - (clientSession) => clientSession.sessionId !== sessionId, - ); + return current.filter((clientSession) => clientSession.sessionId !== sessionId); } function selectPairingEndpoint( endpoints: ReadonlyArray, defaultEndpointKey?: string | null, ): AdvertisedEndpoint | null { - const availableEndpoints = endpoints.filter( - (endpoint) => endpoint.status !== "unavailable", - ); + const availableEndpoints = endpoints.filter((endpoint) => endpoint.status !== "unavailable"); if (defaultEndpointKey) { const selectedEndpoint = availableEndpoints.find( - (endpoint) => - endpointDefaultPreferenceKey(endpoint) === defaultEndpointKey, + (endpoint) => endpointDefaultPreferenceKey(endpoint) === defaultEndpointKey, ); if (selectedEndpoint) { return selectedEndpoint; @@ -389,12 +334,8 @@ function selectPairingEndpoint( } return ( availableEndpoints.find((endpoint) => endpoint.isDefault) ?? - availableEndpoints.find( - (endpoint) => endpoint.reachability !== "loopback", - ) ?? - availableEndpoints.find( - (endpoint) => endpoint.compatibility.hostedHttpsApp === "compatible", - ) ?? + availableEndpoints.find((endpoint) => endpoint.reachability !== "loopback") ?? + availableEndpoints.find((endpoint) => endpoint.compatibility.hostedHttpsApp === "compatible") ?? null ); } @@ -491,26 +432,19 @@ const PairingLinkListRow = memo(function PairingLinkListRow({ ); const endpointPairingUrl = useMemo(() => { const endpoint = selectPairingEndpoint(endpoints, defaultEndpointKey); - return endpoint - ? resolveAdvertisedEndpointPairingUrl(endpoint, pairingLink.credential) - : null; + return endpoint ? resolveAdvertisedEndpointPairingUrl(endpoint, pairingLink.credential) : null; }, [defaultEndpointKey, endpoints, pairingLink.credential]); const endpointCopyOptions = useMemo( () => endpoints .filter((endpoint) => endpoint.status !== "unavailable") .map((endpoint) => { - const url = resolveAdvertisedEndpointPairingUrl( - endpoint, - pairingLink.credential, - ); + const url = resolveAdvertisedEndpointPairingUrl(endpoint, pairingLink.credential); return { key: endpointDefaultPreferenceKey(endpoint), label: endpoint.label, url, - detail: isHostedAppPairingUrl(url) - ? "Hosted app link" - : "Backend pairing URL", + detail: isHostedAppPairingUrl(url) ? "Hosted app link" : "Backend pairing URL", }; }), [endpoints, pairingLink.credential], @@ -518,8 +452,7 @@ const PairingLinkListRow = memo(function PairingLinkListRow({ const shareablePairingUrl = endpointPairingUrl ?? (endpointUrl != null && endpointUrl !== "" - ? (hostedPairingUrl ?? - resolveDesktopPairingUrl(endpointUrl, pairingLink.credential)) + ? (hostedPairingUrl ?? resolveDesktopPairingUrl(endpointUrl, pairingLink.credential)) : isLoopbackHostname(window.location.hostname) ? null : currentOriginPairingUrl); @@ -555,9 +488,7 @@ const PairingLinkListRow = memo(function PairingLinkListRow({ ? "Could not copy pairing URL" : "Could not copy pairing code" : "Clipboard copy unavailable", - description: canCopyToClipboard - ? error.message - : "Showing the full value instead.", + description: canCopyToClipboard ? error.message : "Showing the full value instead.", }), ); }, @@ -597,9 +528,7 @@ const PairingLinkListRow = memo(function PairingLinkListRow({ tooltipText={`Link created at ${formatAccessTimestamp(pairingLink.createdAt)}`} dotClassName="bg-amber-400" /> -

- {primaryLabel} -

+

{primaryLabel}

{shareablePairingUrl ? ( <> @@ -617,12 +546,7 @@ const PairingLinkListRow = memo(function PairingLinkListRow({ > - +

- {[ - roleLabel, - formatExpiresInLabel(pairingLink.expiresAt, nowMs), - ].join(" · ")} + {[roleLabel, formatExpiresInLabel(pairingLink.expiresAt, nowMs)].join(" · ")}

{shareablePairingUrl === null ? (

- Copy the token and pair from another client using this - backend's reachable host. + Copy the token and pair from another client using this backend's reachable host.

) : null}
- + {canCopyToClipboard ? ( <> @@ -685,14 +598,10 @@ const PairingLinkListRow = memo(function PairingLinkListRow({ {endpointCopyOptions.map((option) => ( - copyPairingValue(option.url, "link") - } + onClick={() => copyPairingValue(option.url, "link")} > - - {option.label} - + {option.label} {option.detail} @@ -703,11 +612,7 @@ const PairingLinkListRow = memo(function PairingLinkListRow({ ) : ( - ) @@ -757,10 +662,7 @@ const PairingLinkListRow = memo(function PairingLinkListRow({ ) : null} - {canCopyToClipboard ? ( @@ -809,8 +711,7 @@ const ConnectedClientListRow = memo(function ConnectedClientListRow({ const roleLabel = clientSession.role === "owner" ? "Owner" : "Client"; const deviceInfoBits = [ clientSession.client.deviceType !== "unknown" - ? clientSession.client.deviceType[0]?.toUpperCase() + - clientSession.client.deviceType.slice(1) + ? clientSession.client.deviceType[0]?.toUpperCase() + clientSession.client.deviceType.slice(1) : null, clientSession.client.os ?? null, clientSession.client.browser ?? null, @@ -818,9 +719,7 @@ const ConnectedClientListRow = memo(function ConnectedClientListRow({ ].filter((value): value is string => value !== null); const primaryLabel = clientSession.client.label ?? - ([clientSession.client.os, clientSession.client.browser] - .filter(Boolean) - .join(" · ") || + ([clientSession.client.os, clientSession.client.browser].filter(Boolean).join(" · ") || clientSession.subject); return ( @@ -833,9 +732,7 @@ const ConnectedClientListRow = memo(function ConnectedClientListRow({ dotClassName={isLive ? "bg-success" : "bg-muted-foreground/30"} pingClassName={isLive ? "bg-success/60 duration-2000" : null} /> -

- {primaryLabel} -

+

{primaryLabel}

{clientSession.current ? ( This device @@ -854,9 +751,7 @@ const ConnectedClientListRow = memo(function ConnectedClientListRow({ disabled={revokingClientSessionId === clientSession.sessionId} onClick={() => void onRevokeSession(clientSession.sessionId)} > - {revokingClientSessionId === clientSession.sessionId - ? "Revoking…" - : "Revoke"} + {revokingClientSessionId === clientSession.sessionId ? "Revoking…" : "Revoke"} ) : null}
@@ -871,112 +766,103 @@ type AuthorizedClientsHeaderActionProps = { onRevokeOtherClients: () => void; }; -const AuthorizedClientsHeaderAction = memo( - function AuthorizedClientsHeaderAction({ - clientSessions, - isRevokingOtherClients, - onRevokeOtherClients, - }: AuthorizedClientsHeaderActionProps) { - const [dialogOpen, setDialogOpen] = useState(false); - const [pairingLabel, setPairingLabel] = useState(""); - const [isCreatingPairingLink, setIsCreatingPairingLink] = useState(false); +const AuthorizedClientsHeaderAction = memo(function AuthorizedClientsHeaderAction({ + clientSessions, + isRevokingOtherClients, + onRevokeOtherClients, +}: AuthorizedClientsHeaderActionProps) { + const [dialogOpen, setDialogOpen] = useState(false); + const [pairingLabel, setPairingLabel] = useState(""); + const [isCreatingPairingLink, setIsCreatingPairingLink] = useState(false); - const handleCreatePairingLink = useCallback(async () => { - setIsCreatingPairingLink(true); - try { - await createServerPairingCredential(pairingLabel); - setPairingLabel(""); - setDialogOpen(false); - } catch (error) { - const message = - error instanceof Error - ? error.message - : "Failed to create pairing URL."; - toastManager.add( - stackedThreadToast({ - type: "error", - title: "Could not create pairing URL", - description: message, - }), - ); - } finally { - setIsCreatingPairingLink(false); - } - }, [pairingLabel]); + const handleCreatePairingLink = useCallback(async () => { + setIsCreatingPairingLink(true); + try { + await createServerPairingCredential(pairingLabel); + setPairingLabel(""); + setDialogOpen(false); + } catch (error) { + const message = error instanceof Error ? error.message : "Failed to create pairing URL."; + toastManager.add( + stackedThreadToast({ + type: "error", + title: "Could not create pairing URL", + description: message, + }), + ); + } finally { + setIsCreatingPairingLink(false); + } + }, [pairingLabel]); - return ( -
- + { + setDialogOpen(open); + if (!open) { + setPairingLabel(""); } - onClick={() => void onRevokeOtherClients()} - > - {isRevokingOtherClients ? "Revoking…" : "Revoke others"} - - { - setDialogOpen(open); - if (!open) { - setPairingLabel(""); - } - }} - > - - - Create link - - } - /> - - - Create pairing link - - Generate a one-time link that another device can use to pair - with this backend as an authorized client. - - - - - - - + } + /> + + + Create pairing link + + Generate a one-time link that another device can use to pair with this backend as an + authorized client. + + + + - - -
- ); - }, -); + autoFocus + /> + + + + + + + + + + ); +}); type PairingClientsListProps = { endpointUrl: string | null | undefined; @@ -988,9 +874,7 @@ type PairingClientsListProps = { revokingPairingLinkId: string | null; revokingClientSessionId: string | null; onRevokePairingLink: (id: string) => void; - onRevokeClientSession: ( - sessionId: ServerClientSessionRecord["sessionId"], - ) => void; + onRevokeClientSession: (sessionId: ServerClientSessionRecord["sessionId"]) => void; }; const PairingClientsList = memo(function PairingClientsList({ @@ -1028,13 +912,9 @@ const PairingClientsList = memo(function PairingClientsList({ /> ))} - {pairingLinks.length === 0 && - clientSessions.length === 0 && - !isLoading ? ( + {pairingLinks.length === 0 && clientSessions.length === 0 && !isLoading ? (
-

- No pairing links or client sessions. -

+

No pairing links or client sessions.

) : null} @@ -1059,8 +939,7 @@ const AdvertisedEndpointListRow = memo(function AdvertisedEndpointListRow({ isUpdatingTailscaleServe, }: AdvertisedEndpointListRowProps) { const isAvailable = endpoint.status === "available"; - const needsTailscaleSetup = - isTailscaleHttpsEndpoint(endpoint) && endpoint.status !== "available"; + const needsTailscaleSetup = isTailscaleHttpsEndpoint(endpoint) && endpoint.status !== "available"; const canDisableTailscaleServe = isTailscaleHttpsEndpoint(endpoint) && endpoint.status === "available"; const shouldShowEndpointUrl = !needsTailscaleSetup; @@ -1112,11 +991,7 @@ const AdvertisedEndpointListRow = memo(function AdvertisedEndpointListRow({ ) : null} {!needsTailscaleSetup && !isDefault ? ( - ) : null} @@ -1167,9 +1042,7 @@ function NetworkAccessDescription({ {summary} ) : ( - - {summary} - + {summary} )} ); @@ -1191,12 +1064,8 @@ function SavedBackendListRow({ onRemove, }: SavedBackendListRowProps) { const nowMs = useRelativeTimeTick(1_000); - const record = useSavedEnvironmentRegistryStore( - (state) => state.byId[environmentId] ?? null, - ); - const runtime = useSavedEnvironmentRuntimeStore( - (state) => state.byId[environmentId] ?? null, - ); + const record = useSavedEnvironmentRegistryStore((state) => state.byId[environmentId] ?? null); + const runtime = useSavedEnvironmentRuntimeStore((state) => state.byId[environmentId] ?? null); if (!record) { return null; @@ -1211,17 +1080,11 @@ function SavedBackendListRow({ : connectionState === "error" ? "bg-destructive" : "bg-muted-foreground/40"; - const roleLabel = runtime?.role - ? runtime.role === "owner" - ? "Owner" - : "Client" - : null; + const roleLabel = runtime?.role ? (runtime.role === "owner" ? "Owner" : "Client") : null; const descriptorLabel = runtime?.descriptor?.label ?? null; const statusTooltip = getSavedBackendStatusTooltip(runtime, record, nowMs); const metadataBits = [ - record.desktopSsh - ? `SSH ${formatDesktopSshTarget(record.desktopSsh)}` - : null, + record.desktopSsh ? `SSH ${formatDesktopSshTarget(record.desktopSsh)}` : null, roleLabel, record.lastConnectedAt ? `Last connected ${formatAccessTimestamp(record.lastConnectedAt)}` @@ -1237,24 +1100,16 @@ function SavedBackendListRow({ tooltipText={statusTooltip} dotClassName={stateDotClassName} pingClassName={ - connectionState === "connecting" - ? "bg-warning/60 duration-2000" - : null + connectionState === "connecting" ? "bg-warning/60 duration-2000" : null } /> -

- {record.label} -

+

{record.label}

{metadataBits.length > 0 ? ( -

- {metadataBits.join(" · ")} -

+

{metadataBits.join(" · ")}

) : null} {descriptorLabel && descriptorLabel !== record.label ? ( -

- Server label: {descriptorLabel} -

+

Server label: {descriptorLabel}

) : null}
@@ -1264,9 +1119,7 @@ function SavedBackendListRow({ disabled={reconnectingEnvironmentId === environmentId} onClick={() => void onReconnect(environmentId)} > - {reconnectingEnvironmentId === environmentId - ? "Reconnecting…" - : "Reconnect"} + {reconnectingEnvironmentId === environmentId ? "Reconnecting…" : "Reconnect"}
{discoveredSshHostsError ? ( -

- {discoveredSshHostsError} -

+

{discoveredSshHostsError}

) : null}
@@ -2735,15 +2396,9 @@ export function ConnectionsSettings() { - void handleConnectSshHost(nextTarget) - } + onConnect={(nextTarget) => void handleConnectSshHost(nextTarget)} /> ))} {hasLoadedDiscoveredSshHosts && @@ -2751,8 +2406,7 @@ export function ConnectionsSettings() { discoveredSshHosts.length === 0 ? (

- No SSH hosts were discovered from{" "} - ~/.ssh/config or{" "} + No SSH hosts were discovered from ~/.ssh/config or{" "} known_hosts.

@@ -2760,17 +2414,14 @@ export function ConnectionsSettings() {
{savedBackendError ? ( -

- {savedBackendError} -

+

{savedBackendError}

) : null}

Enter a host manually

- Use an alias or enter host, username, and port - directly. + Use an alias or enter host, username, and port directly.

- Uses your existing SSH keys, agent, and config. - Password and keyboard-interactive prompts open - through your system SSH dialog when needed. + Uses your existing SSH keys, agent, and config. Password and + keyboard-interactive prompts open through your system SSH dialog when + needed.
)} {savedBackendMode !== "ssh" && savedBackendError ? ( -

- {savedBackendError} -

+

{savedBackendError}

) : null} {savedBackendMode !== "ssh" ? (