Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Test: no phone QR for an address the phone app refuses
aivsomkar750541796576
diff --git a/server/cli.test.ts b/server/cli.test.tsindex 57a6eea620..c56979b1a7 100644--- a/server/cli.test.ts+++ b/server/cli.test.ts@@ -129,6 +129,17 @@ describe("openmausbot command line", () => {expect(pairingBlock({ ...base, inviteUrl: invite, phone: "ios" })).toContain(qrToString(link));});+ it("still gives the camera a QR for an address the phone app refuses, and says what the app needs", () => {+ const tailnetIp = "http://100.101.102.103:8799/pair#code=ABCD-EFGH-JKLM";+ const out = pairingBlock({ ...base, link: tailnetIp });+ expect(out).toContain(qrToString(tailnetIp));+ expect(out).toContain("Phone scan with your camera to open it in the browser");+ expect(out).toContain("The MausBot app can't connect to 100.101.102.103:8799.");+ expect(out).toContain("npx openmausbot serve --lan");+ expect(pairingBlock(base)).not.toContain("can't connect");+ expect(pairingBlock({ ...base, link: "http://192.168.1.20:8799/pair#code=ABCD-EFGH-JKLM" })).not.toContain("can't connect");+ });+it("says until when as a clock time, and tomorrow when a code outlives today", () => {expect(untilText(now + 10 * 60_000, now)).not.toMatch(/tomorrow|minutes/);expect(untilText(now + 24 * 3_600_000, now)).toMatch(/^tomorrow /);diff --git a/src/components/ServerPairingCard.test.ts b/src/components/ServerPairingCard.test.tsindex e16e9c28e5..170a1ff1bc 100644--- a/src/components/ServerPairingCard.test.ts+++ b/src/components/ServerPairingCard.test.ts@@ -3,7 +3,7 @@ import { renderToStaticMarkup } from "react-dom/server";import { describe, expect, it } from "vitest";import { codeUntil, lastSeen } from "../lib/pairing-time";-import { canPairDevices, pairingBlockedReason, phoneSecretNote, sameWifiOnlyLink, ServerPairingCard, shownDevices } from "./ServerPairingCard";+import { canPairDevices, pairingBlockedReason, phoneRefusedHost, phoneSecretNote, sameWifiOnlyLink, ServerPairingCard, shownDevices } from "./ServerPairingCard";describe("pairing devices from a hosted server's settings", () => {it("is offered to the owner on the box and to admin sessions, never to chat-only sessions", () => {@@ -116,4 +116,17 @@ describe("pairing devices from a hosted server's settings", () => {expect(sameWifiOnlyLink(null)).toBe(false);expect(sameWifiOnlyLink("not a link")).toBe(false);});++ it("shows no phone QR for an address the phone app refuses over plain http, and names that address", () => {+ const code = "/pair#code=ABCD-EFGH-JKLM";+ expect(phoneRefusedHost(`http://100.101.102.103:8799${code}`)).toBe("100.101.102.103:8799");+ expect(phoneRefusedHost(`http://homeserver:8799${code}`)).toBe("homeserver:8799");+ expect(phoneRefusedHost(`http://nas.home.arpa:8799${code}`)).toBe("nas.home.arpa:8799");+ expect(phoneRefusedHost(`http://bots.example.com${code}`)).toBe("bots.example.com");+ for (const origin of ["https://bots.example.com", "https://100.101.102.103:8799", "http://192.168.1.20:5199", "http://10.0.0.5:5199", "http://172.16.0.9:5199",+ "http://my-pc.local:5199", "http://my-pc.tail1234.ts.net:5199", "http://localhost:8799", "http://[fd00::1]:8799", "http://[fe80::1]:8799"]) {+ expect(phoneRefusedHost(`${origin}${code}`), origin).toBeNull();+ }+ expect(phoneRefusedHost(null)).toBeNull();+ });});