1.8 KiB
1.8 KiB
Outline of sharry upload API
-
POST to "new" route
- uri: https://sharry.yavook.de/api/v2/alias/upload/new
- hdr:
Sharry-Alias: $alias_id - res.status == 200
- res_json.success == true
- res_json.message == "Share created."
- $share_id := res_json.id
-
POST to "tus" route
- uri: https://sharry.yavook.de/api/v2/alias/upload/$share_id/files/tus
- hdr:
Sharry-Alias: $alias_id - hdr:
Sharry-File-Length: $file_bytes - hdr:
Sharry-File-Name: $file_name - hdr:
Sharry-File-Type: $file_mimetype - hdr:
Tus-Resumable: 1.0.0 - hdr:
Upload-Length: $file_bytes - res.status == 201
- $patch_uri := res_hdr.Location
-
(multi) PATCH to "$patch_uri"
- hdr:
Sharry-Alias,Sharry-File-Length,Sharry-File-Name,Sharry-File-Type,Tus-Resumable - hdr:
Upload-Offset: 10485760 * (n-1)for nth chunk - body: up to 10 MiB of binary data
- res.status == 204
- better use res_hdr.Upload-Offset
- hdr:
-
(opt) POST to "notify" route
- uri: https://sharry.yavook.de/api/v2/alias/mail/notify/$share_id
- hdr:
Sharry-Alias - res.status == 200
- res_json.success, res_json.message
Links
- yvk repo: https://code.yavook.de/jmm/shrupl
- sharry issue: https://github.com/eikek/sharry/issues/1659
- ureq: https://stackoverflow.com/questions/59586787/rust-how-to-do-http-put-of-large-files
- hashing: https://duckduckgo.com/?q=rust+get+file+hash&t=canonical&ia=web
Ideas
-
cli functions
- "continue" and "new" flags to avoid user interaction
- "quiet" flag to disable output entirely
- some switch to change log to "pretty-print"
-
hashing
- store file hashes with all
file::*variants - check hashes on "continue"
- store file hashes with all