Skip to content
53 linesCodeBlameRaw

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.

Merge branch 'worktree-agent-aaf03bdceac799c89'1import assert from "node:assert/strict";
2import { test } from "node:test";
3
Merge g1tusercontent.com: registry answers run nothing in a browser, the site's pages run only their own scripts, repository files and avatars on their own origin, raw files rate limited per address4import { HOSTED_ADDRESSES, addressesFor, addressesFrom, cloneUrl, usercontentFrom } from "./addresses.ts";
Merge branch 'worktree-agent-aaf03bdceac799c89'5import { MCP_URL } from "./agent-setup.ts";
6import { OG, SITE } from "./meta.ts";
7
8test("with no settings, the addresses are g1t.sh's", () => {
9 assert.deepEqual(addressesFor({}), HOSTED_ADDRESSES);
10 assert.deepEqual(addressesFor({ SITE_URL: "", API_URL: "", MCP_URL: "" }), HOSTED_ADDRESSES);
11});
12
13test("settings replace the addresses, without trailing slashes", () => {
14 assert.deepEqual(
15 addressesFor({
16 SITE_URL: "http://localhost:8787/",
17 API_URL: "http://localhost:8788",
18 MCP_URL: "http://localhost:8790/mcp/",
19 OG_URL: "",
20 }),
Merge g1tusercontent.com: registry answers run nothing in a browser, the site's pages run only their own scripts, repository files and avatars on their own origin, raw files rate limited per address21 {
22 site: "http://localhost:8787",
23 api: "http://localhost:8788",
24 mcp: "http://localhost:8790/mcp",
25 og: null,
26 usercontent: "http://localhost:8787/-/usercontent",
27 },
Merge branch 'worktree-agent-aaf03bdceac799c89'28 );
29});
30
Merge g1tusercontent.com: registry answers run nothing in a browser, the site's pages run only their own scripts, repository files and avatars on their own origin, raw files rate limited per address31test("files people supply are served from an origin of their own", () => {
32 assert.equal(addressesFor({}).usercontent, "https://g1tusercontent.com");
33 assert.equal(addressesFor({ SITE_URL: "https://git.example.com", USERCONTENT_URL: "https://files.example.net/" }).usercontent, "https://files.example.net");
34 assert.equal(addressesFor({ SITE_URL: "https://git.example.com", USERCONTENT_URL: "https://git.example.com" }).usercontent, "https://git.example.com/-/usercontent");
35 assert.equal(usercontentFrom(undefined), "");
36 assert.equal(usercontentFrom({ addresses: HOSTED_ADDRESSES }), "https://g1tusercontent.com");
37});
38
Merge branch 'worktree-agent-aaf03bdceac799c89'39test("pages without root data use g1t.sh's addresses", () => {
40 assert.deepEqual(addressesFrom(undefined), HOSTED_ADDRESSES);
41 const own = { site: "http://localhost:8787", api: "a", mcp: "m", og: null };
42 assert.deepEqual(addressesFrom({ addresses: own }), own);
43});
44
45test("the defaults kept in meta and agent setup are g1t.sh's", () => {
46 assert.equal(SITE, HOSTED_ADDRESSES.site);
47 assert.equal(OG, HOSTED_ADDRESSES.og);
48 assert.equal(MCP_URL, HOSTED_ADDRESSES.mcp);
49});
50
51test("a clone address is under the site", () => {
52 assert.equal(cloneUrl(HOSTED_ADDRESSES, "acme/web"), "https://g1t.sh/acme/web.git");
53});

This file's history is long; its oldest lines are credited to the oldest commit read.