mirror of
https://gitlab.com/famedly/conduit.git
synced 2025-06-27 16:35:59 +00: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
|
// resolve host to IP to ensure it's not an internal IP
|
||||||
let dns_resolver = services().globals.dns_resolver();
|
let dns_resolver = services().globals.dns_resolver();
|
||||||
match dns_resolver.lookup_ip(host).await {
|
match dns_resolver.lookup_ip(format!("{host}.")).await {
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
return Err(Error::BadServerResponse("Failed to resolve media preview host"));
|
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
|
// 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 {
|
if services().globals.url_previews().use_spamhaus_denylist {
|
||||||
let resolver = services().globals.dns_resolver();
|
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) => {
|
Err(e) => {
|
||||||
if let ResolveErrorKind::NoRecordsFound { .. } = e.kind() { }
|
if let ResolveErrorKind::NoRecordsFound { .. } = e.kind() { }
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -109,7 +109,9 @@ pub struct WellKnownConfig {
|
||||||
#[derive(Clone, Debug, Deserialize, Default)]
|
#[derive(Clone, Debug, Deserialize, Default)]
|
||||||
pub struct UrlPreviewConfig {
|
pub struct UrlPreviewConfig {
|
||||||
pub default: UrlPreviewPermission,
|
pub default: UrlPreviewPermission,
|
||||||
|
#[serde(default)]
|
||||||
pub exceptions: Vec<WildCardedDomain>,
|
pub exceptions: Vec<WildCardedDomain>,
|
||||||
|
#[serde(default)]
|
||||||
pub use_spamhaus_denylist: bool,
|
pub use_spamhaus_denylist: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ database_path = "/tmp"
|
||||||
|
|
||||||
# All the other settings are left at their defaults:
|
# All the other settings are left at their defaults:
|
||||||
address = "127.0.0.1"
|
address = "127.0.0.1"
|
||||||
|
database_backend = "rocksdb"
|
||||||
allow_registration = true
|
allow_registration = true
|
||||||
max_request_size = 20_000_000
|
max_request_size = 20_000_000
|
||||||
port = 6167
|
port = 6167
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue