porndish
This commit is contained in:
@@ -28,5 +28,6 @@ RUN apt install -yq libssl-dev \
|
|||||||
sudo \
|
sudo \
|
||||||
&& apt-get clean
|
&& apt-get clean
|
||||||
|
|
||||||
USER 1000
|
RUN python3 -m pip install --break-system-packages --no-cache-dir curl_cffi
|
||||||
|
|
||||||
|
USER 1000
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ pub mod omgxxx;
|
|||||||
pub mod paradisehill;
|
pub mod paradisehill;
|
||||||
pub mod porn00;
|
pub mod porn00;
|
||||||
pub mod porn4fans;
|
pub mod porn4fans;
|
||||||
|
pub mod porndish;
|
||||||
pub mod pornzog;
|
pub mod pornzog;
|
||||||
pub mod shooshtime;
|
pub mod shooshtime;
|
||||||
pub mod sxyprn;
|
pub mod sxyprn;
|
||||||
@@ -134,6 +135,10 @@ pub static ALL_PROVIDERS: Lazy<HashMap<&'static str, DynProvider>> = Lazy::new(|
|
|||||||
"porn4fans",
|
"porn4fans",
|
||||||
Arc::new(porn4fans::Porn4fansProvider::new()) as DynProvider,
|
Arc::new(porn4fans::Porn4fansProvider::new()) as DynProvider,
|
||||||
);
|
);
|
||||||
|
m.insert(
|
||||||
|
"porndish",
|
||||||
|
Arc::new(porndish::PorndishProvider::new()) as DynProvider,
|
||||||
|
);
|
||||||
m.insert(
|
m.insert(
|
||||||
"shooshtime",
|
"shooshtime",
|
||||||
Arc::new(shooshtime::ShooshtimeProvider::new()) as DynProvider,
|
Arc::new(shooshtime::ShooshtimeProvider::new()) as DynProvider,
|
||||||
|
|||||||
1303
src/providers/porndish.rs
Normal file
1303
src/providers/porndish.rs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -7,6 +7,7 @@ pub mod hanimecdn;
|
|||||||
pub mod hqpornerthumb;
|
pub mod hqpornerthumb;
|
||||||
pub mod javtiful;
|
pub mod javtiful;
|
||||||
pub mod noodlemagazine;
|
pub mod noodlemagazine;
|
||||||
|
pub mod porndishthumb;
|
||||||
pub mod spankbang;
|
pub mod spankbang;
|
||||||
pub mod sxyprn;
|
pub mod sxyprn;
|
||||||
|
|
||||||
|
|||||||
80
src/proxies/porndishthumb.rs
Normal file
80
src/proxies/porndishthumb.rs
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
use ntex::http::header::CONTENT_TYPE;
|
||||||
|
use ntex::{
|
||||||
|
http::Response,
|
||||||
|
web::{self, HttpRequest, error},
|
||||||
|
};
|
||||||
|
use std::process::Command;
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
|
use crate::util::requester::Requester;
|
||||||
|
|
||||||
|
fn is_allowed_thumb_url(url: &str) -> bool {
|
||||||
|
let Some(url) = Url::parse(url).ok() else {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
if url.scheme() != "https" {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let Some(host) = url.host_str() else {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
matches!(host, "www.porndish.com" | "porndish.com")
|
||||||
|
&& url.path().starts_with("/wp-content/uploads/")
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn get_image(
|
||||||
|
req: HttpRequest,
|
||||||
|
_requester: web::types::State<Requester>,
|
||||||
|
) -> Result<impl web::Responder, web::Error> {
|
||||||
|
let endpoint = req.match_info().query("endpoint").to_string();
|
||||||
|
let image_url = if endpoint.starts_with("http://") || endpoint.starts_with("https://") {
|
||||||
|
endpoint
|
||||||
|
} else {
|
||||||
|
format!("https://{}", endpoint.trim_start_matches('/'))
|
||||||
|
};
|
||||||
|
if !is_allowed_thumb_url(&image_url) {
|
||||||
|
return Ok(web::HttpResponse::BadRequest().finish());
|
||||||
|
}
|
||||||
|
|
||||||
|
let output = tokio::task::spawn_blocking(move || {
|
||||||
|
Command::new("python3")
|
||||||
|
.arg("-c")
|
||||||
|
.arg(
|
||||||
|
r#"
|
||||||
|
import sys
|
||||||
|
from curl_cffi import requests
|
||||||
|
|
||||||
|
url = sys.argv[1]
|
||||||
|
response = requests.get(
|
||||||
|
url,
|
||||||
|
impersonate="chrome",
|
||||||
|
timeout=30,
|
||||||
|
allow_redirects=True,
|
||||||
|
headers={"Referer": "https://www.porndish.com/"},
|
||||||
|
)
|
||||||
|
if response.status_code >= 400:
|
||||||
|
sys.stderr.write(f"status={response.status_code}\n")
|
||||||
|
sys.exit(1)
|
||||||
|
sys.stderr.write(response.headers.get("content-type", "application/octet-stream"))
|
||||||
|
sys.stdout.buffer.write(response.content)
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.arg(image_url)
|
||||||
|
.output()
|
||||||
|
})
|
||||||
|
.await
|
||||||
|
.map_err(error::ErrorBadGateway)?
|
||||||
|
.map_err(error::ErrorBadGateway)?;
|
||||||
|
|
||||||
|
if !output.status.success() {
|
||||||
|
return Ok(web::HttpResponse::NotFound().finish());
|
||||||
|
}
|
||||||
|
|
||||||
|
let content_type = String::from_utf8_lossy(&output.stderr).trim().to_string();
|
||||||
|
let mut resp = Response::build(ntex::http::StatusCode::OK);
|
||||||
|
if !content_type.is_empty() {
|
||||||
|
resp.set_header(CONTENT_TYPE, content_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(resp.body(output.stdout))
|
||||||
|
}
|
||||||
@@ -36,6 +36,11 @@ pub fn config(cfg: &mut web::ServiceConfig) {
|
|||||||
web::resource("/hqporner-thumb/{endpoint}*")
|
web::resource("/hqporner-thumb/{endpoint}*")
|
||||||
.route(web::post().to(crate::proxies::hqpornerthumb::get_image))
|
.route(web::post().to(crate::proxies::hqpornerthumb::get_image))
|
||||||
.route(web::get().to(crate::proxies::hqpornerthumb::get_image)),
|
.route(web::get().to(crate::proxies::hqpornerthumb::get_image)),
|
||||||
|
)
|
||||||
|
.service(
|
||||||
|
web::resource("/porndish-thumb/{endpoint}*")
|
||||||
|
.route(web::post().to(crate::proxies::porndishthumb::get_image))
|
||||||
|
.route(web::get().to(crate::proxies::porndishthumb::get_image)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user