From cc343b96bedbd4686fe5eb6733b7fa78116a7604 Mon Sep 17 00:00:00 2001 From: arthurfranca Date: Fri, 12 May 2023 15:18:42 -0300 Subject: [PATCH 1/8] Add NIP-54 --- 54.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 94.md | 2 ++ README.md | 1 + 3 files changed, 45 insertions(+) create mode 100644 54.md diff --git a/54.md b/54.md new file mode 100644 index 0000000000..f04eac87b1 --- /dev/null +++ b/54.md @@ -0,0 +1,42 @@ +NIP-54 +====== + +Inline Resource Metadata +------------------------ + +`draft` `optional` `author:arthurfranca` `author:Giszmo` `author:jb55` + +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. + +The URI fragment follows [media fragments structure](https://www.w3.org/TR/media-frags/#general-structure). For example, one could use `t=number_of_seconds` to start playing a video at the specified position along with an extra [percent-encoded](https://www.ietf.org/rfc/rfc3986.txt) name-value pair separated by `&` char like `https://xyz.com/a-video.mp4#t=24&a%20name=a%20value`. + +The metadata can be appended to any url, like this [NIP-21](21.md) one: `nostr:nevent1qq...pm#a-metadata-name=a-metadata-value` + +## NIP-94 File Fragments + +Besides available w3c and proprietary URI fragment usage, nostr uses existing [NIP-94](94.md) tags as file fragment name-value pairs. For example, one could join the following strings to form an image url with inline metadata: + +- `https://nostr.build/i/863321bb1ae68830ebcf9a343ca0a5e0ce2323d0a55b7fbe86f7a886cf61db8d.jpg` +- `#` +- `dim=3024x4032` +- `&` +- `blurhash=eVF%24%5EOI%3A%24%7BM%7Bo%23*0-nNFxakD-%3FxVM%7DWEWB%25iNKxvR-oetmo%23R-aen%24` +- `&` +- `alt=Picture%20of%20a%20scenic%20view%20overlooking%20the%20coast%20near%20Uvita%2C%20with%20a%20person%20holding%20a%20coffee%20cup` + +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` + +NIP-94 event content may be used as `content` fragment field or alternatively as `alt` if corresponding tag is absent. + +## Recommended client behavior + +When uploading images during a new post, clients can collect metadata +after the image is uploaded and then include the url with inline metadata in the post. + +When pasting urls during post composition, the client could download the image +and add some metadata before the post is sent. + +Clients can use `alt` fragment to add accessible text for people who prefer not to +load images, visibility-impaired users, or text clients. diff --git a/94.md b/94.md index c5e0f18221..be7f706662 100644 --- a/94.md +++ b/94.md @@ -18,6 +18,7 @@ This NIP specifies the use of the `1063` event type, having in `content` a descr * `x` containing the SHA-256 hexencoded string of the file. * `size` (optional) size of file in bytes * `dim` (optional) size of file in pixels in the form `x` +* `alt` (optional) accessible text label that describes the image or video * `magnet` (optional) URI to magnet file * `i` (optional) torrent infohash * `blurhash`(optional) the [blurhash](https://github.com/woltapp/blurhash) to show while the file is being loaded by the client @@ -39,6 +40,7 @@ This NIP specifies the use of the `1063` event type, having in `content` a descr ["x",], ["size", ], ["dim", ], + ["alt", ], ["magnet", ], ["i",], ["blurhash", ], diff --git a/README.md b/README.md index 8be0595159..d5677a08e6 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos - [NIP-51: Lists](51.md) - [NIP-52: Calendar Events](52.md) - [NIP-53: Live Activities](53.md) +- [NIP-54: Inline Resource Metadata](54.md) - [NIP-56: Reporting](56.md) - [NIP-57: Lightning Zaps](57.md) - [NIP-58: Badges](58.md) From 1cc2d72204bacae351fdd3e0bfbc1befbdb96176 Mon Sep 17 00:00:00 2001 From: arthurfranca Date: Wed, 17 May 2023 11:20:23 -0300 Subject: [PATCH 2/8] Considers .content as alt field --- 54.md | 6 ++---- 94.md | 2 -- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/54.md b/54.md index f04eac87b1..5334723949 100644 --- a/54.md +++ b/54.md @@ -4,7 +4,7 @@ NIP-54 Inline Resource Metadata ------------------------ -`draft` `optional` `author:arthurfranca` `author:Giszmo` `author:jb55` +`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. @@ -16,7 +16,7 @@ The metadata can be appended to any url, like this [NIP-21](21.md) one: `nostr:n ## NIP-94 File Fragments -Besides available w3c and proprietary URI fragment usage, nostr uses existing [NIP-94](94.md) tags as file fragment name-value pairs. For example, one could join the following strings to form an image url with inline metadata: +Besides available w3c and proprietary URI fragment usage, nostr uses existing [NIP-94](94.md) tags as file fragment name-value pairs. NIP-94 event `.content` is equivalent to `alt` fragment field. For example, one could join the following strings to form an image url with inline metadata: - `https://nostr.build/i/863321bb1ae68830ebcf9a343ca0a5e0ce2323d0a55b7fbe86f7a886cf61db8d.jpg` - `#` @@ -28,8 +28,6 @@ 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` -NIP-94 event content may be used as `content` fragment field or alternatively as `alt` if corresponding tag is absent. - ## Recommended client behavior When uploading images during a new post, clients can collect metadata diff --git a/94.md b/94.md index be7f706662..c5e0f18221 100644 --- a/94.md +++ b/94.md @@ -18,7 +18,6 @@ This NIP specifies the use of the `1063` event type, having in `content` a descr * `x` containing the SHA-256 hexencoded string of the file. * `size` (optional) size of file in bytes * `dim` (optional) size of file in pixels in the form `x` -* `alt` (optional) accessible text label that describes the image or video * `magnet` (optional) URI to magnet file * `i` (optional) torrent infohash * `blurhash`(optional) the [blurhash](https://github.com/woltapp/blurhash) to show while the file is being loaded by the client @@ -40,7 +39,6 @@ This NIP specifies the use of the `1063` event type, having in `content` a descr ["x",], ["size", ], ["dim", ], - ["alt", ], ["magnet", ], ["i",], ["blurhash", ], From 4845093786117af4f979a729c2a8f087eaf687bb Mon Sep 17 00:00:00 2001 From: arthurfranca Date: Wed, 17 May 2023 12:40:00 -0300 Subject: [PATCH 3/8] Add imeta tag --- 54.md | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/54.md b/54.md index 5334723949..1f4526b294 100644 --- a/54.md +++ b/54.md @@ -12,7 +12,9 @@ It uses [URI Fragment](https://en.wikipedia.org/wiki/URI_fragment) that agents ( The URI fragment follows [media fragments structure](https://www.w3.org/TR/media-frags/#general-structure). For example, one could use `t=number_of_seconds` to start playing a video at the specified position along with an extra [percent-encoded](https://www.ietf.org/rfc/rfc3986.txt) name-value pair separated by `&` char like `https://xyz.com/a-video.mp4#t=24&a%20name=a%20value`. -The metadata can be appended to any url, like this [NIP-21](21.md) one: `nostr:nevent1qq...pm#a-metadata-name=a-metadata-value` +The metadata can be appended to any url, like this [NIP-21](21.md) one: `nostr:nevent1qq...pm#a-metadata-name=a-metadata-value`. + +It is suggested to also add `imeta` tags to events to aid in loading resource placeholders. ## NIP-94 File Fragments @@ -22,12 +24,38 @@ Besides available w3c and proprietary URI fragment usage, nostr uses existing [N - `#` - `dim=3024x4032` - `&` -- `blurhash=eVF%24%5EOI%3A%24%7BM%7Bo%23*0-nNFxakD-%3FxVM%7DWEWB%25iNKxvR-oetmo%23R-aen%24` +- `alt=A%20scenic%20photo%20overlooking%20the%20coast%20of%20Costa%20Rica` - `&` -- `alt=Picture%20of%20a%20scenic%20view%20overlooking%20the%20coast%20near%20Uvita%2C%20with%20a%20person%20holding%20a%20coffee%20cup` +- `blurhash=eVF%24%5EOI%3A%24%7BM%7Bo%23*0-nNFxakD-%3FxVM%7DWEWB%25iNKxvR-oetmo%23R-aen%24` 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` +## imeta tag + +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` (e.g. of a specific video frame), if available, to `imeta` tags. + +### Complete example: + +```js +{ + "kind": 1, + "content": "What a great place! 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`", + "tags": [ + [ + "imeta", + "url https://xyz.com/example.jpg", + "dim 3024x4032", + "alt A scenic photo overlooking the coast of Costa Rica", + "blurhash eVF$^OI:${M{o#*0-nNFxakD-?xVM}WEWB%iNKxvR-oetmo#R-aen$" + ] + ] + // ... other event fields +} +``` + ## Recommended client behavior When uploading images during a new post, clients can collect metadata @@ -36,5 +64,5 @@ after the image is uploaded and then include the url with inline metadata in the When pasting urls during post composition, the client could download the image and add some metadata before the post is sent. -Clients can use `alt` fragment to add accessible text for people who prefer not to +Clients can use `alt` value to add accessible text for people who prefer not to load images, visibility-impaired users, or text clients. From 57fea0e5b7eea73fdb170b97c4f5f3c82c671cd3 Mon Sep 17 00:00:00 2001 From: arthurfranca Date: Thu, 31 Aug 2023 10:55:42 -0300 Subject: [PATCH 4/8] Replace imeta with resource tag --- 54.md | 34 +++++++++++++++++++++------------- README.md | 1 + 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/54.md b/54.md index 1f4526b294..d536120bb7 100644 --- a/54.md +++ b/54.md @@ -8,13 +8,13 @@ Inline Resource Metadata 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. +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. -The URI fragment follows [media fragments structure](https://www.w3.org/TR/media-frags/#general-structure). For example, one could use `t=number_of_seconds` to start playing a video at the specified position along with an extra [percent-encoded](https://www.ietf.org/rfc/rfc3986.txt) name-value pair separated by `&` char like `https://xyz.com/a-video.mp4#t=24&a%20name=a%20value`. +The URI fragment follows [media fragments structure](https://www.w3.org/TR/media-frags/#general-structure). For example, one could use `t=number_of_seconds` to start playing a video at the specified position along with an extra [percent-encoded](https://www.ietf.org/rfc/rfc3986.txt) name-value pair separated by `&` char like `https://xyz.com/a-video.mp4#t=24&a%20name=a%20value`. **Notice the usage of `#` instead of `?`.** The metadata can be appended to any url, like this [NIP-21](21.md) one: `nostr:nevent1qq...pm#a-metadata-name=a-metadata-value`. -It is suggested to also add `imeta` tags to events to aid in loading resource placeholders. +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. ## NIP-94 File Fragments @@ -22,40 +22,48 @@ Besides available w3c and proprietary URI fragment usage, nostr uses existing [N - `https://nostr.build/i/863321bb1ae68830ebcf9a343ca0a5e0ce2323d0a55b7fbe86f7a886cf61db8d.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` -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`. -## imeta tag +## 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` (e.g. of a specific video frame), if available, to `imeta` tags. +For these resources, it is suggested to also add `dim`, `alt` and `blurhash`, if available, to media urls inside `resource` tags. -### Complete example: +### Event Example: ```js { "kind": 1, - "content": "What a great place! 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`", + "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": [ [ - "imeta", - "url https://xyz.com/example.jpg", - "dim 3024x4032", - "alt A scenic photo overlooking the coast of Costa Rica", - "blurhash eVF$^OI:${M{o#*0-nNFxakD-?xVM}WEWB%iNKxvR-oetmo#R-aen$" + "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 Examples: + +A kind 30023 event JSON file (with `nostr/30023` MIME type): +`["resource", "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"]` + ## Recommended client behavior When uploading images during a new post, clients can collect metadata diff --git a/README.md b/README.md index d5677a08e6..2f886c36d6 100644 --- a/README.md +++ b/README.md @@ -195,6 +195,7 @@ 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) | From 403ed94a7c3c7fe328ae3d9c1a914bcbc45cec97 Mon Sep 17 00:00:00 2001 From: arthurfranca Date: Tue, 31 Oct 2023 18:35:17 -0300 Subject: [PATCH 5/8] Reuse nip94 'url' tag instead of 'resource' --- 54.md | 20 +++++--------------- README.md | 1 - 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/54.md b/54.md index d536120bb7..58416c6a47 100644 --- a/54.md +++ b/54.md @@ -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"]` diff --git a/README.md b/README.md index 2f886c36d6..d5677a08e6 100644 --- a/README.md +++ b/README.md @@ -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) | From f2c72ad7128249c1e37be6dca80762cfb35edef4 Mon Sep 17 00:00:00 2001 From: arthurfranca Date: Tue, 31 Oct 2023 19:08:46 -0300 Subject: [PATCH 6/8] Add media tag --- 54.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/54.md b/54.md index 58416c6a47..0001ba4e85 100644 --- a/54.md +++ b/54.md @@ -14,8 +14,6 @@ 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 `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 Besides available w3c and proprietary URI fragment usage, nostr uses existing [NIP-94](94.md) tags as file fragment name-value pairs. NIP-94 event `.content` is equivalent to `alt` fragment field. For example, one could join the following strings to form an image url with inline metadata: @@ -44,16 +42,17 @@ Multiple array values use repeated names and are positioned in the same order of ## 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). +When publishing events of kinds designed with urls inside tags instead of in `.content`, use `media` tags specifically for images and videos +or else pick another tag. 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): `["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"]` - ## Recommended client behavior When uploading images during a new post, clients can collect metadata From e9ad334848836b9b5697dd277a6bb2641c54b3e6 Mon Sep 17 00:00:00 2001 From: arthurfranca Date: Wed, 1 Nov 2023 11:47:36 -0300 Subject: [PATCH 7/8] Use r tag for non-media urls to avoid confusion --- 54.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/54.md b/54.md index 0001ba4e85..303047ef36 100644 --- a/54.md +++ b/54.md @@ -42,8 +42,8 @@ Multiple array values use repeated names and are positioned in the same order of ## Tag Usage -When publishing events of kinds designed with urls inside tags instead of in `.content`, use `media` tags specifically for images and videos -or else pick another tag. 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. +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: @@ -51,7 +51,7 @@ 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): -`["url", "https://xyz.com/example.json#m=nostr%2F30023"]` +`["r", "https://xyz.com/example.json#m=nostr%2F30023"]` ## Recommended client behavior From f500e825922eb4845b18e415c684c2b896d09ec9 Mon Sep 17 00:00:00 2001 From: arthurfranca Date: Mon, 11 Dec 2023 12:44:47 -0300 Subject: [PATCH 8/8] Don't try to anticipate tag usage --- 54.md | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/54.md b/54.md index 303047ef36..e011569426 100644 --- a/54.md +++ b/54.md @@ -4,8 +4,6 @@ NIP-54 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. 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`. -### 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 { "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 } ``` -## 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 When uploading images during a new post, clients can collect metadata