mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-12-23 00:45:53 -05:00
Adding optional file_tags to categorize files and listing public files
This commit is contained in:
parent
346ecd1114
commit
436f7ac2e9
17
96.md
17
96.md
|
@ -1,5 +1,7 @@
|
||||||
# NIP-96
|
# NIP-96
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## HTTP File Storage Integration
|
## HTTP File Storage Integration
|
||||||
|
|
||||||
`draft` `optional`
|
`draft` `optional`
|
||||||
|
@ -102,6 +104,7 @@ List of form fields:
|
||||||
- `media_type`: "avatar" or "banner". Informs the server if the file will be used as an avatar or banner. If absent, the server will interpret it as a normal upload, without special treatment.
|
- `media_type`: "avatar" or "banner". Informs the server if the file will be used as an avatar or banner. If absent, the server will interpret it as a normal upload, without special treatment.
|
||||||
- `content_type`: mime type such as "image/jpeg". This is just a value the server can use to reject early if the mime type isn't supported.
|
- `content_type`: mime type such as "image/jpeg". This is just a value the server can use to reject early if the mime type isn't supported.
|
||||||
- `no_transform`: "true" asks server not to transform the file and serve the uploaded file as is, may be rejected.
|
- `no_transform`: "true" asks server not to transform the file and serve the uploaded file as is, may be rejected.
|
||||||
|
- `file_tags`: **RECOMMENDED** a comma-separated list of tags to be used by the server to categorize the file.
|
||||||
|
|
||||||
Others custom form data fields may be used depending on specific `server` support.
|
Others custom form data fields may be used depending on specific `server` support.
|
||||||
The `server` isn't required to store any metadata sent by `clients`.
|
The `server` isn't required to store any metadata sent by `clients`.
|
||||||
|
@ -164,9 +167,11 @@ The upload response is a json object as follows:
|
||||||
// The server can but does not need to store this value.
|
// The server can but does not need to store this value.
|
||||||
["x", "543244319525d9d08dd69cb716a18158a249b7b3b3ec4bbde5435543acb34443"],
|
["x", "543244319525d9d08dd69cb716a18158a249b7b3b3ec4bbde5435543acb34443"],
|
||||||
// Optional. Recommended for helping clients to easily know file type before downloading it.
|
// Optional. Recommended for helping clients to easily know file type before downloading it.
|
||||||
["m", "image/png"]
|
["m", "image/png"],
|
||||||
// Optional. Recommended for helping clients to reserve an adequate UI space to show the file before downloading it.
|
// Optional. Recommended for helping clients to reserve an adequate UI space to show the file before downloading it.
|
||||||
["dim", "800x600"]
|
["dim", "800x600"],
|
||||||
|
// Optional. Accepted file tags from server for categorization
|
||||||
|
["file_tags", "cat, meme, funny, laugh"],
|
||||||
// ... other optional NIP-94 tags
|
// ... other optional NIP-94 tags
|
||||||
],
|
],
|
||||||
content: ""
|
content: ""
|
||||||
|
@ -277,11 +282,12 @@ The successful response is a 200 OK one with just basic JSON fields:
|
||||||
|
|
||||||
## Listing files
|
## Listing files
|
||||||
|
|
||||||
`GET $api_url?page=x&count=y`
|
`GET $api_url?page=x&count=y&sort=z&search=w`
|
||||||
|
|
||||||
**AUTH required**
|
AUTH **required** for pubkey file listing.
|
||||||
|
AUTH **NOT** required for public file listing.
|
||||||
|
|
||||||
Returns a list of files linked to the authenticated users pubkey.
|
Returns a list of files. If auth event is present, the server should return only files uploaded by the pubkey in the auth event.
|
||||||
|
|
||||||
Example Response:
|
Example Response:
|
||||||
|
|
||||||
|
@ -298,6 +304,7 @@ Example Response:
|
||||||
["size", "123456"],
|
["size", "123456"],
|
||||||
["alt", "a meme that makes you laugh"],
|
["alt", "a meme that makes you laugh"],
|
||||||
["expiration", "1715691139"],
|
["expiration", "1715691139"],
|
||||||
|
["file_tags", "cat, meme, funny, laugh"],
|
||||||
// ...other metadata
|
// ...other metadata
|
||||||
]
|
]
|
||||||
"content": "haha funny meme", // caption
|
"content": "haha funny meme", // caption
|
||||||
|
|
Loading…
Reference in New Issue
Block a user