nips/93.md

58 lines
2.2 KiB
Markdown
Raw Permalink Normal View History

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