Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
refactor(pairing): move sign-in route buttons out of PhoneSetupFlow
Saim Shafiqueb55cbda29003
diff --git a/src/components/PhoneSetupFlow.tsx b/src/components/PhoneSetupFlow.tsxindex 9e038a0979..918d6b735d 100644--- a/src/components/PhoneSetupFlow.tsx+++ b/src/components/PhoneSetupFlow.tsx@@ -17,7 +17,6 @@ import {QrCode,ShieldCheck,Smartphone,- Wifi,} from "lucide-react";import { QRCodeSVG } from "qrcode.react";import { phonePairingLink } from "../../shared/pairing-link";@@ -66,6 +65,7 @@ import {} from "../lib/companion-state";import { ConnectionDetail } from "./ConnectionDetail";import { PhonePairingQr } from "./PhonePairingQr";+import { PhoneSetupSignInRoutes } from "./PhoneSetupSignInRoutes";import { productName } from "../lib/brand";import type { CompanionBridge, CompanionState } from "../lib/companion-types";@@ -977,33 +977,7 @@ export function PhoneSetupFlowView({ controller }: { controller: PhoneSetupContr</button>)}{actionError && <p role="alert" className="mt-3 text-[13px] text-danger">{actionError}</p>}- <div className="my-4 flex items-center gap-3 text-[11px] text-ink-secondary">- <span className="h-px flex-1 bg-hairline/40" /> {t("phone.signIn.or")} <span className="h-px flex-1 bg-hairline/40" />- </div>- <button- disabled={c.busy || c.accountBusy}- onClick={c.useLocal}- className="flex items-center justify-center gap-2 rounded-lg border border-hairline/50 py-2.5 text-[13px] text-ink hover:bg-control disabled:opacity-40"- >- <Wifi size={15} /> {t("phone.signIn.wifiInstead")}- </button>- <p className="mt-2 text-center text-[11px] leading-relaxed text-ink-secondary">- {t("phone.signIn.wifiNote")}- </p>- {c.tailscaleAvailable && (- <button- disabled={c.busy || c.accountBusy}- onClick={c.useTailscale}- className="mt-2 flex items-center justify-center gap-2 rounded-lg border border-hairline/50 py-2.5 text-[13px] text-ink hover:bg-control disabled:opacity-40"- >- {t("phone.signIn.tailscaleInstead")}- </button>- )}- {c.tailscaleAvailable && (- <p className="mt-2 text-center text-[11px] leading-relaxed text-ink-secondary">- {t("phone.signIn.tailnetNote")}- </p>- )}+ <PhoneSetupSignInRoutes c={c} /></div>);}diff --git a/src/components/PhoneSetupSignInRoutes.tsx b/src/components/PhoneSetupSignInRoutes.tsxnew file mode 100644index 0000000000..c9c7a363a7--- /dev/null+++ b/src/components/PhoneSetupSignInRoutes.tsx@@ -0,0 +1,37 @@+import { Wifi } from "lucide-react";+import { t } from "@/lib/i18n";+import type { PhoneSetupController } from "./PhoneSetupFlow";++export function PhoneSetupSignInRoutes({ c }: { c: PhoneSetupController }) {+ return (+ <>+ <div className="my-4 flex items-center gap-3 text-[11px] text-ink-secondary">+ <span className="h-px flex-1 bg-hairline/40" /> {t("phone.signIn.or")} <span className="h-px flex-1 bg-hairline/40" />+ </div>+ <button+ disabled={c.busy || c.accountBusy}+ onClick={c.useLocal}+ className="flex items-center justify-center gap-2 rounded-lg border border-hairline/50 py-2.5 text-[13px] text-ink hover:bg-control disabled:opacity-40"+ >+ <Wifi size={15} /> {t("phone.signIn.wifiInstead")}+ </button>+ <p className="mt-2 text-center text-[11px] leading-relaxed text-ink-secondary">+ {t("phone.signIn.wifiNote")}+ </p>+ {c.tailscaleAvailable && (+ <button+ disabled={c.busy || c.accountBusy}+ onClick={c.useTailscale}+ className="mt-2 flex items-center justify-center gap-2 rounded-lg border border-hairline/50 py-2.5 text-[13px] text-ink hover:bg-control disabled:opacity-40"+ >+ {t("phone.signIn.tailscaleInstead")}+ </button>+ )}+ {c.tailscaleAvailable && (+ <p className="mt-2 text-center text-[11px] leading-relaxed text-ink-secondary">+ {t("phone.signIn.tailnetNote")}+ </p>+ )}+ </>+ );+}diff --git a/src/lib/companion-pairing.test.ts b/src/lib/companion-pairing.test.tsindex c903d217c6..bb89f0d608 100644--- a/src/lib/companion-pairing.test.ts+++ b/src/lib/companion-pairing.test.ts@@ -203,7 +203,7 @@ describe("companionPairingRoute", () => {it("uses the enabled Tailscale route name when the sidecar reports no tailnet endpoint or legacy name", () => {const source = {port: 8810,- routes: { tailscale: { on: true, since: 1, name: "mac.tail1234.ts.net" } },+ routes: { tailscale: { on: true, name: "mac.tail1234.ts.net" } },lan: "192.168.1.42",endpoints: [{ url: "http://192.168.1.42:8810", kind: "lan" as const, priority: 200 },@@ -225,7 +225,7 @@ describe("companionPairingRoute", () => {it("ignores a Tailscale route name that is switched off", () => {expect(companionPairingRoute({port: 8810,- routes: { tailscale: { on: false, since: null, name: "mac.tail1234.ts.net" } },+ routes: { tailscale: { on: false, name: "mac.tail1234.ts.net" } },endpoints: [],}, "tailscale")).toBeNull();});@@ -233,7 +233,7 @@ describe("companionPairingRoute", () => {it("ignores a non-MagicDNS name from the enabled Tailscale route", () => {expect(companionPairingRoute({port: 8810,- routes: { tailscale: { on: true, since: 1, name: "attacker.example" } },+ routes: { tailscale: { on: true, name: "attacker.example" } },endpoints: [],}, "tailscale")).toBeNull();});@@ -241,18 +241,18 @@ describe("companionPairingRoute", () => {it("does not keep a Tailscale pin when the enabled route name changes", () => {const source = {port: 8810,- routes: { tailscale: { on: true, since: 1, name: "mac.tail1234.ts.net" } },+ routes: { tailscale: { on: true, name: "mac.tail1234.ts.net" } },endpoints: [],};const pin = companionPairingRoutePin(source, "tailscale");expect(pin).not.toBeNull();expect(companionPairingRoutePinAvailable({...source,- routes: { tailscale: { on: true, since: 1, name: "other.tail9999.ts.net" } },+ routes: { tailscale: { on: true, name: "other.tail9999.ts.net" } },}, pin!)).toBe(false);expect(companionPairingRoutePinAvailable({...source,- routes: { tailscale: { on: false, since: null, name: "mac.tail1234.ts.net" } },+ routes: { tailscale: { on: false, name: "mac.tail1234.ts.net" } },}, pin!)).toBe(false);});