From 325ed2ec3b2c6266de7af32a6d1fec74808f1cb7 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 16 Jun 2020 12:49:51 +0200 Subject: [PATCH] Rename "instance_whitelist" config option to "allowed_instances" --- docker/federation/docker-compose.yml | 6 +++--- docs/src/contributing_federation_development.md | 2 +- server/config/defaults.hjson | 2 +- server/src/apub/mod.rs | 8 ++++---- server/src/settings.rs | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docker/federation/docker-compose.yml b/docker/federation/docker-compose.yml index 3f986a814..4379eb386 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 80567e60f..520a61275 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 09db4c020..61951321e 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 93f50754f..6a2d6cffb 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 e1ac759c5..b3173457f 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! {