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 {
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"
);
}