Compare commits

..

No commits in common. "main" and "0.0.7" have entirely different histories.
main ... 0.0.7

3 changed files with 8 additions and 8 deletions

2
Cargo.lock generated
View file

@ -34,7 +34,7 @@ dependencies = [
[[package]] [[package]]
name = "api-backend" name = "api-backend"
version = "0.0.8" version = "0.0.7"
dependencies = [ dependencies = [
"axum", "axum",
"chrono", "chrono",

View file

@ -1,7 +1,7 @@
[package] [package]
authors = ["Neshura"] authors = ["Neshura"]
name = "api-backend" name = "api-backend"
version = "0.0.8" version = "0.0.7"
edition = "2021" edition = "2021"
description = "API Backend For Easier Uploading To Kavita" description = "API Backend For Easier Uploading To Kavita"
license = "GPL-3.0-or-later" license = "GPL-3.0-or-later"

View file

@ -199,7 +199,7 @@ async fn upload_file(state: &mut App, request: Request) {
///$KAVITA_URL/api/Library/scan-folder ///$KAVITA_URL/api/Library/scan-folder
let client = reqwest::Client::new(); let client = reqwest::Client::new();
let jwt_url = format!("{}/api/Plugin/authenticate?apiKey={}&pluginName=kwm-api", var("KAVITA_URL").expect("KAVITA_URL needs to be set in the .env file"), var("KAVITA_API_KEY").expect("KAVITA_API_KEY needs to be set in the .env file")); let jwt_url = format!("{}/api/Plugin/authenticate?apiKey={}&pluginName=kwm-api", var("KAVITA_URL").expect("KAVITA_URL needs to be set in the .env file"), var("KAVITA_API_KEY").expect("KAVITA_API_KEY needs to be set in the .env file"));
match client.post(jwt_url).send().await { match client.post(jwt_url).send().await {
Ok(data) => { Ok(data) => {
let auth: PluginAuthResponse = serde_json::from_str(&data.text().await.unwrap()).unwrap(); let auth: PluginAuthResponse = serde_json::from_str(&data.text().await.unwrap()).unwrap();
@ -214,7 +214,7 @@ async fn upload_file(state: &mut App, request: Request) {
let res = client let res = client
.post(url) .post(url)
.header(reqwest::header::AUTHORIZATION, auth.token) .bearer_auth(auth.token)
.body(body) .body(body)
.send() .send()
.await; .await;
@ -229,12 +229,12 @@ async fn upload_file(state: &mut App, request: Request) {
} }
} }
Err(e) => { Err(e) => {
} }
} }
} }
async fn stream_to_file(path: &PathBuf, stream: BodyDataStream) -> Result<(), (StatusCode, String)> async fn stream_to_file(path: &PathBuf, stream: BodyDataStream) -> Result<(), (StatusCode, String)>