From: Felix Ableitner Date: Tue, 16 Jun 2020 10:49:51 +0000 (+0200) Subject: Rename "instance_whitelist" config option to "allowed_instances" X-Git-Url: http://these/git/%7B%60%24%7BarchiveTodayUrl%7D/%22%7Bauthor_url%7D/%22%7Burl%7D/%22?a=commitdiff_plain;h=325ed2ec3b2c6266de7af32a6d1fec74808f1cb7;p=lemmy.git Rename "instance_whitelist" config option to "allowed_instances" --- diff --git a/docker/federation/docker-compose.yml b/docker/federation/docker-compose.yml index 3f986a81..4379eb38 100644 --- a/docker/federation/docker-compose.yml +++ b/docker/federation/docker-compose.yml @@ -29,7 +29,7 @@ services: - LEMMY_FRONT_END_DIR=/app/dist - LEMMY_FEDERATION__ENABLED=true - LEMMY_FEDERATION__TLS_ENABLED=false - - LEMMY_FEDERATION__INSTANCE_WHITELIST=lemmy_beta,lemmy_gamma + - LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy_beta,lemmy_gamma - LEMMY_PORT=8540 - LEMMY_SETUP__ADMIN_USERNAME=lemmy_alpha - LEMMY_SETUP__ADMIN_PASSWORD=lemmy @@ -63,7 +63,7 @@ services: - LEMMY_FRONT_END_DIR=/app/dist - LEMMY_FEDERATION__ENABLED=true - LEMMY_FEDERATION__TLS_ENABLED=false - - LEMMY_FEDERATION__INSTANCE_WHITELIST=lemmy_alpha,lemmy_gamma + - LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy_alpha,lemmy_gamma - LEMMY_PORT=8550 - LEMMY_SETUP__ADMIN_USERNAME=lemmy_beta - LEMMY_SETUP__ADMIN_PASSWORD=lemmy @@ -97,7 +97,7 @@ services: - LEMMY_FRONT_END_DIR=/app/dist - LEMMY_FEDERATION__ENABLED=true - LEMMY_FEDERATION__TLS_ENABLED=false - - LEMMY_FEDERATION__INSTANCE_WHITELIST=lemmy_alpha,lemmy_beta + - LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy_alpha,lemmy_beta - LEMMY_PORT=8560 - LEMMY_SETUP__ADMIN_USERNAME=lemmy_gamma - LEMMY_SETUP__ADMIN_PASSWORD=lemmy diff --git a/docs/src/contributing_federation_development.md b/docs/src/contributing_federation_development.md index 80567e60..520a6127 100644 --- a/docs/src/contributing_federation_development.md +++ b/docs/src/contributing_federation_development.md @@ -47,7 +47,7 @@ Follow the normal installation instructions, either with [Ansible](administratio ``` federation: { enabled: true - instance_whitelist: example.com + allowed_instances: example.com } ``` diff --git a/server/config/defaults.hjson b/server/config/defaults.hjson index 09db4c02..61951321 100644 --- a/server/config/defaults.hjson +++ b/server/config/defaults.hjson @@ -57,7 +57,7 @@ # whether tls is required for activitypub. only disable this for debugging, never for producion. tls_enabled: true # comma seperated list of instances with which federation is allowed - instance_whitelist: "" + allowed_instances: "" } # # email sending configuration # email: { diff --git a/server/src/apub/mod.rs b/server/src/apub/mod.rs index 93f50754..6a2d6cff 100644 --- a/server/src/apub/mod.rs +++ b/server/src/apub/mod.rs @@ -99,20 +99,20 @@ pub fn get_apub_protocol_string() -> &'static str { } } -// Checks if the ID has a valid format, correct scheme, and is in the whitelist. +// Checks if the ID has a valid format, correct scheme, and is in the allowed instance list. fn is_apub_id_valid(apub_id: &Url) -> bool { if apub_id.scheme() != get_apub_protocol_string() { return false; } - let whitelist: Vec = Settings::get() + let allowed_instances: Vec = Settings::get() .federation - .instance_whitelist + .allowed_instances .split(',') .map(|d| d.to_string()) .collect(); match apub_id.domain() { - Some(d) => whitelist.contains(&d.to_owned()), + Some(d) => allowed_instances.contains(&d.to_owned()), None => false, } } diff --git a/server/src/settings.rs b/server/src/settings.rs index e1ac759c..b3173457 100644 --- a/server/src/settings.rs +++ b/server/src/settings.rs @@ -61,7 +61,7 @@ pub struct Database { pub struct Federation { pub enabled: bool, pub tls_enabled: bool, - pub instance_whitelist: String, + pub allowed_instances: String, } lazy_static! {