mirror of
https://github.com/flibusta-apps/books_downloader.git
synced 2025-12-06 06:55:37 +01:00
Update deps
This commit is contained in:
@@ -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...")
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user