Don't try to anticipate tag usage

This commit is contained in:
arthurfranca 2023-12-11 12:44:47 -03:00
parent e9ad334848
commit f500e82592

23
54.md
View File

@ -4,8 +4,6 @@ NIP-54
Inline Resource Metadata Inline Resource Metadata
------------------------ ------------------------
`draft` `optional` `author:arthurfranca` `author:Giszmo` `author:jb55` `author:vitorpamplona`
Inline resource metadata is additional information associated with urls in notes that clients can optionally use to enhance resource loading. Inline resource metadata is additional information associated with urls in notes that clients can optionally use to enhance resource loading.
It uses [URI Fragment](https://en.wikipedia.org/wiki/URI_fragment) that agents (such as web browsers) never send to the server. Because of this, the url is fetched **without** the fragment parameters, unlike using query parameters. It uses [URI Fragment](https://en.wikipedia.org/wiki/URI_fragment) that agents (such as web browsers) never send to the server. Because of this, the url is fetched **without** the fragment parameters, unlike using query parameters.
@ -30,29 +28,20 @@ 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`. 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`.
### Event Example: ## Usage
An url with added metadata can be used anywhere a normal url can, whether embedded in an event's `.content` field or as an event tag value.
### Example:
```js ```js
{ {
"kind": 1, "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`", "content": "What a great place! https://xyz.com/filename#m=image%2Fjpeg&dim=1920x1080`",
// ... other event fields // ... other event fields
} }
``` ```
## Tag Usage
When publishing events of kinds designed with urls inside tags instead of in `.content`, use `media` tags specifically for image, audio and video
or else pick another tag such as `r`. One may also add `media` tags to events to aid in loading media placeholders on clients that postpone or don't do event `.content` parsing.
### Tag Examples:
An image with MIME type, dimensions and blurhash:
`["media", "https://xyz.com/image001.png#m=image%2Fpng&dim=1342x704&blurhash=MnR3f%2C%25M%252%25MjZ~Wj%40j%5Bt7Rjs%3Aayfkj%5BWB%5C"]`
A kind 30023 event JSON file (with `nostr/30023` MIME type):
`["r", "https://xyz.com/example.json#m=nostr%2F30023"]`
## Recommended client behavior ## Recommended client behavior
When uploading images during a new post, clients can collect metadata When uploading images during a new post, clients can collect metadata