- commit
- 8ee3e8f0fa3398cc3223fedb6e61d9e9cdfd0d7f
- parent
- 1f64d5812d21b55c458bc995fb3e3d0b1d8e769b
- author
- Dami <dami.etoile@gmail.com>
| M | relay-templates/ | 39 | ++++++++++++++++++++++++------ |
| M | scripts/ | 7 | +++++ |
@@ -1,18 +1,41 @@
11 # Relay templates22 3-One file per template, in the order the console shows them. Each is a relay4-configuration (`relay-config.schema.json`) with a `template` block for the5-title and the blurb, and the rules sections only: policy, kinds and6-retention. People, bans and addresses are never in a template, and a section7-a template leaves out is left alone when it is applied.3+A relay does not have to do everything. Names are cheap, so pick the template4+for the job and give each job its own name. The console offers these as5+presets, in this order; each is also a file you can apply from a script or6+copy as the start of your own.7+8+| Template | Choose it when |9+|---|---|10+| [default](01-default.jsonc) | you want a plain relay: anyone writes, anyone reads, everything kept. What a fresh claim has. |11+| [outbox](02-outbox.jsonc) | it is where your own public notes and articles live, for the world to read. |12+| [inbox](03-inbox.jsonc) | it is where people reach you: replies, reactions, zaps and reports, kept 90 days. |13+| [private](04-private.jsonc) | only you write and only your devices or a trusted few read: drafts, wallets, app data. |14+| [chat](05-chat.jsonc) | a group of members talks here: messages and the group's chat, directory hidden. |15+| [media](06-media.jsonc) | it is a file host and nothing else: members upload, anyone fetches. |16+| [search](07-search.jsonc) | you want a searchable copy of another relay's prose, refreshed every six hours. Needs a source. |17+| [articles](08-articles.jsonc) | long-form only, yours or mirrored daily from a source. |18+| [dm](09-dm.jsonc) | it is a drop box for private messages: anyone leaves a gift wrap, only members read. |19+| [quiet](10-quiet.jsonc) | it should cost nothing and announce nothing: members only, every optional feature off, switched on one at a time as needed. |20+21+Each file says more in its comment: what the template does, which Haven relay22+it mirrors, and why its kinds are what they are.23+24+## The files25+26+A template is a relay configuration (`../relay-config.schema.json`) with a27+`template` block for the title and the blurb, and the rules sections only:28+policy, kinds and retention. People, bans and addresses are never in a29+template, and a section a template leaves out is left alone when it is30+applied. The number in the file name is the order the console shows them in.831 932 `npm run build:templates` folds the folder into `src/gen/templates.ts`, which1033 the relay serves as its presets; `npm run typecheck` checks every file here11-against the schema and the relay's parser, and fails when the generated12-module is stale.34+against the schema and the relay's parser, fails when the generated module35+is stale, and fails when a file is missing from the table above.1336 1437 To try one on a relay without applying it:1538 1639 ```17-node scripts/ops/relay.mjs plan relay-templates/10-quiet.jsonc wss://<name>.bind.ws40+node ../scripts/ops/relay.mjs plan 10-quiet.jsonc wss://<name>.bind.ws1841 ```@@ -7,6 +7,13 @@ import { stripComments } from "../check/jsonc.mjs";
77 const DIR = new URL("../../relay-templates/", import.meta.url);88 const OUT = new URL("../../src/gen/templates.ts", import.meta.url);99 const files = readdirSync(DIR).filter((f) => f.endsWith(".jsonc")).sort();10+// The folder's README is the catalog: every template has a row there.11+const readme = readFileSync(new URL("README.md", DIR), "utf8");12+const missing = files.filter((f) => !readme.includes(`](${f})`));13+if (missing.length) {14+ console.error(`relay-templates/README.md has no row for: ${missing.join(", ")}`);15+ process.exit(1);16+}1017 const templates = files.map((f) => {1118 const doc = JSON.parse(stripComments(readFileSync(new URL(f, DIR), "utf8")));1219 delete doc.$schema;