Add sha256 hash

This commit is contained in:
2022-01-27 19:56:44 +01:00
parent 8e7aa82c1e
commit 4985f8810b
3 changed files with 23 additions and 6 deletions

View File

@@ -222,7 +222,7 @@ HTTP 403: Forbidden
Returns information about one or more files. You can also put a comma separated Returns information about one or more files. You can also put a comma separated
list of file IDs in the URL and it will return an array of file info, instead of list of file IDs in the URL and it will return an array of file info, instead of
a single object. a single object. There's a limit of 1000 files per request.
### Parameters ### Parameters
@@ -235,16 +235,27 @@ id | true | URL | ID of the file
HTTP 200: OK HTTP 200: OK
``` ```
{ {
"success": true,
"id": "1234abcd", "id": "1234abcd",
"name": "screenshot.png", "name": "screenshot.png",
// Size of the file in bytes
"size": 5694837,
// Number of unique file views, views are counted once per IP address
"views" 1234,
// Total bandwidth usage of the file
"bandwidth_used": 1234567890,
// Premium bandwidth usage, from users with a Pro subscription or bandwidth sharing
"bandwidth_used_paid": 1234567890,
// Unique downloads per IP address
"downloads": 1234,
"date_upload": 2020-02-04T18:34:05.706801Z, "date_upload": 2020-02-04T18:34:05.706801Z,
"date_last_view": 2020-02-04T18:34:05.706801Z, "date_last_view": 2020-02-04T18:34:05.706801Z,
"size": 5694837, // Bytes
"views" 1234, // Amount of unique file views
"bandwidth_used": 1234567890, // Bytes
"mime_type" "image/png", "mime_type" "image/png",
"thumbnail_href": "/file/1234abcd/thumbnail" // Link to a thumbnail of this file // Link to a thumbnail of this file
"thumbnail_href": "/file/1234abcd/thumbnail"
// SHA256 sum of the file, encoded in hexadecimal
"hash_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
// If the current logged in user can edit the file
"can_edit": true,
} }
``` ```

View File

@@ -14,6 +14,7 @@ export let file = {
bandwidth_used: 0, bandwidth_used: 0,
bandwidth_used_paid: 0, bandwidth_used_paid: 0,
description: "", description: "",
hash_sha256: "",
timeseries_href: "", timeseries_href: "",
} }
@@ -150,6 +151,10 @@ onMount(() => {
<td>{file.description}</td> <td>{file.description}</td>
</tr> </tr>
{/if} {/if}
<tr>
<td>SHA256 hash</td>
<td style="word-break: break-all;">{file.hash_sha256}</td>
</tr>
</table> </table>
<h2>Views and downloads</h2> <h2>Views and downloads</h2>

View File

@@ -10,6 +10,7 @@ export const file_struct = {
mime_type: "", mime_type: "",
availability: "", availability: "",
abuse_type: "", abuse_type: "",
hash_sha256: "",
show_ads: false, show_ads: false,
can_edit: false, can_edit: false,
get_href: "", get_href: "",