Advertise implemented NIPs in the NIP-89 app handler
Add NIP references to Marco's kind 31990: an `i` tag per implemented official NIP and an `a` tag for Marco's own kind-30817 Place Photos NIP, shaped the way NostrHub's app directory reads them. Also fix the stale note about the /e/ route being planned; it is implemented.
This commit is contained in:
3 files changed
+89
-10
No files matched your search
@@ -46,7 +46,25 @@ sign through `nak` with an explicit signer from `NOSTR_SECRET_KEY` (an
|
||||
"tags": [
|
||||
["d", "marco.earth"],
|
||||
["k", "360"],
|
||||
["web", "https://marco.earth/e/<bech32>", "nevent"]
|
||||
["web", "https://marco.earth/e/<bech32>", "nevent"],
|
||||
["i", "https://github.com/nostr-protocol/nips/blob/master/01.md"],
|
||||
["i", "https://github.com/nostr-protocol/nips/blob/master/07.md"],
|
||||
["i", "https://github.com/nostr-protocol/nips/blob/master/09.md"],
|
||||
["i", "https://github.com/nostr-protocol/nips/blob/master/19.md"],
|
||||
["i", "https://github.com/nostr-protocol/nips/blob/master/21.md"],
|
||||
["i", "https://github.com/nostr-protocol/nips/blob/master/46.md"],
|
||||
["i", "https://github.com/nostr-protocol/nips/blob/master/57.md"],
|
||||
["i", "https://github.com/nostr-protocol/nips/blob/master/65.md"],
|
||||
["i", "https://github.com/nostr-protocol/nips/blob/master/73.md"],
|
||||
["i", "https://github.com/nostr-protocol/nips/blob/master/89.md"],
|
||||
["i", "https://github.com/nostr-protocol/nips/blob/master/92.md"],
|
||||
["i", "https://github.com/nostr-protocol/nips/blob/master/B7.md"],
|
||||
[
|
||||
"a",
|
||||
"30817:<nip-author-pubkey>:place-photos-and-videos",
|
||||
"wss://nostr.kosmos.org",
|
||||
"nip"
|
||||
]
|
||||
]
|
||||
}
|
||||
```
|
||||
@@ -68,6 +86,44 @@ sign through `nak` with an explicit signer from `NOSTR_SECRET_KEY` (an
|
||||
- The second `web` value (`nevent`) makes the tag kind-specific. When reviews
|
||||
ship, add an `naddr` template (reviews are addressable) pointing at the same
|
||||
route, since an `naddr` resolves to the reviewed place too.
|
||||
- **`i`** tags advertise the official NIPs Marco implements, and one **`a`** tag
|
||||
references Marco's own kind-30817 NIP (Place Photos and Videos). See
|
||||
[Implemented NIPs](#implemented-nips).
|
||||
|
||||
## Implemented NIPs
|
||||
|
||||
The handler lists what Marco implements so directories such as NostrHub's app
|
||||
list can show it. NostrHub reads two shapes:
|
||||
|
||||
- official NIPs as `i` tags whose value is the NIP's file URL in
|
||||
[nostr-protocol/nips](https://github.com/nostr-protocol/nips), e.g.
|
||||
`["i", "https://github.com/nostr-protocol/nips/blob/master/89.md"]`;
|
||||
- custom NIPs (kind 30817) as an `a` tag marked `nip`, e.g.
|
||||
`["a", "30817:<pubkey>:place-photos-and-videos", "wss://nostr.kosmos.org", "nip"]`.
|
||||
|
||||
The set (edit `MARCO_NIPS` and `MARCO_NIP_PHOTOS_D` in
|
||||
`scripts/nostr-common.sh`):
|
||||
|
||||
| NIP | What Marco uses it for |
|
||||
| --- | ----------------------------------------- |
|
||||
| 01 | Base protocol |
|
||||
| 07 | `window.nostr` extension signer |
|
||||
| 09 | Photo deletion (kind 5) |
|
||||
| 19 | bech32 entities (`npub`/`nevent`/`naddr`) |
|
||||
| 21 | `nostr:` URIs |
|
||||
| 46 | Nostr Connect remote signer |
|
||||
| 57 | Zaps (kinds 9734/9735) |
|
||||
| 65 | Reading relay lists (kind 10002) |
|
||||
| 73 | External content IDs (`osm:`) |
|
||||
| 89 | App handlers (this NIP) |
|
||||
| 92 | `imeta` media metadata |
|
||||
| B7 | Blossom blob upload/delete (kind 24242) |
|
||||
|
||||
The [NipId & NIP References](https://nostrhub.io/naddr1qvzqqqrcvypzphm8lxn7gyf9w3wtu7k0hhxsx6ghsrry8hmm44c0t5ss3uk5lssqqqrxu6ts95mnxjpcazr)
|
||||
extension of NIP-73 defines a more general `["i", "<nipid>", …]` + `["k", "nip"]`
|
||||
form (`github.com:nostr-protocol/nips:89`, or `30817:<pubkey>:<d>`), but
|
||||
NostrHub's app directory does not parse it, so the shapes above are used
|
||||
instead.
|
||||
|
||||
## Recommendation event (`kind 31989`)
|
||||
|
||||
|
||||
@@ -42,6 +42,18 @@ MARCO_APP_D="marco.earth"
|
||||
# the spec instead of replacing it, so the scripts guard against it.
|
||||
NIP_SPEC_PUBKEY="1f79058c77a224e5be226c8f024cacdad4d741855d75ed9f11473ba8eb86e1cb"
|
||||
|
||||
# Official NIPs Marco implements, advertised in the app handler (kind 31990) as
|
||||
# NIP references so directories like NostrHub can list them. Space separated
|
||||
# two-character identifiers (B7 is Blossom). See doc/nostr/nip-89-app-handler.md.
|
||||
MARCO_NIPS="01 07 09 19 21 46 57 65 73 89 92 B7"
|
||||
|
||||
# "d" identifier of Marco's own published NIP (kind 30817): Place Photos and
|
||||
# Videos. The app handler references it via its `a` address.
|
||||
MARCO_NIP_PHOTOS_D="place-photos-and-videos"
|
||||
|
||||
# Relay hint for the custom NIP reference.
|
||||
MARCO_NIP_RELAY="wss://nostr.kosmos.org"
|
||||
|
||||
# Requires an explicit signer so we never silently fall back to nak's machine
|
||||
# default key. Exports NAK_SEC for the nak calls.
|
||||
require_signer() {
|
||||
|
||||
@@ -24,17 +24,28 @@ require_signer
|
||||
|
||||
APP_ORIGIN="https://marco.earth"
|
||||
APP_CONTENT="{\"name\":\"Marco\",\"about\":\"An unhosted maps application.\",\"picture\":\"$APP_ORIGIN/icons/icon-192.png\",\"website\":\"$APP_ORIGIN\"}"
|
||||
NIP_URL_PREFIX="https://github.com/nostr-protocol/nips/blob/master"
|
||||
|
||||
# "k" tags list every kind this app handles; add k=30360 when place reviews
|
||||
# ship. Clients replace <bech32> with a NIP-19 nevent before opening the URL.
|
||||
# The /e/<nevent> route is planned in Marco (see the doc).
|
||||
event=$(
|
||||
nak event --sec "$NAK_SEC" -k 31990 \
|
||||
-d "$MARCO_APP_D" \
|
||||
-t k=360 \
|
||||
-t "web=$APP_ORIGIN/e/<bech32>;nevent" \
|
||||
-c "$APP_CONTENT"
|
||||
)
|
||||
# ship. Clients replace <bech32> with a NIP-19 nevent before opening the URL;
|
||||
# the /e/<nevent> route is implemented in Marco (see the doc).
|
||||
#
|
||||
# "i" tags advertise the official NIPs Marco implements and an "a" tag points
|
||||
# at Marco's own kind-30817 NIP. These are the shapes NostrHub's app directory
|
||||
# reads (see doc/nostr/nip-89-app-handler.md).
|
||||
set -- nak event --sec "$NAK_SEC" -k 31990 \
|
||||
-d "$MARCO_APP_D" \
|
||||
-t k=360 \
|
||||
-t "web=$APP_ORIGIN/e/<bech32>;nevent" \
|
||||
-c "$APP_CONTENT"
|
||||
|
||||
for nip in $MARCO_NIPS; do
|
||||
set -- "$@" -t "i=$NIP_URL_PREFIX/$nip.md"
|
||||
done
|
||||
|
||||
set -- "$@" -t "a=30817:$NIP_SPEC_PUBKEY:$MARCO_NIP_PHOTOS_D;$MARCO_NIP_RELAY;nip"
|
||||
|
||||
event=$("$@")
|
||||
|
||||
pubkey=$(printf '%s\n' "$event" | event_pubkey)
|
||||
[ -n "$pubkey" ] || die "could not read pubkey from the signed event"
|
||||
|
||||
Reference in new issue
Block a user