pull stuff out of globals
This commit is contained in:
@@ -180,20 +180,12 @@ async fn download_html(&self, url: &str) -> Result<UrlPreviewData> {
|
||||
let mut bytes: Vec<u8> = Vec::new();
|
||||
while let Some(chunk) = response.chunk().await? {
|
||||
bytes.extend_from_slice(&chunk);
|
||||
if bytes.len()
|
||||
> self
|
||||
.services
|
||||
.globals
|
||||
.url_preview_max_spider_size()
|
||||
{
|
||||
if bytes.len() > self.services.config.url_preview_max_spider_size {
|
||||
debug!(
|
||||
"Response body from URL {} exceeds url_preview_max_spider_size ({}), not \
|
||||
processing the rest of the response body and assuming our necessary data is in \
|
||||
this range.",
|
||||
url,
|
||||
self.services
|
||||
.globals
|
||||
.url_preview_max_spider_size()
|
||||
url, self.services.config.url_preview_max_spider_size
|
||||
);
|
||||
break;
|
||||
}
|
||||
@@ -244,22 +236,22 @@ pub fn url_preview_allowed(&self, url: &Url) -> bool {
|
||||
| Some(h) => h.to_owned(),
|
||||
};
|
||||
|
||||
let allowlist_domain_contains = self
|
||||
let allowlist_domain_contains = &self
|
||||
.services
|
||||
.globals
|
||||
.url_preview_domain_contains_allowlist();
|
||||
let allowlist_domain_explicit = self
|
||||
.config
|
||||
.url_preview_domain_contains_allowlist;
|
||||
let allowlist_domain_explicit = &self
|
||||
.services
|
||||
.globals
|
||||
.url_preview_domain_explicit_allowlist();
|
||||
let denylist_domain_explicit = self
|
||||
.config
|
||||
.url_preview_domain_explicit_allowlist;
|
||||
let denylist_domain_explicit = &self
|
||||
.services
|
||||
.globals
|
||||
.url_preview_domain_explicit_denylist();
|
||||
let allowlist_url_contains = self
|
||||
.config
|
||||
.url_preview_domain_explicit_denylist;
|
||||
let allowlist_url_contains = &self
|
||||
.services
|
||||
.globals
|
||||
.url_preview_url_contains_allowlist();
|
||||
.config
|
||||
.url_preview_url_contains_allowlist;
|
||||
|
||||
if allowlist_domain_contains.contains(&"*".to_owned())
|
||||
|| allowlist_domain_explicit.contains(&"*".to_owned())
|
||||
@@ -306,11 +298,7 @@ pub fn url_preview_allowed(&self, url: &Url) -> bool {
|
||||
}
|
||||
|
||||
// check root domain if available and if user has root domain checks
|
||||
if self
|
||||
.services
|
||||
.globals
|
||||
.url_preview_check_root_domain()
|
||||
{
|
||||
if self.services.config.url_preview_check_root_domain {
|
||||
debug!("Checking root domain");
|
||||
match host.split_once('.') {
|
||||
| None => return false,
|
||||
|
||||
Reference in New Issue
Block a user