diff options
| author | kehiy <kehiiiiya@gmail.com> | 2024-09-03 20:41:31 +0330 |
|---|---|---|
| committer | kehiy <kehiiiiya@gmail.com> | 2024-09-03 20:41:31 +0330 |
| commit | e6552476aa2e5ca7256be572a9aa226ec8a022ee (patch) | |
| tree | 46f14902bd2bfb85e5f3369ece456c46b697b1a2 /96.md | |
| parent | b4a2561df7325b8624bc5ffad154ec946ade2f1e (diff) | |
format(all): json formatting
Diffstat (limited to '96.md')
| -rw-r--r-- | 96.md | 51 |
1 files changed, 25 insertions, 26 deletions
| @@ -19,7 +19,7 @@ will not have to learn anything about nostr relays. | |||
| 19 | 19 | ||
| 20 | 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`: | 20 | 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`: |
| 21 | 21 | ||
| 22 | ```js | 22 | ```jsonc |
| 23 | { | 23 | { |
| 24 | // Required | 24 | // Required |
| 25 | // File upload and deletion are served from this url | 25 | // 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 | |||
| 59 | "file_expiration": [14, 90], | 59 | "file_expiration": [14, 90], |
| 60 | "media_transformations": { | 60 | "media_transformations": { |
| 61 | "image": [ | 61 | "image": [ |
| 62 | 'resizing' | 62 | "resizing" |
| 63 | ] | 63 | ] |
| 64 | } | 64 | } |
| 65 | } | 65 | } |
| @@ -127,14 +127,14 @@ The `server` MUST link the user's `pubkey` string as the owner of the file so to | |||
| 127 | 127 | ||
| 128 | The upload response is a json object as follows: | 128 | The upload response is a json object as follows: |
| 129 | 129 | ||
| 130 | ```js | 130 | ```jsonc |
| 131 | { | 131 | { |
| 132 | // "success" if successful or "error" if not | 132 | // "success" if successful or "error" if not |
| 133 | status: "success", | 133 | "status": "success", |
| 134 | // Free text success, failure or info message | 134 | // Free text success, failure or info message |
| 135 | message: "Upload successful.", | 135 | "message": "Upload successful.", |
| 136 | // Optional. See "Delayed Processing" section | 136 | // Optional. See "Delayed Processing" section |
| 137 | processing_url: "...", | 137 | "processing_url": "...", |
| 138 | // This uses the NIP-94 event format but DO NOT need | 138 | // This uses the NIP-94 event format but DO NOT need |
| 139 | // to fill some fields like "id", "pubkey", "created_at" and "sig" | 139 | // to fill some fields like "id", "pubkey", "created_at" and "sig" |
| 140 | // | 140 | // |
| @@ -143,9 +143,9 @@ The upload response is a json object as follows: | |||
| 143 | // and, optionally, all file metadata the server wants to make available | 143 | // and, optionally, all file metadata the server wants to make available |
| 144 | // | 144 | // |
| 145 | // nip94_event field is absent if unsuccessful upload | 145 | // nip94_event field is absent if unsuccessful upload |
| 146 | nip94_event: { | 146 | "nip94_event2":{ |
| 147 | // Required tags: "url" and "ox" | 147 | // Required tags: "url" and "ox" |
| 148 | tags: [ | 148 | "tags": [ |
| 149 | // Can be same from /.well-known/nostr/nip96.json's "download_url" field | 149 | // Can be same from /.well-known/nostr/nip96.json's "download_url" field |
| 150 | // (or "api_url" field if "download_url" is absent or empty) with appended | 150 | // (or "api_url" field if "download_url" is absent or empty) with appended |
| 151 | // original file hash. | 151 | // original file hash. |
| @@ -171,7 +171,7 @@ The upload response is a json object as follows: | |||
| 171 | ["dim", "800x600"] | 171 | ["dim", "800x600"] |
| 172 | // ... other optional NIP-94 tags | 172 | // ... other optional NIP-94 tags |
| 173 | ], | 173 | ], |
| 174 | content: "" | 174 | "content": "" |
| 175 | }, | 175 | }, |
| 176 | // ... other custom fields (please consider adding them to this NIP or to NIP-94 tags) | 176 | // ... other custom fields (please consider adding them to this NIP or to NIP-94 tags) |
| 177 | } | 177 | } |
| @@ -202,12 +202,12 @@ the file processing is done. | |||
| 202 | 202 | ||
| 203 | If the processing isn't done, the server should reply at the `processing_url` url with **200 OK** and the following JSON: | 203 | If the processing isn't done, the server should reply at the `processing_url` url with **200 OK** and the following JSON: |
| 204 | 204 | ||
| 205 | ``` | 205 | ```jsonc |
| 206 | { | 206 | { |
| 207 | // It should be "processing". If "error" it would mean the processing failed. | 207 | // It should be "processing". If "error" it would mean the processing failed. |
| 208 | status: "processing", | 208 | "status": "processing", |
| 209 | message: "Processing. Please check again later for updated status.", | 209 | "message": "Processing. Please check again later for updated status.", |
| 210 | percentage: 15 // Processing percentage. An integer between 0 and 100. | 210 | "percentage": 15 // Processing percentage. An integer between 0 and 100. |
| 211 | } | 211 | } |
| 212 | ``` | 212 | ``` |
| 213 | 213 | ||
| @@ -270,10 +270,10 @@ in the same file hash). | |||
| 270 | 270 | ||
| 271 | The successful response is a 200 OK one with just basic JSON fields: | 271 | The successful response is a 200 OK one with just basic JSON fields: |
| 272 | 272 | ||
| 273 | ``` | 273 | ```json |
| 274 | { | 274 | { |
| 275 | status: "success", | 275 | "status": "success", |
| 276 | message: "File deleted." | 276 | "message": "File deleted." |
| 277 | } | 277 | } |
| 278 | ``` | 278 | ``` |
| 279 | 279 | ||
| @@ -287,7 +287,7 @@ Returns a list of files linked to the authenticated users pubkey. | |||
| 287 | 287 | ||
| 288 | Example Response: | 288 | Example Response: |
| 289 | 289 | ||
| 290 | ```js | 290 | ```jsonc |
| 291 | { | 291 | { |
| 292 | "count": 1, // server page size, eg. max(1, min(server_max_page_size, arg_count)) | 292 | "count": 1, // server page size, eg. max(1, min(server_max_page_size, arg_count)) |
| 293 | "total": 1, // total number of files | 293 | "total": 1, // total number of files |
| @@ -295,17 +295,16 @@ Example Response: | |||
| 295 | "files": [ | 295 | "files": [ |
| 296 | { | 296 | { |
| 297 | "tags": [ | 297 | "tags": [ |
| 298 | ["ox": "719171db19525d9d08dd69cb716a18158a249b7b3b3ec4bbdec5698dca104b7b"], | 298 | ["ox", "719171db19525d9d08dd69cb716a18158a249b7b3b3ec4bbdec5698dca104b7b"], |
| 299 | ["x": "5d2899290e0e69bcd809949ee516a4a1597205390878f780c098707a7f18e3df"], | 299 | ["x", "5d2899290e0e69bcd809949ee516a4a1597205390878f780c098707a7f18e3df"], |
| 300 | ["size", "123456"], | 300 | ["size", "123456"], |
| 301 | ["alt", "a meme that makes you laugh"], | 301 | ["alt", "a meme that makes you laugh"], |
| 302 | ["expiration", "1715691139"], | 302 | ["expiration", "1715691139"], |
| 303 | // ...other metadata | 303 | // ...other metadata |
| 304 | ] | 304 | ], |
| 305 | "content": "haha funny meme", // caption | 305 | "content": "haha funny meme", // caption |
| 306 | "created_at": 1715691130 // upload timestamp | 306 | "created_at": 1715691130 // upload timestamp |
| 307 | }, | 307 | } |
| 308 | ... | ||
| 309 | ] | 308 | ] |
| 310 | } | 309 | } |
| 311 | ``` | 310 | ``` |
| @@ -324,14 +323,14 @@ Note: HTTP File Storage Server developers may skip this section. This is meant f | |||
| 324 | A File Server Preference event is a kind 10096 replaceable event meant to select one or more servers the user wants | 323 | A File Server Preference event is a kind 10096 replaceable event meant to select one or more servers the user wants |
| 325 | to upload files to. Servers are listed as `server` tags: | 324 | to upload files to. Servers are listed as `server` tags: |
| 326 | 325 | ||
| 327 | ```js | 326 | ```json |
| 328 | { | 327 | {. |
| 329 | // ... | ||
| 330 | "kind": 10096, | 328 | "kind": 10096, |
| 331 | "content": "", | 329 | "content": "", |
| 332 | "tags": [ | 330 | "tags": [ |
| 333 | ["server", "https://file.server.one"], | 331 | ["server", "https://file.server.one"], |
| 334 | ["server", "https://file.server.two"] | 332 | ["server", "https://file.server.two"] |
| 335 | ] | 333 | ], |
| 334 | // other fields... | ||
| 336 | } | 335 | } |
| 337 | ``` | 336 | ``` |