Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| The phone app with your own g1t, on g1t.sh/download until Google Play, and Node 24 (#5) | 1 | import assert from "node:assert/strict"; |
| 2 | import { test } from "node:test"; | |
| 3 | ||
| 4 | import { connectLink, parseDiscovery } from "./discovery.ts"; | |
| 5 | ||
| 6 | test("a discovery document is read for its origins", () => { | |
| 7 | assert.deepEqual( | |
| 8 | parseDiscovery({ name: "g1t", site: "https://g1t.example.com/", api: "http://10.0.0.5:8789/x", mcp: "https://g1t.example.com/mcp/", hosted: false, phone: { chat: true, push: false } }), | |
| 9 | { name: "g1t", site: "https://g1t.example.com", api: "http://10.0.0.5:8789", mcp: "https://g1t.example.com/mcp", hosted: false, phone: { chat: true, push: false } }, | |
| 10 | ); | |
| 11 | }); | |
| 12 | ||
| 13 | test("anything else is not one", () => { | |
| 14 | assert.equal(parseDiscovery(null), null); | |
| 15 | assert.equal(parseDiscovery({ site: "https://a.example", api: "https://b.example" }), null, "no name"); | |
| 16 | assert.equal(parseDiscovery({ name: "g1t", site: "javascript:alert(1)", api: "https://b.example" }), null); | |
| 17 | assert.equal(parseDiscovery({ name: "g1t", site: "https://a.example" }), null, "no API"); | |
| 18 | }); | |
| 19 | ||
| 20 | test("a connect link carries the site", () => { | |
| 21 | assert.equal(connectLink("https://g1t.example.com"), "g1t://connect?server=https%3A%2F%2Fg1t.example.com"); | |
| 22 | }); |
This file's history is long; its oldest lines are credited to the oldest commit read.