shrupl/notes.md

57 lines
1.8 KiB
Markdown
Raw Normal View History

# Outline of sharry upload API
2025-05-22 17:34:44 +00:00
1. 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
1. 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
1. (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
1. (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
2025-06-05 17:47:42 +00:00
- 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
- https://stackoverflow.com/q/69787906
- https://github.com/RustCrypto/hashes
2025-06-05 17:47:42 +00:00
# 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"
2025-06-24 00:18:36 +00:00
- CLI switch to skip hashing