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

View File

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

View File

@@ -1,5 +1,5 @@
use axum::{
body::StreamBody,
body::Body,
extract::Path,
http::{header, StatusCode},
response::{AppendHeaders, IntoResponse},
@@ -44,7 +44,6 @@ pub async fn download(
let reader = data.get_async_read();
let stream = ReaderStream::new(reader);
let body = StreamBody::new(stream);
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 {
@@ -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
.headers()
.get(header::AUTHORIZATION)