pub rate_limit_search_per_second: Option<i32>,
pub federation_enabled: Option<bool>,
pub federation_debug: Option<bool>,
- pub federation_strict_allowlist: Option<bool>,
- pub federation_http_fetch_retry_limit: Option<i32>,
pub federation_worker_count: Option<i32>,
pub captcha_enabled: Option<bool>,
pub captcha_difficulty: Option<String>,
pub rate_limit_search_per_second: Option<i32>,
pub federation_enabled: Option<bool>,
pub federation_debug: Option<bool>,
- pub federation_strict_allowlist: Option<bool>,
- pub federation_http_fetch_retry_limit: Option<i32>,
pub federation_worker_count: Option<i32>,
pub captcha_enabled: Option<bool>,
pub captcha_difficulty: Option<String>,
.actor_name_max_length(data.actor_name_max_length)
.federation_enabled(data.federation_enabled)
.federation_debug(data.federation_debug)
- .federation_strict_allowlist(data.federation_strict_allowlist)
- .federation_http_fetch_retry_limit(data.federation_http_fetch_retry_limit)
.federation_worker_count(data.federation_worker_count)
.captcha_enabled(data.captcha_enabled)
.captcha_difficulty(data.captcha_difficulty.clone())
.actor_name_max_length(data.actor_name_max_length)
.federation_enabled(data.federation_enabled)
.federation_debug(data.federation_debug)
- .federation_strict_allowlist(data.federation_strict_allowlist)
- .federation_http_fetch_retry_limit(data.federation_http_fetch_retry_limit)
.federation_worker_count(data.federation_worker_count)
.captcha_enabled(data.captcha_enabled)
.captcha_difficulty(data.captcha_difficulty.clone())
-use crate::{local_instance, ActorType};
+use crate::{local_instance, ActorType, FEDERATION_HTTP_FETCH_LIMIT};
use activitypub_federation::{core::object_id::ObjectId, traits::ApubObject};
use anyhow::anyhow;
use itertools::Itertools;
-use lemmy_db_schema::{newtypes::DbUrl, source::local_site::LocalSite};
+use lemmy_db_schema::newtypes::DbUrl;
use lemmy_utils::error::LemmyError;
use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize};
);
debug!("Fetching webfinger url: {}", &fetch_url);
- let local_site = LocalSite::read(context.pool()).await;
- let http_fetch_retry_limit = local_site
- .as_ref()
- .map(|l| l.federation_http_fetch_retry_limit)
- .unwrap_or(25);
-
*request_counter += 1;
- if *request_counter > http_fetch_retry_limit {
+ if *request_counter > FEDERATION_HTTP_FETCH_LIMIT {
return Err(LemmyError::from_message("Request retry limit reached"));
}
pub mod objects;
pub mod protocol;
+const FEDERATION_HTTP_FETCH_LIMIT: i32 = 25;
+
static CONTEXT: Lazy<Vec<serde_json::Value>> = Lazy::new(|| {
serde_json::from_str(include_str!("../assets/lemmy/context.json")).expect("parse context")
});
.as_ref()
.map(|l| l.federation_worker_count)
.unwrap_or(64) as u64;
- let http_fetch_retry_limit = local_site
- .as_ref()
- .map(|l| l.federation_http_fetch_retry_limit)
- .unwrap_or(25);
let federation_debug = local_site
.as_ref()
.map(|l| l.federation_debug)
.unwrap_or(true);
let settings = InstanceSettings::builder()
- .http_fetch_retry_limit(http_fetch_retry_limit)
+ .http_fetch_retry_limit(FEDERATION_HTTP_FETCH_LIMIT)
.worker_count(worker_count)
.debug(federation_debug)
.http_signature_compat(true)
}
if let Some(allowed) = local_site_data.allowed_instances.as_ref() {
- // Only check allowlist if this is a community, or strict allowlist is enabled.
- let strict_allowlist = local_site_data
- .local_site
- .as_ref()
- .map(|l| l.federation_strict_allowlist)
- .unwrap_or(true);
- if is_strict || strict_allowlist {
+ // Only check allowlist if this is a community
+ if is_strict {
// need to allow this explicitly because apub receive might contain objects from our local
// instance.
let mut allowed_and_local = allowed.clone();
actor_name_max_length -> Int4,
federation_enabled -> Bool,
federation_debug -> Bool,
- federation_strict_allowlist -> Bool,
- federation_http_fetch_retry_limit -> Int4,
federation_worker_count -> Int4,
captcha_enabled -> Bool,
captcha_difficulty -> Text,
pub actor_name_max_length: i32,
pub federation_enabled: bool,
pub federation_debug: bool,
- pub federation_strict_allowlist: bool,
- pub federation_http_fetch_retry_limit: i32,
pub federation_worker_count: i32,
pub captcha_enabled: bool,
pub captcha_difficulty: String,
pub actor_name_max_length: Option<i32>,
pub federation_enabled: Option<bool>,
pub federation_debug: Option<bool>,
- pub federation_strict_allowlist: Option<bool>,
- pub federation_http_fetch_retry_limit: Option<i32>,
pub federation_worker_count: Option<i32>,
pub captcha_enabled: Option<bool>,
pub captcha_difficulty: Option<String>,
pub actor_name_max_length: Option<i32>,
pub federation_enabled: Option<bool>,
pub federation_debug: Option<bool>,
- pub federation_strict_allowlist: Option<bool>,
- pub federation_http_fetch_retry_limit: Option<i32>,
pub federation_worker_count: Option<i32>,
pub captcha_enabled: Option<bool>,
pub captcha_difficulty: Option<String>,
--- /dev/null
+alter table local_site add column federation_strict_allowlist bool default true not null;
+alter table local_site add column federation_http_fetch_retry_limit int not null default 25;
--- /dev/null
+alter table local_site drop column federation_strict_allowlist;
+alter table local_site drop column federation_http_fetch_retry_limit;