Remove no token paths

This commit is contained in:
Edward Shen 2021-03-22 23:04:54 -04:00
parent c828c76128
commit 2e02944958
Signed by: edward
GPG key ID: 19182661E818369F
5 changed files with 5 additions and 25 deletions

2
Cargo.lock generated
View file

@ -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",

View file

@ -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"

View file

@ -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)))
}) })

View file

@ -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>,
} }

View file

@ -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!(
"{}{}", "{}{}",