Compare commits
2 commits
afb4a1b47f
...
2e02944958
Author | SHA1 | Date | |
---|---|---|---|
2e02944958 | |||
c828c76128 |
5 changed files with 21 additions and 41 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -1221,7 +1221,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mangadex-home"
|
name = "mangadex-home"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"base64 0.13.0",
|
"base64 0.13.0",
|
||||||
|
|
34
Cargo.toml
34
Cargo.toml
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "mangadex-home"
|
name = "mangadex-home"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
authors = ["Edward Shen <code@eddie.sh>"]
|
authors = ["Edward Shen <code@eddie.sh>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
@ -10,26 +10,26 @@ repository = "https://github.com/edward-shen/mangadex-home-rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = { version = "4.0.0-beta.4", features = [ "rustls" ] }
|
actix-web = { version = "4.0.0-beta.4", features = [ "rustls" ] }
|
||||||
reqwest = { version = "0.11", features = ["json"] }
|
|
||||||
parking_lot = "0.11"
|
|
||||||
base64 = "0.13"
|
base64 = "0.13"
|
||||||
sodiumoxide = "0.2"
|
bincode = "1"
|
||||||
thiserror = "1"
|
|
||||||
chrono = { version = "0.4", features = [ "serde" ] }
|
|
||||||
serde = "1"
|
|
||||||
serde_json = "1"
|
|
||||||
url = { version = "2", features = [ "serde" ] }
|
|
||||||
dotenv = "0.15"
|
|
||||||
log = "0.4"
|
|
||||||
rustls = "0.19"
|
|
||||||
simple_logger = "1"
|
|
||||||
lru = "0.6"
|
|
||||||
futures = "0.3"
|
|
||||||
bytes = "1"
|
bytes = "1"
|
||||||
cacache = "8"
|
cacache = "8"
|
||||||
ssri = "5"
|
chrono = { version = "0.4", features = [ "serde" ] }
|
||||||
bincode = "1"
|
|
||||||
ctrlc = "3"
|
ctrlc = "3"
|
||||||
|
dotenv = "0.15"
|
||||||
|
futures = "0.3"
|
||||||
|
parking_lot = "0.11"
|
||||||
|
reqwest = { version = "0.11", features = [ "json" ] }
|
||||||
|
log = "0.4"
|
||||||
|
lru = "0.6"
|
||||||
|
rustls = "0.19"
|
||||||
|
serde = "1"
|
||||||
|
serde_json = "1"
|
||||||
|
simple_logger = "1"
|
||||||
|
sodiumoxide = "0.2"
|
||||||
|
ssri = "5"
|
||||||
|
thiserror = "1"
|
||||||
|
url = { version = "2", features = [ "serde" ] }
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = true
|
lto = true
|
||||||
|
|
|
@ -10,8 +10,7 @@ use std::time::Duration;
|
||||||
use std::{num::ParseIntError, sync::atomic::Ordering};
|
use std::{num::ParseIntError, sync::atomic::Ordering};
|
||||||
|
|
||||||
use actix_web::rt::{spawn, time, System};
|
use actix_web::rt::{spawn, time, System};
|
||||||
use actix_web::web;
|
use actix_web::web::{self, Data};
|
||||||
use actix_web::web::Data;
|
|
||||||
use actix_web::{App, HttpServer};
|
use actix_web::{App, HttpServer};
|
||||||
use log::{error, warn, LevelFilter};
|
use log::{error, warn, LevelFilter};
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
|
@ -85,9 +84,7 @@ async fn main() -> Result<(), std::io::Error> {
|
||||||
HttpServer::new(move || {
|
HttpServer::new(move || {
|
||||||
App::new()
|
App::new()
|
||||||
.service(routes::token_data)
|
.service(routes::token_data)
|
||||||
.service(routes::no_token_data)
|
|
||||||
.service(routes::token_data_saver)
|
.service(routes::token_data_saver)
|
||||||
.service(routes::no_token_data_saver)
|
|
||||||
.route("{tail:.*}", web::get().to(routes::default))
|
.route("{tail:.*}", web::get().to(routes::default))
|
||||||
.app_data(Data::from(Arc::clone(&data_1)))
|
.app_data(Data::from(Arc::clone(&data_1)))
|
||||||
})
|
})
|
||||||
|
|
|
@ -55,6 +55,7 @@ pub struct Response {
|
||||||
pub token_key: Option<String>,
|
pub token_key: Option<String>,
|
||||||
pub compromised: bool,
|
pub compromised: bool,
|
||||||
pub paused: bool,
|
pub paused: bool,
|
||||||
|
#[serde(default)]
|
||||||
pub force_tokens: bool,
|
pub force_tokens: bool,
|
||||||
pub tls: Option<Tls>,
|
pub tls: Option<Tls>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ const SERVER_ID_STRING: &str = concat!(
|
||||||
env!("CARGO_PKG_VERSION"),
|
env!("CARGO_PKG_VERSION"),
|
||||||
" (",
|
" (",
|
||||||
client_api_version!(),
|
client_api_version!(),
|
||||||
")",
|
") - Conforming to spec revision b82043289",
|
||||||
);
|
);
|
||||||
|
|
||||||
enum ServerResponse {
|
enum ServerResponse {
|
||||||
|
@ -74,24 +74,6 @@ async fn token_data_saver(
|
||||||
fetch_image(state, chapter_hash, file_name, true).await
|
fetch_image(state, chapter_hash, file_name, true).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/data/{chapter_hash}/{file_name}")]
|
|
||||||
async fn no_token_data(
|
|
||||||
state: Data<RwLockServerState>,
|
|
||||||
path: Path<(String, String)>,
|
|
||||||
) -> impl Responder {
|
|
||||||
let (chapter_hash, file_name) = path.into_inner();
|
|
||||||
fetch_image(state, chapter_hash, file_name, false).await
|
|
||||||
}
|
|
||||||
|
|
||||||
#[get("/data-saver/{chapter_hash}/{file_name}")]
|
|
||||||
async fn no_token_data_saver(
|
|
||||||
state: Data<RwLockServerState>,
|
|
||||||
path: Path<(String, String)>,
|
|
||||||
) -> impl Responder {
|
|
||||||
let (chapter_hash, file_name) = path.into_inner();
|
|
||||||
fetch_image(state, chapter_hash, file_name, true).await
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn default(state: Data<RwLockServerState>, req: HttpRequest) -> impl Responder {
|
pub async fn default(state: Data<RwLockServerState>, req: HttpRequest) -> impl Responder {
|
||||||
let path = &format!(
|
let path = &format!(
|
||||||
"{}{}",
|
"{}{}",
|
||||||
|
|
Loading…
Reference in a new issue