mirror of
https://gitlab.com/famedly/conduit.git
synced 2025-04-22 14:10:16 +03:00
Fix domain lookups
This commit is contained in:
parent
7dd9bda17b
commit
03653d6a10
3 changed files with 5 additions and 2 deletions
|
@ -185,7 +185,7 @@ async fn request_url_preview(url: &Url) -> Result<UrlPreviewData> {
|
|||
|
||||
// resolve host to IP to ensure it's not an internal IP
|
||||
let dns_resolver = services().globals.dns_resolver();
|
||||
match dns_resolver.lookup_ip(host).await {
|
||||
match dns_resolver.lookup_ip(format!("{host}.")).await {
|
||||
Err(_) => {
|
||||
return Err(Error::BadServerResponse("Failed to resolve media preview host"));
|
||||
},
|
||||
|
@ -199,7 +199,7 @@ async fn request_url_preview(url: &Url) -> Result<UrlPreviewData> {
|
|||
// https://docs.spamhaus.com/datasets/docs/source/70-access-methods/data-query-service/040-dqs-queries.html
|
||||
if services().globals.url_previews().use_spamhaus_denylist {
|
||||
let resolver = services().globals.dns_resolver();
|
||||
match resolver.lookup_ip(format!("{host}.dbl.spamhaus.org")).await {
|
||||
match resolver.lookup_ip(format!("{host}.dbl.spamhaus.org.")).await {
|
||||
Err(e) => {
|
||||
if let ResolveErrorKind::NoRecordsFound { .. } = e.kind() { }
|
||||
else {
|
||||
|
|
|
@ -109,7 +109,9 @@ pub struct WellKnownConfig {
|
|||
#[derive(Clone, Debug, Deserialize, Default)]
|
||||
pub struct UrlPreviewConfig {
|
||||
pub default: UrlPreviewPermission,
|
||||
#[serde(default)]
|
||||
pub exceptions: Vec<WildCardedDomain>,
|
||||
#[serde(default)]
|
||||
pub use_spamhaus_denylist: bool,
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ database_path = "/tmp"
|
|||
|
||||
# All the other settings are left at their defaults:
|
||||
address = "127.0.0.1"
|
||||
database_backend = "rocksdb"
|
||||
allow_registration = true
|
||||
max_request_size = 20_000_000
|
||||
port = 6167
|
||||
|
|
Loading…
Reference in a new issue