Reuse nip94 'url' tag instead of 'resource'

This commit is contained in:
arthurfranca 2023-10-31 18:35:17 -03:00
parent 57fea0e5b7
commit 403ed94a7c
2 changed files with 5 additions and 16 deletions

20
54.md
View File

@ -14,7 +14,7 @@ The URI fragment follows [media fragments structure](https://www.w3.org/TR/media
The metadata can be appended to any url, like this [NIP-21](21.md) one: `nostr:nevent1qq...pm#a-metadata-name=a-metadata-value`.
One may also add `resource` tags to events to aid in loading resource placeholders on clients that postpone or don't do event `.content` parsing.
One may also add `url` tags to events to aid in loading resource placeholders on clients that postpone or don't do event `.content` parsing.
## NIP-94 File Fragments
@ -32,34 +32,24 @@ Besides available w3c and proprietary URI fragment usage, nostr uses existing [N
Multiple array values use repeated names and are positioned in the same order of ocurrence in the tag array. For instance, `["aes-256-gcm", 'i-am-a-key', 'i-am-an-iv']` becomes `aes-256-gcm=i-am-a-key&aes-256-gcm=i-am-an-iv`.
## Tag Usage
Metadata fragments are great for sharing urls with extra embedded metadata. They are also good for copying and pasting a resource's url from one note to a new one without losing its metadata.
But some clients can prepare image and video placeholders faster if specific fields are present outside of `.content`.
For these resources, it is suggested to also add `dim`, `alt` and `blurhash`, if available, to media urls inside `resource` tags.
### Event Example:
```js
{
"kind": 1,
"content": "What a great place! https://xyz.com/example.jpg#m=image%2Fjpeg&dim=3024x4032&alt=A%20scenic%20photo%20overlooking%20the%20coast%20of%20Costa%20Rica&blurhash=eVF%24%5EOI%3A%24%7BM%7Bo%23*0-nNFxakD-%3FxVM%7DWEWB%25iNKxvR-oetmo%23R-aen%24`",
"tags": [
[
"resource", "https://xyz.com/example.jpg#dim=3024x4032&alt=A%20scenic%20photo%20overlooking%20the%20coast%20of%20Costa%20Rica&blurhash=eVF%24%5EOI%3A%24%7BM%7Bo%23*0-nNFxakD-%3FxVM%7DWEWB%25iNKxvR-oetmo%23R-aen%24"
]
]
// ... other event fields
}
```
Also, some event kinds other than kind 1 and kind 30023 may have been designed with urls inside tags instead of in `.content`. For these cases, use `resource` tags (or `r` tags if it needs to be indexed by relays in this case, metadata fragment keys and query parameter keys SHOULD be arranged in ascending order).
## Tag Usage
Some event kinds may have been designed with urls inside tags instead of in `.content`. For these cases, use `url` tags (or `r` tags if it needs to be indexed by relays in this case, metadata fragment keys and query parameter keys SHOULD be arranged in ascending order).
### Tag Examples:
A kind 30023 event JSON file (with `nostr/30023` MIME type):
`["resource", "https://xyz.com/example.json#m=nostr%2F30023"]`
`["url", "https://xyz.com/example.json#m=nostr%2F30023"]`
A PDF file without extension with added MIME type information:
`["r", "https://xyz.com/article02#m=application%2Fpdf"]`

View File

@ -195,7 +195,6 @@ Please update these lists when proposing NIPs introducing new event kinds.
| `published_at` | unix timestamp (string) | -- | [23](23.md) |
| `relay` | relay url | -- | [42](42.md) |
| `relays` | relay list | -- | [57](57.md) |
| `resource | URL | -- | [54](54.md) |
| `subject` | subject | -- | [14](14.md) |
| `summary` | article summary | -- | [23](23.md) |
| `thumb` | badge thumbnail | dimensions in pixels | [58](58.md) |