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