clone

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

card: the owner's nprofile with this relay as the hint, for apps that have no relay pages

Dami committed 5cf7ea4
commit
5cf7ea42aea03a06ab5fcc82e416fe52892f07cd
parent
b27adb87dccb9e8c33159a179984dc52f63a13e1
author
Dami <dami.etoile@gmail.com>
4 files changed, +10 -4
Mdocs/05-your-relay-on-the-web.md2+-
Mdocs/14-http-reference.md2+-
Msrc/card.ts6++++--
Mtest/card.test.ts4++++
M docs/05-your-relay-on-the-web.md +1 -1
M docs/14-http-reference.md +1 -1
M src/card.ts +4 -2
@@ -1,13 +1,13 @@
11 // The relay card: something a name can be linked to from a profile.22 //3-// GET /card.json the facts: name, owner, members, rules, fuel, naddr3+// GET /card.json the facts: name, owner, members, rules, fuel, naddr, nprofile44 // GET /card.nostr the same facts as a kind 30078 signed by the relay key55 // GET /card.svg an open graph sized picture with a QR of the naddr66 // GET /qr.svg any short text as a QR, for the console77 //88 // Cards are public and cached for five minutes. Unclaimed and leased relays99 // get a smaller card that says so.10-import { naddrEncode } from "nostr-tools/nip19";10+import { naddrEncode, nprofileEncode } from "nostr-tools/nip19";1111 import { svg as qrSVG, encode as qrEncode } from "./qr.ts";1212 import { KIND_GROUP_METADATA } from "./identity.ts";1313 import { escapeHTML } from "./ui.ts";
@@ -35,6 +35,7 @@ export interface Card {
3535 writes?: "open" | "allowlist" | "wot" | "owner";3636 fuel?: "allowance" | "burning" | "out";3737 naddr?: string;38+ nprofile?: string; // the owner, with this relay as the hint: "find me here" for feed clients3839 signed_url?: string;3940 image?: string;4041 }
@@ -63,6 +64,7 @@ export function cardData(relay: Relay, host: string, caller: string[] = []): Car
6364 image: web + "/card.svg",6465 };6566 if (p.icon) card.icon = p.icon;67+ card.nprofile = nprofileEncode({ pubkey: p.owner, relays: [url] });6668 if (self) {6769 card.self = self;6870 card.naddr = naddrEncode({ kind: KIND_GROUP_METADATA, pubkey: self, identifier: relay.slug, relays: [url] });
M test/card.test.ts +4 -0