clone

nostr relays on demand at <name>.bind.ws: claim one with your key, pay in zaps past the free allowance

docs: views, for readers, clients, the console and the architecture

Dami committed 227029e
commit
227029e382f38e12d490781ed30f27cd942e9ca9
parent
a28344f2481aac9815ca5e56a864dd3d611dae3f
author
Dami <dami.etoile@gmail.com>
5 files changed, +38 -0
Mdocs/01-relay-configuration.md2++
Mdocs/05-your-relay-on-the-web.md18++++++++++++++++++
Mdocs/10-architecture.md8++++++++
Mdocs/13-scripts-and-agents.md2++
Mdocs/14-http-reference.md8++++++++
M docs/01-relay-configuration.md +2 -0
M docs/05-your-relay-on-the-web.md +18 -0
@@ -41,6 +41,24 @@ Clients that speak NIP-96 instead find the same store through `/.well-known/nost
4141 4242 Send a signed report (NIP-56) that names the file's hash to `PUT /report`. It lands in the reports queue on the Moderation tab next to reported events. Deleting a reported file also blocks its hash, so it cannot be uploaded again through either door.4343 44+## Views45+46+A view is a record the relay signs from what it holds, so a client reads one event instead of hundreds. Each is a kind 30078 event by the relay's own key with `d` set to `bind.ws/view/<name>`, listed in the relay's information document under `views`, and served as JSON at `/view/<name>`.47+48+| View | What it holds | How often |49+|---|---|---|50+| profiles | every member's newest name, picture and address, the owner first | daily, and when the member list changes |51+| relays | where the members are: the relays in their relay lists, most shared first | daily |52+| calendar | events in the next 30 days from the calendar kinds (NIP-52), with accepted RSVPs counted | hourly, when something changed |53+| moderation | this month's counts: bans, reports filed and resolved, events hidden and deleted, addresses blocked | daily |54+| articles | the newest 100 long-form posts by address, title and date | when one arrives, and daily |55+| zaps | sats received by the top 50 notes and authors here, from stored receipts | hourly, when something changed |56+| presence | who has a connection open and who wrote in the last 15 minutes | live, never stored |57+58+Profiles and relays follow the directory switch, calendar, articles and presence follow the read rule. A members-only view is never stored, since a stored event is readable by anyone the read rule lets in. It is folded and signed when a member asks for it with a signed request. Presence is an ephemeral event, kind 20078, sent to whoever subscribes to it and answered from memory at `/view/presence`; it is broadcast at most once every 30 seconds.59+60+Views cost rows written, which fuel counts. The Data tab shows what each one wrote on its last run, and the weekly digest adds them up. Any view can be switched off there.61+4462 ## Scripts4563 4664 The relay has an HTTP door for scripts. Sign a request with your key (NIP-98) and post to `/events`, `/query` or `/count`. No websocket needed. The full path for scripts and agents, from leasing a relay to pulling history, is in [Scripts and agents](13-scripts-and-agents.md).
M docs/10-architecture.md +8 -0
@@ -135,6 +135,14 @@ Wiring the relay into the owner's lists (kinds 10002, 10050, 10007, 10063) happe
135135 136136 The console (`dashboard.ts`) is one page, no build step: markup, styles and script as three string literals. Its signer is NIP-07 when present or a NIP-46 session over the relay itself, using a bundle of nostr-tools served at `/signer.js` and loaded only when someone picks remote signing.137137 138+## Views139+140+`src/views.ts` is a registry of folds. Each view names a trigger, an audience and a fold that returns tags and content; hourly views add a fingerprint so nothing is republished when the inputs did not move. The record is a kind 30078 signed by the identity key on the same strictly increasing clock as the group state, `d` = `bind.ws/view/<name>`, stored and broadcast through `emit` like the roster, taken down when the view is switched off, empty, or no longer public. The rows a run wrote are measured around the fold from the store's write counter and kept as the last 60 runs, which the console and the digest read.141+142+Audience decides storage. A public view is stored. A members-only view is never stored, because a stored event is readable by anyone the read rule admits; `GET /view/<name>` folds and signs it on request for a member who proves it with NIP-98. Presence is neither: an ephemeral kind 20078 built from the socket list and a map of recent writers, broadcast when the set changes at most once every 30 seconds, rebuilt from the sockets after a wake since the map does not survive hibernation.143+144+The daily alarm runs daily views once a day and hourly views once an hour. Write-triggered views mark themselves dirty and republish ten seconds later, so a burst republishes once, and the daily run catches whatever a sleep dropped. Retention and purge skip every event the identity key signed, on top of the protected kinds, so views and the other records never expire.145+138146 ## Protocol surface139147 140148 NIP-01, 05, 09, 11, 13, 17 and 59 private kinds, 29, 40, 42, 43, 45 with HLL counts, 46 as transport, 50, 56, 57, 62, 67, 70, 77, 86, 94, 96, 98, and Blossom BUD-01, 02, 03 by way of the lists, 04, 06, 08 and 09. `test/conformance` is a black-box suite that runs against any relay URL.
M docs/13-scripts-and-agents.md +2 -0
M docs/14-http-reference.md +8 -0