From bde51dfdd27953ac971e89b5170d2b90b623654b Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Thu, 23 Nov 2023 01:00:13 -0300 Subject: [PATCH] NIP-93: backwards-compatible alternative media URLs. --- 93.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 1 + 2 files changed, 58 insertions(+) create mode 100644 93.md diff --git a/93.md b/93.md new file mode 100644 index 0000000..2b38275 --- /dev/null +++ b/93.md @@ -0,0 +1,57 @@ +NIP-93 +====== + +Alternative URLs +---------------- + +Whenever there is a URL linked to in an event, alternative versions of that same URL can be given as `alturl` tags in that same event. For example: + +```json +{ + "kind": 1, + "content": "I just painted this: https://www.foundmyself.com/gallery/albums/userpics/55231/qs170gzrh0by7w0ftxaas76tx2r7vb.jpg", + "tags": [ + [ + "alturl", + "https://www.foundmyself.com/gallery/albums/userpics/55231/qs170gzrh0by7w0ftxaas76tx2r7vb.jpg", + "http://images5.fanpop.com/image/photos/31600000/The-Starry-Night-by-Vincent-van-Gogh-1889-fine-art-31674050-2560-2027.jpg", + "https://www.paintingmania.com/arts/vincent-van-gogh/large/starry-night-6_2843.jpg?version=09.12.13" + ] + ], + ... +} +``` + +The second element in the tag is the original URL that is in the content, the remaining elements are alternative sources for the same content. + +Alternative URLs do not have to contain exactly the same content, byte-for-byte. + +## Fixing other people's events + +When someone else publishes an event containing URLs, other people can reference it in an event that adds alternative URLs for them, thus preventing the original event from losing its meaning once its referenced URL becomes inaccessible. + +For example, in response to an event + +```json +{ + "id": "ad777844308977e54867c64aa0a425e15f29618105080c8c33c5a00e9198a076", + "kind": 1, + "content": "I just painted this: https://wallpapercave.com/wp/wp5960277.jpg", + ... +} +``` + +Other people (or the same person) could publish events of kind `4001` like this: + +```json +{ + "kind": 4001, + "tags": [ + ["alt", "alternative image for event ad77..."], + ["e", "ad777844308977e54867c64aa0a425e15f29618105080c8c33c5a00e9198a076"], + ["alturl", "https://wallpapercave.com/wp/wp5960277.jpg", "https://wallpapercave.com/wp/wp5960312.jpg"] + ] +} +``` + +Then clients, when finding out that the original URL of the event is no longer available, could try to load an alternative from one of the `kind:4001` events that reference the original one. They should prioritize replacements from the original author and then use some kind of heuristics to prevent misleading replacements (only load `kind:4001` events from trustworthy friends or friends of the original author, for example). diff --git a/README.md b/README.md index b8b98d9..f27d7fc 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos | `1971` | Problem Tracker | [nostrocket-1971][nostrocket-1971] | | `1984` | Reporting | [56](56.md) | | `1985` | Label | [32](32.md) | +| `4001` | URL Alternative | [93](93.md) | | `4550` | Community Post Approval | [72](72.md) | | `5000`-`5999` | Job Request | [90](90.md) | | `6000`-`6999` | Job Result | [90](90.md) |