upgrade dependencies

This commit is contained in:
neri 2022-07-02 22:28:48 +02:00
parent 36b9096325
commit bf7c762f83
4 changed files with 216 additions and 390 deletions

585
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,30 +1,30 @@
[package]
name = "datatrash"
version = "1.1.2"
version = "1.1.3"
authors = ["neri"]
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
actix-web = { version = "4.0.1", default-features = false, features = [
actix-web = { version = "4.1.0", default-features = false, features = [
"macros",
"compress-gzip",
"compress-zstd",
] }
sqlx = { version = "0.5.13", default-features = false, features = [
sqlx = { version = "0.6.0", default-features = false, features = [
"runtime-tokio-rustls",
"postgres",
"time",
] }
env_logger = "0.9.0"
log = "0.4.16"
actix-files = "0.6.0"
tokio = { version = "1.17.0", features = ["rt", "macros", "sync"] }
log = "0.4.17"
actix-files = "0.6.1"
tokio = { version = "1.19.2", features = ["rt", "macros", "sync"] }
actix-multipart = "0.4.0"
futures-util = "0.3.21"
rand = "0.8.5"
time = "0.2.27"
time = "0.3.11"
htmlescape = "0.3.1"
urlencoding = "2.1.0"
tree_magic_mini = { version = "3.0.3", features = ["with-gpl-data"] }

View File

@ -7,7 +7,7 @@ pub async fn setup_db() -> PgPool {
let pool = PgPoolOptions::new()
.max_connections(5)
.connect_timeout(std::time::Duration::from_secs(5))
.acquire_timeout(std::time::Duration::from_secs(5))
.connect(conn_url)
.await
.expect("could not create db pool");

View File

@ -3,8 +3,7 @@ use actix_multipart::{Field, Multipart};
use actix_web::{error, http::header::DispositionParam, Error};
use futures_util::{StreamExt, TryStreamExt};
use std::path::Path;
use time::OffsetDateTime;
use time::{ext::NumericalDuration, Duration};
use time::{Duration, OffsetDateTime};
use tokio::{fs::File, io::AsyncWriteExt};
const MAX_UPLOAD_SECONDS: i64 = 31 * 24 * 60 * 60;
@ -72,7 +71,7 @@ pub(crate) async fn parse_multipart(
.transpose()
.map_err(|e| error::ErrorBadRequest(format!("field keep_for is not a number: {}", e)))?
.unwrap_or(DEFAULT_UPLOAD_SECONDS);
let valid_duration = keep_for.seconds();
let valid_duration = Duration::seconds(keep_for.into());
let valid_till = OffsetDateTime::now_utc() + valid_duration;
let upload_config = UploadConfig {