mirror of
https://github.com/nostr-protocol/nips.git
synced 2025-09-01 05:50:47 -04:00
format(all): json formatting
This commit is contained in:
51
96.md
51
96.md
@@ -19,7 +19,7 @@ will not have to learn anything about nostr relays.
|
||||
|
||||
File storage servers wishing to be accessible by nostr users should opt-in by making available an https route at `/.well-known/nostr/nip96.json` with `api_url`:
|
||||
|
||||
```js
|
||||
```jsonc
|
||||
{
|
||||
// Required
|
||||
// File upload and deletion are served from this url
|
||||
@@ -59,7 +59,7 @@ File storage servers wishing to be accessible by nostr users should opt-in by ma
|
||||
"file_expiration": [14, 90],
|
||||
"media_transformations": {
|
||||
"image": [
|
||||
'resizing'
|
||||
"resizing"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -127,14 +127,14 @@ The `server` MUST link the user's `pubkey` string as the owner of the file so to
|
||||
|
||||
The upload response is a json object as follows:
|
||||
|
||||
```js
|
||||
```jsonc
|
||||
{
|
||||
// "success" if successful or "error" if not
|
||||
status: "success",
|
||||
"status": "success",
|
||||
// Free text success, failure or info message
|
||||
message: "Upload successful.",
|
||||
"message": "Upload successful.",
|
||||
// Optional. See "Delayed Processing" section
|
||||
processing_url: "...",
|
||||
"processing_url": "...",
|
||||
// This uses the NIP-94 event format but DO NOT need
|
||||
// to fill some fields like "id", "pubkey", "created_at" and "sig"
|
||||
//
|
||||
@@ -143,9 +143,9 @@ The upload response is a json object as follows:
|
||||
// and, optionally, all file metadata the server wants to make available
|
||||
//
|
||||
// nip94_event field is absent if unsuccessful upload
|
||||
nip94_event: {
|
||||
"nip94_event2":{
|
||||
// Required tags: "url" and "ox"
|
||||
tags: [
|
||||
"tags": [
|
||||
// Can be same from /.well-known/nostr/nip96.json's "download_url" field
|
||||
// (or "api_url" field if "download_url" is absent or empty) with appended
|
||||
// original file hash.
|
||||
@@ -171,7 +171,7 @@ The upload response is a json object as follows:
|
||||
["dim", "800x600"]
|
||||
// ... other optional NIP-94 tags
|
||||
],
|
||||
content: ""
|
||||
"content": ""
|
||||
},
|
||||
// ... other custom fields (please consider adding them to this NIP or to NIP-94 tags)
|
||||
}
|
||||
@@ -202,12 +202,12 @@ the file processing is done.
|
||||
|
||||
If the processing isn't done, the server should reply at the `processing_url` url with **200 OK** and the following JSON:
|
||||
|
||||
```
|
||||
```jsonc
|
||||
{
|
||||
// It should be "processing". If "error" it would mean the processing failed.
|
||||
status: "processing",
|
||||
message: "Processing. Please check again later for updated status.",
|
||||
percentage: 15 // Processing percentage. An integer between 0 and 100.
|
||||
"status": "processing",
|
||||
"message": "Processing. Please check again later for updated status.",
|
||||
"percentage": 15 // Processing percentage. An integer between 0 and 100.
|
||||
}
|
||||
```
|
||||
|
||||
@@ -270,10 +270,10 @@ in the same file hash).
|
||||
|
||||
The successful response is a 200 OK one with just basic JSON fields:
|
||||
|
||||
```
|
||||
```json
|
||||
{
|
||||
status: "success",
|
||||
message: "File deleted."
|
||||
"status": "success",
|
||||
"message": "File deleted."
|
||||
}
|
||||
```
|
||||
|
||||
@@ -287,7 +287,7 @@ Returns a list of files linked to the authenticated users pubkey.
|
||||
|
||||
Example Response:
|
||||
|
||||
```js
|
||||
```jsonc
|
||||
{
|
||||
"count": 1, // server page size, eg. max(1, min(server_max_page_size, arg_count))
|
||||
"total": 1, // total number of files
|
||||
@@ -295,17 +295,16 @@ Example Response:
|
||||
"files": [
|
||||
{
|
||||
"tags": [
|
||||
["ox": "719171db19525d9d08dd69cb716a18158a249b7b3b3ec4bbdec5698dca104b7b"],
|
||||
["x": "5d2899290e0e69bcd809949ee516a4a1597205390878f780c098707a7f18e3df"],
|
||||
["ox", "719171db19525d9d08dd69cb716a18158a249b7b3b3ec4bbdec5698dca104b7b"],
|
||||
["x", "5d2899290e0e69bcd809949ee516a4a1597205390878f780c098707a7f18e3df"],
|
||||
["size", "123456"],
|
||||
["alt", "a meme that makes you laugh"],
|
||||
["expiration", "1715691139"],
|
||||
// ...other metadata
|
||||
]
|
||||
],
|
||||
"content": "haha funny meme", // caption
|
||||
"created_at": 1715691130 // upload timestamp
|
||||
},
|
||||
...
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
@@ -324,14 +323,14 @@ Note: HTTP File Storage Server developers may skip this section. This is meant f
|
||||
A File Server Preference event is a kind 10096 replaceable event meant to select one or more servers the user wants
|
||||
to upload files to. Servers are listed as `server` tags:
|
||||
|
||||
```js
|
||||
{
|
||||
// ...
|
||||
```json
|
||||
{.
|
||||
"kind": 10096,
|
||||
"content": "",
|
||||
"tags": [
|
||||
["server", "https://file.server.one"],
|
||||
["server", "https://file.server.two"]
|
||||
]
|
||||
],
|
||||
// other fields...
|
||||
}
|
||||
```
|
||||
|
Reference in New Issue
Block a user