vw_small

Hardened fork of Vaultwarden (https://github.com/dani-garcia/vaultwarden) with fewer features.
git clone https://git.philomathiclife.com/repos/vw_small
Log | Files | Refs | README

commit d292269ea069af7ebd342548d42bb7810848eca2
parent 0586c0028556ace24a3852bb845cc22bce5c59f5
Author: Daniel GarcĂ­a <dani-garcia@users.noreply.github.com>
Date:   Thu, 10 Oct 2019 23:21:22 +0200

Make the blacklist logic be cached

Diffstat:
Msrc/api/icons.rs | 13+++++--------
1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/api/icons.rs b/src/api/icons.rs @@ -61,14 +61,7 @@ fn icon(domain: String) -> Content<Vec<u8>> { return Content(icon_type, FALLBACK_ICON.to_vec()); } - if check_icon_domain_is_blacklisted(&domain) { - warn!("Domain is blacklisted: {:#?}", domain); - return Content(icon_type, FALLBACK_ICON.to_vec()); - } - - let icon = get_icon(&domain); - - Content(icon_type, icon) + Content(icon_type, get_icon(&domain)) } 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> { + if check_icon_domain_is_blacklisted(domain) { + err!("Domain is blacklisted", domain) + } + let (iconlist, cookie_str) = get_icon_url(&domain)?; let mut buffer = Vec::new();