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 works with a g1t of your own as well as g1t.sh, and nothing about that shows to people on g1t.sh. Every g1t now says where its parts are at /.well-known/g1t.json (the site, the API and the MCP server, and whether it sends phones notifications; @g1t/contracts/discovery), so someone pointing the app at theirs types only the address they open it at; a g1t from before has none, and the app takes the API to be api. in front of the site, as before. A self-hosted g1t's download page shows a QR code and Open in the g1t app, a g1t://connect?server=<site> link the app asks about before switching, so its people type nothing. The sign-in screen has one button on g1t.sh, with a quiet "Using your own g1t?" at its foot, and says "Signing in to <host>" when pointed elsewhere. | 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 | }); |