Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Each way into this computer is its own switch, and nothing starts until one is on (#4755)
Milind Sonice8c34ec1f7f
diff --git a/companion/README.md b/companion/README.mdindex 4d42499f6a..c54f4891e9 100644--- a/companion/README.md+++ b/companion/README.md@@ -124,6 +124,8 @@ it is switched on, so the opt-in is never implicit.| `OMB_COMPANION_DIR` | `~/.openmausbot-companion` | paired devices live here || `OMB_COMPANION_NAME` | your name, from the harness | what the phone calls this computer || `OMB_COMPANION_E2E` | off | `1` turns on the end-to-end encrypted connection when standing alone (the desktop app turns it on itself); the transport key is kept in `e2e-key.json` beside the devices |+| `OMB_COMPANION_ROUTES` | `wifi` | the direct ways in, a comma list of `wifi` (this computer's LAN addresses and Bonjour) and `tailscale` (its tailnet address); empty for neither, when only the relay or an HTTPS address reaches it. A connection is answered only when both ends are private (loopback, RFC 1918, link-local, fd00::/8, or a tailnet peer on Tailscale's own interface) and it arrived on a way in that is on. The desktop app sets it from Settings → Remote access |+| `OMB_COMPANION_TAILNET_NAME` | none | this computer's MagicDNS name, offered while `tailscale` is listed. The sidecar never runs Tailscale to learn it: the desktop app asks Tailscale once, when the person turns Tailscale on || `OMB_COMPANION_BONJOUR` | on | `0` keeps a test rig off the network's Bonjour || `OMB_COMPANION_RELAY_URL` | none | test rigs only: a `ws://127.0.0.1:<port>` relay in place of `wss://relayN.openmausbot.com` |diff --git a/companion/src/control.ts b/companion/src/control.tsindex 828f4a4d83..ce9f4bdf5e 100644--- a/companion/src/control.ts+++ b/companion/src/control.ts@@ -9,7 +9,8 @@ import type { DeviceRegistry, DeviceRoutes } from "./devices.ts";import type { E2EDescriptor } from "./e2e/descriptor.ts";import type { LiveRoute } from "./e2e/registry.ts";import { companionEndpointCandidates, hostedCompanionUrl } from "./endpoints.ts";-import { lanAddresses, lanInterfaces, tailnetName, tailscaleAddress } from "./listener.ts";+import { directRoutes, routedAddresses } from "./direct-routes.ts";+import { lanInterfaces, tailnetName, tailscaleAddress } from "./listener.ts";import { defaultHostName } from "./mdns.ts";import { publicNetworks } from "./windows-network.ts";@@ -33,7 +34,8 @@ export interface ControlOptions {disconnectDevice?: (deviceId: string) => void;/** Revoked, not merely changed: the harness ends the Live call that phone holds. */revoked?: (deviceId: string) => void;- refreshTailscale?: () => Promise<void>;+ /** `PUT /routes` from the desktop app: which direct ways in are on, and the tailnet name it learned. */+ setDirectRoutes?: (body: unknown) => boolean;publicNetworks?: () => ReadonlySet<string>;/** End-to-end status; absent or `enabled: false` while it is off. */e2e?: () => E2EStatus;@@ -171,8 +173,9 @@ const currentHostedUrl = (options: Pick<ControlOptions, "hostedUrl">): string |* name, which resolves only while it runs. The bare tailnet address is absent:* iOS refuses plain HTTP to 100.64/10. */export function hostCandidates(- addresses: string[] = lanAddresses(),+ addresses: string[] = routedAddresses(),magicDnsName: string | null = tailnetName(),+ bonjourHost: string | null = directRoutes().wifi ? defaultHostName() : null,): string[] {const tailscale = tailscaleAddress(addresses);const out: string[] = [];@@ -180,13 +183,14 @@ export function hostCandidates(for (const address of addresses) {if (address !== tailscale) out.push(address);}- out.push(defaultHostName());+ if (bonjourHost) out.push(bonjourHost);return out;}/** Recomputed per request: addresses change when you join another network. */export function companionState(options: Omit<ControlOptions, "controlToken">) {- const interfaces = lanInterfaces();+ const routed = new Set(routedAddresses());+ const interfaces = lanInterfaces().filter((entry) => routed.has(entry.address));const addresses = interfaces.map((entry) => entry.address);const tailscale = tailscaleAddress(addresses);const lead = interfaces.find((entry) => entry.address !== tailscale) ?? null;@@ -197,6 +201,7 @@ export function companionState(options: Omit<ControlOptions, "controlToken">) {? lead.name: null;const secretPublicKey = options.secretPublicKey?.() ?? null;+ const routes = directRoutes();return {// Lets a parent tell this sidecar from an unrelated process on the control port.pid: process.pid,@@ -204,6 +209,7 @@ export function companionState(options: Omit<ControlOptions, "controlToken">) {addresses,...(tailscale ? { tailscale } : {}),...(tailscale && name ? { tailnetName: name } : {}),+ directRoutes: { wifi: routes.wifi, tailscale: routes.tailscale },lan: lead?.address ?? null,// Windows has this network as Public, so its firewall likely drops a phone....(publicNetwork ? { publicNetwork } : {}),@@ -260,10 +266,11 @@ export function createControlServer(options: ControlOptions): Server {return json(res, 403, { error: "forbidden: open the companion's control page from the link it printed" });}if (method === "GET" && path === "/state") return json(res, 200, companionState(options));- if (method === "POST" && path === "/tailscale/refresh" && options.refreshTailscale) {- void options.refreshTailscale().then(- () => json(res, 200, companionState(options)),- () => json(res, 500, { error: "could not refresh Tailscale" }),+ const setRoutes = options.setDirectRoutes;+ if (method === "PUT" && path === "/routes" && setRoutes) {+ readSmallJson(req).then(+ (body) => (setRoutes(body) ? json(res, 200, companionState(options)) : json(res, 400, { error: "routes must name wifi and tailscale as booleans" })),+ (error: Error) => json(res, 400, { error: error.message }),);return;}@@ -447,7 +454,7 @@ function render(s) {: "<p class=dim>No network address yet.</p>") +(s.tailnetName && s.lan ? "<p class=dim>On this network only: <code>" + esc(s.lan) + ":" + s.port + "</code></p>" : "") +(s.tailscale && !s.tailnetName- ? "<p class=dim>On a tailnet, but this computer's MagicDNS name could not be read from Tailscale — either MagicDNS is off, or its command line tool is not where we looked. iPhones cannot connect to a bare tailnet address; the console output lists what was tried.</p>"+ ? "<p class=dim>On a tailnet, but this computer's MagicDNS name could not be read from Tailscale — either MagicDNS is off, or nobody gave it one. iPhones cannot connect to a bare tailnet address: turn Tailscale on in the desktop app, or set OMB_COMPANION_TAILNET_NAME.</p>": "") +(!s.tailscale? "<p class=dim>Reachable on this network only. Install Tailscale on both this computer and your phone to reach it from anywhere — including networks that stop devices from seeing each other.</p>"diff --git a/companion/src/direct-routes.ts b/companion/src/direct-routes.tsnew file mode 100644index 0000000000..2c4d5d64ca--- /dev/null+++ b/companion/src/direct-routes.ts@@ -0,0 +1,107 @@+// Which direct ways in are on: Same Wi-Fi (this computer's LAN addresses and Bonjour) and Tailscale (its tailnet+// address). The desktop app decides; a sidecar standing alone serves Same Wi-Fi unless told otherwise.+import { isIP } from "node:net";+import { networkInterfaces } from "node:os";++import { lanAddresses, setTailnetName } from "./listener.ts";++export interface DirectRoutes {+ wifi: boolean;+ tailscale: boolean;+ tailnetName: string | null;+}++const TAILNET_NAME = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*\.ts\.net$/i;++let current: DirectRoutes = { wifi: true, tailscale: false, tailnetName: null };++export function directRoutes(): DirectRoutes {+ return current;+}++/** Unknown input keeps the field as it was; a name is kept only if it looks like a MagicDNS name. */+export function setDirectRoutes(next: { wifi?: unknown; tailscale?: unknown; tailnetName?: unknown }): DirectRoutes {+ const name = typeof next.tailnetName === "string" && TAILNET_NAME.test(next.tailnetName) ? next.tailnetName.toLowerCase() : next.tailnetName === null ? null : current.tailnetName;+ current = {+ wifi: typeof next.wifi === "boolean" ? next.wifi : current.wifi,+ tailscale: typeof next.tailscale === "boolean" ? next.tailscale : current.tailscale,+ tailnetName: name,+ };+ setTailnetName(current.tailscale ? current.tailnetName : null);+ return current;+}++/** `OMB_COMPANION_ROUTES` is a comma list of `wifi` and `tailscale` (empty for neither); unset means Same Wi-Fi. */+export function directRoutesFromEnv(env: NodeJS.ProcessEnv): DirectRoutes {+ const listed = env.OMB_COMPANION_ROUTES;+ const names = listed === undefined ? ["wifi"] : listed.split(",").map((part) => part.trim().toLowerCase());+ return setDirectRoutes({+ wifi: names.includes("wifi"),+ tailscale: names.includes("tailscale"),+ tailnetName: env.OMB_COMPANION_TAILNET_NAME ?? null,+ });+}++export const anyDirectRoute = (routes = current): boolean => routes.wifi || routes.tailscale;++const bare = (address: string): string => (address.startsWith("::ffff:") ? address.slice(7) : address).replace(/%.*$/, "").toLowerCase();++const TAILSCALE_V6 = /^fd7a:115c:a1e0:/i;++/** Tailscale's own interface: `tailscale0` on Linux, "Tailscale" on Windows, and on macOS the utun that carries a+ * fd7a:115c:a1e0::/48 address. Never any 100.64/10 address alone: carrier NAT and other VPNs use that range too. */+export function tailnetInterfaceAddresses(interfaces: ReturnType<typeof networkInterfaces> = networkInterfaces()): Set<string> {+ const found = new Set<string>();+ for (const [name, entries] of Object.entries(interfaces)) {+ const list = entries ?? [];+ if (/^tailscale/i.test(name) || list.some((entry) => TAILSCALE_V6.test(entry.address))) {+ for (const entry of list) found.add(bare(entry.address));+ }+ }+ return found;+}++export function isTailnetAddress(address: string | undefined, tailnet: Set<string> = tailnetInterfaceAddresses()): boolean {+ return Boolean(address) && tailnet.has(bare(address!));+}++/** A tailnet peer's own address: Tailscale's ranges, 100.64.0.0/10 and fd7a:115c:a1e0::/48. */+const inTailscaleRange = (address: string): boolean => {+ if (isIP(address) === 4) {+ const [first, second] = address.split(".").map(Number);+ return first === 100 && second >= 64 && second <= 127;+ }+ return TAILSCALE_V6.test(address);+};++/** Loopback, RFC 1918, link-local, or fd00::/8. */+export function isPrivateLanAddress(address: string | undefined): boolean {+ if (!address) return false;+ const value = bare(address);+ if (isIP(value) === 4) {+ const [a, b] = value.split(".").map(Number);+ return a === 127 || a === 10 || (a === 172 && b >= 16 && b <= 31) || (a === 192 && b === 168) || (a === 169 && b === 254);+ }+ return value === "::1" || /^fe[89ab][0-9a-f]:/i.test(value) || /^fd[0-9a-f]{2}:/i.test(value);+}++const isLoopback = (address: string) => address === "127.0.0.1" || address === "::1" || address.startsWith("::ffff:127.");++/** The addresses this computer offers devices: the tailnet one only with Tailscale on, the rest only with Same Wi-Fi. */+export function routedAddresses(addresses: string[] = lanAddresses(), routes = current, tailnet = tailnetInterfaceAddresses()): string[] {+ return addresses.filter((address) => (isTailnetAddress(address, tailnet) ? routes.tailscale : routes.wifi && isPrivateLanAddress(address)));+}++/**+ * Security: the device port binds every interface, so a connection is answered only when both ends are private and it+ * arrived on a way in that is on: on the tailnet interface from a tailnet peer with Tailscale on, or on a private LAN+ * address from a private LAN peer with Same Wi-Fi on. A public peer is refused on any way in.+ */+export function acceptsConnection(localAddress: string | undefined, remoteAddress: string | undefined, routes = current, tailnet = tailnetInterfaceAddresses()): boolean {+ if (!localAddress || !remoteAddress) return false;+ const local = bare(localAddress);+ const remote = bare(remoteAddress);+ if (isLoopback(local)) return isLoopback(remote);+ if (isTailnetAddress(local, tailnet)) return routes.tailscale && inTailscaleRange(remote);+ return routes.wifi && isPrivateLanAddress(local) && isPrivateLanAddress(remote) && !isLoopback(remote);+}diff --git a/companion/src/endpoints.ts b/companion/src/endpoints.tsindex 9c9b4648f3..6b904fbb96 100644--- a/companion/src/endpoints.ts+++ b/companion/src/endpoints.ts@@ -1,4 +1,5 @@-import { lanAddresses, tailnetName, tailscaleAddress } from "./listener.ts";+import { tailnetName, tailscaleAddress } from "./listener.ts";+import { directRoutes, routedAddresses } from "./direct-routes.ts";import { defaultHostName } from "./mdns.ts";export const COMPANION_ENDPOINT_KINDS = ["hosted", "tailnet", "lan", "bonjour"] as const;@@ -51,10 +52,10 @@ const httpOrigin = (host: string, port: number): string => {* connection walk. */export function companionEndpointCandidates(port: number,- addresses: string[] = lanAddresses(),+ addresses: string[] = routedAddresses(),magicDnsName: string | null = tailnetName(),hostedUrl: string | null = null,- bonjourHost: string = defaultHostName(),+ bonjourHost: string | null = directRoutes().wifi ? defaultHostName() : null,): CompanionEndpoint[] {const tailscale = tailscaleAddress(addresses);const candidates: CompanionEndpoint[] = [];@@ -68,7 +69,7 @@ export function companionEndpointCandidates(candidates.push({ url: httpOrigin(address, port), kind: "lan", priority: 200 + index });}});- candidates.push({ url: httpOrigin(bonjourHost, port), kind: "bonjour", priority: 300 });+ if (bonjourHost) candidates.push({ url: httpOrigin(bonjourHost, port), kind: "bonjour", priority: 300 });const seen = new Set<string>();const ordered = candidatesdiff --git a/companion/src/index.ts b/companion/src/index.tsindex 549c7ad46f..500e4592c8 100755--- a/companion/src/index.ts+++ b/companion/src/index.ts@@ -12,7 +12,8 @@ import { createControlServer, hostCandidates, initialControlToken } from "./contimport { createConnectedDeviceTracker } from "./connected-devices.ts";import { DeviceRegistry } from "./devices.ts";import { companionEndpointCandidates, hostedCompanionUrl } from "./endpoints.ts";-import { lanAddresses, refreshTailnetName, tailnetName, tailscaleAddress } from "./listener.ts";+import { tailnetName, tailscaleAddress } from "./listener.ts";+import { acceptsConnection, anyDirectRoute, directRoutes, directRoutesFromEnv, routedAddresses, setDirectRoutes } from "./direct-routes.ts";import {advertisableAddresses,clampBytes,@@ -73,6 +74,7 @@ const COMPANION_PORT = num(process.env.OMB_COMPANION_PORT, 8810);const CONTROL_PORT = num(process.env.OMB_CONTROL_PORT, 8811);const SERVICE_TYPE = "_openmausbot._tcp";let hostedUrl = hostedCompanionUrl(process.env.OMB_COMPANION_HOSTED_URL);+directRoutesFromEnv(process.env);const PRIVATE_ORIGIN = companionOriginSocket(process.env.OMB_COMPANION_INTERNAL_ORIGIN);const SECRET_PUBLIC_KEY = normalizedPhoneSecretPublicKey(process.env.OMB_PHONE_SECRET_PUBLIC_KEY ?? "",@@ -158,6 +160,26 @@ const proxy = createProxyHandler({});const e2eOrigin = createE2EOrigin((req, res) => proxy(req, res), (req, socket, head) => proxy.upgrade(req, socket, head));const companion = createServer((req, res) => proxy(req, res, "lan"));+const directSockets = new Set<import("node:net").Socket>();+companion.on("connection", (socket) => {+ if (!acceptsConnection(socket.localAddress, socket.remoteAddress)) return void socket.destroy();+ directSockets.add(socket);+ socket.once("close", () => directSockets.delete(socket));+});+let directListening = false;++/** Binds the device port while Same Wi-Fi or Tailscale is on, and drops connections on a way in just turned off. */+async function syncDirectListener(): Promise<void> {+ for (const socket of directSockets) if (!acceptsConnection(socket.localAddress, socket.remoteAddress)) socket.destroy();+ if (anyDirectRoute() && !directListening) {+ await listen(companion, COMPANION_PORT, "0.0.0.0");+ directListening = true;+ } else if (!anyDirectRoute() && directListening) {+ directListening = false;+ companion.closeAllConnections?.();+ await new Promise<void>((resolve) => companion.close(() => resolve()));+ }+}// `createServer` handles plain HTTP only; noVNC's WebSocket and /v1/e2e arrive as Node's separate `upgrade` event.companion.on("upgrade", (req, socket, head) =>isE2EUpgrade(req) ? handleDirectUpgrade(req, socket, head, e2e, e2eOrigin) : proxy.upgrade(req, socket, head, "lan"));@@ -229,7 +251,14 @@ const control = createControlServer({if (parentPort && !mutationToken) return;void notifyDeviceRevoked({ harnessPort: HARNESS_PORT, deviceId, mutationToken: mutationToken ?? undefined });},- refreshTailscale: () => refreshTailnetName(),+ setDirectRoutes: (body) => {+ const next = body && typeof body === "object" ? (body as Record<string, unknown>) : null;+ if (!next || typeof next.wifi !== "boolean" || typeof next.tailscale !== "boolean") return false;+ setDirectRoutes(next);+ void syncDirectListener().catch((error: Error) => console.warn(`companion: ${error.message}`));+ void watcher.check();+ return true;+ },e2e: () => ({ enabled: e2e.enabled, relay: relay?.status ?? "off", node: relay?.node ?? null, descriptor: e2e.descriptor(null) }),liveRoutes: () => e2e.routes(),// The phone hears where it may connect from inside its session first. Narrowed, the relay keeps it a moment so that@@ -300,7 +329,7 @@ async function main(): Promise<void> {console.log(`e2e: on, transport key ${b64u(key.publicKey).slice(0, 8)}…`);}await listen(control, CONTROL_PORT, "127.0.0.1");- await listen(companion, COMPANION_PORT, "0.0.0.0");+ await syncDirectListener();if (managedOrigin && PRIVATE_ORIGIN) {await listenCompanionOrigin(managedOrigin, PRIVATE_ORIGIN);}@@ -308,9 +337,6 @@ async function main(): Promise<void> {// Before advertising, so the first record already carries the name; a later rename withdraws the old one.await refreshMachineName();- const tailscaleTried: string[] = [];- await refreshTailnetName((cli, outcome) => tailscaleTried.push(` ${cli} — ${outcome}`)).catch(() => {});-// Through the watcher: a laptop may have no addresses yet, and they change// under a running sidecar. Discovery failing is never fatal.if (process.env.OMB_COMPANION_BONJOUR !== "0") {@@ -321,16 +347,15 @@ async function main(): Promise<void> {nameTimer = setInterval(() => void refreshMachineName().then((changed) => (changed && !stopping ? watcher.check() : undefined)), 30_000);nameTimer.unref?.();- const addresses = lanAddresses();+ const addresses = routedAddresses();const tailscale = tailscaleAddress(addresses);const reach = tailnetName() ?? tailscale ?? addresses[0];- console.log(`companion http://0.0.0.0:${COMPANION_PORT} → harness 127.0.0.1:${HARNESS_PORT}`);+ const on = Object.entries(directRoutes()).filter(([name, value]) => name !== "tailnetName" && value).map(([name]) => name);+ console.log(directListening+ ? `companion http://0.0.0.0:${COMPANION_PORT} (${on.join(", ")}) → harness 127.0.0.1:${HARNESS_PORT}`+ : `companion no direct way in is on → harness 127.0.0.1:${HARNESS_PORT}`);if (!parentPort) console.log(`pair here http://127.0.0.1:${CONTROL_PORT}/#token=${controlToken}`);- if (reach) console.log(`on your phone, enter ${reach}:${COMPANION_PORT}`);- if (tailscale && !tailnetName()) {- console.log("no MagicDNS name found. Tailscale CLI attempts:");- for (const line of tailscaleTried) console.log(line);- }+ if (reach && directListening) console.log(`on your phone, enter ${reach}:${COMPANION_PORT}`);}const shutdown = async (signal: string): Promise<void> => {diff --git a/companion/src/listener.ts b/companion/src/listener.tsindex c9b6c60342..30b33ac5a7 100644--- a/companion/src/listener.ts+++ b/companion/src/listener.ts@@ -1,5 +1,4 @@-// Where this computer can be reached and what it is called there. Binds nothing.-import { execFile } from "node:child_process";+// Where this computer can be reached and what it is called there. Binds nothing and runs nothing.import { homedir, networkInterfaces } from "node:os";import { delimiter, join } from "node:path";@@ -63,23 +62,27 @@ export function tailscaleAddress(addresses: string[] = lanAddresses()): string |return null;}-/** e.g. `macbook.tail1234.ts.net`. Plain HTTP to a tailnet address hits App- * Transport Security: iOS exempts local networking, but 100.64/10 is CGNAT- * shared space, not one of the private ranges that exemption covers. A- * `ts.net` hostname can be exempted by name. Cached: asking is a subprocess. */-let cachedTailnetName: string | null = null;-let activeTailnetRefresh: Promise<void> | null = null;+/** e.g. `macbook.tail1234.ts.net`, learned by the desktop app when the person+ * turns Tailscale on; this process never runs Tailscale. Plain HTTP to a+ * tailnet address hits App Transport Security: iOS exempts local networking,+ * but 100.64/10 is CGNAT shared space, not one of the private ranges that+ * exemption covers. A `ts.net` hostname can be exempted by name. */+let currentTailnetName: string | null = null;export function tailnetName(): string | null {- return cachedTailnetName;+ return currentTailnetName;+}++export function setTailnetName(name: string | null): void {+ currentTailnetName = name;}export function tailscaleCandidates(home = homedir()): string[] {// Absolute paths first: an app opened from Finder gets// /usr/bin:/bin:/usr/sbin:/sbin, no Homebrew and no /usr/local.+ // The macOS app's own executable comes last: run without CLI mode it opens+ // the Tailscale app, which then connects.return [- "/Applications/Tailscale.app/Contents/MacOS/Tailscale",- join(home, "Applications", "Tailscale.app", "Contents", "MacOS", "Tailscale"),"/opt/homebrew/bin/tailscale","/usr/local/bin/tailscale","/usr/bin/tailscale",@@ -87,12 +90,11 @@ export function tailscaleCandidates(home = homedir()): string[] {"C:\\Program Files\\Tailscale\\tailscale.exe","C:\\Program Files (x86)\\Tailscale\\tailscale.exe","tailscale",+ "/Applications/Tailscale.app/Contents/MacOS/Tailscale",+ join(home, "Applications", "Tailscale.app", "Contents", "MacOS", "Tailscale"),];}-/** For the whole CLI hunt, across every candidate path. */-const TAILSCALE_BUDGET_MS = 5000;-export const searchPath = (): string =>[process.env.PATH ?? "", "/opt/homebrew/bin", "/usr/local/bin", "/usr/bin", "/bin"].filter(Boolean)@@ -106,70 +108,3 @@ export const tailscaleEnvironment = (): NodeJS.ProcessEnv => ({PATH: searchPath(),TAILSCALE_BE_CLI: "1",});--/** Every failure just means "no name"; `onAttempt` reports which paths were- * tried, so "turn on MagicDNS" is not said to someone who has it on. */-async function refreshTailnetNameOnce(- onAttempt?: (cli: string, outcome: string) => void,-): Promise<void> {- const deadline = Date.now() + TAILSCALE_BUDGET_MS;- for (const cli of tailscaleCandidates()) {- const left = deadline - Date.now();- if (left <= 0) {- onAttempt?.(cli, "skipped — out of time looking for the Tailscale CLI");- continue;- }- const name = await new Promise<string | null>((resolve) => {- execFile(- cli,- ["status", "--json"],- {- timeout: Math.max(250, left),- // A wedged CLI may ignore SIGTERM past the deadline.- killSignal: "SIGKILL",- // `status --json` lists every peer; the default 1 MiB cap fails a- // large tailnet with ENOBUFS, which would read as "not installed".- maxBuffer: 16 * 1024 * 1024,- env: tailscaleEnvironment(),- },- (error, stdout) => {- if (error) {- onAttempt?.(cli, error.message.split("\n")[0]);- return resolve(null);- }- try {- const dns = JSON.parse(stdout)?.Self?.DNSName;- // MagicDNS names are fully qualified, trailing dot and all- const trimmed = typeof dns === "string" && dns ? dns.replace(/\.$/, "") : null;- onAttempt?.(cli, trimmed ? `ok: ${trimmed}` : "ran, but no MagicDNS name in status");- resolve(trimmed);- } catch {- onAttempt?.(cli, /Tailscale GUI failed to start/i.test(stdout)- ? "exited successfully in GUI mode instead of CLI mode"- : "exited successfully, but status output was not JSON");- resolve(null);- }- },- );- });- if (name) {- cachedTailnetName = name;- return;- }- }- cachedTailnetName = null;-}--/** Coalesce startup and user-triggered probes so a slower failure cannot- * overwrite a successful MagicDNS result from another concurrent probe. */-export function refreshTailnetName(- onAttempt?: (cli: string, outcome: string) => void,-): Promise<void> {- if (activeTailnetRefresh) return activeTailnetRefresh;- let refresh: Promise<void>;- refresh = refreshTailnetNameOnce(onAttempt).finally(() => {- if (activeTailnetRefresh === refresh) activeTailnetRefresh = null;- });- activeTailnetRefresh = refresh;- return refresh;-}diff --git a/companion/src/mdns.ts b/companion/src/mdns.tsindex c74171c73c..4fd7ae48b7 100644--- a/companion/src/mdns.ts+++ b/companion/src/mdns.ts@@ -5,6 +5,7 @@ import { createSocket } from "node:dgram";import { hostname, networkInterfaces } from "node:os";import { lanAddresses } from "./listener.ts";+import { directRoutes, isPrivateLanAddress, isTailnetAddress, tailnetInterfaceAddresses } from "./direct-routes.ts";const MDNS_ADDRESS = "224.0.0.251";const MDNS_PORT = 5353;@@ -357,8 +358,11 @@ export function defaultHostName(machine = hostname()): string {return `openmausbot-${digest}.local`;}+/** Bonjour is part of Same Wi-Fi: nothing is advertised while it is off, and never the tailnet address. */export function advertisableAddresses(): string[] {- return lanAddresses();+ if (!directRoutes().wifi) return [];+ const tailnet = tailnetInterfaceAddresses();+ return lanAddresses().filter((address) => !isTailnetAddress(address, tailnet) && isPrivateLanAddress(address));}diff --git a/companion/test/control.test.ts b/companion/test/control.test.tsindex e762ac3c07..443613e814 100644--- a/companion/test/control.test.ts+++ b/companion/test/control.test.ts@@ -10,8 +10,7 @@ let devices: DeviceRegistry;let connectedDeviceIds: string[] = [];let disconnectedDeviceIds: string[] = [];let revokedDeviceIds: string[] = [];-let tailscaleRefreshes = 0;-let completedTailscaleRefreshes = 0;+const routeBodies: unknown[] = [];const CONTROL_TOKEN = "c".repeat(43);let controlToken: string | null = CONTROL_TOKEN;const withToken = { "x-openmausbot-control-token": CONTROL_TOKEN };@@ -53,10 +52,9 @@ beforeAll(async () => {revoked: (deviceId) => {revokedDeviceIds.push(deviceId);},- refreshTailscale: async () => {- tailscaleRefreshes += 1;- await Promise.resolve();- completedTailscaleRefreshes += 1;+ setDirectRoutes: (body) => {+ routeBodies.push(body);+ return typeof (body as { wifi?: unknown })?.wifi === "boolean";},});port = await new Promise<number>((resolve) =>@@ -70,7 +68,7 @@ afterAll(async () => {describe("the per-launch control token", () => {it("refuses every route without it, so a page served from the control port cannot pair a device", async () => {- for (const [method, path] of [["POST", "/pairing"], ["GET", "/state"], ["DELETE", "/pairing"], ["POST", "/tailscale/refresh"], ["POST", "/devices/x/browser-control"], ["DELETE", "/devices/x"]]) {+ for (const [method, path] of [["POST", "/pairing"], ["GET", "/state"], ["DELETE", "/pairing"], ["PUT", "/routes"], ["POST", "/devices/x/browser-control"], ["DELETE", "/devices/x"]]) {const tokenless = await ask(method, path, { origin: `http://127.0.0.1:${port}` }, undefined, {});expect(tokenless.status, `${method} ${path}`).toBe(403);expect(JSON.stringify(tokenless.body)).not.toMatch(/omb_pair_|"code"/);@@ -193,20 +191,18 @@ describe("origins the control server will change state for", () => {await ask("DELETE", "/pairing");});- it("refreshes Tailscale before returning state without opening pairing", async () => {- const before = tailscaleRefreshes;- const refreshed = await ask("POST", "/tailscale/refresh");-- expect(refreshed.status).toBe(200);- expect(tailscaleRefreshes).toBe(before + 1);- expect(completedTailscaleRefreshes).toBe(tailscaleRefreshes);- expect(refreshed.body.pairing).toBeNull();+ it("takes the desktop app's direct ways in, and runs no Tailscale route of its own", async () => {+ const put = await ask("PUT", "/routes", { "content-type": "application/json" }, JSON.stringify({ wifi: false, tailscale: true, tailnetName: "mac.tail1.ts.net" }));+ expect(put.status).toBe(200);+ expect(routeBodies.at(-1)).toEqual({ wifi: false, tailscale: true, tailnetName: "mac.tail1.ts.net" });+ expect((await ask("PUT", "/routes", { "content-type": "application/json" }, JSON.stringify({ wifi: "yes" }))).status).toBe(400);+ expect((await ask("POST", "/tailscale/refresh")).status).toBe(404);});- it("refuses a Tailscale refresh from a foreign page", async () => {- const before = tailscaleRefreshes;- expect((await ask("POST", "/tailscale/refresh", { origin: "https://evil.example" })).status).toBe(403);- expect(tailscaleRefreshes).toBe(before);+ it("refuses a routes change from a foreign page", async () => {+ const before = routeBodies.length;+ expect((await ask("PUT", "/routes", { origin: "https://evil.example", "content-type": "application/json" }, JSON.stringify({ wifi: true, tailscale: true }))).status).toBe(403);+ expect(routeBodies.length).toBe(before);});it("does not let a stale conditional close cancel a replacement code", async () => {diff --git a/companion/test/direct-routes.test.ts b/companion/test/direct-routes.test.tsnew file mode 100644index 0000000000..94705ccc61--- /dev/null+++ b/companion/test/direct-routes.test.ts@@ -0,0 +1,63 @@+import { afterEach, describe, expect, it } from "vitest";++import { tailnetName } from "../src/listener.ts";+import { acceptsConnection, directRoutesFromEnv, isPrivateLanAddress, isTailnetAddress, routedAddresses, setDirectRoutes, tailnetInterfaceAddresses } from "../src/direct-routes.ts";++const iface = (address: string, family: "IPv4" | "IPv6" = "IPv4") => ({ address, family, internal: false, netmask: "", mac: "", cidr: null }) as never;+const macTailnet = tailnetInterfaceAddresses({ en0: [iface("192.168.1.4")], utun4: [iface("100.101.2.3"), iface("fd7a:115c:a1e0::5", "IPv6")] });++afterEach(() => {+ setDirectRoutes({ wifi: true, tailscale: false, tailnetName: null });+});++describe("direct ways in", () => {+ it("serves Same Wi-Fi alone when standing alone, and exactly what the desktop app lists otherwise", () => {+ expect(directRoutesFromEnv({})).toEqual({ wifi: true, tailscale: false, tailnetName: null });+ expect(directRoutesFromEnv({ OMB_COMPANION_ROUTES: "" })).toEqual({ wifi: false, tailscale: false, tailnetName: null });+ expect(directRoutesFromEnv({ OMB_COMPANION_ROUTES: "tailscale", OMB_COMPANION_TAILNET_NAME: "Mac.tail1.ts.net" }))+ .toEqual({ wifi: false, tailscale: true, tailnetName: "mac.tail1.ts.net" });+ expect(tailnetName()).toBe("mac.tail1.ts.net");+ });++ it("forgets the tailnet name while Tailscale is off, and refuses a name that isn't a tailnet one", () => {+ setDirectRoutes({ wifi: true, tailscale: false, tailnetName: "mac.tail1.ts.net" });+ expect(tailnetName()).toBeNull();+ expect(setDirectRoutes({ tailscale: true, tailnetName: "evil.example.com" }).tailnetName).toBe("mac.tail1.ts.net");+ });++ it("finds the tailnet by Tailscale's interface, never by a 100.64/10 address alone", () => {+ expect(isTailnetAddress("100.101.2.3", macTailnet)).toBe(true);+ expect(isTailnetAddress("::ffff:100.101.2.3", macTailnet)).toBe(true);+ expect(isTailnetAddress("192.168.1.4", macTailnet)).toBe(false);+ expect(isTailnetAddress("100.80.0.9", tailnetInterfaceAddresses({ en0: [iface("100.80.0.9")] }))).toBe(false);+ expect(isTailnetAddress("100.80.0.9", tailnetInterfaceAddresses({ utun2: [iface("100.80.0.9")] }))).toBe(false);+ expect(isTailnetAddress("100.70.0.1", tailnetInterfaceAddresses({ tailscale0: [iface("100.70.0.1")] }))).toBe(true);+ expect(isTailnetAddress("100.70.0.1", tailnetInterfaceAddresses({ Tailscale: [iface("100.70.0.1")] }))).toBe(true);+ });++ it("calls only loopback, RFC 1918, link-local and fd00::/8 private", () => {+ for (const address of ["127.0.0.1", "10.0.0.2", "172.20.1.1", "192.168.1.4", "169.254.3.3", "fe80::1", "fd12::3", "::ffff:192.168.1.4"]) expect(isPrivateLanAddress(address)).toBe(true);+ for (const address of ["203.0.113.9", "100.80.0.9", "172.32.0.1", "8.8.8.8", "2001:db8::1"]) expect(isPrivateLanAddress(address)).toBe(false);+ });++ it("answers a connection only when both ends are private and its way in is on", () => {+ setDirectRoutes({ wifi: true, tailscale: false });+ expect(acceptsConnection("192.168.1.4", "192.168.1.20", undefined, macTailnet)).toBe(true);+ expect(acceptsConnection("192.168.1.4", "203.0.113.9", undefined, macTailnet)).toBe(false);+ expect(acceptsConnection("203.0.113.5", "198.51.100.7", undefined, macTailnet)).toBe(false);+ expect(acceptsConnection("100.101.2.3", "100.64.0.8", undefined, macTailnet)).toBe(false);+ setDirectRoutes({ wifi: false, tailscale: true });+ expect(acceptsConnection("100.101.2.3", "100.64.0.8", undefined, macTailnet)).toBe(true);+ expect(acceptsConnection("100.101.2.3", "203.0.113.9", undefined, macTailnet)).toBe(false);+ expect(acceptsConnection("192.168.1.4", "192.168.1.20", undefined, macTailnet)).toBe(false);+ expect(acceptsConnection("127.0.0.1", "127.0.0.1", undefined, macTailnet)).toBe(true);+ expect(acceptsConnection("127.0.0.1", "203.0.113.9", undefined, macTailnet)).toBe(false);+ expect(acceptsConnection(undefined, "192.168.1.20", undefined, macTailnet)).toBe(false);+ });++ it("offers the tailnet address only with Tailscale on, and private LAN addresses only with Same Wi-Fi on", () => {+ const addresses = ["192.168.1.4", "100.101.2.3", "203.0.113.5"];+ expect(routedAddresses(addresses, { wifi: true, tailscale: false, tailnetName: null }, macTailnet)).toEqual(["192.168.1.4"]);+ expect(routedAddresses(addresses, { wifi: false, tailscale: true, tailnetName: null }, macTailnet)).toEqual(["100.101.2.3"]);+ });+});diff --git a/companion/test/fixtures/record-exec.mjs b/companion/test/fixtures/record-exec.mjsnew file mode 100644index 0000000000..d78bf8a6d8--- /dev/null+++ b/companion/test/fixtures/record-exec.mjs@@ -0,0 +1,13 @@+// Preloaded into a sidecar under test: every execFile is recorded and refused, so no real program (Tailscale above+// all) ever runs on the machine running the tests.+import { appendFileSync } from "node:fs";+import { createRequire, syncBuiltinESMExports } from "node:module";++const childProcess = createRequire(import.meta.url)("node:child_process");+childProcess.execFile = (file, args, options, callback) => {+ appendFileSync(process.env.RECORD_EXEC_FILE, `${JSON.stringify([file, ...(Array.isArray(args) ? args : [])])}\n`);+ const done = [args, options, callback].find((value) => typeof value === "function");+ queueMicrotask(() => done?.(Object.assign(new Error("ENOENT"), { code: "ENOENT" }), "", ""));+ return { kill() {}, on() {}, once() {} };+};+syncBuiltinESMExports();diff --git a/companion/test/fixtures/tailscale-cli.mjs b/companion/test/fixtures/tailscale-cli.mjsindex 7c2c9ec7a9..6440b4edb1 100644--- a/companion/test/fixtures/tailscale-cli.mjs+++ b/companion/test/fixtures/tailscale-cli.mjs@@ -14,6 +14,8 @@ if (mode === "gui" || process.env.TAILSCALE_BE_CLI !== "1") {TailscaleIPs: ["100.64.0.7"],},}));+} else if (process.argv[2] === "serve" && process.argv[3] === "status") {+ console.log("{}");} else if (process.argv[2] === "serve") {console.log("Serve configuration updated");} else {diff --git a/companion/test/listener.test.ts b/companion/test/listener.test.tsindex 503b9dde3b..2292d12d58 100644--- a/companion/test/listener.test.ts+++ b/companion/test/listener.test.ts@@ -10,11 +10,9 @@ describe("tailscaleCandidates", () => {expect(candidates).toContain("C:\\Program Files (x86)\\Tailscale\\tailscale.exe");});- it("keeps the absolute candidates in documented lookup order with bare PATH last", () => {+ it("tries every CLI, PATH included, before the macOS app's own executable", () => {const home = "/home/test";expect(tailscaleCandidates(home)).toEqual([- "/Applications/Tailscale.app/Contents/MacOS/Tailscale",- join(home, "Applications", "Tailscale.app", "Contents", "MacOS", "Tailscale"),"/opt/homebrew/bin/tailscale","/usr/local/bin/tailscale","/usr/bin/tailscale",@@ -22,6 +20,8 @@ describe("tailscaleCandidates", () => {"C:\\Program Files\\Tailscale\\tailscale.exe","C:\\Program Files (x86)\\Tailscale\\tailscale.exe","tailscale",+ "/Applications/Tailscale.app/Contents/MacOS/Tailscale",+ join(home, "Applications", "Tailscale.app", "Contents", "MacOS", "Tailscale"),]);});});diff --git a/companion/test/tailscale-cli.test.ts b/companion/test/tailscale-cli.test.tsindex 16bec54ff4..14889bb8e4 100644--- a/companion/test/tailscale-cli.test.ts+++ b/companion/test/tailscale-cli.test.ts@@ -39,9 +39,6 @@ vi.mock("node:os", async (original) => ({}),}));-import { createControlServer, type companionState } from "../src/control.ts";-import { DeviceRegistry } from "../src/devices.ts";-import { refreshTailnetName, tailnetName } from "../src/listener.ts";import { tailscaleStatus } from "../../server/tailscale.ts";let control: Server | undefined;@@ -63,66 +60,11 @@ afterEach(async () => {});describe("Tailscale from a shell-less standalone macOS app", () => {- it("refreshes the real control endpoint and advertises HTTP on the companion port", async () => {- fixture.output = "gui";- const attempts: string[] = [];- await refreshTailnetName((_cli, outcome) => attempts.push(outcome));- expect(tailnetName()).toBeNull();- expect(attempts[0]).toBe("exited successfully in GUI mode instead of CLI mode");- expect(attempts.join("\n")).not.toContain("private diagnostic");-- fixture.output = "auto";- fixture.calls = [];- control = createControlServer({- devices: new DeviceRegistry(),- controlToken: () => "fixture-control-token",- companionPort: 8787,- discovery: () => ({ advertising: false, name: "Fixture" }),- hostedUrl: () => "https://fixture.openmausbot.com",- refreshTailscale: () => refreshTailnetName(),- });- await new Promise<void>((resolve) => control!.listen(0, "127.0.0.1", resolve));- const { port } = control.address() as { port: number };- const response = await fetch(`http://127.0.0.1:${port}/tailscale/refresh`, { method: "POST", headers: { "x-openmausbot-control-token": "fixture-control-token" } });- const state = await response.json() as ReturnType<typeof companionState>;- expect(response.status).toBe(200);- expect(state.tailnetName).toBe("fixture.tail1234.ts.net");- expect(state.endpoints).toContainEqual({ url: "http://fixture.tail1234.ts.net:8787", kind: "tailnet", priority: 100 });- expect(state.endpoints).toContainEqual({ url: "https://fixture.openmausbot.com", kind: "hosted", priority: 0 });- expect(state.endpoints.some((endpoint: { url: string }) => endpoint.url.includes("100.64.0.7"))).toBe(false);- expect(state.pairing).toBeNull();- expect(fixture.calls).toHaveLength(1);- expect(fixture.calls[0].cli).toBe(standalone);- expect(fixture.calls[0].options.env?.TAILSCALE_BE_CLI).toBe("1");- expect(process.env.TAILSCALE_BE_CLI).toBe("0");- });-- it("keeps trying installed CLI paths after a successful GUI-only exit", async () => {- fixture.output = "gui";- fixture.fallback = true;- await refreshTailnetName();- expect(tailnetName()).toBe("fixture.tail1234.ts.net");- expect(fixture.calls.at(-1)?.cli).toBe("/usr/bin/tailscale");- });-- it.each([- ["invalid", "exited successfully, but status output was not JSON"],- ["no-dns", "ran, but no MagicDNS name in status"],- ])("distinguishes %s from GUI mode and clears stale names", async (output, expected) => {- await refreshTailnetName();- expect(tailnetName()).not.toBeNull();- fixture.output = output;- const attempts: string[] = [];- await refreshTailnetName((_cli, outcome) => attempts.push(outcome));- expect(tailnetName()).toBeNull();- expect(attempts[0]).toBe(expected);- expect(attempts.join("\n")).not.toContain("private diagnostic");- });-it("also forces CLI mode for the self-hosted server's status check", async () => {const result = await tailscaleStatus();expect(result).toHaveProperty("status");- expect(fixture.calls.map(({ args }) => args)).toEqual([["status", "--json"]]);- expect(fixture.calls.every(({ options }) => options.env?.TAILSCALE_BE_CLI === "1" && !options.shell)).toBe(true);+ const ran = fixture.calls.filter(({ cli }) => cli === standalone);+ expect(ran.map(({ args }) => args)).toEqual([["status", "--json"]]);+ expect(ran.every(({ options }) => options.env?.TAILSCALE_BE_CLI === "1" && !options.shell)).toBe(true);});});diff --git a/companion/test/tailscale-opt-in.test.ts b/companion/test/tailscale-opt-in.test.tsnew file mode 100644index 0000000000..0230762da3--- /dev/null+++ b/companion/test/tailscale-opt-in.test.ts@@ -0,0 +1,84 @@+import { spawn } from "node:child_process";+import { existsSync, mkdtempSync, readFileSync, rmSync } from "node:fs";+import { createServer } from "node:net";+import { tmpdir } from "node:os";+import { dirname, join } from "node:path";+import { fileURLToPath, pathToFileURL } from "node:url";+import { afterEach, describe, expect, it } from "vitest";++const HERE = dirname(fileURLToPath(import.meta.url));+const ENTRY = join(HERE, "..", "src", "index.ts");+const RECORDER = pathToFileURL(join(HERE, "fixtures", "record-exec.mjs")).href;+const dirs: string[] = [];++afterEach(() => {+ for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true });+});++const freePort = (): Promise<number> =>+ new Promise((resolve) => {+ const server = createServer();+ server.listen(0, "127.0.0.1", () => {+ const { port } = server.address() as { port: number };+ server.close(() => resolve(port));+ });+ });++/** Starts a real sidecar until it says it is up, and returns every program it tried to run meanwhile. */+async function startSidecar(env: Record<string, string>): Promise<{ programs: string[][]; out: string }> {+ const home = mkdtempSync(join(tmpdir(), "omb-companion-tailscale-"));+ dirs.push(home);+ const record = join(home, "exec.jsonl");+ const [companionPort, controlPort] = [await freePort(), await freePort()];+ const child = spawn(process.execPath, ["--import", RECORDER, ENTRY], {+ env: {+ PATH: process.env.PATH ?? "",+ HOME: home,+ USERPROFILE: home,+ OMB_COMPANION_DIR: join(home, "companion"),+ OMB_PORT: "9150",+ OMB_COMPANION_PORT: String(companionPort),+ OMB_CONTROL_PORT: String(controlPort),+ OMB_COMPANION_BONJOUR: "0",+ RECORD_EXEC_FILE: record,+ ...env,+ },+ stdio: ["ignore", "pipe", "pipe"],+ });+ let out = "";+ try {+ await new Promise<void>((resolve, reject) => {+ const timer = setTimeout(() => reject(new Error(`the sidecar never came up:\n${out}`)), 15_000);+ child.stdout.on("data", (chunk) => {+ out += chunk;+ if (out.includes("companion ")) {+ clearTimeout(timer);+ resolve();+ }+ });+ child.stderr.on("data", (chunk) => (out += chunk));+ child.once("exit", (code) => reject(new Error(`the sidecar exited (${code}):\n${out}`)));+ });+ } finally {+ child.kill("SIGKILL");+ }+ const programs = existsSync(record) ? readFileSync(record, "utf8").trim().split("\n").filter(Boolean).map((line) => JSON.parse(line) as string[]) : [];+ return { programs, out };+}++const isTailscale = (program: string[]) => /tailscale/i.test(program[0] ?? "");++describe("the phone link and Tailscale", () => {+ it("never runs a Tailscale program when it starts, with Tailscale off or on", async () => {+ expect((await startSidecar({})).programs.filter(isTailscale)).toEqual([]);+ const on = await startSidecar({ OMB_COMPANION_ROUTES: "wifi,tailscale", OMB_COMPANION_TAILNET_NAME: "mac.tail1.ts.net" });+ expect(on.programs.filter(isTailscale)).toEqual([]);+ expect(on.out).toContain("(wifi, tailscale)");+ }, 30_000);++ it("binds no device port when only the relay or the HTTPS address is on", async () => {+ const { out } = await startSidecar({ OMB_COMPANION_ROUTES: "" });+ expect(out).toContain("no direct way in is on");+ expect(out).not.toContain("http://0.0.0.0");+ }, 30_000);+});diff --git a/docs/desktop-companion.md b/docs/desktop-companion.mdindex 4813251f5d..546efdce59 100644--- a/docs/desktop-companion.md+++ b/docs/desktop-companion.md@@ -31,7 +31,7 @@ The HTTPS address uses the host's managed outbound tunnel. TLS is verified by th## Pair over Tailscale1. Install Tailscale on both computers, sign into the same tailnet, and leave MagicDNS enabled.-2. On the host, open **Settings → Remote access**, turn on Remote access, and open **Pair over Tailscale** to display a six-digit code.+2. On the host, open **Settings → Remote access → Advanced**, turn the **Tailscale pairing** switch on (the app never starts or checks Tailscale until you do), and open **Pair over Tailscale** to display a six-digit code.3. On the client, open **Settings → Remote access → Connect to another computer**and choose **Desktop companion**.4. Enter the host's full `.ts.net` MagicDNS name and the six-digit code.diff --git a/docs/ios-companion.md b/docs/ios-companion.mdindex 0be1c8f95f..ad202c67bb 100644--- a/docs/ios-companion.md+++ b/docs/ios-companion.md@@ -170,18 +170,34 @@ direct LAN requires choosing that computer or address again.Tailscale is an optional route away from home and on Wi-Fi networks thatisolate clients. In desktop **Settings → Remote access**, the primary card remains**Secure HTTPS pairing — Recommended**. The separate **Tailscale pairing**-card is only for people who already use Tailscale. Install or open Tailscale-on both devices, sign in to the same tailnet, leave MagicDNS enabled, and-choose **Turn on device access & check** followed by **Pair over Tailscale**.-That first action explicitly starts Remote access so the phone has a listener-to reach. OpenMausBot then places the computer's MagicDNS name in that-dedicated QR; it never silently replaces the default hosted HTTPS route.-Manual entry remains available as a fallback.--The URL is still `http`, but the path is encrypted and authenticated by-WireGuard inside the tailnet. Use the MagicDNS name rather than the+card is only for people who already use Tailscale, and its switch is off+until you turn it on: the app never starts, checks or configures Tailscale by+itself. Install or open Tailscale on both devices, sign in to the same tailnet,+leave MagicDNS enabled, turn the **Tailscale pairing** switch on (under+**Advanced**), then choose **Pair over Tailscale**. Turning it on also starts+Remote access so the phone has a listener to reach. OpenMausBot then places the+computer's tailnet addresses in that dedicated QR; it never silently replaces+the default hosted HTTPS route. Manual entry remains available as a fallback.++With the switch on, the link also answers on this computer's tailnet address+(found by Tailscale's own interface, never by a 100.64/10 address alone),+and the app asks Tailscale for the computer's MagicDNS name once: when you turn+the switch on, and again only when you choose **Check again**. It runs only+Tailscale's command-line tool (`tailscale status --json`), never the macOS app's+executable: with only the app installed it asks you to choose **Install CLI** in+the Tailscale app's settings. It never opens the Tailscale app or signs it in. The+URL is `http://<computer>.<tailnet>.ts.net:8810`, encrypted and authenticated+by WireGuard inside the tailnet. Use the MagicDNS name rather than the`100.64.0.0/10` address: App Transport Security exceptions are domain-based,and `ios/project.yml` narrowly allows insecure HTTP for `ts.net` subdomains.+Turning the switch off stops answering on the tailnet address; it never changes+anything in your Tailscale.++Each way in (Same Wi-Fi, Anywhere through MausBot, Tailscale, the HTTPS+address) is its own switch and stays off until you turn it on. While nothing is+paired and no code is open, the phone link sleeps: nothing listens and there is+no relay connection. A desktop that is only a client of another computer starts+none of it.Tailscale is optional. The direct path does not use an OpenMausBot-operatedrelay or create a cloud copy of local transcript data.diff --git a/electron/companion-account-ipc.node-test.mjs b/electron/companion-account-ipc.node-test.mjsindex c3be95a796..19631d2d0b 100644--- a/electron/companion-account-ipc.node-test.mjs+++ b/electron/companion-account-ipc.node-test.mjs@@ -71,12 +71,14 @@ test("prepare is local-only, takes nothing from the page, and an organisation caconst origin = "http://127.0.0.1:49210";const handlers = new Map();const prepared = [];+ const routes = [];let refusal = null;localOrigin.setLocalOrigin(origin);const context = vm.createContext({ipcMain: { handle: (channel, handler) => handlers.set(channel, handler) },localOnly: localOrigin.localOnly,managedRemoteAccessRefusal: () => refusal,+ rememberCompanionRoute: async (route, on) => { routes.push([route, on]); },ensureCompanionAccountService: () => ({state: () => ({ status: "ready" }),requestCode: () => ({}),@@ -96,6 +98,7 @@ test("prepare is local-only, takes nothing from the page, and an organisation caconst local = { senderFrame: { url: `${origin}/` } };assert.deepEqual(await prepare(local, { endpoint: "https://evil.example.test" }), { available: true, status: "ready" });assert.deepEqual(prepared, [[]]);+ assert.deepEqual(routes, [["https", true]], "setting up the secure address is the person turning the HTTPS address on");assert.throws(() => prepare({ senderFrame: { url: "https://remote.example.test/" } }), /only available/);refusal = "Example Org does not allow remote access to this computer.";diff --git a/electron/companion-e2e.mjs b/electron/companion-e2e.mjsindex 4435c9362d..d6b3448882 100644--- a/electron/companion-e2e.mjs+++ b/electron/companion-e2e.mjs@@ -12,11 +12,11 @@ export function deviceCounts(state) {return { e2e: Math.min(e2e, 100), legacy: Math.min(devices.length - e2e, 100) };}-/** The relay is needed while the companion runs and a phone could use it: one not restricted to Wi-Fi and Tailscale,- * or a pairing window. Null when that can't be told. */+/** The relay is needed while the companion runs, the person has Anywhere, through MausBot on, and a phone could use it:+ * one not restricted to Wi-Fi and Tailscale, or a pairing window. Null when that can't be told. */export function relayNeed(state) {if (!state || typeof state !== "object") return null;- if (state.enabled !== true) return false;+ if (state.enabled !== true || state.routes?.relay?.on !== true) return false;if (state.error) return null;if (state.devicesUnreadable === true || !Array.isArray(state.devices)) return null;return Boolean(state.pairing) || state.devices.some((device) => device?.routes !== "local");diff --git a/electron/companion-e2e.test.mjs b/electron/companion-e2e.test.mjsindex 2e5961b97a..2da94bfff4 100644--- a/electron/companion-e2e.test.mjs+++ b/electron/companion-e2e.test.mjs@@ -107,13 +107,16 @@ describe("relay tokens", () => {describe("the desktop's end-to-end connection", () => {it("counts devices for the adoption gates and knows when the relay is needed", () => {- const state = { enabled: true, pairing: null, devices: [{ e2eAt: 1, routes: "local" }, { routes: "any" }] };+ const relay = { routes: { relay: { on: true, since: 1 } } };+ const state = { enabled: true, ...relay, pairing: null, devices: [{ e2eAt: 1, routes: "local" }, { routes: "any" }] };expect(deviceCounts(state)).toEqual({ e2e: 1, legacy: 1 });expect(relayNeed(state)).toBe(true);+ expect(relayNeed({ ...state, routes: { relay: { on: false, since: null } } })).toBe(false);+ expect(relayNeed({ ...state, routes: undefined })).toBe(false);expect(relayNeed({ ...state, devices: [{ routes: "local" }] })).toBe(false);expect(relayNeed({ ...state, devices: [], pairing: { token: "t" } })).toBe(true);expect(relayNeed({ enabled: false })).toBe(false);- expect(relayNeed({ enabled: true, error: "x" })).toBeNull();+ expect(relayNeed({ enabled: true, ...relay, error: "x" })).toBeNull();});it("makes the key on the first relay token, tells the sidecar, and keeps it on after the token goes", async () => {@@ -126,7 +129,7 @@ describe("the desktop's end-to-end connection", () => {document = derive(document);},fetchGrant: async () => (answer instanceof Error ? Promise.reject(answer) : answer),- companionState: async () => ({ enabled: true, devices: [], pairing: { token: "t" } }),+ companionState: async () => ({ enabled: true, routes: { relay: { on: true, since: 1 } }, devices: [], pairing: { token: "t" } }),post: (message) => posted.push(message),setTimer: () => 1,clearTimer: () => {},@@ -153,7 +156,7 @@ describe("the desktop's end-to-end connection", () => {readCredentials: () => ({}),updateCredentials: async () => {},fetchGrant: async () => Promise.reject(Object.assign(new Error("off"), { code: "relay_unavailable" })),- companionState: async () => ({ enabled: true, devices: [], pairing: { token: "t" } }),+ companionState: async () => ({ enabled: true, routes: { relay: { on: true, since: 1 } }, devices: [], pairing: { token: "t" } }),post: (message) => posted.push(message),setTimer: () => 1,clearTimer: () => {},diff --git a/electron/companion-settings.mjs b/electron/companion-settings.mjsnew file mode 100644index 0000000000..0bfc589f3f--- /dev/null+++ b/electron/companion-settings.mjs@@ -0,0 +1,111 @@+import fs from "node:fs";+import os from "node:os";+import path from "node:path";++/** `companion-settings.json` in the app's user data: each way into this computer and whether the person turned it on.+ * `wifi` is Same Wi-Fi (the device port on the LAN, and Bonjour), `relay` is Anywhere, through MausBot, `tailscale`+ * the tailnet address, `https` the HTTPS address (the managed tunnel). `notices` lists routes kept on by the update+ * that the person has not seen yet. */+export const COMPANION_SETTINGS_VERSION = 2;+export const ROUTES = Object.freeze(["wifi", "relay", "tailscale", "https"]);+/** A device seen this recently counts as using its routes. */+export const RECENT_DEVICE_MS = 30 * 24 * 60 * 60 * 1_000;++const off = () => ({ on: false, since: null });++export function defaultCompanionSettings() {+ return { version: COMPANION_SETTINGS_VERSION, keepAwake: false, routes: Object.fromEntries(ROUTES.map((route) => [route, off()])), notices: [] };+}++function readRoute(value, route) {+ if (!value || typeof value !== "object" || value.on !== true) return off();+ const since = Number.isSafeInteger(value.since) ? value.since : null;+ if (route === "tailscale") return { on: true, since, name: typeof value.name === "string" && /\.ts\.net$/i.test(value.name) ? value.name : null };+ return { on: true, since };+}++/**+ * Settings before version 2 had one flag that started everything at launch. The update keeps a route on only where a+ * paired device seen in the last 30 days could be using it, and lists each kept route as a notice: nothing paired keeps+ * nothing on. The sidecar records no route per device, so this goes by what a device could use: Same Wi-Fi for any+ * device; the relay for an end-to-end device not limited to home routes; the HTTPS address for a device not limited+ * to home routes while this computer has its managed address; Tailscale only while this computer has a tailnet address.+ * Anything unreadable is "off": these flags open network listeners.+ */+export function readCompanionSettings(raw, facts = {}) {+ const parsed = raw && typeof raw === "object" ? raw : {};+ const keepAwake = parsed.keepAwake === true;+ if (parsed.version === COMPANION_SETTINGS_VERSION) {+ const routes = Object.fromEntries(ROUTES.map((route) => [route, readRoute(parsed.routes?.[route], route)]));+ const notices = Array.isArray(parsed.notices) ? ROUTES.filter((route) => parsed.notices.includes(route) && routes[route].on) : [];+ return { version: COMPANION_SETTINGS_VERSION, keepAwake, routes, notices };+ }+ const settings = { ...defaultCompanionSettings(), keepAwake };+ if (parsed.enabled !== true) return settings;+ const now = facts.now ?? Date.now();+ const recent = (Array.isArray(facts.devices) ? facts.devices : []).filter((device) => Number.isFinite(device?.lastSeenAt) && now - device.lastSeenAt <= RECENT_DEVICE_MS);+ if (recent.length === 0) return settings;+ const away = recent.filter((device) => device.routes !== "local");+ const kept = {+ wifi: true,+ relay: away.some((device) => Number.isSafeInteger(device.e2eAt)),+ tailscale: facts.tailnetAddress === true,+ https: away.length > 0 && facts.managedAddress === true,+ };+ for (const route of ROUTES) if (kept[route]) settings.routes[route] = route === "tailscale" ? { on: true, since: now, name: null } : { on: true, since: now };+ settings.notices = ROUTES.filter((route) => kept[route]);+ return settings;+}++export const anyRouteOn = (settings) => ROUTES.some((route) => settings?.routes?.[route]?.on === true);++/** Same Wi-Fi and Tailscale are what the sidecar itself listens for; the relay and the HTTPS address reach it otherwise. */+export const directRoutesOn = (settings) => ({ wifi: settings?.routes?.wifi?.on === true, tailscale: settings?.routes?.tailscale?.on === true });++export function setRoute(settings, route, on, { now = Date.now(), name } = {}) {+ if (!ROUTES.includes(route)) return settings;+ const current = settings.routes[route];+ const next = on ? { on: true, since: current.on ? current.since : now, ...(route === "tailscale" ? { name: name !== undefined ? name : current.name ?? null } : {}) } : off();+ return { ...settings, routes: { ...settings.routes, [route]: next }, notices: on ? settings.notices : settings.notices.filter((notice) => notice !== route) };+}++/**+ * The phone link's sidecar runs only for a computer that runs its own server, has a way in turned on and has a device+ * paired with it (or a pairing code open, which the dialog asks for). Never for a desktop that is only a client of+ * another computer.+ */+export function phoneLinkStartsAtLaunch({ remoteClient, serverReady, settings, pairedPhones }) {+ return !remoteClient && serverReady === true && anyRouteOn(settings) && (pairedPhones ?? 0) > 0;+}++/** A running sidecar with nothing paired and no code open goes back to sleep; its routes stay as set. */+export const phoneLinkShouldSleep = (state) =>+ state?.enabled === true && !state.error && state.devicesUnreadable !== true && Array.isArray(state.devices) && state.devices.length === 0 && !state.pairing;++export const companionDevicesFile = (env = process.env, home = os.homedir()) =>+ path.join(env.OMB_COMPANION_DIR ?? path.join(home, ".openmausbot-companion"), "devices.json");++/** Paired devices in the companion's own store; null when the file exists but cannot be read. */+export function readPairedDevices(file = companionDevicesFile()) {+ let text;+ try {+ text = fs.readFileSync(file, "utf8");+ } catch (error) {+ return error?.code === "ENOENT" ? [] : null;+ }+ try {+ const devices = JSON.parse(text)?.devices;+ return Array.isArray(devices) ? devices : null;+ } catch {+ return null;+ }+}++export const countPairedPhones = (file) => readPairedDevices(file)?.length ?? null;++/** Looks at this computer's interfaces only: Tailscale's own interface (`tailscale0`, "Tailscale", or the utun that+ * carries a fd7a:115c:a1e0::/48 address). A 100.64/10 address alone is not Tailscale: carrier NAT and other VPNs use it. */+export function hasTailnetAddress(interfaces = os.networkInterfaces()) {+ return Object.entries(interfaces).some(([name, entries]) =>+ (entries ?? []).length > 0 && (/^tailscale/i.test(name) || (entries ?? []).some((entry) => /^fd7a:115c:a1e0:/i.test(entry?.address ?? ""))));+}diff --git a/electron/companion-settings.node-test.mjs b/electron/companion-settings.node-test.mjsnew file mode 100644index 0000000000..0480053282--- /dev/null+++ b/electron/companion-settings.node-test.mjs@@ -0,0 +1,104 @@+import assert from "node:assert/strict";+import { mkdtempSync, rmSync, writeFileSync } from "node:fs";+import { tmpdir } from "node:os";+import path from "node:path";+import test from "node:test";++import {+ COMPANION_SETTINGS_VERSION, RECENT_DEVICE_MS, anyRouteOn, companionDevicesFile, countPairedPhones, defaultCompanionSettings, directRoutesOn,+ hasTailnetAddress, phoneLinkShouldSleep, phoneLinkStartsAtLaunch, readCompanionSettings, setRoute,+} from "./companion-settings.mjs";++const NOW = 1_800_000_000_000;+const on = (routes) => routes.reduce((settings, route) => setRoute(settings, route, true, { now: NOW }), defaultCompanionSettings());+const here = { remoteClient: false, serverReady: true, settings: on(["wifi"]), pairedPhones: 1 };++test("every way in is off on a new install", () => {+ const settings = readCompanionSettings(null);+ assert.equal(anyRouteOn(settings), false);+ assert.deepEqual(settings.notices, []);+});++test("the phone link starts at launch only for this computer's own server, with a way in on and a device paired", () => {+ assert.equal(phoneLinkStartsAtLaunch(here), true);+ assert.equal(phoneLinkStartsAtLaunch({ ...here, remoteClient: true }), false, "a desktop that is only a client of another computer");+ assert.equal(phoneLinkStartsAtLaunch({ ...here, serverReady: false }), false, "no server of its own running");+ assert.equal(phoneLinkStartsAtLaunch({ ...here, settings: defaultCompanionSettings() }), false, "every way in off");+ assert.equal(phoneLinkStartsAtLaunch({ ...here, pairedPhones: 0 }), false, "on, but nothing paired: it sleeps");+ assert.equal(phoneLinkStartsAtLaunch({ ...here, pairedPhones: null }), false, "the paired list could not be read");+});++test("an empty sidecar sleeps; one with a device or an open code stays", () => {+ assert.equal(phoneLinkShouldSleep({ enabled: true, devices: [], pairing: null }), true);+ assert.equal(phoneLinkShouldSleep({ enabled: true, devices: [{ id: "a" }], pairing: null }), false);+ assert.equal(phoneLinkShouldSleep({ enabled: true, devices: [], pairing: { code: "1" } }), false);+ assert.equal(phoneLinkShouldSleep({ enabled: true, devices: [], pairing: null, devicesUnreadable: true }), false);+ assert.equal(phoneLinkShouldSleep({ enabled: false, devices: [], pairing: null }), false);+});++test("each route is its own switch; turning one off drops its notice", () => {+ let settings = setRoute(defaultCompanionSettings(), "tailscale", true, { now: NOW, name: "mac.tail1.ts.net" });+ assert.deepEqual(directRoutesOn(settings), { wifi: false, tailscale: true });+ assert.deepEqual(settings.routes.tailscale, { on: true, since: NOW, name: "mac.tail1.ts.net" });+ settings = { ...settings, notices: ["tailscale"] };+ settings = setRoute(settings, "tailscale", false);+ assert.deepEqual(settings.routes.tailscale, { on: false, since: null });+ assert.deepEqual(settings.notices, []);+});++const device = (overrides = {}) => ({ id: "d", lastSeenAt: NOW - 60_000, routes: "any", e2eAt: NOW - 1e9, ...overrides });+const migrate = (facts, raw = { enabled: true, keepAwake: true }) => readCompanionSettings(raw, { now: NOW, ...facts });+const kept = (settings) => Object.entries(settings.routes).filter(([, route]) => route.on).map(([name]) => name);++test("the update turns everything off when nothing was paired, and keeps nothing on silently", () => {+ assert.deepEqual(kept(migrate({ devices: [] })), []);+ assert.deepEqual(kept(migrate({ devices: [device()] }, { enabled: false })), []);+ const stale = migrate({ devices: [device({ lastSeenAt: NOW - RECENT_DEVICE_MS - 1 })], tailnetAddress: true, managedAddress: true });+ assert.deepEqual(kept(stale), [], "a device not seen in 30 days keeps nothing on");+});++test("the update keeps on what a recently seen device could use, each with a notice", () => {+ const phone = migrate({ devices: [device()], managedAddress: true });+ assert.deepEqual(kept(phone), ["wifi", "relay", "https"]);+ assert.deepEqual(phone.notices, ["wifi", "relay", "https"]);+ assert.equal(phone.keepAwake, true);+ assert.equal(phone.version, COMPANION_SETTINGS_VERSION);++ assert.deepEqual(kept(migrate({ devices: [device({ routes: "local" })], managedAddress: true })), ["wifi"], "a home-only device keeps Same Wi-Fi only");+ assert.deepEqual(kept(migrate({ devices: [device({ e2eAt: undefined })] })), ["wifi"], "an old app has no relay");+ const tailnet = migrate({ devices: [device({ routes: "local" })], tailnetAddress: true });+ assert.deepEqual(kept(tailnet), ["wifi", "tailscale"]);+ assert.equal(tailnet.routes.tailscale.name, null, "the name is asked for only on Check again");+});++test("settings already in the new shape are read as written", () => {+ const written = { ...on(["relay"]), notices: ["relay", "wifi"] };+ const read = readCompanionSettings(JSON.parse(JSON.stringify(written)), { devices: [device()], tailnetAddress: true });+ assert.deepEqual(kept(read), ["relay"]);+ assert.deepEqual(read.notices, ["relay"], "a notice for a route that is off is dropped");+ assert.equal(readCompanionSettings({ version: COMPANION_SETTINGS_VERSION, routes: { wifi: { on: "yes" } } }).routes.wifi.on, false);+});++test("paired devices are read from the companion's own store", () => {+ const dir = mkdtempSync(path.join(tmpdir(), "omb-companion-settings-"));+ try {+ const file = companionDevicesFile({ OMB_COMPANION_DIR: dir });+ assert.equal(file, path.join(dir, "devices.json"));+ assert.equal(countPairedPhones(file), 0, "nothing paired yet");+ writeFileSync(file, JSON.stringify({ devices: [{ id: "a" }, { id: "b" }] }));+ assert.equal(countPairedPhones(file), 2);+ writeFileSync(file, "{not json");+ assert.equal(countPairedPhones(file), null);+ } finally {+ rmSync(dir, { recursive: true, force: true });+ }+});++test("Tailscale is seen by its own interface, never by a 100.64/10 address alone", () => {+ assert.equal(hasTailnetAddress({ en0: [{ family: "IPv4", address: "192.168.1.4" }] }), false);+ assert.equal(hasTailnetAddress({ utun4: [{ family: "IPv4", address: "100.101.2.3" }] }), false, "carrier NAT or another VPN");+ assert.equal(hasTailnetAddress({ en0: [{ family: "IPv4", address: "100.80.0.1" }] }), false);+ assert.equal(hasTailnetAddress({ utun4: [{ family: "IPv4", address: "100.101.2.3" }, { family: "IPv6", address: "fd7a:115c:a1e0::1" }] }), true);+ assert.equal(hasTailnetAddress({ tailscale0: [{ family: "IPv4", address: "100.70.0.1" }] }), true);+ assert.equal(hasTailnetAddress({ Tailscale: [{ family: "IPv4", address: "100.70.0.1" }] }), true);+});diff --git a/electron/companion.mjs b/electron/companion.mjsindex dcc7caffd4..5cff93b3bb 100644--- a/electron/companion.mjs+++ b/electron/companion.mjs@@ -4,6 +4,7 @@ import { randomBytes } from "node:crypto";import fs from "node:fs";import path from "node:path";import { resolveCompanionEntry } from "./companion-entry.mjs";+import { anyRouteOn, COMPANION_SETTINGS_VERSION, countPairedPhones, directRoutesOn, hasTailnetAddress, phoneLinkStartsAtLaunch, readCompanionSettings, readPairedDevices, setRoute } from "./companion-settings.mjs";import {cleanupCompanionOriginEndpoint,companionOriginHealth,@@ -33,29 +34,47 @@ const entryPoint = (resourcesPath) =>const settingsFile = () => path.join(app.getPath("userData"), "companion-settings.json");-function companionSettings() {+let migrationFacts = () => ({});++/** Main's part of the one-time update: whether this computer has its managed HTTPS address. */+export function setCompanionMigrationFacts(read) {+ migrationFacts = read;+}++export function companionSettings() {+ let raw = null;try {- const parsed = JSON.parse(fs.readFileSync(settingsFile(), "utf8"));- return { enabled: parsed?.enabled === true, keepAwake: parsed?.keepAwake === true };+ raw = JSON.parse(fs.readFileSync(settingsFile(), "utf8"));} catch {- return { enabled: false, keepAwake: false };}+ if (raw?.version === COMPANION_SETTINGS_VERSION) return readCompanionSettings(raw);+ const settings = readCompanionSettings(raw, raw?.enabled === true ? { devices: readPairedDevices() ?? [], tailnetAddress: hasTailnetAddress(), ...migrationFacts() } : {});+ if (raw) writeCompanionSettings(settings);+ return settings;}-/** Anything unreadable is "off": the flag opens a network listener, so it fails closed. */+/** Any way in turned on: the old single switch reads this. */export function companionEnabledAtRest() {- return companionSettings().enabled;+ return anyRouteOn(companionSettings());+}++export function companionRouteOn(route) {+ return companionSettings().routes[route]?.on === true;+}++/** The launch rule, with this computer's paired devices read from the companion's store. */+export function companionStartsAtLaunch({ remoteClient, serverReady }) {+ return phoneLinkStartsAtLaunch({ remoteClient, serverReady, settings: companionSettings(), pairedPhones: countPairedPhones() });}export function companionKeepAwakeAtRest() {return companionSettings().keepAwake;}-function rememberCompanionSettings(patch) {+function writeCompanionSettings(next) {const file = settingsFile();const temporary = `${file}.${process.pid}.tmp`;try {- const next = { ...companionSettings(), ...patch };fs.mkdirSync(path.dirname(file), { recursive: true });fs.writeFileSync(temporary, JSON.stringify(next, null, 2));fs.renameSync(temporary, file);@@ -67,13 +86,24 @@ function rememberCompanionSettings(patch) {}}+export function rememberCompanionKeepAwake(keepAwake) {+ writeCompanionSettings({ ...companionSettings(), keepAwake: keepAwake === true });+}-export function rememberCompanionEnabled(enabled) {- rememberCompanionSettings({ enabled });+/** Turns one way in on or off for good, and tells a running sidecar which direct ways in to listen on. */+export async function rememberCompanionRoute(route, on, extra) {+ const next = setRoute(companionSettings(), route, on, extra);+ writeCompanionSettings(next);+ if (proc && (route === "wifi" || route === "tailscale")) {+ await control("PUT", "/routes", { ...directRoutesOn(next), tailnetName: next.routes.tailscale.name ?? null }).catch(() => {});+ }+ return next;}-export function rememberCompanionKeepAwake(keepAwake) {- rememberCompanionSettings({ keepAwake });+/** The person saw the update's note about a route kept on. */+export function dismissCompanionNotice(route) {+ const settings = companionSettings();+ writeCompanionSettings({ ...settings, notices: settings.notices.filter((notice) => notice !== route) });}async function control(method, urlPath, body, { timeoutMs = 4_000 } = {}) {@@ -182,6 +212,11 @@ async function start({ resourcesPath, harnessPort, mutationToken, hostedUrl = nudelete childEnvironment.OMB_COMPANION_HOSTED_URL;delete childEnvironment.OMB_COMPANION_INTERNAL_ORIGIN;delete childEnvironment.OMB_PHONE_SECRET_PUBLIC_KEY;+ delete childEnvironment.OMB_COMPANION_TAILNET_NAME;+ const settings = companionSettings();+ const direct = directRoutesOn(settings);+ childEnvironment.OMB_COMPANION_ROUTES = Object.keys(direct).filter((route) => direct[route]).join(",");+ if (direct.tailscale && settings.routes.tailscale.name) childEnvironment.OMB_COMPANION_TAILNET_NAME = settings.routes.tailscale.name;if (hostedUrl) childEnvironment.OMB_COMPANION_HOSTED_URL = hostedUrl;childEnvironment.OMB_COMPANION_INTERNAL_ORIGIN = allocatedOrigin.socketPath;if (/^[A-Za-z0-9_-]{87}$/.test(String(secretPublicKey ?? ""))) {@@ -314,14 +349,24 @@ export function setCompanionHostedUrl(endpoint) {});}+/** Paired devices as the sidecar would list them, read from its store while it sleeps. */+function devicesAtRest() {+ return (readPairedDevices() ?? []).map(({ tokenHash: _secret, ...device }) => device);+}++function restState() {+ const settings = companionSettings();+ return { keepAwake: settings.keepAwake, routes: settings.routes, notices: settings.notices };+}+export async function companionState() {- const keepAwake = companionKeepAwakeAtRest();+ const rest = restState();if (!proc) {const state = {enabled: false,- keepAwake,+ ...rest,port: COMPANION_PORT,- devices: [],+ devices: devicesAtRest(),connectedDeviceIds: [],pairing: null,};@@ -330,11 +375,11 @@ export async function companionState() {}try {const state = await control("GET", "/state");- return { enabled: true, keepAwake, ...state };+ return { enabled: true, ...rest, ...state };} catch {return {enabled: true,- keepAwake,+ ...rest,port: COMPANION_PORT,devices: [],connectedDeviceIds: [],@@ -344,25 +389,6 @@ export async function companionState() {}}-export async function companionRefreshTailscale() {- if (!proc) return companionState();- try {- // The sidecar's Tailscale CLI hunt is bounded to 5 s; allow more here.- const state = await control("POST", "/tailscale/refresh", undefined, { timeoutMs: 6_000 });- return {- enabled: true,- keepAwake: companionKeepAwakeAtRest(),- ...state,- };- } catch {- const state = await companionState();- return {- ...state,- error: state.error ?? "Tailscale could not be checked.",- };- }-}-/** A conditional close cannot erase a newer code created after the renderer began cancelling. */export async function companionPairing(open, expectedToken) {if (!proc) return companionState();@@ -379,7 +405,7 @@ export async function companionPairing(open, expectedToken) {e2eHooks.changed();return {enabled: true,- keepAwake: companionKeepAwakeAtRest(),+ ...restState(),...state,};} catch {@@ -404,7 +430,7 @@ export async function companionRevoke(deviceId) {export async function companionPairingRenew() {if (!proc) return companionState();try {- return { enabled: true, keepAwake: companionKeepAwakeAtRest(), ...(await control("POST", "/pairing/renew")) };+ return { enabled: true, ...restState(), ...(await control("POST", "/pairing/renew")) };} catch {return companionPairing(true);}diff --git a/electron/main.mjs b/electron/main.mjsindex cf5b2b5814..ab12407f6d 100644--- a/electron/main.mjs+++ b/electron/main.mjs@@ -460,10 +460,11 @@ const DESKTOP_CRASH_LOG = path.join(LOG_DIR, "desktop-crashes.log");const DESKTOP_CRASH_LOG_MAX_BYTES = 512 * 1024;let logStream = null;let desktopShutdownStarted = false;-import { companionAdvertisedHostedUrl, companionEnabledAtRest, companionOriginTarget, companionPairing, companionPairingRenew, companionDeviceRoutes, companionRefreshTailscale, companionCloudDesktopAccess,- companionBrowserControlAccess, companionRevoke, companionRunning, companionState, rememberCompanionEnabled, rememberCompanionKeepAwake, setCompanionHostedUrl, setCompanionLifecycleListener, startCompanion, stopCompanion } from "./companion.mjs";+import { companionAdvertisedHostedUrl, companionEnabledAtRest, companionOriginTarget, companionPairing, companionPairingRenew, companionDeviceRoutes, companionStartsAtLaunch, companionCloudDesktopAccess, companionRouteOn, dismissCompanionNotice, rememberCompanionRoute, setCompanionMigrationFacts,+ companionBrowserControlAccess, companionRevoke, companionRunning, companionState, rememberCompanionKeepAwake, setCompanionHostedUrl, setCompanionLifecycleListener, startCompanion, stopCompanion } from "./companion.mjs";import { createDesktopCompanionE2E, deviceCounts } from "./companion-e2e-desktop.mjs";import { autoStartCompanion } from "./companion-autostart.mjs";+import { createPhoneLinkRoutes } from "./phone-link-routes.mjs";import { createRoutineWakeHold, rememberRoutineWake, routineWakeSettings } from "./routine-wake.mjs";import { CREDENTIAL_PATCH, credentialSaveError } from "./credential-patch.mjs";@@ -648,7 +649,7 @@ async function startManagedCompanionConnection({ waitForVerification = true } =if (companionAccountCleanupPending(secureCredentials)) {return publicManagedCompanionState();}- const access = managedCompanionTunnelAccess(secureCredentials);+ const access = companionRouteOn("https") ? managedCompanionTunnelAccess(secureCredentials) : null;if (!access) return publicManagedCompanionState();const target = companionOriginTarget();if (!target) return publicManagedCompanionState();@@ -662,7 +663,7 @@ async function startManagedCompanionConnection({ waitForVerification = true } =return publicManagedCompanionState();}-async function startDesktopCompanion({ waitForHosted = true, remember = true } = {}) {+async function startDesktopCompanion({ waitForHosted = true, remember = true, routes = ["wifi", "relay"] } = {}) {const refusal = managedRemoteAccessRefusal();if (refusal) throw new Error(refusal);companionDesiredThisLaunch = true;@@ -672,7 +673,8 @@ async function startDesktopCompanion({ waitForHosted = true, remember = true } =companionDesiredThisLaunch = false;return desktopCompanionState();}- if (remember) rememberCompanionEnabled(true);+ if (remember) for (const route of routes.filter((name) => ["wifi", "relay"].includes(name))) await rememberCompanionRoute(route, true);+ phoneLinkRoutes.touched();await startManagedCompanionConnection({ waitForVerification: waitForHosted });return desktopCompanionState();}@@ -680,20 +682,16 @@ async function startDesktopCompanion({ waitForHosted = true, remember = true } =async function stopDesktopCompanion({ remember = true } = {}) {companionDesiredThisLaunch = false;companionLaunchGeneration += 1;- if (remember) rememberCompanionEnabled(false);+ if (remember) for (const route of ["wifi", "relay", "tailscale", "https"]) await rememberCompanionRoute(route, false);syncCompanionKeepAwake(false, false);await managedCompanionConnector?.stop();await stopCompanion();return desktopCompanionState();}-async function refreshDesktopCompanionTailscale() {- if (!companionRunning()) {- const started = await startDesktopCompanion({ waitForHosted: false });- if (!started.enabled || started.error) return started;- }- return decorateDesktopCompanionState(await companionRefreshTailscale());-}+const phoneLinkRoutes = createPhoneLinkRoutes({ rememberRoute: rememberCompanionRoute, routeOn: companionRouteOn, dismissNotice: dismissCompanionNotice, state: () => desktopCompanionState(), running: companionRunning, log: slog, changed: (route, on) => (route !== "https" ? companionE2E?.reconcile() : on ? startManagedCompanionConnection({ waitForVerification: false }) : stopManagedCompanionEndpointLocally()),+ wake: () => (!companionRunning() && companionStartsAtLaunch({ remoteClient: Boolean(desktopRemoteAccess), serverReady }) ? startDesktopCompanion({ waitForHosted: false, remember: false }) : null), sleep: () => stopDesktopCompanion({ remember: false }) });+setCompanionMigrationFacts(() => ({ managedAddress: Boolean(managedCompanionTunnelAccess(secureCredentials)) }));setCompanionLifecycleListener(({ expected, pid }) => {if (expected) return;@@ -2411,7 +2409,7 @@ function managedRemoteAccessRefusal() {const policy = managedDesktop?.policy?.();return policy?.remoteAccess === false ? `${policy.organizationName} does not allow remote access to this computer.` : null;}-ipcMain.handle("companion:start", localOnly("companion:start", () => startDesktopCompanion()));+ipcMain.handle("companion:start", localOnly("companion:start", (_event, routes) => startDesktopCompanion({ routes: Array.isArray(routes) ? routes : undefined })));ipcMain.handle("companion:stop", localOnly("companion:stop", () => stopDesktopCompanion()));ipcMain.handle("companion:keep-awake", localOnly("companion:keep-awake", async (_event, enabled) => {rememberCompanionKeepAwake(Boolean(enabled));@@ -2422,10 +2420,11 @@ ipcMain.handle("routines:keep-awake", localOnly("routines:keep-awake", async (_erememberRoutineWake(app.getPath("userData"), Boolean(enabled));return routineWake.poll();}));-ipcMain.handle("companion:refresh-tailscale", localOnly("companion:refresh-tailscale", () => refreshDesktopCompanionTailscale()));+phoneLinkRoutes.install(ipcMain, localOnly);ipcMain.handle("companion:pairing", localOnly("companion:pairing", (_event, open, expectedToken) => {const refusal = open ? managedRemoteAccessRefusal() : null;if (refusal) throw new Error(refusal);+ phoneLinkRoutes.touched();return companionPairing(Boolean(open), expectedToken).then(decorateDesktopCompanionState);}));ipcMain.handle("companion:cloud-desktop", localOnly("companion:cloud-desktop", (_event, deviceId, allowed) =>@@ -2505,7 +2504,7 @@ ipcMain.handle("companion-account:retry", localOnly("companion-account:retry", (ipcMain.handle("companion-account:prepare", localOnly("companion-account:prepare", () => {const refusal = managedRemoteAccessRefusal();if (refusal) throw new Error(refusal);- return ensureCompanionAccountService().prepare();+ return rememberCompanionRoute("https", true).then(() => ensureCompanionAccountService().prepare());}));ipcMain.handle("companion-account:sign-out", localOnly("companion-account:sign-out", () => ensureCompanionAccountService().signOut()));@@ -2637,7 +2636,7 @@ const cloudLook = createCloudLook({ store: lookFile(() => path.join(app.getPath(const cloudBuy = installCloudBuy({ ipcMain, guard: localWorkspaceOnly, client: ensureCloudAccount, offersReady: cloudOffersReady, clipboard, look: cloudLook });const localServerRequest = (route, init = {}) => (serverProc && serverReady ? fetch(`http://127.0.0.1:${SERVER_PORT}${route}`, { ...init, redirect: "error", credentials: "omit", headers: { ...init.headers, [DESKTOP_MUTATION_HEADER]: desktopMutationToken } }) : Promise.reject(new Error("not running")));const teamProfileSeeds = createTeamProfileSeeds({ teamFetch: (...args) => session.defaultSession.fetch(...args), localRequest: localServerRequest, log: slog });-const oneHome = installOneHome({ ipcMain, clean: cleanWorkspace, cloudPage: cloudPageAsking, pageOrigin: activePageOrigin, confirmMove: confirmTeamMove, server: () => serverProc, cookieFetch: (...args) => session.defaultSession.fetch(...args), home: () => (myCloud() && cloudAccount ? { origin: myCloud(), grant: () => cloudAccount.pairHome() } : null), power: cloudPower, file: () => path.join(app.getPath("userData"), "cloud-send.json"), localRequest: localServerRequest, space: { disk: () => cloudPlanDisk(ensureCloudAccount().state()), grow: sizeGb => ensureCloudAccount().growDisk(sizeGb) }, reconnect: origin => signInCloudSession({ origin, mine: myCloud(), pair: () => ensureCloudAccount().pairHome(), fetch: (...args) => session.defaultSession.fetch(...args) }), window: () => (desktopRemoteAccess ? null : mainWindow), localOrigin: rendererOrigin, account: () => cloudAccount, journalFile: () => path.join(app.getPath("userData"), "one-home.json"), tempRoot: () => path.join(app.getPath("temp"), "openmaus-one-home"), lend: projects => sharingController().lendProjects(projects), phone: { paired: () => companionEnabledAtRest(), start: () => startDesktopCompanion({ waitForHosted: false, remember: false }).then(() => {}) }, openHome: () => void showHome({ place: "cloud" }), openTeam: team => void showHome({ place: { team: team.id, name: team.name } }), openLocal: () => void showHome(), restart: () => relaunchAfterDesktopRemoteChange(), version: app.getVersion(), log: slog, other: () => ownHome, accountsHere: () => accountRing()?.count() ?? 1, t: nativeT }); ownHome = installOwnHome({ t: nativeT, localRequest: localServerRequest, fetch: (...args) => session.defaultSession.fetch(...args), environments: () => environmentsState.environments, handoff: what => oneHome.handoff(what), cloudJournal: () => oneHome.journal(), journal: jsonFile(path.join(app.getPath("userData"), "own-home.json")), choice: jsonFile(path.join(app.getPath("userData"), "own-home-choice.json")), sendState: jsonFile(path.join(app.getPath("userData"), "own-home-send.json")), lend: (projects, place) => sharingController().lendProjects(projects, place), phone: { paired: () => companionEnabledAtRest(), start: () => startDesktopCompanion({ waitForHosted: false, remember: false }).then(() => {}) }, openHome: place => void workspaceMenuAction(() => switchEnvironment(place.id)), lastInput: oneHome.lastInput, version: app.getVersion(), log: slog, onChange: () => { oneHome.publish(); computerSharing?.cloudChanged(); railChanged(); } }); twoPlaces = installTwoPlacesMain({ t: nativeT, ipcMain, guard: localWorkspaceOnly, localRequest: localServerRequest, fetch: (...args) => session.defaultSession.fetch(...args), environments: () => environmentsState.environments, cloud: () => ({ origin: myCloud(), asleep: cloudPower.asleep() }), oneHome, ownHome, dismissed: jsonFile(path.join(app.getPath("userData"), "two-places.json")), account: () => cloudAccount, teamsRemembered: jsonFile(path.join(app.getPath("userData"), "team-places.json")), log: slog, tell: () => { if (mainWindow && !mainWindow.isDestroyed() && senderIsLocal({ sender: mainWindow.webContents })) mainWindow.webContents.send("two-places:changed"); } });+const oneHome = installOneHome({ ipcMain, clean: cleanWorkspace, cloudPage: cloudPageAsking, pageOrigin: activePageOrigin, confirmMove: confirmTeamMove, server: () => serverProc, cookieFetch: (...args) => session.defaultSession.fetch(...args), home: () => (myCloud() && cloudAccount ? { origin: myCloud(), grant: () => cloudAccount.pairHome() } : null), power: cloudPower, file: () => path.join(app.getPath("userData"), "cloud-send.json"), localRequest: localServerRequest, space: { disk: () => cloudPlanDisk(ensureCloudAccount().state()), grow: sizeGb => ensureCloudAccount().growDisk(sizeGb) }, reconnect: origin => signInCloudSession({ origin, mine: myCloud(), pair: () => ensureCloudAccount().pairHome(), fetch: (...args) => session.defaultSession.fetch(...args) }), window: () => (desktopRemoteAccess ? null : mainWindow), localOrigin: rendererOrigin, account: () => cloudAccount, journalFile: () => path.join(app.getPath("userData"), "one-home.json"), tempRoot: () => path.join(app.getPath("temp"), "openmaus-one-home"), lend: projects => sharingController().lendProjects(projects), phone: { paired: () => companionStartsAtLaunch({ remoteClient: Boolean(desktopRemoteAccess), serverReady }), start: () => startDesktopCompanion({ waitForHosted: false, remember: false }).then(() => {}) }, openHome: () => void showHome({ place: "cloud" }), openTeam: team => void showHome({ place: { team: team.id, name: team.name } }), openLocal: () => void showHome(), restart: () => relaunchAfterDesktopRemoteChange(), version: app.getVersion(), log: slog, other: () => ownHome, accountsHere: () => accountRing()?.count() ?? 1, t: nativeT }); ownHome = installOwnHome({ t: nativeT, localRequest: localServerRequest, fetch: (...args) => session.defaultSession.fetch(...args), environments: () => environmentsState.environments, handoff: what => oneHome.handoff(what), cloudJournal: () => oneHome.journal(), journal: jsonFile(path.join(app.getPath("userData"), "own-home.json")), choice: jsonFile(path.join(app.getPath("userData"), "own-home-choice.json")), sendState: jsonFile(path.join(app.getPath("userData"), "own-home-send.json")), lend: (projects, place) => sharingController().lendProjects(projects, place), phone: { paired: () => companionStartsAtLaunch({ remoteClient: Boolean(desktopRemoteAccess), serverReady }), start: () => startDesktopCompanion({ waitForHosted: false, remember: false }).then(() => {}) }, openHome: place => void workspaceMenuAction(() => switchEnvironment(place.id)), lastInput: oneHome.lastInput, version: app.getVersion(), log: slog, onChange: () => { oneHome.publish(); computerSharing?.cloudChanged(); railChanged(); } }); twoPlaces = installTwoPlacesMain({ t: nativeT, ipcMain, guard: localWorkspaceOnly, localRequest: localServerRequest, fetch: (...args) => session.defaultSession.fetch(...args), environments: () => environmentsState.environments, cloud: () => ({ origin: myCloud(), asleep: cloudPower.asleep() }), oneHome, ownHome, dismissed: jsonFile(path.join(app.getPath("userData"), "two-places.json")), account: () => cloudAccount, teamsRemembered: jsonFile(path.join(app.getPath("userData"), "team-places.json")), log: slog, tell: () => { if (mainWindow && !mainWindow.isDestroyed() && senderIsLocal({ sender: mainWindow.webContents })) mainWindow.webContents.send("two-places:changed"); } });// Teams from the verified session as places this window shows (home-places.mjs): the one to open next time, and its lines.const homePlaces = createHomePlaces({ store: jsonFile(path.join(app.getPath("userData"), "home-place.json")), environments: () => environmentsState, persist: persistEnvironments, makeId: randomUUID, homeOrigin: myCloud, log: slog });const homeWindow = createHomeWindow({ clean: cleanWorkspace, journal: oneHome.journal, frozen: oneHome.marker, account: () => (app.isPackaged && !desktopRemoteAccess ? cloudAccount : null), restored: cloudAccountRestored,@@ -3085,11 +3084,12 @@ app.whenReady().then(async () => {cloudAccountStarted = ensureCloudAccount().start().catch(() => {}).then(() => accountRing()?.start()).finally(() => { cloudAccountRestoring = false; });}void cloudAccountStarted.then(() => { cloudSignInRestored = true; void oneHome.kick(); void homeWindow.refresh(); }); void ownHome?.kick();- if (!desktopRemoteAccess && serverReady && companionEnabledAtRest()) {+ if (companionStartsAtLaunch({ remoteClient: Boolean(desktopRemoteAccess), serverReady })) {// Retries stop once the person turns the phone off, starts it by hand or quits.const wanted = () => !desktopShutdownStarted && companionEnabledAtRest() && !companionRunning();void autoStartCompanion({ restored: managedDesktop?.whenRestored(), start: () => startDesktopCompanion({ waitForHosted: false, remember: false }), wanted, log: slog });}+ phoneLinkRoutes.start();setLocalOrigin(rendererOrigin());session.defaultSession.webRequest.onCompleted({ urls: ["https://*/api/*"] }, details => homeWindow.responded(details));appPermissions = appPermissionHandlers({diff --git a/electron/phone-link-routes.mjs b/electron/phone-link-routes.mjsnew file mode 100644index 0000000000..80f5cb743e--- /dev/null+++ b/electron/phone-link-routes.mjs@@ -0,0 +1,77 @@+import { checkTailscale } from "./tailscale-check.mjs";+import { phoneLinkShouldSleep, ROUTES } from "./companion-settings.mjs";++/** A sidecar started for a pairing code gets this long before an empty one goes back to sleep. */+export const PHONE_LINK_SLEEP_GRACE_MS = 3 * 60_000;+const SLEEP_CHECK_MS = 60_000;++/**+ * The phone link's ways in, as the person turns them on and off: each switch is its own choice, Tailscale runs only on+ * Turn on or Check again, and a sidecar with nothing paired and no code open goes back to sleep.+ *+ * `wake()` starts the sidecar when the launch rule now holds (a way in is on and something is paired).+ */+export function createPhoneLinkRoutes({ rememberRoute, routeOn, dismissNotice, state, running, wake, sleep, changed = () => {}, check = checkTailscale, now = Date.now, setTimer = setInterval, log = () => {} }) {+ let activeSince = 0;+ let timer = null;++ async function setTailscale(on) {+ if (!on) {+ await rememberRoute("tailscale", false);+ return state();+ }+ const result = await check();+ if (result.state !== "ready") return { ...(await state()), tailscaleProblem: result.state };+ await rememberRoute("tailscale", true, { name: result.name });+ await wake();+ return state();+ }++ const api = {+ setTailscale,+ /** Check again: asks Tailscale for the name only while the route is on, and starts nothing. */+ async checkTailscale() {+ if (!routeOn("tailscale")) return state();+ const result = await check();+ if (result.state !== "ready") return { ...(await state()), tailscaleProblem: result.state };+ await rememberRoute("tailscale", true, { name: result.name });+ return state();+ },+ async setRoute(route, on) {+ if (!ROUTES.includes(route)) return state();+ if (route === "tailscale") return setTailscale(on === true);+ await rememberRoute(route, on === true);+ await changed(route, on === true);+ if (on === true) await wake();+ return state();+ },+ async dismissNotice(route) {+ dismissNotice(route);+ return state();+ },+ /** A code opened or the sidecar started for one: an empty sidecar is kept a while for the device to arrive. */+ touched() {+ activeSince = now();+ },+ async sleepIfIdle() {+ if (!running() || now() - activeSince < PHONE_LINK_SLEEP_GRACE_MS) return false;+ if (!phoneLinkShouldSleep(await state().catch(() => null))) return false;+ log("phone link: nothing paired and no code open; sleeping");+ await sleep();+ return true;+ },+ /** Every channel is the desktop window's own (`localOnly`). */+ install(ipcMain, localOnly) {+ const handle = (channel, run) => ipcMain.handle(channel, localOnly(channel, run));+ handle("companion:refresh-tailscale", () => api.checkTailscale());+ handle("companion:tailscale", (_event, on) => api.setTailscale(on === true));+ handle("companion:route", (_event, route, on) => api.setRoute(String(route), on === true));+ handle("companion:notice-dismiss", (_event, route) => api.dismissNotice(String(route)));+ },+ start() {+ timer ??= setTimer(() => void api.sleepIfIdle(), SLEEP_CHECK_MS);+ timer.unref?.();+ },+ };+ return api;+}diff --git a/electron/phone-link-routes.node-test.mjs b/electron/phone-link-routes.node-test.mjsnew file mode 100644index 0000000000..96c8844d4c--- /dev/null+++ b/electron/phone-link-routes.node-test.mjs@@ -0,0 +1,115 @@+import assert from "node:assert/strict";+import test from "node:test";++import { createPhoneLinkRoutes, PHONE_LINK_SLEEP_GRACE_MS } from "./phone-link-routes.mjs";+import { checkTailscale, readTailscaleStatus, TAILSCALE_CLI_PATHS, tailscaleEnvironment, tailscaleInstall } from "./tailscale-check.mjs";++function world({ check = async () => ({ state: "ready", name: "mac.tail1.ts.net" }), tailscaleOn = false, sidecar = null } = {}) {+ const w = { routes: { tailscale: tailscaleOn }, names: [], checks: 0, wakes: 0, sleeps: 0, changed: [], clock: 1_000_000, sidecar, running: sidecar !== null };+ w.links = createPhoneLinkRoutes({+ rememberRoute: async (route, on, extra) => { w.routes[route] = on; if (extra?.name) w.names.push(extra.name); },+ routeOn: (route) => w.routes[route] === true,+ dismissNotice: () => {},+ state: async () => ({ routes: w.routes, ...(w.sidecar ?? { enabled: false }) }),+ running: () => w.running,+ wake: async () => { w.wakes++; },+ sleep: async () => { w.sleeps++; w.running = false; },+ changed: async (route, on) => { w.changed.push([route, on]); },+ check: async () => { w.checks++; return check(); },+ now: () => w.clock,+ setTimer: () => ({ unref() {} }),+ });+ return w;+}++test("Tailscale's Turn on asks Tailscale once, keeps the name, and wakes a link with something paired", async () => {+ const w = world();+ await w.links.setTailscale(true);+ assert.equal(w.checks, 1);+ assert.equal(w.routes.tailscale, true);+ assert.deepEqual(w.names, ["mac.tail1.ts.net"]);+ assert.equal(w.wakes, 1);+});++test("a Tailscale that isn't installed or is signed out leaves the route off and says why", async () => {+ for (const state of ["not-installed", "signed-out"]) {+ const w = world({ check: async () => ({ state }) });+ const reply = await w.links.setTailscale(true);+ assert.equal(reply.tailscaleProblem, state);+ assert.equal(w.routes.tailscale, false);+ assert.equal(w.wakes, 0);+ }+});++test("Check again runs Tailscale only while its route is on, and starts nothing", async () => {+ const off = world();+ await off.links.checkTailscale();+ assert.equal(off.checks, 0, "off: nothing is run");+ const on = world({ tailscaleOn: true });+ await on.links.checkTailscale();+ assert.equal(on.checks, 1);+ assert.equal(on.wakes, 0, "Check again has no side effects");+});++test("turning Tailscale off runs nothing", async () => {+ const w = world({ tailscaleOn: true });+ await w.links.setTailscale(false);+ assert.equal(w.checks, 0);+ assert.equal(w.routes.tailscale, false);+});++test("other routes switch on their own, tell main which changed, and wake only when turned on", async () => {+ const w = world();+ await w.links.setRoute("relay", true);+ await w.links.setRoute("https", false);+ await w.links.setRoute("nonsense", true);+ assert.deepEqual(w.changed, [["relay", true], ["https", false]]);+ assert.equal(w.wakes, 1);+ assert.equal(w.routes.nonsense, undefined);+});++test("an empty sidecar goes back to sleep after the grace for a code, never one with a device or a code open", async () => {+ const empty = world({ sidecar: { enabled: true, devices: [], pairing: null } });+ empty.links.touched();+ assert.equal(await empty.links.sleepIfIdle(), false, "just started for a code");+ empty.clock += PHONE_LINK_SLEEP_GRACE_MS;+ assert.equal(await empty.links.sleepIfIdle(), true);+ assert.equal(empty.sleeps, 1);++ const paired = world({ sidecar: { enabled: true, devices: [{ id: "a" }], pairing: null } });+ paired.clock += PHONE_LINK_SLEEP_GRACE_MS;+ assert.equal(await paired.links.sleepIfIdle(), false);+ const pairing = world({ sidecar: { enabled: true, devices: [], pairing: { code: "1" } } });+ pairing.clock += PHONE_LINK_SLEEP_GRACE_MS;+ assert.equal(await pairing.links.sleepIfIdle(), false);+});++test("Tailscale presence is checked by looking for files; nothing runs when none is there", async () => {+ const none = { exists: () => false, env: { PATH: "" }, home: "/nowhere", platform: "darwin" };+ assert.equal(tailscaleInstall(none), "none");+ assert.equal(tailscaleInstall({ ...none, exists: (file) => file === "/usr/bin/tailscale" }), "cli");+ assert.equal(tailscaleInstall({ ...none, exists: (file) => file === "/Applications/Tailscale.app" }), "app-only");+ let runs = 0;+ const run = async () => { runs++; return { missing: false, stdout: "", stderr: "" }; };+ assert.deepEqual(await checkTailscale({ install: () => "none", run }), { state: "not-installed" });+ assert.deepEqual(await checkTailscale({ install: () => "app-only", run }), { state: "no-cli" }, "the macOS app's executable is never run");+ assert.equal(runs, 0);+});++test("one status reading tells ready, signed out, not running and not allowed apart", async () => {+ assert.deepEqual(readTailscaleStatus(JSON.stringify({ BackendState: "Running", Self: { DNSName: "Mac.tail1.ts.net." } })), { state: "ready", name: "mac.tail1.ts.net" });+ assert.deepEqual(readTailscaleStatus(JSON.stringify({ BackendState: "NeedsLogin", Self: { DNSName: "" } })), { state: "signed-out" });+ assert.deepEqual(readTailscaleStatus(JSON.stringify({ BackendState: "Stopped" })), { state: "not-running" });+ assert.deepEqual(readTailscaleStatus("", "failed to connect to local tailscaled; it doesn't appear to be running"), { state: "not-running" });+ assert.deepEqual(readTailscaleStatus("", "Access denied: watch IPN bus access denied"), { state: "needs-permission" });+ const tried = [];+ const result = await checkTailscale({+ install: () => "cli",+ candidates: ["/opt/homebrew/bin/tailscale", "/usr/bin/tailscale"],+ run: async (cli) => { tried.push(cli); return cli === "/opt/homebrew/bin/tailscale" ? { missing: true, stdout: "", stderr: "" } : { missing: false, stdout: JSON.stringify({ BackendState: "Running", Self: { DNSName: "mac.tail1.ts.net." } }), stderr: "" }; },+ });+ assert.deepEqual(result, { state: "ready", name: "mac.tail1.ts.net" });+ assert.deepEqual(tried, ["/opt/homebrew/bin/tailscale", "/usr/bin/tailscale"]);+ assert.ok(!TAILSCALE_CLI_PATHS.some((cli) => /Tailscale\.app/.test(cli)), "no app executable among the candidates");+ assert.equal(tailscaleEnvironment({ PATH: "" }).TAILSCALE_BE_CLI, "1");+});diff --git a/electron/preload.cjs b/electron/preload.cjsindex fa82c3b27c..c500daba44 100644--- a/electron/preload.cjs+++ b/electron/preload.cjs@@ -261,10 +261,13 @@ const bridge = {},companion: {state: () => ipcRenderer.invoke("companion:state"),- start: () => ipcRenderer.invoke("companion:start"),+ start: (routes) => ipcRenderer.invoke("companion:start", Array.isArray(routes) ? routes.filter((route) => typeof route === "string") : undefined),stop: () => ipcRenderer.invoke("companion:stop"),keepAwake: (enabled) => ipcRenderer.invoke("companion:keep-awake", enabled),refreshTailscale: () => ipcRenderer.invoke("companion:refresh-tailscale"),+ setTailscale: (on) => ipcRenderer.invoke("companion:tailscale", on === true),+ setRoute: (route, on) => ipcRenderer.invoke("companion:route", String(route), on === true),+ dismissNotice: (route) => ipcRenderer.invoke("companion:notice-dismiss", String(route)),pairing: (open, expectedToken) => ipcRenderer.invoke("companion:pairing", open, expectedToken),cloudDesktop: (deviceId, allowed) => ipcRenderer.invoke("companion:cloud-desktop", deviceId, allowed),browserControl: (deviceId, allowed) => ipcRenderer.invoke("companion:browser-control", deviceId, allowed),diff --git a/electron/tailscale-check.mjs b/electron/tailscale-check.mjsnew file mode 100644index 0000000000..e62abde102--- /dev/null+++ b/electron/tailscale-check.mjs@@ -0,0 +1,77 @@+// Runs only when the person presses Turn on or Check again on the Tailscale route, and only Tailscale's command-line+// tool: never the macOS app's executable, so the app is never opened or signed in. Never logs Tailscale's raw output+// (it can carry auth keys and node names).+import { execFile } from "node:child_process";+import fs from "node:fs";+import os from "node:os";+import path from "node:path";++/** Tailscale's command-line tool where its installers put it, then PATH. */+export const TAILSCALE_CLI_PATHS = Object.freeze([+ "/opt/homebrew/bin/tailscale",+ "/usr/local/bin/tailscale",+ "/usr/bin/tailscale",+ "/run/current-system/sw/bin/tailscale",+ "C:\\Program Files\\Tailscale\\tailscale.exe",+ "C:\\Program Files (x86)\\Tailscale\\tailscale.exe",+ "tailscale",+]);++const macApps = (home) => ["/Applications/Tailscale.app", path.join(home, "Applications", "Tailscale.app")];+const onPath = (name, env) => (env.PATH ?? "").split(path.delimiter).filter(Boolean).some((dir) => fs.existsSync(path.join(dir, name)));++/** Looks for files only: nothing is run. "app-only" is the macOS app without its command-line tool. */+export function tailscaleInstall({ exists = fs.existsSync, env = process.env, home = os.homedir(), platform = process.platform } = {}) {+ const cli = TAILSCALE_CLI_PATHS.some((candidate) => (candidate === "tailscale" ? onPath(platform === "win32" ? "tailscale.exe" : "tailscale", env) : exists(candidate)));+ if (cli) return "cli";+ return macApps(home).some((app) => exists(app)) ? "app-only" : "none";+}++/** The macOS app's command-line tool chooses CLI mode from its environment; keep it explicit.+ * https://tailscale.com/docs/reference/tailscale-cli?tab=macos */+export const tailscaleEnvironment = (env = process.env) => ({+ ...env,+ PATH: [env.PATH ?? "", "/opt/homebrew/bin", "/usr/local/bin", "/usr/bin", "/bin"].filter(Boolean).join(path.delimiter),+ TAILSCALE_BE_CLI: "1",+});++const runStatus = (cli) =>+ new Promise((resolve) => {+ execFile(cli, ["status", "--json"], { timeout: 5_000, killSignal: "SIGKILL", maxBuffer: 16 * 1024 * 1024, env: tailscaleEnvironment(), windowsHide: true },+ (error, stdout, stderr) => resolve({ missing: error?.code === "ENOENT", stdout: String(stdout ?? ""), stderr: String(stderr ?? "") }));+ });++/** What one `tailscale status --json` says, in the row's words: ready (with this computer's MagicDNS name), signed out,+ * not running, or not allowed to ask. */+export function readTailscaleStatus(stdout, stderr = "") {+ let parsed = null;+ try {+ parsed = JSON.parse(stdout);+ } catch {+ }+ if (!parsed) {+ const text = stderr.toLowerCase();+ if (/access denied|permission denied|operator|not permitted/.test(text)) return { state: "needs-permission" };+ return { state: "not-running" };+ }+ if (parsed.BackendState === "Stopped") return { state: "not-running" };+ const dns = parsed?.Self?.DNSName;+ const name = typeof dns === "string" ? dns.replace(/\.$/, "").toLowerCase() : "";+ if (parsed.BackendState !== "Running" || !name.endsWith(".ts.net")) return { state: "signed-out" };+ return { state: "ready", name };+}++export async function checkTailscale({ run = runStatus, install = () => tailscaleInstall(), candidates = TAILSCALE_CLI_PATHS } = {}) {+ const found = install();+ if (found === "none") return { state: "not-installed" };+ if (found === "app-only") return { state: "no-cli" };+ let last = { state: "not-installed" };+ for (const cli of candidates) {+ const result = await run(cli);+ if (result.missing) continue;+ last = readTailscaleStatus(result.stdout, result.stderr);+ if (last.state === "ready") return last;+ break;+ }+ return last;+}diff --git a/src/components/CompanionSection.test.ts b/src/components/CompanionSection.test.tsindex f30e37ddcc..2a7d1afd80 100644--- a/src/components/CompanionSection.test.ts+++ b/src/components/CompanionSection.test.ts@@ -1,4 +1,6 @@-import { describe, expect, it } from "vitest";+import { createElement } from "react";+import { renderToStaticMarkup } from "react-dom/server";+import { describe, expect, it, vi } from "vitest";import type { CompanionAccountState } from "../types/ogb";import {@@ -14,8 +16,10 @@ import {deriveTailscalePairingStatus,loadCompanionBridgeState,pairingSurfaceCopy,+ RouteNotices,shouldHydrateCompanionEmail,} from "./CompanionSection";+import type { PhoneSetupController } from "./PhoneSetupFlow";const account = (status: CompanionAccountState["status"], message?: string): CompanionAccountState => ({available: true,@@ -205,34 +209,43 @@ describe("Tailscale pairing onboarding", () => {);});- it("explains every step between unchecked and ready", () => {- expect(deriveTailscalePairingStatus({ enabled: false }, false)).toMatchObject({- kind: "unchecked",- detail: expect.stringContaining("turns on Remote access"),+ it("explains every step from off to ready", () => {+ const tailscale = (route: { on: boolean; since: number | null; name?: string | null }) => ({+ wifi: { on: false, since: null }, relay: { on: false, since: null }, https: { on: false, since: null }, tailscale: route,});- expect(deriveTailscalePairingStatus({ enabled: true }, false).kind).toBe("unavailable");- expect(deriveTailscalePairingStatus({- enabled: true,- tailscale: "100.99.1.2",- }, false).kind).toBe("magicdns");- expect(deriveTailscalePairingStatus({- enabled: true,- tailscale: "100.99.1.2",- tailnetName: "mac.tail1234.ts.net",- }, true)).toMatchObject({- kind: "ready",+ expect(deriveTailscalePairingStatus({ enabled: true }).kind).toBe("off");+ expect(deriveTailscalePairingStatus({ enabled: false, tailscaleProblem: "not-installed" })).toMatchObject({ kind: "not-installed", title: "Tailscale isn't installed on this computer." });+ expect(deriveTailscalePairingStatus({ enabled: false, tailscaleProblem: "signed-out" })).toMatchObject({ kind: "signed-out", title: "Open Tailscale and sign in, then try again." });+ expect(deriveTailscalePairingStatus({ enabled: true, routes: tailscale({ on: true, since: 1, name: null }) }).kind).toBe("magicdns");+ expect(deriveTailscalePairingStatus({ enabled: false, routes: tailscale({ on: true, since: 1, name: "mac.tail1234.ts.net" }) })).toMatchObject({+ kind: "waiting",title: "Ready on mac.tail1234.ts.net",+ detail: "On. It answers once a device is paired.",});+ expect(deriveTailscalePairingStatus({ enabled: true, routes: tailscale({ on: true, since: 1, name: "mac.tail1234.ts.net" }) }).kind).toBe("ready");});it("surfaces sidecar failures instead of pretending Tailscale is merely absent", () => {expect(deriveTailscalePairingStatus({enabled: true,error: "the companion is not responding",- }, false)).toEqual({+ })).toEqual({kind: "error",title: "Remote access needs attention",detail: "the companion is not responding",});});});++describe("the update's notes about routes it kept on", () => {+ it("names each kept route with Turn off beside OK, and shows nothing once they are seen", () => {+ const c = { busy: false, act: vi.fn() } as unknown as PhoneSetupController;+ const html = renderToStaticMarkup(createElement(RouteNotices, { c, notices: ["wifi", "tailscale"] }));+ expect(html).toContain('data-route-notice="wifi"');+ expect(html).toContain("Same Wi-Fi is on because a paired device uses it.");+ expect(html).toContain("Tailscale is on because a paired device may use it.");+ expect(html.match(/>Turn off</g)).toHaveLength(2);+ expect(html.match(/>OK</g)).toHaveLength(2);+ expect(renderToStaticMarkup(createElement(RouteNotices, { c, notices: [] }))).toBe("");+ });+});diff --git a/src/components/CompanionSection.tsx b/src/components/CompanionSection.tsxindex d2bbada279..ff4f5e9448 100644--- a/src/components/CompanionSection.tsx+++ b/src/components/CompanionSection.tsx@@ -15,6 +15,8 @@ import {companionBridge,loadCompanionBridgeState,shouldHydrateCompanionEmail,+ type CompanionBridge,+ type CompanionRoute,type CompanionState,type PhoneSetupController,usePhoneSetupController,@@ -41,48 +43,68 @@ export interface CompanionPanelStatus {}export interface TailscalePairingStatus {- kind: "unchecked" | "unavailable" | "magicdns" | "ready" | "error";+ kind: "off" | "not-installed" | "signed-out" | "magicdns" | "waiting" | "ready" | "error";title: string;detail: string;}+/** Any way in the person turned on; an older build's single switch reads as "on" while its sidecar runs. */+export const companionRoutesOn = (state: Pick<CompanionState, "enabled" | "routes">): boolean =>+ state.routes ? Object.values(state.routes).some((route) => route.on) : state.enabled;+export function deriveTailscalePairingStatus(- state: Pick<CompanionState, "enabled" | "tailscale" | "tailnetName" | "error">,- routeAvailable: boolean,+ state: Pick<CompanionState, "enabled" | "routes" | "tailscaleProblem" | "error">,): TailscalePairingStatus {- if (state.error) {- return {- kind: "error",- title: t("remote.status.attention"),- detail: state.error,- };- }- if (routeAvailable && state.tailnetName) {- return {- kind: "ready",- title: t("remote.tailscale.ready", { name: state.tailnetName }),- detail: t("remote.tailscale.readyDetail"),- };- }- if (state.tailscale) {- return {- kind: "magicdns",- title: t("remote.tailscale.magicDns"),- detail: t("remote.tailscale.magicDnsDetail"),- };- }- if (state.enabled) {- return {- kind: "unavailable",- title: t("remote.tailscale.notConnected"),- detail: t("remote.tailscale.notConnectedDetail"),- };- }- return {- kind: "unchecked",- title: t("remote.tailscale.already"),- detail: t("remote.tailscale.alreadyDetail"),- };+ if (state.tailscaleProblem === "not-installed") return { kind: "not-installed", title: t("remote.tailscale.notInstalled"), detail: "" };+ if (state.tailscaleProblem === "no-cli") return { kind: "signed-out", title: t("remote.tailscale.noCli"), detail: "" };+ if (state.tailscaleProblem === "not-running") return { kind: "signed-out", title: t("remote.tailscale.notRunning"), detail: "" };+ if (state.tailscaleProblem === "needs-permission") return { kind: "signed-out", title: t("remote.tailscale.needsPermission", { app: productName() }), detail: "" };+ if (state.tailscaleProblem === "signed-out") return { kind: "signed-out", title: t("remote.tailscale.signIn"), detail: "" };+ if (state.error) return { kind: "error", title: t("remote.status.attention"), detail: state.error };+ const route = state.routes?.tailscale;+ if (!route?.on) return { kind: "off", title: t("remote.status.off"), detail: "" };+ if (!route.name) return { kind: "magicdns", title: t("remote.tailscale.magicDns"), detail: t("remote.tailscale.magicDnsDetail") };+ const title = t("remote.tailscale.ready", { name: route.name });+ return state.enabled+ ? { kind: "ready", title, detail: t("remote.tailscale.readyDetail") }+ : { kind: "waiting", title, detail: t("remote.tailscale.linkOff") };+}++/** Older app builds have no switch: on falls back to the check that turns it on, and off cannot be asked of them. */+export function setCompanionTailscale(companion: CompanionBridge, on: boolean): Promise<CompanionState> {+ if (companion.setTailscale) return companion.setTailscale(on);+ return on ? companion.refreshTailscale() : companion.state();+}++const NOTICE_KEY = {+ wifi: "remote.notice.wifi",+ relay: "remote.notice.relay",+ tailscale: "remote.notice.tailscale",+ https: "remote.notice.https",+} as const;++/** The update's one-time notes: each route it kept on, with Turn off beside OK. */+export function RouteNotices({ c, notices }: { c: PhoneSetupController; notices: CompanionRoute[] }) {+ if (notices.length === 0) return null;+ return (+ <div className="flex flex-col gap-2" data-route-notices="">+ {notices.map((route) => (+ <div key={route} role="status" data-route-notice={route} className="flex flex-wrap items-center justify-between gap-3 rounded-xl bg-inset px-3 py-2.5 text-[13px] text-ink">+ <span className="min-w-0">{t(NOTICE_KEY[route])}</span>+ <span className="flex shrink-0 gap-2">+ <button type="button" disabled={c.busy} className="rounded-lg border border-hairline/40 px-2.5 py-1 text-[12px] hover:bg-control disabled:opacity-40"+ onClick={() => void c.act((companion) => (route === "tailscale" ? setCompanionTailscale(companion, false) : companion.setRoute?.(route, false) ?? companion.state()))}>+ {t("remote.notice.turnOff")}+ </button>+ <button type="button" disabled={c.busy} className="rounded-lg px-2.5 py-1 text-[12px] text-ink-secondary hover:bg-control disabled:opacity-40"+ onClick={() => void c.act((companion) => companion.dismissNotice?.(route) ?? companion.state())}>+ {t("common.ok")}+ </button>+ </span>+ </div>+ ))}+ </div>+ );}export function pairingSurfaceCopy(@@ -107,10 +129,10 @@ export function pairingSurfaceCopy(}export function deriveCompanionPanelStatus(- state: Pick<CompanionState, "enabled" | "devices" | "error">,+ state: Pick<CompanionState, "enabled" | "routes" | "devices" | "error">,): CompanionPanelStatus | null {if (state.error) return { label: t("remote.status.attention"), good: false };- if (!state.enabled) return { label: t("remote.status.off"), good: false };+ if (!companionRoutesOn(state)) return { label: t("remote.status.off"), good: false };const pairedCount = state.devices.length;if (!pairedCount) return null;return {@@ -188,7 +210,9 @@ export function CompanionSection({ profileEmail = "", focusRequest = 0 }: { profconst panelStatus = deriveCompanionPanelStatus(state);const accountActionError = companionAccountActionError(c.account, c.accountError);const pairingCopy = pairingSurfaceCopy(c);- const tailscaleStatus = deriveTailscalePairingStatus(state, c.tailscaleAvailable);+ const tailscaleStatus = deriveTailscalePairingStatus(state);+ const tailscaleOn = state.routes?.tailscale?.on === true;+ const routesOn = companionRoutesOn(state);const hosted = state.endpoints?.find((endpoint) => endpoint.kind === "hosted");const localRoutes = [state.tailnetName ? { label: "Tailscale", value: `${state.tailnetName}:${state.port}` } : null,@@ -207,6 +231,7 @@ export function CompanionSection({ profileEmail = "", focusRequest = 0 }: { profreturn (<div className="flex flex-col gap-4">{remoteBlocked && <p role="status" className="text-[13px] leading-relaxed text-ink-secondary">{remoteBlocked}</p>}+ <RouteNotices c={c} notices={state.notices ?? []} /><div ref={pairingFlow} tabIndex={-1} data-phone-pairing="computer" className="scroll-mt-4 rounded-xl ring-1 ring-accent/40 focus:outline-none"><Card title={pairingCopy.title} subtitle={pairingCopy.subtitle}>{(panelStatus || (pairedCount > 0 && c.hostedReady)) && (@@ -245,10 +270,10 @@ export function CompanionSection({ profileEmail = "", focusRequest = 0 }: { prof</div></div><Switch- checked={state.enabled}+ checked={routesOn}aria-label={t("remote.title")}- disabled={c.busy || (Boolean(remoteBlocked) && !state.enabled)}- onClick={() => void c.act((companion) => (state.enabled ? companion.stop() : companion.start()))}+ disabled={c.busy || (Boolean(remoteBlocked) && !routesOn)}+ onClick={() => void c.act((companion) => (routesOn ? companion.stop() : companion.start()))}/></div>@@ -263,49 +288,81 @@ export function CompanionSection({ profileEmail = "", focusRequest = 0 }: { prof<PhonesList /><div className="border-t border-hairline/30 pt-4">- <div className="text-[13px] text-ink">{t("remote.pairing.tailscale.title")}</div>- <div className="mt-0.5 text-[12px] leading-relaxed text-ink-secondary">{t("remote.tailscaleCard.subtitle")}</div>- <div className="mt-3">- <div className="rounded-xl bg-inset px-3 py-3" aria-live="polite">- <div className="flex items-start gap-2.5">- <ShieldCheck- size={16}- className={`mt-0.5 shrink-0 ${tailscaleStatus.kind === "ready" ? "text-success" : "text-ink-secondary"}`}- />- <div className="min-w-0">- <div className="text-[13px] font-medium text-ink">{tailscaleStatus.title}</div>- <div className="mt-0.5 text-[12px] leading-relaxed text-ink-secondary">- {tailscaleStatus.detail}+ <div className="flex items-center justify-between gap-4">+ <div className="min-w-0">+ <div className="text-[13px] text-ink">{t("remote.pairing.tailscale.title")}</div>+ <div className="mt-0.5 text-[12px] leading-relaxed text-ink-secondary">{t("remote.tailscaleCard.subtitle")}</div>+ <div className="mt-1 text-[12px] leading-relaxed text-ink-secondary">{t("remote.tailscaleSwitch.detail", { app: productName() })}</div>+ </div>+ <Switch+ checked={tailscaleOn}+ aria-label={t("remote.pairing.tailscale.title")}+ disabled={c.busy || c.accountBusy || (Boolean(managedBy) && !tailscaleOn)}+ onClick={() => void c.act((companion) => setCompanionTailscale(companion, !tailscaleOn))}+ />+ </div>+ {tailscaleStatus.kind !== "off" && (+ <div className="mt-3" data-tailscale-status={tailscaleStatus.kind}>+ <div className="rounded-xl bg-inset px-3 py-3" aria-live="polite">+ <div className="flex items-start gap-2.5">+ <ShieldCheck+ size={16}+ className={`mt-0.5 shrink-0 ${tailscaleStatus.kind === "ready" ? "text-success" : "text-ink-secondary"}`}+ />+ <div className="min-w-0">+ <div className="text-[13px] font-medium text-ink">{tailscaleStatus.title}</div>+ {tailscaleStatus.detail && (+ <div className="mt-0.5 text-[12px] leading-relaxed text-ink-secondary">+ {tailscaleStatus.detail}+ </div>+ )}</div></div>- </div>- </div>- {tailscaleStatus.kind === "ready" ? (- <button- disabled={c.busy || c.accountBusy || Boolean(managedBy)}- title={managedBy ?? undefined}- onClick={() => {- c.useTailscale();- window.requestAnimationFrame(() => {- pairingFlow.current?.scrollIntoView({ block: "start" });- pairingFlow.current?.focus({ preventScroll: true });- });- }}- className="mt-3 rounded-lg border border-hairline/40 px-3 py-1.5 text-[12px] text-ink hover:bg-control disabled:opacity-40"- >- {t("remote.pairOverTailscale")}- </button>- ) : (- <button- disabled={c.busy || c.accountBusy || (Boolean(managedBy) && !state.enabled)}- title={managedBy ?? undefined}- onClick={c.refreshTailscale}- className="mt-3 rounded-lg border border-hairline/40 px-3 py-1.5 text-[12px] text-ink hover:bg-control disabled:opacity-40"- >- {c.busy ? t("common.checking") : managedBy && !state.enabled ? managedBy : state.enabled ? t("remote.checkAgain") : t("remote.turnOnAndCheck")}- </button>- )}- </div>+ </div>+ <div className="mt-3 flex flex-wrap gap-2">+ {(tailscaleStatus.kind === "ready" || tailscaleStatus.kind === "waiting") && (+ <button+ disabled={c.busy || c.accountBusy || Boolean(managedBy)}+ title={managedBy ?? undefined}+ onClick={() => {+ c.useTailscale();+ window.requestAnimationFrame(() => {+ pairingFlow.current?.scrollIntoView({ block: "start" });+ pairingFlow.current?.focus({ preventScroll: true });+ });+ }}+ className="rounded-lg border border-hairline/40 px-3 py-1.5 text-[12px] text-ink hover:bg-control disabled:opacity-40"+ >+ {t("remote.pairOverTailscale")}+ </button>+ )}+ {tailscaleOn && tailscaleStatus.kind !== "error" && (+ <button+ disabled={c.busy || c.accountBusy}+ onClick={c.refreshTailscale}+ className="rounded-lg border border-hairline/40 px-3 py-1.5 text-[12px] text-ink hover:bg-control disabled:opacity-40"+ >+ {c.busy ? t("common.checking") : t("remote.checkAgain")}+ </button>+ )}+ {tailscaleStatus.kind === "not-installed" && (+ <a href="https://tailscale.com/download" target="_blank" rel="noreferrer"+ className="rounded-lg border border-hairline/40 px-3 py-1.5 text-[12px] text-ink hover:bg-control">+ {t("remote.tailscale.getIt")}+ </a>+ )}+ {tailscaleStatus.kind === "signed-out" && (+ <button+ disabled={c.busy || c.accountBusy}+ onClick={() => void c.act((companion) => setCompanionTailscale(companion, true))}+ className="rounded-lg border border-hairline/40 px-3 py-1.5 text-[12px] text-ink hover:bg-control disabled:opacity-40"+ >+ {t("common.tryAgain")}+ </button>+ )}+ </div>+ </div>+ )}</div><div className="flex items-center justify-between gap-4 border-t border-hairline/30 pt-4">@@ -318,7 +375,7 @@ export function CompanionSection({ profileEmail = "", focusRequest = 0 }: { prof<Switchchecked={state.keepAwake}aria-label={t("remote.keepAwakeAria")}- disabled={c.busy || !state.enabled}+ disabled={c.busy || !routesOn}onClick={() => void c.act((companion) => companion.keepAwake(!state.keepAwake))}/></div>diff --git a/src/components/PhoneSetupFlow.tsx b/src/components/PhoneSetupFlow.tsxindex 185e00ca55..806b897cc1 100644--- a/src/components/PhoneSetupFlow.tsx+++ b/src/components/PhoneSetupFlow.tsx@@ -69,7 +69,7 @@ import { PhonePairingQr } from "./PhonePairingQr";import { productName } from "../lib/brand";import type { CompanionBridge, CompanionState } from "../lib/companion-types";-export type { CompanionBridge, CompanionState, PhoneDevice } from "../lib/companion-types";+export type { CompanionBridge, CompanionRoute, CompanionState, PhoneDevice } from "../lib/companion-types";type AccountBridge = NonNullable<NonNullable<Window["ogb"]>["companionAccount"]>;type StateBridge<T> = { state: () => Promise<T> };@@ -328,7 +328,7 @@ export function usePhoneSetupController(profileEmail = ""): PhoneSetupControllerread: () => companion.state(),start: () => mutateCompanionBridgeState(companionMutationEpoch,- () => companion.start(),+ () => companion.start(routeMode === "tailscale" ? [] : undefined),),refreshTailscale: () => mutateCompanionBridgeState(companionMutationEpoch,diff --git a/src/lib/companion-types.ts b/src/lib/companion-types.tsindex 31ddd6de8f..a5a62f06cb 100644--- a/src/lib/companion-types.ts+++ b/src/lib/companion-types.ts@@ -17,6 +17,9 @@ export interface PhoneDevice {route?: "wifi" | "tailscale" | "relay" | null;}+/** Same Wi-Fi, Anywhere through MausBot, Tailscale, and the HTTPS address. */+export type CompanionRoute = "wifi" | "relay" | "tailscale" | "https";+export interface CompanionState {enabled: boolean;keepAwake: boolean;@@ -27,6 +30,12 @@ export interface CompanionState {addresses?: string[];tailscale?: string;tailnetName?: string;+ /** Each way into this computer and whether the person turned it on. Absent on older builds. */+ routes?: Record<CompanionRoute, { on: boolean; since: number | null; name?: string | null }>;+ /** Routes the update kept on that the person has not been told about yet. */+ notices?: CompanionRoute[];+ /** Why Tailscale could not be turned on or checked just now. */+ tailscaleProblem?: "not-installed" | "no-cli" | "not-running" | "needs-permission" | "signed-out";lan?: string | null;hosts?: string[];endpoints?: CompanionEndpoint[];@@ -41,10 +50,16 @@ export interface CompanionState {export type CompanionBridge = {state: () => Promise<CompanionState>;- start: () => Promise<CompanionState>;+ /** Turns on `routes` (Same Wi-Fi and the relay when omitted) and starts the phone link. */+ start: (routes?: CompanionRoute[]) => Promise<CompanionState>;stop: () => Promise<CompanionState>;keepAwake: (enabled: boolean) => Promise<CompanionState>;+ /** Check again: asks Tailscale for this computer's name while its route is on; starts nothing. */refreshTailscale: () => Promise<CompanionState>;+ /** The rest are absent on an app build before per-route switches. */+ setTailscale?: (on: boolean) => Promise<CompanionState>;+ setRoute?: (route: CompanionRoute, on: boolean) => Promise<CompanionState>;+ dismissNotice?: (route: CompanionRoute) => Promise<CompanionState>;pairing: (open: boolean, expectedToken?: string) => Promise<CompanionState>;cloudDesktop: (deviceId: string, allowed: boolean) => Promise<CompanionState>;browserControl: (deviceId: string, allowed: boolean) => Promise<CompanionState>;diff --git a/src/locales/de.json b/src/locales/de.jsonindex a50278e8c2..19a2513036 100644--- a/src/locales/de.json+++ b/src/locales/de.json@@ -1540,19 +1540,27 @@"remote.tailscale.readyDetail": "Halte Tailscale auf dem Host und dem zu koppelnden Gerät verbunden.","remote.tailscale.magicDns": "Tailscale gefunden — MagicDNS fehlt noch","remote.tailscale.magicDnsDetail": "Aktiviere MagicDNS in Tailscale und prüf erneut, damit das Gerät einen sicheren Tailnet-Namen bekommt.",- "remote.tailscale.notConnected": "Tailscale ist noch nicht verbunden",- "remote.tailscale.notConnectedDetail": "Öffne Tailscale auf beiden Geräten, melde dich im selben Tailnet an und prüf erneut.",- "remote.tailscale.already": "Nutzt du schon Tailscale?",- "remote.tailscale.alreadyDetail": "Verbinde beide Geräte mit demselben Tailnet. Das Prüfen aktiviert den Fernzugriff, damit das andere Gerät diesen Rechner erreicht.","remote.desktopOnly.title": "{app} von einem anderen Gerät nutzen","remote.desktopOnly.subtitle": "Öffne Fernzugriff in der Desktop-App, um ein Telefon oder einen Rechner zu koppeln.","remote.title": "Fernzugriff","remote.checking": "Gerätezugriff wird geprüft…","remote.worksAway": "Funktioniert auch unterwegs","remote.tailscaleCard.subtitle": "Optional — für alle, die Tailscale schon nutzen. Das sichere HTTPS oben bleibt die empfohlene Einrichtung.",+ "remote.tailscaleSwitch.detail": "Aus, bis Sie es einschalten: {app} startet Tailscale nie von selbst und öffnet die Tailscale-App nie und meldet sie nie an. Eingeschaltet erreichen Geräte in Ihrem Tailnet diesen Rechner über seinen Tailnet-Namen.",+ "remote.tailscale.linkOff": "An. Antwortet, sobald ein Gerät gekoppelt ist.",+ "remote.tailscale.notInstalled": "Tailscale ist auf diesem Rechner nicht installiert.",+ "remote.tailscale.getIt": "Tailscale holen",+ "remote.tailscale.signIn": "Öffnen Sie Tailscale, melden Sie sich an und versuchen Sie es erneut.",+ "remote.tailscale.noCli": "Installieren Sie das Befehlszeilentool von Tailscale: Öffnen Sie in der Tailscale-App die Einstellungen, wählen Sie Install CLI und versuchen Sie es erneut.",+ "remote.tailscale.notRunning": "Tailscale läuft nicht. Öffnen Sie es und versuchen Sie es erneut.",+ "remote.tailscale.needsPermission": "Tailscale lässt {app} nicht fragen. Führen Sie unter Linux einmal sudo tailscale set --operator=$USER aus und versuchen Sie es erneut.",+ "remote.notice.wifi": "Gleiches WLAN ist an, weil ein gekoppeltes Gerät es nutzt.",+ "remote.notice.relay": "Überall, über {app} ist an, weil ein gekoppeltes Gerät es nutzt.",+ "remote.notice.tailscale": "Tailscale ist an, weil ein gekoppeltes Gerät es nutzen könnte.",+ "remote.notice.https": "Ihre {app}-Webadresse ist an, weil ein gekoppeltes Gerät sie nutzt.",+ "remote.notice.turnOff": "Ausschalten","remote.pairOverTailscale": "Über Tailscale koppeln","remote.checkAgain": "Erneut prüfen",- "remote.turnOnAndCheck": "Gerätezugriff einschalten & prüfen","remote.devices.title": "Gekoppelte Geräte","remote.devices.subtitle": "Verwalte die Geräte, die dieses {app} nutzen dürfen.","remote.devices.empty": "Noch sind keine Geräte gekoppelt.",diff --git a/src/locales/en.json b/src/locales/en.jsonindex 48505fc989..5f28615721 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -4473,19 +4473,27 @@"remote.tailscale.readyDetail": "Keep Tailscale connected on the host and the device being paired.","remote.tailscale.magicDns": "Tailscale found, but MagicDNS is still needed","remote.tailscale.magicDnsDetail": "Turn on MagicDNS in Tailscale, then check again so the device gets a secure tailnet name.",- "remote.tailscale.notConnected": "Tailscale is not connected yet",- "remote.tailscale.notConnectedDetail": "Open Tailscale on both devices, sign in to the same tailnet, then check again.",- "remote.tailscale.already": "Already use Tailscale?",- "remote.tailscale.alreadyDetail": "Connect both devices to the same tailnet. Checking turns on Remote access so the other device can reach this computer.","remote.desktopOnly.title": "Use {app} from another device","remote.desktopOnly.subtitle": "Open Remote access in the desktop app to pair a phone or computer.","remote.title": "Remote access","remote.checking": "Checking device access…","remote.worksAway": "Works away from home","remote.tailscaleCard.subtitle": "Optional, for people who already use Tailscale. Secure HTTPS above remains the recommended setup.",+ "remote.tailscaleSwitch.detail": "Off until you turn it on: {app} never runs Tailscale by itself, and never opens or signs in the Tailscale app. On, devices on your tailnet reach this computer by its tailnet name.",+ "remote.tailscale.linkOff": "On. It answers once a device is paired.",+ "remote.tailscale.notInstalled": "Tailscale isn't installed on this computer.",+ "remote.tailscale.getIt": "Get Tailscale",+ "remote.tailscale.signIn": "Open Tailscale and sign in, then try again.",+ "remote.tailscale.noCli": "Install Tailscale's command-line tool: in the Tailscale app, open Settings and choose Install CLI, then try again.",+ "remote.tailscale.notRunning": "Tailscale isn't running. Open it, then try again.",+ "remote.tailscale.needsPermission": "Tailscale won't let {app} ask it. On Linux, run sudo tailscale set --operator=$USER once, then try again.",+ "remote.notice.wifi": "Same Wi-Fi is on because a paired device uses it.",+ "remote.notice.relay": "Anywhere, through {app} is on because a paired device uses it.",+ "remote.notice.tailscale": "Tailscale is on because a paired device may use it.",+ "remote.notice.https": "Your {app} web address is on because a paired device uses it.",+ "remote.notice.turnOff": "Turn off","remote.pairOverTailscale": "Pair over Tailscale","remote.checkAgain": "Check again",- "remote.turnOnAndCheck": "Turn on device access & check","remote.devices.title": "Paired devices","remote.devices.subtitle": "Manage the devices that can use this {app}.","remote.devices.empty": "No devices are paired yet.",diff --git a/src/locales/es.json b/src/locales/es.jsonindex fb4fb32686..b1654a1e63 100644--- a/src/locales/es.json+++ b/src/locales/es.json@@ -3485,19 +3485,27 @@"remote.tailscale.readyDetail": "Mantén Tailscale conectado en el host y en el dispositivo que vas a emparejar.","remote.tailscale.magicDns": "Tailscale detectado: aún falta MagicDNS","remote.tailscale.magicDnsDetail": "Activa MagicDNS en Tailscale y vuelve a comprobar, para que el dispositivo reciba un nombre seguro en la tailnet.",- "remote.tailscale.notConnected": "Tailscale todavía no está conectado",- "remote.tailscale.notConnectedDetail": "Abre Tailscale en ambos dispositivos, inicia sesión en la misma tailnet y vuelve a comprobar.",- "remote.tailscale.already": "¿Ya usas Tailscale?",- "remote.tailscale.alreadyDetail": "Conecta ambos dispositivos a la misma tailnet. Al comprobar se activa el acceso remoto para que el otro dispositivo llegue a este equipo.","remote.desktopOnly.title": "Usar {app} desde otro dispositivo","remote.desktopOnly.subtitle": "Abre Acceso remoto en la app de escritorio para emparejar un teléfono o un equipo.","remote.title": "Acceso remoto","remote.checking": "Comprobando el acceso del dispositivo…","remote.worksAway": "Funciona fuera de casa","remote.tailscaleCard.subtitle": "Opcional: para quien ya usa Tailscale. El HTTPS seguro de arriba sigue siendo lo recomendado.",+ "remote.tailscaleSwitch.detail": "Apagado hasta que lo actives: {app} nunca ejecuta Tailscale por su cuenta, ni abre ni inicia sesión en la app de Tailscale. Activado, los dispositivos de tu tailnet llegan a esta computadora por su nombre de tailnet.",+ "remote.tailscale.linkOff": "Activado. Responde en cuanto se empareje un dispositivo.",+ "remote.tailscale.notInstalled": "Tailscale no está instalado en esta computadora.",+ "remote.tailscale.getIt": "Obtener Tailscale",+ "remote.tailscale.signIn": "Abre Tailscale e inicia sesión, luego vuelve a intentarlo.",+ "remote.tailscale.noCli": "Instala la herramienta de línea de comandos de Tailscale: en la app de Tailscale, abre Ajustes, elige Install CLI y vuelve a intentarlo.",+ "remote.tailscale.notRunning": "Tailscale no se está ejecutando. Ábrelo y vuelve a intentarlo.",+ "remote.tailscale.needsPermission": "Tailscale no deja que {app} le pregunte. En Linux, ejecuta una vez sudo tailscale set --operator=$USER y vuelve a intentarlo.",+ "remote.notice.wifi": "Misma red Wi-Fi está activada porque un dispositivo emparejado la usa.",+ "remote.notice.relay": "En cualquier lugar, a través de {app} está activado porque un dispositivo emparejado lo usa.",+ "remote.notice.tailscale": "Tailscale está activado porque un dispositivo emparejado podría usarlo.",+ "remote.notice.https": "Tu dirección web de {app} está activada porque un dispositivo emparejado la usa.",+ "remote.notice.turnOff": "Desactivar","remote.pairOverTailscale": "Emparejar por Tailscale","remote.checkAgain": "Comprobar otra vez",- "remote.turnOnAndCheck": "Activar el acceso de dispositivos y comprobar","remote.devices.title": "Dispositivos emparejados","remote.devices.subtitle": "Gestiona los dispositivos que pueden usar este {app}.","remote.devices.empty": "Todavía no hay dispositivos emparejados.",diff --git a/src/locales/fr.json b/src/locales/fr.jsonindex 1a530558eb..8376637464 100644--- a/src/locales/fr.json+++ b/src/locales/fr.json@@ -1484,19 +1484,27 @@"remote.tailscale.readyDetail": "Gardez Tailscale connecté sur l'hôte et sur l'appareil à associer.","remote.tailscale.magicDns": "Tailscale trouvé — il manque encore MagicDNS","remote.tailscale.magicDnsDetail": "Activez MagicDNS dans Tailscale, puis revérifiez pour que l'appareil obtienne un nom sécurisé sur le tailnet.",- "remote.tailscale.notConnected": "Tailscale n'est pas encore connecté",- "remote.tailscale.notConnectedDetail": "Ouvrez Tailscale sur les deux appareils, connectez-vous au même tailnet, puis revérifiez.",- "remote.tailscale.already": "Vous utilisez déjà Tailscale ?",- "remote.tailscale.alreadyDetail": "Connectez les deux appareils au même tailnet. La vérification active l'accès à distance pour que l'autre appareil atteigne cet ordinateur.","remote.desktopOnly.title": "Utiliser {app} depuis un autre appareil","remote.desktopOnly.subtitle": "Ouvrez Accès à distance dans l'application de bureau pour associer un téléphone ou un ordinateur.","remote.title": "Accès à distance","remote.checking": "Vérification de l'accès de l'appareil…","remote.worksAway": "Fonctionne hors du domicile","remote.tailscaleCard.subtitle": "Facultatif — pour ceux qui utilisent déjà Tailscale. L'HTTPS sécurisé ci-dessus reste la configuration recommandée.",+ "remote.tailscaleSwitch.detail": "Désactivé tant que vous ne l'activez pas : {app} ne lance jamais Tailscale de lui-même et n'ouvre ni ne connecte jamais l'app Tailscale. Activé, les appareils de votre tailnet joignent cet ordinateur par son nom tailnet.",+ "remote.tailscale.linkOff": "Activé. Répond dès qu'un appareil est appairé.",+ "remote.tailscale.notInstalled": "Tailscale n'est pas installé sur cet ordinateur.",+ "remote.tailscale.getIt": "Obtenir Tailscale",+ "remote.tailscale.signIn": "Ouvrez Tailscale et connectez-vous, puis réessayez.",+ "remote.tailscale.noCli": "Installez l'outil en ligne de commande de Tailscale : dans l'app Tailscale, ouvrez les réglages, choisissez Install CLI, puis réessayez.",+ "remote.tailscale.notRunning": "Tailscale n'est pas lancé. Ouvrez-le, puis réessayez.",+ "remote.tailscale.needsPermission": "Tailscale refuse que {app} l'interroge. Sous Linux, lancez une fois sudo tailscale set --operator=$USER, puis réessayez.",+ "remote.notice.wifi": "Même Wi-Fi est activé parce qu'un appareil appairé l'utilise.",+ "remote.notice.relay": "Partout, via {app} est activé parce qu'un appareil appairé l'utilise.",+ "remote.notice.tailscale": "Tailscale est activé parce qu'un appareil appairé pourrait l'utiliser.",+ "remote.notice.https": "Votre adresse web {app} est activée parce qu'un appareil appairé l'utilise.",+ "remote.notice.turnOff": "Désactiver","remote.pairOverTailscale": "Associer via Tailscale","remote.checkAgain": "Revérifier",- "remote.turnOnAndCheck": "Activer l'accès des appareils et vérifier","remote.devices.title": "Appareils associés","remote.devices.subtitle": "Gérez les appareils autorisés à utiliser ce {app}.","remote.devices.empty": "Aucun appareil associé pour l'instant.",diff --git a/src/locales/hi.json b/src/locales/hi.jsonindex df551a4c1f..6967b826b7 100644--- a/src/locales/hi.json+++ b/src/locales/hi.json@@ -1484,19 +1484,27 @@"remote.tailscale.readyDetail": "होस्ट और जोड़े जाने वाले डिवाइस, दोनों पर Tailscale जुड़ा रखें।","remote.tailscale.magicDns": "Tailscale मिला — MagicDNS अब भी चाहिए","remote.tailscale.magicDnsDetail": "Tailscale में MagicDNS चालू करें, फिर दोबारा जाँचें ताकि डिवाइस को सुरक्षित tailnet नाम मिले।",- "remote.tailscale.notConnected": "Tailscale अभी जुड़ा नहीं है",- "remote.tailscale.notConnectedDetail": "दोनों डिवाइस पर Tailscale खोलें, एक ही tailnet में साइन इन करें, फिर दोबारा जाँचें।",- "remote.tailscale.already": "पहले से Tailscale इस्तेमाल करते हैं?",- "remote.tailscale.alreadyDetail": "दोनों डिवाइस को एक ही tailnet से जोड़ें। जाँचने पर रिमोट एक्सेस चालू हो जाता है ताकि दूसरा डिवाइस इस कंप्यूटर तक पहुँच सके।","remote.desktopOnly.title": "किसी दूसरे डिवाइस से {app} इस्तेमाल करें","remote.desktopOnly.subtitle": "फ़ोन या कंप्यूटर जोड़ने के लिए डेस्कटॉप ऐप में रिमोट एक्सेस खोलें।","remote.title": "रिमोट एक्सेस","remote.checking": "डिवाइस की पहुँच जाँची जा रही है…","remote.worksAway": "घर से बाहर भी चलता है","remote.tailscaleCard.subtitle": "वैकल्पिक — उनके लिए जो पहले से Tailscale इस्तेमाल करते हैं। ऊपर वाला सुरक्षित HTTPS ही अनुशंसित है।",+ "remote.tailscaleSwitch.detail": "जब तक आप इसे चालू न करें, बंद रहता है: {app} कभी अपने आप Tailscale नहीं चलाता, और Tailscale ऐप को कभी खोलता या साइन इन नहीं करता। चालू होने पर आपके tailnet के डिवाइस इस कंप्यूटर तक उसके tailnet नाम से पहुँचते हैं।",+ "remote.tailscale.linkOff": "चालू। कोई डिवाइस जुड़ते ही जवाब देता है।",+ "remote.tailscale.notInstalled": "इस कंप्यूटर पर Tailscale इंस्टॉल नहीं है।",+ "remote.tailscale.getIt": "Tailscale पाएँ",+ "remote.tailscale.signIn": "Tailscale खोलें और साइन इन करें, फिर दोबारा कोशिश करें।",+ "remote.tailscale.noCli": "Tailscale का कमांड-लाइन टूल इंस्टॉल करें: Tailscale ऐप में सेटिंग्स खोलें, Install CLI चुनें, फिर दोबारा कोशिश करें।",+ "remote.tailscale.notRunning": "Tailscale चल नहीं रहा है। उसे खोलें, फिर दोबारा कोशिश करें।",+ "remote.tailscale.needsPermission": "Tailscale {app} को पूछने नहीं दे रहा। Linux पर एक बार sudo tailscale set --operator=$USER चलाएँ, फिर दोबारा कोशिश करें।",+ "remote.notice.wifi": "एक ही Wi-Fi चालू है क्योंकि एक जुड़ा हुआ डिवाइस इसका इस्तेमाल करता है।",+ "remote.notice.relay": "कहीं से भी, {app} के ज़रिए चालू है क्योंकि एक जुड़ा हुआ डिवाइस इसका इस्तेमाल करता है।",+ "remote.notice.tailscale": "Tailscale चालू है क्योंकि एक जुड़ा हुआ डिवाइस इसका इस्तेमाल कर सकता है।",+ "remote.notice.https": "आपका {app} वेब पता चालू है क्योंकि एक जुड़ा हुआ डिवाइस इसका इस्तेमाल करता है।",+ "remote.notice.turnOff": "बंद करें","remote.pairOverTailscale": "Tailscale से जोड़ें","remote.checkAgain": "दोबारा जाँचें",- "remote.turnOnAndCheck": "डिवाइस एक्सेस चालू करें और जाँचें","remote.devices.title": "जुड़े हुए डिवाइस","remote.devices.subtitle": "इस {app} का उपयोग कर सकने वाले डिवाइस प्रबंधित करें।","remote.devices.empty": "अभी कोई डिवाइस जुड़ा नहीं है।",diff --git a/src/locales/it.json b/src/locales/it.jsonindex 334d7be4d0..97ecc09c10 100644--- a/src/locales/it.json+++ b/src/locales/it.json@@ -3734,19 +3734,27 @@"remote.tailscale.readyDetail": "Tieni Tailscale connesso sull'host e sul dispositivo da abbinare.","remote.tailscale.magicDns": "Tailscale trovato — serve ancora MagicDNS","remote.tailscale.magicDnsDetail": "Attiva MagicDNS in Tailscale, poi controlla di nuovo, così il dispositivo ottiene un nome tailnet sicuro.",- "remote.tailscale.notConnected": "Tailscale non è ancora connesso",- "remote.tailscale.notConnectedDetail": "Apri Tailscale su entrambi i dispositivi, accedi alla stessa tailnet, poi controlla di nuovo.",- "remote.tailscale.already": "Usi già Tailscale?",- "remote.tailscale.alreadyDetail": "Collega entrambi i dispositivi alla stessa tailnet. Il controllo attiva l'accesso remoto, così l'altro dispositivo può raggiungere questo computer.","remote.desktopOnly.title": "Usa {app} da un altro dispositivo","remote.desktopOnly.subtitle": "Apri Accesso remoto nell'app desktop per abbinare un telefono o un computer.","remote.title": "Accesso remoto","remote.checking": "Controllo dell'accesso al dispositivo…","remote.worksAway": "Funziona anche fuori casa","remote.tailscaleCard.subtitle": "Facoltativo — per chi usa già Tailscale. L'HTTPS sicuro qui sopra resta la configurazione consigliata.",+ "remote.tailscaleSwitch.detail": "Spento finché non lo accendi: {app} non avvia mai Tailscale da solo e non apre né fa accedere mai l'app Tailscale. Acceso, i dispositivi della tua tailnet raggiungono questo computer con il suo nome tailnet.",+ "remote.tailscale.linkOff": "Acceso. Risponde appena un dispositivo è abbinato.",+ "remote.tailscale.notInstalled": "Tailscale non è installato su questo computer.",+ "remote.tailscale.getIt": "Scarica Tailscale",+ "remote.tailscale.signIn": "Apri Tailscale e accedi, poi riprova.",+ "remote.tailscale.noCli": "Installa lo strumento a riga di comando di Tailscale: nell'app Tailscale apri Impostazioni, scegli Install CLI, poi riprova.",+ "remote.tailscale.notRunning": "Tailscale non è in esecuzione. Aprilo, poi riprova.",+ "remote.tailscale.needsPermission": "Tailscale non lascia che {app} lo interroghi. Su Linux esegui una volta sudo tailscale set --operator=$USER, poi riprova.",+ "remote.notice.wifi": "Stessa Wi-Fi è acceso perché un dispositivo abbinato lo usa.",+ "remote.notice.relay": "Ovunque, tramite {app} è acceso perché un dispositivo abbinato lo usa.",+ "remote.notice.tailscale": "Tailscale è acceso perché un dispositivo abbinato potrebbe usarlo.",+ "remote.notice.https": "Il tuo indirizzo web {app} è acceso perché un dispositivo abbinato lo usa.",+ "remote.notice.turnOff": "Spegni","remote.pairOverTailscale": "Abbina tramite Tailscale","remote.checkAgain": "Controlla di nuovo",- "remote.turnOnAndCheck": "Attiva l'accesso al dispositivo e controlla","remote.devices.title": "Dispositivi abbinati","remote.devices.subtitle": "Gestisci i dispositivi che possono usare questo {app}.","remote.devices.empty": "Nessun dispositivo abbinato per ora.",diff --git a/src/locales/ja.json b/src/locales/ja.jsonindex dfeabb1c24..5ffcb1e331 100644--- a/src/locales/ja.json+++ b/src/locales/ja.json@@ -4303,19 +4303,27 @@"remote.tailscale.readyDetail": "ホストと接続するデバイスの両方で、Tailscale を接続したままにしてください。","remote.tailscale.magicDns": "Tailscale を検出 — MagicDNS がまだ必要です","remote.tailscale.magicDnsDetail": "Tailscale で MagicDNS を有効にしてから、もう一度確認してください。デバイスに安全な tailnet 名が割り当てられます。",- "remote.tailscale.notConnected": "Tailscale はまだ接続されていません",- "remote.tailscale.notConnectedDetail": "両方のデバイスで Tailscale を開き、同じ tailnet にサインインしてから、もう一度確認してください。",- "remote.tailscale.already": "すでに Tailscale をお使いですか?",- "remote.tailscale.alreadyDetail": "両方のデバイスを同じ tailnet に接続してください。確認するとリモートアクセスが有効になり、もう一方のデバイスからこのコンピューターに届きます。","remote.desktopOnly.title": "別のデバイスから {app} を使う","remote.desktopOnly.subtitle": "スマートフォンやパソコンを接続するには、デスクトップアプリでリモートアクセスを開いてください。","remote.title": "リモートアクセス","remote.checking": "デバイスのアクセスを確認中…","remote.worksAway": "外出先でも使えます","remote.tailscaleCard.subtitle": "任意です。すでに Tailscale を使っている方向けで、推奨は上の安全な HTTPS のままです。",+ "remote.tailscaleSwitch.detail": "オンにするまではオフです。{app} が Tailscale を勝手に実行したり、Tailscale アプリを開いたりサインインしたりすることはありません。オンにすると、tailnet 上のデバイスが tailnet 名でこのコンピューターに接続します。",+ "remote.tailscale.linkOff": "オン。デバイスがペアリングされると応答します。",+ "remote.tailscale.notInstalled": "このコンピューターには Tailscale がインストールされていません。",+ "remote.tailscale.getIt": "Tailscale を入手",+ "remote.tailscale.signIn": "Tailscale を開いてサインインし、もう一度お試しください。",+ "remote.tailscale.noCli": "Tailscale のコマンドラインツールをインストールしてください: Tailscale アプリの設定で Install CLI を選び、もう一度お試しください。",+ "remote.tailscale.notRunning": "Tailscale が起動していません。開いてから、もう一度お試しください。",+ "remote.tailscale.needsPermission": "Tailscale が {app} からの問い合わせを許可していません。Linux では sudo tailscale set --operator=$USER を一度実行してから、もう一度お試しください。",+ "remote.notice.wifi": "ペアリング済みのデバイスが使っているため、同じ Wi-Fi はオンです。",+ "remote.notice.relay": "ペアリング済みのデバイスが使っているため、{app} 経由でどこからでもはオンです。",+ "remote.notice.tailscale": "ペアリング済みのデバイスが使う可能性があるため、Tailscale はオンです。",+ "remote.notice.https": "ペアリング済みのデバイスが使っているため、{app} の Web アドレスはオンです。",+ "remote.notice.turnOff": "オフにする","remote.pairOverTailscale": "Tailscale でペアリング","remote.checkAgain": "もう一度確認",- "remote.turnOnAndCheck": "デバイスアクセスを有効にして確認","remote.devices.title": "ペアリング済みのデバイス","remote.devices.subtitle": "この {app} を使えるデバイスを管理します。","remote.devices.empty": "まだペアリング済みのデバイスはありません。",diff --git a/src/locales/ko.json b/src/locales/ko.jsonindex ff24be4514..73a6c8d10d 100644--- a/src/locales/ko.json+++ b/src/locales/ko.json@@ -4103,19 +4103,27 @@"remote.tailscale.readyDetail": "호스트와 페어링할 기기 모두에서 Tailscale 연결을 유지하세요.","remote.tailscale.magicDns": "Tailscale 감지됨 — MagicDNS가 필요해요","remote.tailscale.magicDnsDetail": "Tailscale에서 MagicDNS를 켠 뒤 다시 확인하면 기기가 안전한 tailnet 이름을 받아요.",- "remote.tailscale.notConnected": "Tailscale이 아직 연결되지 않았어요",- "remote.tailscale.notConnectedDetail": "두 기기에서 Tailscale을 열고 같은 tailnet에 로그인한 뒤 다시 확인하세요.",- "remote.tailscale.already": "이미 Tailscale을 쓰나요?",- "remote.tailscale.alreadyDetail": "두 기기를 같은 tailnet에 연결하세요. 확인하면 원격 접근이 켜져서 다른 기기가 이 컴퓨터에 접속할 수 있어요.","remote.desktopOnly.title": "다른 기기에서 {app} 쓰기","remote.desktopOnly.subtitle": "휴대폰이나 컴퓨터를 페어링하려면 데스크톱 앱에서 원격 접근을 여세요.","remote.title": "원격 접근","remote.checking": "기기 접근 확인 중…","remote.worksAway": "집 밖에서도 작동","remote.tailscaleCard.subtitle": "선택 사항 — 이미 Tailscale을 쓰는 분을 위한 기능이에요. 위의 안전한 HTTPS를 여전히 추천해요.",+ "remote.tailscaleSwitch.detail": "켜기 전까지는 꺼져 있습니다. {app}은 Tailscale을 스스로 실행하지 않으며, Tailscale 앱을 열거나 로그인시키지 않습니다. 켜면 tailnet의 기기가 tailnet 이름으로 이 컴퓨터에 연결합니다.",+ "remote.tailscale.linkOff": "켜짐. 기기가 페어링되면 응답합니다.",+ "remote.tailscale.notInstalled": "이 컴퓨터에 Tailscale이 설치되어 있지 않습니다.",+ "remote.tailscale.getIt": "Tailscale 받기",+ "remote.tailscale.signIn": "Tailscale을 열고 로그인한 다음 다시 시도하세요.",+ "remote.tailscale.noCli": "Tailscale 명령줄 도구를 설치하세요: Tailscale 앱의 설정에서 Install CLI를 고른 뒤 다시 시도하세요.",+ "remote.tailscale.notRunning": "Tailscale이 실행 중이 아닙니다. 연 다음 다시 시도하세요.",+ "remote.tailscale.needsPermission": "Tailscale이 {app}의 요청을 허용하지 않습니다. Linux에서는 sudo tailscale set --operator=$USER를 한 번 실행한 뒤 다시 시도하세요.",+ "remote.notice.wifi": "페어링된 기기가 사용 중이라 같은 Wi-Fi가 켜져 있습니다.",+ "remote.notice.relay": "페어링된 기기가 사용 중이라 {app}을 통한 어디서나가 켜져 있습니다.",+ "remote.notice.tailscale": "페어링된 기기가 사용할 수 있어 Tailscale이 켜져 있습니다.",+ "remote.notice.https": "페어링된 기기가 사용 중이라 {app} 웹 주소가 켜져 있습니다.",+ "remote.notice.turnOff": "끄기","remote.pairOverTailscale": "Tailscale로 페어링","remote.checkAgain": "다시 확인",- "remote.turnOnAndCheck": "기기 접근 켜고 확인","remote.devices.title": "페어링된 기기","remote.devices.subtitle": "이 {app}을(를) 쓸 수 있는 기기를 관리해요.","remote.devices.empty": "아직 페어링된 기기가 없어요.",diff --git a/src/locales/pl.json b/src/locales/pl.jsonindex f265087351..a78ab75d1f 100644--- a/src/locales/pl.json+++ b/src/locales/pl.json@@ -3798,19 +3798,27 @@"remote.tailscale.readyDetail": "Utrzymuj Tailscale połączony na hoście i parowanym urządzeniu.","remote.tailscale.magicDns": "Znaleziono Tailscale — MagicDNS jest nadal potrzebny","remote.tailscale.magicDnsDetail": "Włącz MagicDNS w Tailscale, a następnie sprawdź ponownie, aby urządzenie otrzymało bezpieczną nazwę w tailnecie.",- "remote.tailscale.notConnected": "Tailscale nie jest jeszcze połączony",- "remote.tailscale.notConnectedDetail": "Otwórz Tailscale na obu urządzeniach, zaloguj się do tego samego tailnetu, a następnie sprawdź ponownie.",- "remote.tailscale.already": "Korzystasz już z Tailscale?",- "remote.tailscale.alreadyDetail": "Połącz oba urządzenia z tym samym tailnetem. Sprawdzanie włącza dostęp zdalny, aby drugie urządzenie mogło połączyć się z tym komputerem.","remote.desktopOnly.title": "Korzystaj z aplikacji {app} na innym urządzeniu","remote.desktopOnly.subtitle": "Otwórz dostęp zdalny w aplikacji na komputer, aby sparować telefon lub komputer.","remote.title": "Dostęp zdalny","remote.checking": "Sprawdzanie dostępu urządzeń…","remote.worksAway": "Działa poza domem","remote.tailscaleCard.subtitle": "Opcjonalne — dla osób, które już korzystają z Tailscale. Bezpieczne HTTPS powyżej pozostaje zalecaną konfiguracją.",+ "remote.tailscaleSwitch.detail": "Wyłączone, dopóki go nie włączysz: {app} nigdy sam nie uruchamia Tailscale ani nie otwiera i nie loguje aplikacji Tailscale. Po włączeniu urządzenia w Twoim tailnecie łączą się z tym komputerem po jego nazwie w tailnecie.",+ "remote.tailscale.linkOff": "Włączone. Odpowie, gdy jakieś urządzenie zostanie sparowane.",+ "remote.tailscale.notInstalled": "Tailscale nie jest zainstalowany na tym komputerze.",+ "remote.tailscale.getIt": "Pobierz Tailscale",+ "remote.tailscale.signIn": "Otwórz Tailscale i zaloguj się, a potem spróbuj ponownie.",+ "remote.tailscale.noCli": "Zainstaluj narzędzie wiersza poleceń Tailscale: w aplikacji Tailscale otwórz Ustawienia, wybierz Install CLI i spróbuj ponownie.",+ "remote.tailscale.notRunning": "Tailscale nie działa. Otwórz go i spróbuj ponownie.",+ "remote.tailscale.needsPermission": "Tailscale nie pozwala {app} pytać. Na Linuksie uruchom raz sudo tailscale set --operator=$USER i spróbuj ponownie.",+ "remote.notice.wifi": "Ta sama sieć Wi-Fi jest włączona, bo używa jej sparowane urządzenie.",+ "remote.notice.relay": "Wszędzie, przez {app} jest włączone, bo używa tego sparowane urządzenie.",+ "remote.notice.tailscale": "Tailscale jest włączony, bo może go używać sparowane urządzenie.",+ "remote.notice.https": "Twój adres internetowy {app} jest włączony, bo używa go sparowane urządzenie.",+ "remote.notice.turnOff": "Wyłącz","remote.pairOverTailscale": "Sparuj przez Tailscale","remote.checkAgain": "Sprawdź ponownie",- "remote.turnOnAndCheck": "Włącz dostęp urządzeń i sprawdź","remote.devices.title": "Sparowane urządzenia","remote.devices.subtitle": "Zarządzaj urządzeniami uprawnionymi do korzystania z aplikacji {app}.","remote.devices.empty": "Nie sparowano jeszcze żadnych urządzeń.",diff --git a/src/locales/pt-br.json b/src/locales/pt-br.jsonindex c8415e5625..f3ee29120f 100644--- a/src/locales/pt-br.json+++ b/src/locales/pt-br.json@@ -4223,19 +4223,27 @@"remote.tailscale.readyDetail": "Mantenha o Tailscale conectado neste computador e no dispositivo que será pareado.","remote.tailscale.magicDns": "Tailscale encontrado, mas ainda falta o MagicDNS","remote.tailscale.magicDnsDetail": "Ligue o MagicDNS no Tailscale e verifique novamente, para o dispositivo receber um nome seguro na tailnet.",- "remote.tailscale.notConnected": "O Tailscale ainda não está conectado",- "remote.tailscale.notConnectedDetail": "Abra o Tailscale nos dois dispositivos, entre na mesma tailnet e verifique novamente.",- "remote.tailscale.already": "Já usa Tailscale?",- "remote.tailscale.alreadyDetail": "Conecte os dois dispositivos à mesma tailnet. A verificação liga o acesso remoto para o outro dispositivo acessar este computador.","remote.desktopOnly.title": "Usar {app} de outro dispositivo","remote.desktopOnly.subtitle": "Para parear um celular ou computador, abra “Acesso remoto” no app para computador.","remote.title": "Acesso remoto","remote.checking": "Verificando o acesso do dispositivo…","remote.worksAway": "Funciona fora de casa","remote.tailscaleCard.subtitle": "Opcional, para quem já usa o Tailscale. O HTTPS seguro acima continua sendo a opção recomendada.",+ "remote.tailscaleSwitch.detail": "Desligado até você ligar: o {app} nunca executa o Tailscale sozinho, nem abre ou faz login no app do Tailscale. Ligado, os dispositivos da sua tailnet chegam a este computador pelo nome dele na tailnet.",+ "remote.tailscale.linkOff": "Ligado. Responde assim que um dispositivo for pareado.",+ "remote.tailscale.notInstalled": "O Tailscale não está instalado neste computador.",+ "remote.tailscale.getIt": "Baixar o Tailscale",+ "remote.tailscale.signIn": "Abra o Tailscale e faça login, depois tente novamente.",+ "remote.tailscale.noCli": "Instale a ferramenta de linha de comando do Tailscale: no app do Tailscale, abra as Configurações, escolha Install CLI e tente novamente.",+ "remote.tailscale.notRunning": "O Tailscale não está em execução. Abra-o e tente novamente.",+ "remote.tailscale.needsPermission": "O Tailscale não deixa o {app} consultá-lo. No Linux, rode uma vez sudo tailscale set --operator=$USER e tente novamente.",+ "remote.notice.wifi": "Mesmo Wi-Fi está ligado porque um dispositivo pareado o usa.",+ "remote.notice.relay": "De qualquer lugar, pelo {app} está ligado porque um dispositivo pareado o usa.",+ "remote.notice.tailscale": "O Tailscale está ligado porque um dispositivo pareado pode usá-lo.",+ "remote.notice.https": "Seu endereço web do {app} está ligado porque um dispositivo pareado o usa.",+ "remote.notice.turnOff": "Desligar","remote.pairOverTailscale": "Parear pelo Tailscale","remote.checkAgain": "Verificar novamente",- "remote.turnOnAndCheck": "Ligar o acesso de dispositivos e verificar","remote.devices.title": "Dispositivos pareados","remote.devices.subtitle": "Gerencie os dispositivos que podem usar esta instalação de {app}.","remote.devices.empty": "Nenhum dispositivo pareado ainda.",diff --git a/src/locales/ru.json b/src/locales/ru.jsonindex 3c8c9c0db3..f2e5a3ef57 100644--- a/src/locales/ru.json+++ b/src/locales/ru.json@@ -3854,19 +3854,27 @@"remote.tailscale.readyDetail": "Держите Tailscale подключённым на хосте и на сопрягаемом устройстве.","remote.tailscale.magicDns": "Tailscale найден — ещё нужен MagicDNS","remote.tailscale.magicDnsDetail": "Включите MagicDNS в Tailscale, затем проверьте снова, чтобы устройство получило безопасное имя tailnet.",- "remote.tailscale.notConnected": "Tailscale ещё не подключён",- "remote.tailscale.notConnectedDetail": "Откройте Tailscale на обоих устройствах, войдите в один tailnet, затем проверьте снова.",- "remote.tailscale.already": "Уже пользуетесь Tailscale?",- "remote.tailscale.alreadyDetail": "Подключите оба устройства к одному tailnet. Проверка включит удалённый доступ, чтобы другое устройство могло связаться с этим компьютером.","remote.desktopOnly.title": "Используйте {app} с другого устройства","remote.desktopOnly.subtitle": "Откройте «Удалённый доступ» в настольном приложении, чтобы сопрячь телефон или компьютер.","remote.title": "Удалённый доступ","remote.checking": "Проверяем доступ устройства…","remote.worksAway": "Работает вне домашней сети","remote.tailscaleCard.subtitle": "Необязательно — для тех, кто уже пользуется Tailscale. Размещённый выше защищённый HTTPS остаётся рекомендуемым вариантом.",+ "remote.tailscaleSwitch.detail": "Выключено, пока вы не включите: {app} никогда сам не запускает Tailscale и никогда не открывает приложение Tailscale и не входит в него. Когда включено, устройства в вашем tailnet подключаются к этому компьютеру по его имени в tailnet.",+ "remote.tailscale.linkOff": "Включено. Ответит, как только устройство будет сопряжено.",+ "remote.tailscale.notInstalled": "Tailscale не установлен на этом компьютере.",+ "remote.tailscale.getIt": "Скачать Tailscale",+ "remote.tailscale.signIn": "Откройте Tailscale и войдите, затем попробуйте снова.",+ "remote.tailscale.noCli": "Установите инструмент командной строки Tailscale: в приложении Tailscale откройте настройки, выберите Install CLI и попробуйте снова.",+ "remote.tailscale.notRunning": "Tailscale не запущен. Откройте его и попробуйте снова.",+ "remote.tailscale.needsPermission": "Tailscale не позволяет {app} обращаться к нему. В Linux один раз выполните sudo tailscale set --operator=$USER и попробуйте снова.",+ "remote.notice.wifi": "«Та же Wi-Fi» включена, потому что ею пользуется сопряжённое устройство.",+ "remote.notice.relay": "«Откуда угодно, через {app}» включено, потому что этим пользуется сопряжённое устройство.",+ "remote.notice.tailscale": "Tailscale включён, потому что им может пользоваться сопряжённое устройство.",+ "remote.notice.https": "Ваш веб-адрес {app} включён, потому что им пользуется сопряжённое устройство.",+ "remote.notice.turnOff": "Выключить","remote.pairOverTailscale": "Сопрячь через Tailscale","remote.checkAgain": "Проверить снова",- "remote.turnOnAndCheck": "Включить доступ устройств и проверить","remote.devices.title": "Сопряжённые устройства","remote.devices.subtitle": "Управляйте устройствами, которые могут использовать этот {app}.","remote.devices.empty": "Сопряжённых устройств пока нет.",diff --git a/src/locales/tr.json b/src/locales/tr.jsonindex 5ac41b20d3..3655a247a8 100644--- a/src/locales/tr.json+++ b/src/locales/tr.json@@ -3147,19 +3147,27 @@"remote.tailscale.readyDetail": "Ana bilgisayarda ve eşleştirilen cihazda Tailscale bağlantısını açık tutun.","remote.tailscale.magicDns": "Tailscale bulundu — MagicDNS hâlâ gerekli","remote.tailscale.magicDnsDetail": "Cihazın güvenli bir tailnet adı alması için Tailscale'de MagicDNS'i açın, ardından tekrar kontrol edin.",- "remote.tailscale.notConnected": "Tailscale henüz bağlı değil",- "remote.tailscale.notConnectedDetail": "Her iki cihazda da Tailscale'i açın, aynı tailnet ağına giriş yapın, ardından tekrar kontrol edin.",- "remote.tailscale.already": "Zaten Tailscale kullanıyor musunuz?",- "remote.tailscale.alreadyDetail": "Her iki cihazı da aynı tailnet ağına bağlayın. Kontrol etmek, diğer cihazın bu bilgisayara ulaşabilmesi için Uzaktan erişimi açar.","remote.desktopOnly.title": "{app} uygulamasını başka bir cihazdan kullanın","remote.desktopOnly.subtitle": "Bir telefonu veya bilgisayarı eşleştirmek için masaüstü uygulamasında Uzaktan erişimi açın.","remote.title": "Uzaktan erişim","remote.checking": "Cihaz erişimi kontrol ediliyor…","remote.worksAway": "Evden uzakta da çalışır","remote.tailscaleCard.subtitle": "İsteğe bağlı — zaten Tailscale kullanan kişiler için. Yukarıdaki Güvenli HTTPS önerilen kurulum olmaya devam eder.",+ "remote.tailscaleSwitch.detail": "Siz açana kadar kapalı: {app} Tailscale'i asla kendiliğinden çalıştırmaz, Tailscale uygulamasını asla açmaz veya oturum açtırmaz. Açıkken tailnet'inizdeki cihazlar bu bilgisayara tailnet adıyla ulaşır.",+ "remote.tailscale.linkOff": "Açık. Bir cihaz eşleştirilince yanıt verir.",+ "remote.tailscale.notInstalled": "Bu bilgisayarda Tailscale yüklü değil.",+ "remote.tailscale.getIt": "Tailscale'i edinin",+ "remote.tailscale.signIn": "Tailscale'i açıp oturum açın, ardından tekrar deneyin.",+ "remote.tailscale.noCli": "Tailscale'in komut satırı aracını yükleyin: Tailscale uygulamasında Ayarlar'ı açıp Install CLI'ı seçin, ardından tekrar deneyin.",+ "remote.tailscale.notRunning": "Tailscale çalışmıyor. Açın, ardından tekrar deneyin.",+ "remote.tailscale.needsPermission": "Tailscale, {app} uygulamasının sormasına izin vermiyor. Linux'ta bir kez sudo tailscale set --operator=$USER çalıştırın, ardından tekrar deneyin.",+ "remote.notice.wifi": "Eşleştirilmiş bir cihaz kullandığı için Aynı Wi-Fi açık.",+ "remote.notice.relay": "Eşleştirilmiş bir cihaz kullandığı için Her yerden, {app} üzerinden açık.",+ "remote.notice.tailscale": "Eşleştirilmiş bir cihaz kullanabileceği için Tailscale açık.",+ "remote.notice.https": "Eşleştirilmiş bir cihaz kullandığı için {app} web adresiniz açık.",+ "remote.notice.turnOff": "Kapat","remote.pairOverTailscale": "Tailscale üzerinden eşleştir","remote.checkAgain": "Tekrar kontrol et",- "remote.turnOnAndCheck": "Cihaz erişimini aç ve kontrol et","remote.devices.title": "Eşleştirilmiş cihazlar","remote.devices.subtitle": "Bu {app} uygulamasını kullanabilen cihazları yönetin.","remote.devices.empty": "Henüz eşleştirilmiş cihaz yok.",diff --git a/src/locales/uk.json b/src/locales/uk.jsonindex 84d4159443..a1ecd13874 100644--- a/src/locales/uk.json+++ b/src/locales/uk.json@@ -1801,19 +1801,27 @@"remote.tailscale.readyDetail": "Тримайте Tailscale підключеним на хості та пристрої, що прив'язується.","remote.tailscale.magicDns": "Tailscale знайдено — ще потрібен MagicDNS","remote.tailscale.magicDnsDetail": "Увімкніть MagicDNS у Tailscale, потім перевірте ще раз, щоб пристрій отримав безпечне ім'я tailnet.",- "remote.tailscale.notConnected": "Tailscale ще не підключений",- "remote.tailscale.notConnectedDetail": "Відкрийте Tailscale на обох пристроях, увійдіть в один tailnet, потім перевірте ще раз.",- "remote.tailscale.already": "Вже користуєтеся Tailscale?",- "remote.tailscale.alreadyDetail": "Підключіть обидва пристрої до одного tailnet. Перевірка вмикає Віддалений доступ, щоб інший пристрій міг дістатися цього комп'ютера.","remote.desktopOnly.title": "Користуйтеся {app} з іншого пристрою","remote.desktopOnly.subtitle": "Відкрийте Віддалений доступ у десктопному застосунку, щоб прив'язати телефон або комп'ютер.","remote.title": "Віддалений доступ","remote.checking": "Перевіряємо доступ пристрою…","remote.worksAway": "Працює і поза домом","remote.tailscaleCard.subtitle": "Необов'язково — для тих, хто вже користується Tailscale. Безпечний HTTPS вище лишається рекомендованим налаштуванням.",+ "remote.tailscaleSwitch.detail": "Вимкнено, доки ви не ввімкнете: {app} ніколи сам не запускає Tailscale і ніколи не відкриває застосунок Tailscale й не входить у нього. Коли ввімкнено, пристрої у вашому tailnet під'єднуються до цього комп'ютера за його ім'ям у tailnet.",+ "remote.tailscale.linkOff": "Увімкнено. Відповість, щойно пристрій буде прив'язано.",+ "remote.tailscale.notInstalled": "Tailscale не встановлено на цьому комп'ютері.",+ "remote.tailscale.getIt": "Завантажити Tailscale",+ "remote.tailscale.signIn": "Відкрийте Tailscale й увійдіть, потім спробуйте ще раз.",+ "remote.tailscale.noCli": "Встановіть інструмент командного рядка Tailscale: у застосунку Tailscale відкрийте налаштування, виберіть Install CLI і спробуйте ще раз.",+ "remote.tailscale.notRunning": "Tailscale не запущено. Відкрийте його і спробуйте ще раз.",+ "remote.tailscale.needsPermission": "Tailscale не дозволяє {app} звертатися до нього. У Linux один раз виконайте sudo tailscale set --operator=$USER і спробуйте ще раз.",+ "remote.notice.wifi": "«Та сама Wi-Fi» увімкнена, бо нею користується прив'язаний пристрій.",+ "remote.notice.relay": "«Звідусіль, через {app}» увімкнено, бо цим користується прив'язаний пристрій.",+ "remote.notice.tailscale": "Tailscale увімкнено, бо ним може користуватися прив'язаний пристрій.",+ "remote.notice.https": "Ваша веб-адреса {app} увімкнена, бо нею користується прив'язаний пристрій.",+ "remote.notice.turnOff": "Вимкнути","remote.pairOverTailscale": "Прив'язати через Tailscale","remote.checkAgain": "Перевірити ще раз",- "remote.turnOnAndCheck": "Увімкнути доступ пристроїв і перевірити","remote.devices.title": "Прив'язані пристрої","remote.devices.subtitle": "Керуйте пристроями, що можуть користуватися цим {app}.","remote.devices.empty": "Прив'язаних пристроїв ще немає.",diff --git a/src/locales/vi.json b/src/locales/vi.jsonindex c2dd42d77b..e88c30bad9 100644--- a/src/locales/vi.json+++ b/src/locales/vi.json@@ -3147,19 +3147,27 @@"remote.tailscale.readyDetail": "Duy trì kết nối Tailscale trên máy tính chủ và thiết bị đang được ghép nối.","remote.tailscale.magicDns": "Đã tìm thấy Tailscale — vẫn cần MagicDNS","remote.tailscale.magicDnsDetail": "Bật MagicDNS trong Tailscale, sau đó kiểm tra lại để thiết bị nhận tên tailnet bảo mật.",- "remote.tailscale.notConnected": "Tailscale chưa được kết nối",- "remote.tailscale.notConnectedDetail": "Mở Tailscale trên cả hai thiết bị, đăng nhập vào cùng một tailnet, sau đó kiểm tra lại.",- "remote.tailscale.already": "Đã dùng Tailscale?",- "remote.tailscale.alreadyDetail": "Kết nối cả hai thiết bị vào cùng một tailnet. Thao tác kiểm tra sẽ bật Truy cập từ xa để thiết bị kia có thể kết nối tới máy tính này.","remote.desktopOnly.title": "Dùng {app} từ thiết bị khác","remote.desktopOnly.subtitle": "Mở mục Truy cập từ xa trong ứng dụng desktop để ghép nối điện thoại hoặc máy tính.","remote.title": "Truy cập từ xa","remote.checking": "Đang kiểm tra quyền truy cập thiết bị…","remote.worksAway": "Hoạt động khi xa nhà","remote.tailscaleCard.subtitle": "Tùy chọn — dành cho những người đã dùng Tailscale. Ghép nối HTTPS bảo mật ở trên vẫn là thiết lập được đề xuất.",+ "remote.tailscaleSwitch.detail": "Tắt cho đến khi bạn bật: {app} không bao giờ tự chạy Tailscale, cũng không bao giờ mở hay đăng nhập ứng dụng Tailscale. Khi bật, các thiết bị trên tailnet của bạn kết nối tới máy tính này bằng tên tailnet của nó.",+ "remote.tailscale.linkOff": "Đang bật. Sẽ trả lời khi có thiết bị được ghép nối.",+ "remote.tailscale.notInstalled": "Máy tính này chưa cài Tailscale.",+ "remote.tailscale.getIt": "Tải Tailscale",+ "remote.tailscale.signIn": "Mở Tailscale và đăng nhập, rồi thử lại.",+ "remote.tailscale.noCli": "Hãy cài công cụ dòng lệnh của Tailscale: trong ứng dụng Tailscale, mở Cài đặt và chọn Install CLI, rồi thử lại.",+ "remote.tailscale.notRunning": "Tailscale chưa chạy. Hãy mở nó rồi thử lại.",+ "remote.tailscale.needsPermission": "Tailscale không cho {app} hỏi. Trên Linux, chạy một lần sudo tailscale set --operator=$USER rồi thử lại.",+ "remote.notice.wifi": "Cùng Wi-Fi đang bật vì một thiết bị đã ghép nối dùng nó.",+ "remote.notice.relay": "Ở bất kỳ đâu, qua {app} đang bật vì một thiết bị đã ghép nối dùng nó.",+ "remote.notice.tailscale": "Tailscale đang bật vì một thiết bị đã ghép nối có thể dùng nó.",+ "remote.notice.https": "Địa chỉ web {app} của bạn đang bật vì một thiết bị đã ghép nối dùng nó.",+ "remote.notice.turnOff": "Tắt","remote.pairOverTailscale": "Ghép nối qua Tailscale","remote.checkAgain": "Kiểm tra lại",- "remote.turnOnAndCheck": "Bật quyền truy cập thiết bị và kiểm tra","remote.devices.title": "Thiết bị đã ghép nối","remote.devices.subtitle": "Quản lý các thiết bị có thể sử dụng {app} này.","remote.devices.empty": "Chưa có thiết bị nào được ghép nối.",diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.jsonindex dce54fc33b..6edff780b9 100644--- a/src/locales/zh-tw.json+++ b/src/locales/zh-tw.json@@ -2667,19 +2667,27 @@"remote.tailscale.readyDetail": "請讓主機與待配對裝置保持連上 Tailscale。","remote.tailscale.magicDns": "已找到 Tailscale — 仍需要 MagicDNS","remote.tailscale.magicDnsDetail": "請在 Tailscale 中啟用 MagicDNS,然後再次檢查,讓裝置取得安全的 tailnet 名稱。",- "remote.tailscale.notConnected": "Tailscale 尚未連線",- "remote.tailscale.notConnectedDetail": "請在兩台裝置上開啟 Tailscale,登入同一個 tailnet,然後再次檢查。",- "remote.tailscale.already": "已經在使用 Tailscale 了嗎?",- "remote.tailscale.alreadyDetail": "請將兩台裝置連上同一個 tailnet。執行檢查會啟用遠端存取,讓另一台裝置能連到這台電腦。","remote.desktopOnly.title": "從其他裝置使用 {app}","remote.desktopOnly.subtitle": "請在桌面版中開啟「遠端存取」,以配對手機或電腦。","remote.title": "遠端存取","remote.checking": "正在檢查裝置存取…","remote.worksAway": "離開住家也能使用","remote.tailscaleCard.subtitle": "選用 — 適合已經在使用 Tailscale 的人。上方的安全 HTTPS 仍是建議的設定方式。",+ "remote.tailscaleSwitch.detail": "在你開啟之前保持關閉:{app} 從不自行執行 Tailscale,也從不開啟 Tailscale 應用程式或替你登入。開啟後,你 tailnet 上的裝置透過 tailnet 名稱連到這台電腦。",+ "remote.tailscale.linkOff": "已開啟。有裝置配對後就會回應。",+ "remote.tailscale.notInstalled": "這台電腦沒有安裝 Tailscale。",+ "remote.tailscale.getIt": "取得 Tailscale",+ "remote.tailscale.signIn": "開啟 Tailscale 並登入,然後再試一次。",+ "remote.tailscale.noCli": "請安裝 Tailscale 的命令列工具:在 Tailscale 應用程式中開啟設定並選擇 Install CLI,然後再試一次。",+ "remote.tailscale.notRunning": "Tailscale 沒有在執行。請開啟它,然後再試一次。",+ "remote.tailscale.needsPermission": "Tailscale 不允許 {app} 查詢。在 Linux 上執行一次 sudo tailscale set --operator=$USER,然後再試一次。",+ "remote.notice.wifi": "「同一個 Wi-Fi」已開啟,因為有已配對的裝置在用。",+ "remote.notice.relay": "「透過 {app} 隨處連線」已開啟,因為有已配對的裝置在用。",+ "remote.notice.tailscale": "Tailscale 已開啟,因為已配對的裝置可能在用。",+ "remote.notice.https": "你的 {app} 網址已開啟,因為有已配對的裝置在用。",+ "remote.notice.turnOff": "關閉","remote.pairOverTailscale": "透過 Tailscale 配對","remote.checkAgain": "再次檢查",- "remote.turnOnAndCheck": "啟用裝置存取並檢查","remote.devices.title": "已配對的裝置","remote.devices.subtitle": "管理可以使用此 {app} 的裝置。","remote.devices.empty": "尚未配對任何裝置。",diff --git a/src/locales/zh.json b/src/locales/zh.jsonindex 80b92619f0..43739ba677 100644--- a/src/locales/zh.json+++ b/src/locales/zh.json@@ -4272,19 +4272,27 @@"remote.tailscale.readyDetail": "请让主机和待配对设备都保持 Tailscale 连接。","remote.tailscale.magicDns": "已找到 Tailscale——还需要 MagicDNS","remote.tailscale.magicDnsDetail": "在 Tailscale 中打开 MagicDNS,然后重新检查,设备才能获得安全的 tailnet 名称。",- "remote.tailscale.notConnected": "Tailscale 尚未连接",- "remote.tailscale.notConnectedDetail": "在两台设备上打开 Tailscale,登录同一个 tailnet,然后重新检查。",- "remote.tailscale.already": "已经在用 Tailscale?",- "remote.tailscale.alreadyDetail": "把两台设备连到同一个 tailnet。检查时会打开远程访问,这样另一台设备才能连到这台电脑。","remote.desktopOnly.title": "在另一台设备上使用 {app}","remote.desktopOnly.subtitle": "在桌面应用中打开「远程访问」即可配对手机或电脑。","remote.title": "远程访问","remote.checking": "正在检查设备访问…","remote.worksAway": "离家也能用","remote.tailscaleCard.subtitle": "可选——面向已经在用 Tailscale 的人。上面的安全 HTTPS 仍是推荐方式。",+ "remote.tailscaleSwitch.detail": "在你打开之前保持关闭:{app} 从不自行运行 Tailscale,也从不打开 Tailscale 应用或替你登录。打开后,你 tailnet 上的设备通过 tailnet 名称连到这台电脑。",+ "remote.tailscale.linkOff": "已打开。有设备配对后就会响应。",+ "remote.tailscale.notInstalled": "这台电脑没有安装 Tailscale。",+ "remote.tailscale.getIt": "获取 Tailscale",+ "remote.tailscale.signIn": "打开 Tailscale 并登录,然后重试。",+ "remote.tailscale.noCli": "请安装 Tailscale 的命令行工具:在 Tailscale 应用中打开设置并选择 Install CLI,然后重试。",+ "remote.tailscale.notRunning": "Tailscale 没有运行。请打开它,然后重试。",+ "remote.tailscale.needsPermission": "Tailscale 不允许 {app} 查询。在 Linux 上运行一次 sudo tailscale set --operator=$USER,然后重试。",+ "remote.notice.wifi": "「同一 Wi-Fi」已打开,因为有已配对的设备在用。",+ "remote.notice.relay": "「通过 {app} 随处连接」已打开,因为有已配对的设备在用。",+ "remote.notice.tailscale": "Tailscale 已打开,因为已配对的设备可能在用。",+ "remote.notice.https": "你的 {app} 网址已打开,因为有已配对的设备在用。",+ "remote.notice.turnOff": "关闭","remote.pairOverTailscale": "通过 Tailscale 配对","remote.checkAgain": "重新检查",- "remote.turnOnAndCheck": "开启设备访问并检查","remote.devices.title": "已配对的设备","remote.devices.subtitle": "管理可以使用这个 {app} 的设备。","remote.devices.empty": "还没有配对任何设备。",