This commit is contained in:
2023-09-14 21:50:23 +02:00
parent efaf2e385a
commit cbab567692
6 changed files with 59 additions and 65 deletions

View File

@@ -13,10 +13,10 @@ where
{
let client = reqwest::Client::new();
let formated_url = format!("{}{}", &config::CONFIG.book_library_url, url);
let formatted_url = format!("{}{}", &config::CONFIG.book_library_url, url);
let response = client
.get(formated_url)
.get(formatted_url)
.query(&params)
.header("Authorization", &config::CONFIG.book_library_api_key)
.send()

View File

@@ -122,7 +122,7 @@ pub async fn download_chain<'a>(
);
};
let (unziped_temp_file, data_size) = {
let (unzipped_temp_file, data_size) = {
let temp_file_to_unzip_result = response_to_tempfile(&mut response).await;
let temp_file_to_unzip = match temp_file_to_unzip_result {
Some(v) => v.0,
@@ -137,7 +137,7 @@ pub async fn download_chain<'a>(
let (mut clean_file, data_size) = if converting {
match convert_file(unziped_temp_file, file_type.to_string()).await {
match convert_file(unzipped_temp_file, file_type.to_string()).await {
Some(mut response) => {
match response_to_tempfile(&mut response).await {
Some(v) => v,
@@ -147,7 +147,7 @@ pub async fn download_chain<'a>(
None => return None,
}
} else {
(unziped_temp_file, data_size)
(unzipped_temp_file, data_size)
};
if !final_need_zip {

View File

@@ -5,7 +5,7 @@ use axum::{
response::{AppendHeaders, IntoResponse},
};
use axum::{
http::{self, Request},
http::Request,
middleware::{self, Next},
response::Response,
routing::get,
@@ -92,7 +92,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> {
let auth_header = req
.headers()
.get(http::header::AUTHORIZATION)
.get(header::AUTHORIZATION)
.and_then(|header| header.to_str().ok());
let auth_header = if let Some(auth_header) = auth_header {