NIP-93: backwards-compatible alternative media URLs.

This commit is contained in:
fiatjaf 2023-11-23 01:00:13 -03:00
parent 7822a8b126
commit bde51dfdd2
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1
2 changed files with 58 additions and 0 deletions

57
93.md Normal file
View File

@ -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).

View File

@ -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] | | `1971` | Problem Tracker | [nostrocket-1971][nostrocket-1971] |
| `1984` | Reporting | [56](56.md) | | `1984` | Reporting | [56](56.md) |
| `1985` | Label | [32](32.md) | | `1985` | Label | [32](32.md) |
| `4001` | URL Alternative | [93](93.md) |
| `4550` | Community Post Approval | [72](72.md) | | `4550` | Community Post Approval | [72](72.md) |
| `5000`-`5999` | Job Request | [90](90.md) | | `5000`-`5999` | Job Request | [90](90.md) |
| `6000`-`6999` | Job Result | [90](90.md) | | `6000`-`6999` | Job Result | [90](90.md) |