update deps, fix clippy, format
This commit is contained in:
parent
774b13e46c
commit
37727bfd3d
8 changed files with 95 additions and 81 deletions
116
Cargo.lock
generated
116
Cargo.lock
generated
|
@ -74,9 +74,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
|||
|
||||
[[package]]
|
||||
name = "axum"
|
||||
version = "0.5.12"
|
||||
version = "0.5.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d16705af05732b7d3258ec0f7b73c03a658a28925e050d8852d5b568ee8bcf4e"
|
||||
checksum = "c943a505c17b494638a38a9af129067f760c9c06794b9f57d499266909be8e72"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"axum-core",
|
||||
|
@ -126,9 +126,9 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
|
|||
|
||||
[[package]]
|
||||
name = "base64ct"
|
||||
version = "1.0.1"
|
||||
version = "1.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a32fd6af2b5827bce66c29053ba0e7c42b9dcab01835835058558c10851a46b"
|
||||
checksum = "3bdca834647821e0b13d9539a8634eb62d3501b6b6c2cec1722786ee6671b851"
|
||||
|
||||
[[package]]
|
||||
name = "bincode"
|
||||
|
@ -211,9 +211,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
|||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.1.0"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
|
||||
checksum = "f0b3de4a0c5e67e16066a0715723abd91edc2f9001d09c46e1dca929351e130e"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
@ -314,9 +314,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "3.2.8"
|
||||
version = "3.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "190814073e85d238f31ff738fcb0bf6910cedeb73376c87cd69291028966fd83"
|
||||
checksum = "44bbe24bbd31a185bc2c4f7c2abe80bea13a20d57ee4e55be70ac512bdc76417"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"bitflags",
|
||||
|
@ -331,9 +331,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "3.2.7"
|
||||
version = "3.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "759bf187376e1afa7b85b959e6a664a3e7a95203415dba952ad19139e798f902"
|
||||
checksum = "9ba52acd3b0a5c33aeada5cdaa3267cdc7c594a98731d4268cdc1532f4264cb4"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-error",
|
||||
|
@ -381,9 +381,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.10"
|
||||
version = "0.8.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d82ee10ce34d7bc12c2122495e7593a9c41347ecdd64185af4ecf72cb1a7f83"
|
||||
checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
|
@ -391,9 +391,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
version = "0.1.5"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2ccfd8c0ee4cce11e45b3fd6f9d5e69e0cc62912aa6a0cb1bf4617b0eba5a12f"
|
||||
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
"typenum",
|
||||
|
@ -645,9 +645,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.2"
|
||||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "607c8a29735385251a339424dd462993c0fed8fa09d378f259377df08c126022"
|
||||
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||
|
||||
[[package]]
|
||||
name = "headers"
|
||||
|
@ -810,9 +810,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.58"
|
||||
version = "0.3.59"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27"
|
||||
checksum = "258451ab10b34f8af53416d1fdab72c22e805f0c92a1136d59470ec0b11138b2"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
@ -1077,9 +1077,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
|
|||
|
||||
[[package]]
|
||||
name = "os_str_bytes"
|
||||
version = "6.1.0"
|
||||
version = "6.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa"
|
||||
checksum = "648001efe5d5c0102d8cea768e348da85d90af8ba91f0bea908f157951493cd4"
|
||||
|
||||
[[package]]
|
||||
name = "password-hash"
|
||||
|
@ -1195,9 +1195,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.40"
|
||||
version = "1.0.42"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7"
|
||||
checksum = "c278e965f1d8cf32d6e0e96de3d3e79712178ae67986d9cf9151f51e95aac89b"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
@ -1243,9 +1243,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.2.13"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
|
||||
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
@ -1340,13 +1340,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rpassword"
|
||||
version = "6.0.1"
|
||||
version = "7.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2bf099a1888612545b683d2661a1940089f6c2e5a8e38979b2159da876bfd956"
|
||||
checksum = "26b763cb66df1c928432cc35053f8bd4cec3335d8559fc16010017d16b3c1680"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
|
@ -1404,18 +1402,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.138"
|
||||
version = "1.0.140"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1578c6245786b9d168c5447eeacfb96856573ca56c9d68fdcf394be134882a47"
|
||||
checksum = "fc855a42c7967b7c369eb5860f7164ef1f6f81c20c7cc1141f2a604e18723b03"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.138"
|
||||
version = "1.0.140"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "023e9b1467aef8a10fb88f25611870ada9800ef7e22afce356bb0d2387b6f27c"
|
||||
checksum = "6f2122636b9fe3b81f1cb25099fcf2d3f542cdb1d45940d56c713158884a05da"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -1504,9 +1502,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
version = "0.4.6"
|
||||
version = "0.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32"
|
||||
checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
|
@ -1642,10 +1643,11 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
|||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.19.2"
|
||||
version = "1.20.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c51a52ed6686dd62c320f9b89299e9dfb46f730c7a48e635c19f21d116cb1439"
|
||||
checksum = "7a8325f63a7d4774dd041e363b2409ed1c5cbbd0f867795e661df066b2b0a581"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"bytes",
|
||||
"libc",
|
||||
"memchr",
|
||||
|
@ -1794,9 +1796,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tracing-subscriber"
|
||||
version = "0.3.14"
|
||||
version = "0.3.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a713421342a5a666b7577783721d3117f1b69a393df803ee17bb73b1e122a59"
|
||||
checksum = "60db860322da191b40952ad9affe65ea23e7dd6a5c442c2c42865810c6ab8e6b"
|
||||
dependencies = [
|
||||
"ansi_term",
|
||||
"sharded-slab",
|
||||
|
@ -1856,9 +1858,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"
|
|||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.1"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c"
|
||||
checksum = "15c61ba63f9235225a22310255a29b806b907c9b8c964bcbd0a2c70f3f2deea7"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-normalization"
|
||||
|
@ -1945,9 +1947,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.81"
|
||||
version = "0.2.82"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994"
|
||||
checksum = "fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"serde",
|
||||
|
@ -1957,13 +1959,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.81"
|
||||
version = "0.2.82"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a"
|
||||
checksum = "662cd44805586bd52971b9586b1df85cdbbd9112e4ef4d8f41559c334dc6ac3f"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
|
@ -1972,9 +1974,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.31"
|
||||
version = "0.4.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de9a9cec1733468a8c657e57fa2413d2ae2c0129b95e87c5b72b8ace4d13f31f"
|
||||
checksum = "fa76fb221a1f8acddf5b54ace85912606980ad661ac7a503b4570ffd3a624dad"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
|
@ -1984,9 +1986,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.81"
|
||||
version = "0.2.82"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa"
|
||||
checksum = "b260f13d3012071dfb1512849c033b1925038373aea48ced3012c09df952c602"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
|
@ -1994,9 +1996,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.81"
|
||||
version = "0.2.82"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048"
|
||||
checksum = "5be8e654bdd9b79216c2929ab90721aa82faf65c48cdf08bdc4e7f51357b80da"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -2007,15 +2009,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.81"
|
||||
version = "0.2.82"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be"
|
||||
checksum = "6598dd0bd3c7d51095ff6531a5b23e02acdc81804e30d8f07afb77b7215a140a"
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.58"
|
||||
version = "0.3.59"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90"
|
||||
checksum = "ed055ab27f941423197eb86b2035720b1a3ce40504df082cac2ecc6ed73335a1"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
|
@ -2134,9 +2136,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zeroize"
|
||||
version = "1.5.6"
|
||||
version = "1.5.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "20b578acffd8516a6c3f2a1bdefc1ec37e547bb4e0fb8b6b01a4cafc886b4442"
|
||||
checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f"
|
||||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
|
|
|
@ -12,6 +12,6 @@ license = "GPL-3.0-or-later"
|
|||
omegaupload-common = { path = "../common" }
|
||||
anyhow = "1.0.58"
|
||||
atty = "0.2.14"
|
||||
clap = { version = "3.2.8", features = ["derive"] }
|
||||
clap = { version = "3.2.15", features = ["derive"] }
|
||||
reqwest = { version = "0.11.11", default-features = false, features = ["rustls-tls", "blocking"] }
|
||||
rpassword = "6.0.1"
|
||||
rpassword = "7.0.0"
|
||||
|
|
|
@ -24,8 +24,8 @@ use anyhow::{anyhow, bail, Context, Result};
|
|||
use atty::Stream;
|
||||
use clap::Parser;
|
||||
use omegaupload_common::crypto::{open_in_place, seal_in_place};
|
||||
use omegaupload_common::secrecy::{ExposeSecret, SecretString, SecretVec};
|
||||
use omegaupload_common::fragment::Builder;
|
||||
use omegaupload_common::secrecy::{ExposeSecret, SecretString, SecretVec};
|
||||
use omegaupload_common::{
|
||||
base64, Expiration, ParsedUrl, Url, API_ENDPOINT, EXPIRATION_HEADER_NAME,
|
||||
};
|
||||
|
|
|
@ -10,14 +10,14 @@ license = "MIT"
|
|||
|
||||
[dependencies]
|
||||
base64 = "0.13.0"
|
||||
bytes = { version = "1.1.0", features = ["serde"] }
|
||||
bytes = { version = "1.2.0", features = ["serde"] }
|
||||
chacha20poly1305 = { version = "0.9.1", features = ["stream", "std"] }
|
||||
chrono = { version = "0.4.19", features = ["serde"] }
|
||||
headers = "0.3.7"
|
||||
lazy_static = "1.4.0"
|
||||
rand = "0.8.5"
|
||||
secrecy = "0.8.0"
|
||||
serde = { version = "1.0.138", features = ["derive"] }
|
||||
serde = { version = "1.0.140", features = ["derive"] }
|
||||
thiserror = "1.0.31"
|
||||
typenum = "1.15.0"
|
||||
url = "2.2.2"
|
||||
|
|
|
@ -8,6 +8,7 @@ pub struct Builder {
|
|||
}
|
||||
|
||||
impl Builder {
|
||||
#[must_use]
|
||||
pub fn new(decryption_key: SecretString) -> Self {
|
||||
Self {
|
||||
decryption_key,
|
||||
|
@ -17,6 +18,7 @@ impl Builder {
|
|||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub const fn needs_password(mut self) -> Self {
|
||||
self.needs_password = true;
|
||||
self
|
||||
|
@ -24,6 +26,7 @@ impl Builder {
|
|||
|
||||
// False positive
|
||||
#[allow(clippy::missing_const_for_fn)]
|
||||
#[must_use]
|
||||
pub fn file_name(mut self, name: String) -> Self {
|
||||
self.file_name = Some(name);
|
||||
self
|
||||
|
@ -31,11 +34,13 @@ impl Builder {
|
|||
|
||||
// False positive
|
||||
#[allow(clippy::missing_const_for_fn)]
|
||||
#[must_use]
|
||||
pub fn language(mut self, language: String) -> Self {
|
||||
self.language = Some(language);
|
||||
self
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn build(self) -> SecretString {
|
||||
if !self.needs_password && self.file_name.is_none() && self.language.is_none() {
|
||||
return self.decryption_key;
|
||||
|
|
|
@ -8,23 +8,23 @@ edition = "2021"
|
|||
[dependencies]
|
||||
omegaupload-common = { path = "../common" }
|
||||
anyhow = "1.0.58"
|
||||
axum = { version = "0.5.12", features = ["http2", "headers"] }
|
||||
axum = { version = "0.5.14", features = ["http2", "headers"] }
|
||||
bincode = "1.3.3"
|
||||
# We don't care about which version (We want to match with axum), we just need
|
||||
# to enable the feature
|
||||
bytes = { version = "1.1.0", features = ["serde"] }
|
||||
bytes = { version = "1.2.0", features = ["serde"] }
|
||||
chrono = { version = "0.4.19", features = ["serde"] }
|
||||
futures = "0.3.21"
|
||||
# We just need to pull in whatever axum is pulling in
|
||||
headers = "0.3.7"
|
||||
lazy_static = "1.4.0"
|
||||
# Disable `random()` and `thread_rng()`
|
||||
rand = { version = "0.8.5", default_features = false }
|
||||
rocksdb = { version = "0.18.0", default_features = false, features = ["zstd"] }
|
||||
serde = { version = "1.0.138", features = ["derive"] }
|
||||
rand = { version = "0.8.5", default-features = false }
|
||||
rocksdb = { version = "0.18.0", default-features = false, features = ["zstd"] }
|
||||
serde = { version = "1.0.140", features = ["derive"] }
|
||||
signal-hook = "0.3.14"
|
||||
signal-hook-tokio = { version = "0.3.1", features = ["futures-v0_3"] }
|
||||
tokio = { version = "1.19.2", features = ["macros", "rt-multi-thread"] }
|
||||
tokio = { version = "1.20.1", features = ["macros", "rt-multi-thread"] }
|
||||
tower-http = { version = "0.3.4", features = ["fs"] }
|
||||
tracing = "0.1.35"
|
||||
tracing-subscriber = "0.3.14"
|
||||
tracing-subscriber = "0.3.15"
|
||||
|
|
|
@ -12,24 +12,24 @@ omegaupload-common = { path = "../common", features = ["wasm"] }
|
|||
getrandom = { version = "0.2.7", features = ["js"] }
|
||||
|
||||
anyhow = "1.0.58"
|
||||
bytes = "1.1.0"
|
||||
bytes = "1.2.0"
|
||||
byte-unit = "4.0.14"
|
||||
console_error_panic_hook = "0.1.7"
|
||||
gloo-console = "0.2.1"
|
||||
http = "0.2.8"
|
||||
js-sys = "0.3.58"
|
||||
js-sys = "0.3.59"
|
||||
mime_guess = "2.0.4"
|
||||
reqwasm = "0.5.0"
|
||||
tree_magic_mini = { version = "3.0.3", features = ["with-gpl-data"] }
|
||||
serde = { version = "1.0.138", features = ["derive"] }
|
||||
wasm-bindgen = { version = "0.2.81", features = ["serde-serialize"] }
|
||||
wasm-bindgen-futures = "0.4.31"
|
||||
serde = { version = "1.0.140", features = ["derive"] }
|
||||
wasm-bindgen = { version = "0.2.82", features = ["serde-serialize"] }
|
||||
wasm-bindgen-futures = "0.4.32"
|
||||
zip = { version = "0.6.2", default-features = false, features = ["deflate"] }
|
||||
flate2 = "1.0.24"
|
||||
tar = "0.4.38"
|
||||
|
||||
[dependencies.web-sys]
|
||||
version = "0.3.58"
|
||||
version = "0.3.59"
|
||||
features = [
|
||||
"BlobPropertyBag",
|
||||
"TextDecoder",
|
||||
|
|
|
@ -25,11 +25,11 @@ use gloo_console::{error, log};
|
|||
use http::uri::PathAndQuery;
|
||||
use http::{StatusCode, Uri};
|
||||
use js_sys::{Array, JsString, Object, Uint8Array};
|
||||
use omegaupload_common::crypto::{Error as CryptoError, Key};
|
||||
use omegaupload_common::fragment::Builder;
|
||||
use omegaupload_common::base64;
|
||||
use omegaupload_common::crypto::seal_in_place;
|
||||
use omegaupload_common::secrecy::{Secret, SecretVec, SecretString, ExposeSecret};
|
||||
use omegaupload_common::crypto::{Error as CryptoError, Key};
|
||||
use omegaupload_common::fragment::Builder;
|
||||
use omegaupload_common::secrecy::{ExposeSecret, Secret, SecretString, SecretVec};
|
||||
use omegaupload_common::{Expiration, PartialParsedUrl, Url};
|
||||
use reqwasm::http::Request;
|
||||
use wasm_bindgen::prelude::{wasm_bindgen, Closure};
|
||||
|
@ -194,13 +194,20 @@ async fn do_encrypt(mut data: Vec<u8>) -> Result<()> {
|
|||
let mut url = Url::from_str(&s)?;
|
||||
let fragment = Builder::new(key);
|
||||
|
||||
let js_data = Uint8Array::new_with_length(data.len() as u32);
|
||||
let js_data = Uint8Array::new_with_length(u32::try_from(data.len()).expect("Data too large"));
|
||||
js_data.copy_from(&data);
|
||||
|
||||
let short_code = Request::post(url.as_ref()).body(js_data).send().await?.text().await?;
|
||||
let short_code = Request::post(url.as_ref())
|
||||
.body(js_data)
|
||||
.send()
|
||||
.await?
|
||||
.text()
|
||||
.await?;
|
||||
url.set_path(&short_code);
|
||||
url.set_fragment(Some(fragment.build().expose_secret()));
|
||||
location().set_href(url.as_ref()).expect("Unable to navigate to encrypted upload");
|
||||
location()
|
||||
.set_href(url.as_ref())
|
||||
.expect("Unable to navigate to encrypted upload");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue