geforkt von mirrored/vaultwarden
Make the blacklist logic be cached
Dieser Commit ist enthalten in:
Ursprung
0586c00285
Commit
d292269ea0
1 geänderte Dateien mit 5 neuen und 8 gelöschten Zeilen
|
@ -61,14 +61,7 @@ fn icon(domain: String) -> Content<Vec<u8>> {
|
||||||
return Content(icon_type, FALLBACK_ICON.to_vec());
|
return Content(icon_type, FALLBACK_ICON.to_vec());
|
||||||
}
|
}
|
||||||
|
|
||||||
if check_icon_domain_is_blacklisted(&domain) {
|
Content(icon_type, get_icon(&domain))
|
||||||
warn!("Domain is blacklisted: {:#?}", domain);
|
|
||||||
return Content(icon_type, FALLBACK_ICON.to_vec());
|
|
||||||
}
|
|
||||||
|
|
||||||
let icon = get_icon(&domain);
|
|
||||||
|
|
||||||
Content(icon_type, icon)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_icon_domain_is_blacklisted(domain: &str) -> bool {
|
fn check_icon_domain_is_blacklisted(domain: &str) -> bool {
|
||||||
|
@ -380,6 +373,10 @@ fn parse_sizes(sizes: Option<String>) -> (u16, u16) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn download_icon(domain: &str) -> Result<Vec<u8>, Error> {
|
fn download_icon(domain: &str) -> Result<Vec<u8>, Error> {
|
||||||
|
if check_icon_domain_is_blacklisted(domain) {
|
||||||
|
err!("Domain is blacklisted", domain)
|
||||||
|
}
|
||||||
|
|
||||||
let (iconlist, cookie_str) = get_icon_url(&domain)?;
|
let (iconlist, cookie_str) = get_icon_url(&domain)?;
|
||||||
|
|
||||||
let mut buffer = Vec::new();
|
let mut buffer = Vec::new();
|
||||||
|
|
Laden …
In neuem Issue referenzieren