pimpbunny thumb proxy
This commit is contained in:
@@ -178,30 +178,9 @@ impl PimpbunnyProvider {
|
||||
}
|
||||
}
|
||||
|
||||
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, "pimpbunny.com" | "www.pimpbunny.com")
|
||||
&& url.path().starts_with("/contents/videos_screenshots/")
|
||||
}
|
||||
|
||||
fn proxied_thumb(&self, options: &ServerOptions, thumb: &str) -> String {
|
||||
if thumb.is_empty() || !Self::is_allowed_thumb_url(thumb) {
|
||||
return thumb.to_string();
|
||||
}
|
||||
|
||||
crate::providers::build_proxy_url(
|
||||
options,
|
||||
"pimpbunny-thumb",
|
||||
&crate::providers::strip_url_scheme(thumb),
|
||||
)
|
||||
let _ = options;
|
||||
thumb.to_string()
|
||||
}
|
||||
|
||||
fn is_allowed_detail_url(url: &str) -> bool {
|
||||
@@ -911,7 +890,7 @@ mod tests {
|
||||
|
||||
assert_eq!(
|
||||
proxied,
|
||||
"https://example.com/proxy/pimpbunny-thumb/pimpbunny.com/contents/videos_screenshots/517000/517329/800x450/1.jpg"
|
||||
"https://pimpbunny.com/contents/videos_screenshots/517000/517329/800x450/1.jpg"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ pub mod hqpornerthumb;
|
||||
pub mod javtiful;
|
||||
pub mod noodlemagazine;
|
||||
pub mod pimpbunny;
|
||||
pub mod pimpbunnythumb;
|
||||
pub mod porndish;
|
||||
pub mod porndishthumb;
|
||||
pub mod pornhd3x;
|
||||
|
||||
@@ -105,11 +105,6 @@ pub fn config(cfg: &mut web::ServiceConfig) {
|
||||
.route(web::post().to(crate::proxies::pornhubthumb::get_image))
|
||||
.route(web::get().to(crate::proxies::pornhubthumb::get_image)),
|
||||
);
|
||||
cfg.service(
|
||||
web::resource("/pimpbunny-thumb/{endpoint}*")
|
||||
.route(web::post().to(crate::proxies::pimpbunnythumb::get_image))
|
||||
.route(web::get().to(crate::proxies::pimpbunnythumb::get_image)),
|
||||
);
|
||||
}
|
||||
|
||||
async fn proxy2redirect(
|
||||
|
||||
Reference in New Issue
Block a user