mirror of
https://github.com/flibusta-apps/books_downloader.git
synced 2025-12-06 06:55:37 +01:00
Fix
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
use reqwest::{Response, multipart::{Form, Part}, Body};
|
use reqwest::{Response, Body};
|
||||||
use tempfile::SpooledTempFile;
|
use tempfile::SpooledTempFile;
|
||||||
use tokio_util::io::ReaderStream;
|
use tokio_util::io::ReaderStream;
|
||||||
|
|
||||||
@@ -7,17 +7,17 @@ use crate::config;
|
|||||||
use super::downloader::types::SpooledTempAsyncRead;
|
use super::downloader::types::SpooledTempAsyncRead;
|
||||||
|
|
||||||
pub async fn convert_file(file: SpooledTempFile, file_type: String) -> Option<Response> {
|
pub async fn convert_file(file: SpooledTempFile, file_type: String) -> Option<Response> {
|
||||||
let client = reqwest::Client::new();
|
let body = Body::wrap_stream(ReaderStream::new(SpooledTempAsyncRead::new(file)));
|
||||||
|
|
||||||
let async_file = Body::wrap_stream(ReaderStream::new(SpooledTempAsyncRead::new(file)));
|
let response = reqwest::Client::new()
|
||||||
let file_part = Part::stream(async_file).file_name("file");
|
.post(
|
||||||
let form = Form::new()
|
format!(
|
||||||
.text("format", file_type.clone())
|
"{}{}",
|
||||||
.part("file", file_part);
|
config::CONFIG.converter_url,
|
||||||
|
file_type
|
||||||
let response = client
|
)
|
||||||
.post(&config::CONFIG.converter_url)
|
)
|
||||||
.multipart(form)
|
.body(body)
|
||||||
.header("Authorization", &config::CONFIG.converter_api_key)
|
.header("Authorization", &config::CONFIG.converter_api_key)
|
||||||
.send().await;
|
.send().await;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user