Update deps

This commit is contained in:
2023-12-10 22:03:54 +01:00
parent b11f9132f4
commit 95c7a3754a
4 changed files with 489 additions and 306 deletions

766
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -6,25 +6,25 @@ edition = "2021"
# 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]
tokio = { version = "1.33.0", features = ["full"] } tokio = { version = "1.35.0", features = ["full"] }
tokio-util = { version = "0.7.10", features = ["compat"] } tokio-util = { version = "0.7.10", features = ["compat"] }
futures = "0.3.29" futures = "0.3.29"
reqwest = { version = "0.11.22", features = ["json", "stream", "multipart"] } reqwest = { version = "0.11.22", features = ["json", "stream", "multipart"] }
tracing = "0.1.40" tracing = "0.1.40"
tracing-subscriber = { version = "0.3.17", features = ["env-filter"]} tracing-subscriber = { version = "0.3.18", features = ["env-filter"]}
tower-http = { version = "0.4.4", features = ["trace"] } tower-http = { version = "0.5.0", features = ["trace"] }
once_cell = "1.18.0" once_cell = "1.19.0"
serde = { version = "1.0.192", features = ["derive"] } serde = { version = "1.0.193", features = ["derive"] }
serde_json = "1.0.108" serde_json = "1.0.108"
axum = "0.6.20" axum = "0.7.2"
translit = "0.5.0" translit = "0.5.0"
zip = "0.6.6" zip = "0.6.6"
tempfile = "3.8.1" tempfile = "3.8.1"
bytes = "1.5.0" bytes = "1.5.0"
axum-prometheus = "0.4.0" axum-prometheus = "0.5.0"
base64 = "0.21.5" base64 = "0.21.5"
sentry = { version = "0.31.7", features = ["debug-images"] } sentry = { version = "0.32.0", features = ["debug-images"] }

View File

@@ -29,9 +29,7 @@ async fn main() {
let app = get_router().await; let app = get_router().await;
info!("Start webserver..."); info!("Start webserver...");
axum::Server::bind(&addr) let listener = tokio::net::TcpListener::bind(&addr).await.unwrap();
.serve(app.into_make_service()) axum::serve(listener, app).await.unwrap();
.await
.unwrap();
info!("Webserver shutdown...") info!("Webserver shutdown...")
} }

View File

@@ -1,5 +1,5 @@
use axum::{ use axum::{
body::StreamBody, body::Body,
extract::Path, extract::Path,
http::{header, StatusCode}, http::{header, StatusCode},
response::{AppendHeaders, IntoResponse}, response::{AppendHeaders, IntoResponse},
@@ -44,7 +44,6 @@ pub async fn download(
let reader = data.get_async_read(); let reader = data.get_async_read();
let stream = ReaderStream::new(reader); let stream = ReaderStream::new(reader);
let body = StreamBody::new(stream);
let encoder = general_purpose::STANDARD; let encoder = general_purpose::STANDARD;
@@ -64,7 +63,7 @@ pub async fn download(
), ),
]); ]);
Ok((headers, body)) Ok((headers, Body::from_stream(stream)))
} }
pub async fn get_filename(Path((book_id, file_type)): Path<(u32, String)>) -> impl IntoResponse { pub async fn get_filename(Path((book_id, file_type)): Path<(u32, String)>) -> impl IntoResponse {
@@ -86,7 +85,7 @@ pub async fn get_filename(Path((book_id, file_type)): Path<(u32, String)>) -> im
) )
} }
async fn auth<B>(req: Request<B>, next: Next<B>) -> Result<Response, StatusCode> { async fn auth(req: Request<axum::body::Body>, next: Next) -> Result<Response, StatusCode> {
let auth_header = req let auth_header = req
.headers() .headers()
.get(header::AUTHORIZATION) .get(header::AUTHORIZATION)