Update deps
This commit is contained in:
parent
b33dfac117
commit
b213253927
8 changed files with 858 additions and 514 deletions
1324
Cargo.lock
generated
1324
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -9,9 +9,9 @@ license = "MIT"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
base64 = "0.13.0"
|
base64 = "0.21.0"
|
||||||
bytes = { version = "1.2.0", features = ["serde"] }
|
bytes = { version = "1.2.0", features = ["serde"] }
|
||||||
chacha20poly1305 = { version = "0.9.1", features = ["stream", "std"] }
|
chacha20poly1305 = { version = "0.10", features = ["stream", "std"] }
|
||||||
chrono = { version = "0.4.19", features = ["serde"] }
|
chrono = { version = "0.4.19", features = ["serde"] }
|
||||||
headers = "0.3.7"
|
headers = "0.3.7"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
|
@ -21,10 +21,10 @@ serde = { version = "1.0.140", features = ["derive"] }
|
||||||
thiserror = "1.0.31"
|
thiserror = "1.0.31"
|
||||||
typenum = "1.15.0"
|
typenum = "1.15.0"
|
||||||
url = "2.2.2"
|
url = "2.2.2"
|
||||||
argon2 = "0.4.1"
|
argon2 = "0.5"
|
||||||
|
|
||||||
# Wasm features
|
# Wasm features
|
||||||
gloo-console = { version = "0.2.1", optional = true }
|
gloo-console = { version = "0.3", optional = true }
|
||||||
reqwasm = { version = "0.5.0", optional = true }
|
reqwasm = { version = "0.5.0", optional = true }
|
||||||
http = { version = "0.2.8", optional = true }
|
http = { version = "0.2.8", optional = true }
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,17 @@
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
// SOFTWARE.
|
// SOFTWARE.
|
||||||
|
|
||||||
use base64::{DecodeError, URL_SAFE};
|
use base64::alphabet::URL_SAFE;
|
||||||
|
use base64::engine::general_purpose::GeneralPurpose;
|
||||||
|
use base64::engine::general_purpose::GeneralPurposeConfig;
|
||||||
|
use base64::DecodeError;
|
||||||
|
use base64::Engine;
|
||||||
|
|
||||||
|
const URL_BASE64: GeneralPurpose = GeneralPurpose::new(&URL_SAFE, GeneralPurposeConfig::new());
|
||||||
|
|
||||||
/// URL-safe Base64 encoding.
|
/// URL-safe Base64 encoding.
|
||||||
pub fn encode(input: impl AsRef<[u8]>) -> String {
|
pub fn encode(input: impl AsRef<[u8]>) -> String {
|
||||||
base64::encode_config(input, URL_SAFE)
|
URL_BASE64.encode(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// URL-safe Base64 decoding.
|
/// URL-safe Base64 decoding.
|
||||||
|
@ -32,5 +38,5 @@ pub fn encode(input: impl AsRef<[u8]>) -> String {
|
||||||
/// Returns an error if a buffer cannot be decoded, such as if there's an
|
/// Returns an error if a buffer cannot be decoded, such as if there's an
|
||||||
/// incorrect number of bytes.
|
/// incorrect number of bytes.
|
||||||
pub fn decode(input: impl AsRef<[u8]>) -> Result<Vec<u8>, DecodeError> {
|
pub fn decode(input: impl AsRef<[u8]>) -> Result<Vec<u8>, DecodeError> {
|
||||||
base64::decode_config(input, URL_SAFE)
|
URL_BASE64.decode(input)
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,12 +23,13 @@ use std::ops::{Deref, DerefMut};
|
||||||
use argon2::{Argon2, ParamsBuilder};
|
use argon2::{Argon2, ParamsBuilder};
|
||||||
use chacha20poly1305::aead::generic_array::sequence::GenericSequence;
|
use chacha20poly1305::aead::generic_array::sequence::GenericSequence;
|
||||||
use chacha20poly1305::aead::generic_array::GenericArray;
|
use chacha20poly1305::aead::generic_array::GenericArray;
|
||||||
use chacha20poly1305::aead::{AeadInPlace, NewAead};
|
use chacha20poly1305::aead::{AeadInPlace};
|
||||||
use chacha20poly1305::XChaCha20Poly1305;
|
use chacha20poly1305::XChaCha20Poly1305;
|
||||||
use chacha20poly1305::XNonce;
|
use chacha20poly1305::XNonce;
|
||||||
use rand::{CryptoRng, Rng};
|
use rand::{CryptoRng, Rng};
|
||||||
use secrecy::{DebugSecret, ExposeSecret, Secret, SecretVec, Zeroize};
|
use secrecy::{DebugSecret, ExposeSecret, Secret, SecretVec, Zeroize};
|
||||||
use typenum::Unsigned;
|
use typenum::Unsigned;
|
||||||
|
use chacha20poly1305::KeyInit;
|
||||||
|
|
||||||
#[derive(Debug, thiserror::Error)]
|
#[derive(Debug, thiserror::Error)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
|
@ -277,12 +278,9 @@ fn get_argon2() -> Argon2<'static> {
|
||||||
let mut params = ParamsBuilder::new();
|
let mut params = ParamsBuilder::new();
|
||||||
params
|
params
|
||||||
.m_cost(15 * 1024) // 15 MiB
|
.m_cost(15 * 1024) // 15 MiB
|
||||||
.expect("Hard coded params to work")
|
|
||||||
.t_cost(2)
|
.t_cost(2)
|
||||||
.expect("Hard coded params to work")
|
.p_cost(2);
|
||||||
.p_cost(2)
|
let params = params.build().expect("Hard coded params to work");
|
||||||
.expect("Hard coded params to work");
|
|
||||||
let params = params.params().expect("Hard coded params to work");
|
|
||||||
Argon2::new(argon2::Algorithm::Argon2id, argon2::Version::V0x13, params)
|
Argon2::new(argon2::Algorithm::Argon2id, argon2::Version::V0x13, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ edition = "2021"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
omegaupload-common = { path = "../common" }
|
omegaupload-common = { path = "../common" }
|
||||||
anyhow = "1.0.58"
|
anyhow = "1.0.58"
|
||||||
axum = { version = "0.5.14", features = ["http2", "headers"] }
|
axum = { version = "0.6", features = ["http2", "headers"] }
|
||||||
bincode = "1.3.3"
|
bincode = "1.3.3"
|
||||||
# We don't care about which version (We want to match with axum), we just need
|
# We don't care about which version (We want to match with axum), we just need
|
||||||
# to enable the feature
|
# to enable the feature
|
||||||
|
@ -20,11 +20,11 @@ headers = "0.3.7"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
# Disable `random()` and `thread_rng()`
|
# Disable `random()` and `thread_rng()`
|
||||||
rand = { version = "0.8.5", default-features = false }
|
rand = { version = "0.8.5", default-features = false }
|
||||||
rocksdb = { version = "0.18.0", default-features = false, features = ["zstd"] }
|
rocksdb = { version = "0.21", default-features = false, features = ["zstd"] }
|
||||||
serde = { version = "1.0.140", features = ["derive"] }
|
serde = { version = "1.0.140", features = ["derive"] }
|
||||||
signal-hook = "0.3.14"
|
signal-hook = "0.3.14"
|
||||||
signal-hook-tokio = { version = "0.3.1", features = ["futures-v0_3"] }
|
signal-hook-tokio = { version = "0.3.1", features = ["futures-v0_3"] }
|
||||||
tokio = { version = "1.20.1", features = ["macros", "rt-multi-thread"] }
|
tokio = { version = "1.20.1", features = ["macros", "rt-multi-thread"] }
|
||||||
tower-http = { version = "0.3.4", features = ["fs"] }
|
tower-http = { version = "0.4", features = ["fs"] }
|
||||||
tracing = "0.1.35"
|
tracing = "0.1.35"
|
||||||
tracing-subscriber = "0.3.15"
|
tracing-subscriber = "0.3.15"
|
||||||
|
|
|
@ -97,8 +97,8 @@ async fn main() -> Result<()> {
|
||||||
"/",
|
"/",
|
||||||
post(upload::<SHORT_CODE_SIZE>).get_service(index_service.clone()),
|
post(upload::<SHORT_CODE_SIZE>).get_service(index_service.clone()),
|
||||||
)
|
)
|
||||||
.route("/:code", index_service)
|
.route_service("/:code", index_service)
|
||||||
.nest("/static", root_service)
|
.nest_service("/static", root_service)
|
||||||
.route(
|
.route(
|
||||||
&format!("{API_ENDPOINT}/:code"),
|
&format!("{API_ENDPOINT}/:code"),
|
||||||
get(paste::<SHORT_CODE_SIZE>).delete(delete::<SHORT_CODE_SIZE>),
|
get(paste::<SHORT_CODE_SIZE>).delete(delete::<SHORT_CODE_SIZE>),
|
||||||
|
@ -129,7 +129,8 @@ fn set_up_expirations<const N: usize>(db: &Arc<DB>) {
|
||||||
|
|
||||||
let db_ref = Arc::clone(db);
|
let db_ref = Arc::clone(db);
|
||||||
|
|
||||||
for (key, value) in db.iterator_cf(meta_cf, IteratorMode::Start) {
|
for item in db.iterator_cf(meta_cf, IteratorMode::Start) {
|
||||||
|
let (key, value) = item.unwrap();
|
||||||
let key: [u8; N] = (*key).try_into().unwrap();
|
let key: [u8; N] = (*key).try_into().unwrap();
|
||||||
|
|
||||||
let expiration = if let Ok(value) = bincode::deserialize::<Expiration>(&value) {
|
let expiration = if let Ok(value) = bincode::deserialize::<Expiration>(&value) {
|
||||||
|
|
|
@ -15,12 +15,13 @@ anyhow = "1.0.58"
|
||||||
bytes = "1.2.0"
|
bytes = "1.2.0"
|
||||||
byte-unit = "4.0.14"
|
byte-unit = "4.0.14"
|
||||||
console_error_panic_hook = "0.1.7"
|
console_error_panic_hook = "0.1.7"
|
||||||
gloo-console = "0.2.1"
|
gloo-console = "0.3"
|
||||||
http = "0.2.8"
|
http = "0.2.8"
|
||||||
js-sys = "0.3.59"
|
js-sys = "0.3.59"
|
||||||
mime_guess = "2.0.4"
|
mime_guess = "2.0.4"
|
||||||
tree_magic_mini = { version = "3.0.3", features = ["with-gpl-data"] }
|
tree_magic_mini = { version = "3.0.3", features = ["with-gpl-data"] }
|
||||||
serde = { version = "1.0.140", features = ["derive"] }
|
serde = { version = "1.0.140", features = ["derive"] }
|
||||||
|
serde-wasm-bindgen = { version = "0.6" }
|
||||||
wasm-bindgen = { version = "0.2.82", features = ["serde-serialize"] }
|
wasm-bindgen = { version = "0.2.82", features = ["serde-serialize"] }
|
||||||
wasm-bindgen-futures = "0.4.32"
|
wasm-bindgen-futures = "0.4.32"
|
||||||
zip = { version = "0.6.2", default-features = false, features = ["deflate"] }
|
zip = { version = "0.6.2", default-features = false, features = ["deflate"] }
|
||||||
|
|
|
@ -330,7 +330,7 @@ fn on_success(
|
||||||
JsValue::from(
|
JsValue::from(
|
||||||
entries
|
entries
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|x| JsValue::from_serde(x).ok())
|
.filter_map(|x| serde_wasm_bindgen::to_value(x).ok())
|
||||||
.collect::<Array>(),
|
.collect::<Array>(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue