tinyrelayfile
tinyrelay/scripts/configure-git-performance.mjs/

scripts/configure-git-performance.mjs raw
1// Enable only base Git hosting on an isolated, owned benchmark tenant.
2import { finalizeEvent } from "nostr-tools/pure";
3import { getToken } from "nostr-tools/nip98";
4
5const url = process.argv[2] || "http://127.0.0.1:17447";
6const privateRepos = process.argv.includes("--private");
7const secret = Uint8Array.from(Buffer.from("fc1d06a0fd5e622dcf448d0b3c2fccc891a5ecf74546a7675460d92441fecfdd", "hex"));
8async function rpc(method, params = []) {
9 const payload = {method, params};
10 const token = await getToken(url, "POST", event => finalizeEvent(event, secret), true, payload);
11 const response = await fetch(url, {method: "POST", headers: {
12 "Content-Type": "application/nostr+json+rpc", Authorization: token,
13 }, body: JSON.stringify(payload)});
14 const result = await response.json();
15 if (!response.ok || result.error) throw Error(JSON.stringify(result));
16 return result.result;
17}
18const policy = await rpc("getpolicy");
19policy.features = {...policy.features, grasp: true, grasp02: false, grasp03: false, grasp05: false, grasp06: false, grasp08: privateRepos};
20if (privateRepos) policy.reads = "members";
21console.log(JSON.stringify(await rpc("setpolicy", [policy])));

About

ownerc01503e8035f
visibilitypublic
headd730679639bf

Maintainers

  • c01503e8035f owner
  • ba1b5beed5b5 agent hermes

Clone

  • https://012.run/npub1cq2s86qrtadf36eqq3epm38wmhdynrrcwxf84eldk3f94dkv7ttsrulrz5/tinyrelay.git

Refs