pimpbunny thumb proxy

This commit is contained in:
Simon
2026-04-06 06:40:31 +00:00
parent 772835d4d1
commit 70355dd969
3 changed files with 3 additions and 30 deletions

View File

@@ -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 { fn proxied_thumb(&self, options: &ServerOptions, thumb: &str) -> String {
if thumb.is_empty() || !Self::is_allowed_thumb_url(thumb) { let _ = options;
return thumb.to_string(); thumb.to_string()
}
crate::providers::build_proxy_url(
options,
"pimpbunny-thumb",
&crate::providers::strip_url_scheme(thumb),
)
} }
fn is_allowed_detail_url(url: &str) -> bool { fn is_allowed_detail_url(url: &str) -> bool {
@@ -911,7 +890,7 @@ mod tests {
assert_eq!( assert_eq!(
proxied, 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"
); );
} }

View File

@@ -19,7 +19,6 @@ pub mod hqpornerthumb;
pub mod javtiful; pub mod javtiful;
pub mod noodlemagazine; pub mod noodlemagazine;
pub mod pimpbunny; pub mod pimpbunny;
pub mod pimpbunnythumb;
pub mod porndish; pub mod porndish;
pub mod porndishthumb; pub mod porndishthumb;
pub mod pornhd3x; pub mod pornhd3x;

View File

@@ -105,11 +105,6 @@ pub fn config(cfg: &mut web::ServiceConfig) {
.route(web::post().to(crate::proxies::pornhubthumb::get_image)) .route(web::post().to(crate::proxies::pornhubthumb::get_image))
.route(web::get().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( async fn proxy2redirect(