mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-01 16:51:21 +00:00
Rename "instance_whitelist" config option to "allowed_instances"
This commit is contained in:
parent
cfa40e482a
commit
325ed2ec3b
5 changed files with 10 additions and 10 deletions
6
docker/federation/docker-compose.yml
vendored
6
docker/federation/docker-compose.yml
vendored
|
@ -29,7 +29,7 @@ services:
|
||||||
- LEMMY_FRONT_END_DIR=/app/dist
|
- LEMMY_FRONT_END_DIR=/app/dist
|
||||||
- LEMMY_FEDERATION__ENABLED=true
|
- LEMMY_FEDERATION__ENABLED=true
|
||||||
- LEMMY_FEDERATION__TLS_ENABLED=false
|
- 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_PORT=8540
|
||||||
- LEMMY_SETUP__ADMIN_USERNAME=lemmy_alpha
|
- LEMMY_SETUP__ADMIN_USERNAME=lemmy_alpha
|
||||||
- LEMMY_SETUP__ADMIN_PASSWORD=lemmy
|
- LEMMY_SETUP__ADMIN_PASSWORD=lemmy
|
||||||
|
@ -63,7 +63,7 @@ services:
|
||||||
- LEMMY_FRONT_END_DIR=/app/dist
|
- LEMMY_FRONT_END_DIR=/app/dist
|
||||||
- LEMMY_FEDERATION__ENABLED=true
|
- LEMMY_FEDERATION__ENABLED=true
|
||||||
- LEMMY_FEDERATION__TLS_ENABLED=false
|
- 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_PORT=8550
|
||||||
- LEMMY_SETUP__ADMIN_USERNAME=lemmy_beta
|
- LEMMY_SETUP__ADMIN_USERNAME=lemmy_beta
|
||||||
- LEMMY_SETUP__ADMIN_PASSWORD=lemmy
|
- LEMMY_SETUP__ADMIN_PASSWORD=lemmy
|
||||||
|
@ -97,7 +97,7 @@ services:
|
||||||
- LEMMY_FRONT_END_DIR=/app/dist
|
- LEMMY_FRONT_END_DIR=/app/dist
|
||||||
- LEMMY_FEDERATION__ENABLED=true
|
- LEMMY_FEDERATION__ENABLED=true
|
||||||
- LEMMY_FEDERATION__TLS_ENABLED=false
|
- 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_PORT=8560
|
||||||
- LEMMY_SETUP__ADMIN_USERNAME=lemmy_gamma
|
- LEMMY_SETUP__ADMIN_USERNAME=lemmy_gamma
|
||||||
- LEMMY_SETUP__ADMIN_PASSWORD=lemmy
|
- LEMMY_SETUP__ADMIN_PASSWORD=lemmy
|
||||||
|
|
|
@ -47,7 +47,7 @@ Follow the normal installation instructions, either with [Ansible](administratio
|
||||||
```
|
```
|
||||||
federation: {
|
federation: {
|
||||||
enabled: true
|
enabled: true
|
||||||
instance_whitelist: example.com
|
allowed_instances: example.com
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
2
server/config/defaults.hjson
vendored
2
server/config/defaults.hjson
vendored
|
@ -57,7 +57,7 @@
|
||||||
# whether tls is required for activitypub. only disable this for debugging, never for producion.
|
# whether tls is required for activitypub. only disable this for debugging, never for producion.
|
||||||
tls_enabled: true
|
tls_enabled: true
|
||||||
# comma seperated list of instances with which federation is allowed
|
# comma seperated list of instances with which federation is allowed
|
||||||
instance_whitelist: ""
|
allowed_instances: ""
|
||||||
}
|
}
|
||||||
# # email sending configuration
|
# # email sending configuration
|
||||||
# email: {
|
# email: {
|
||||||
|
|
|
@ -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 {
|
fn is_apub_id_valid(apub_id: &Url) -> bool {
|
||||||
if apub_id.scheme() != get_apub_protocol_string() {
|
if apub_id.scheme() != get_apub_protocol_string() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let whitelist: Vec<String> = Settings::get()
|
let allowed_instances: Vec<String> = Settings::get()
|
||||||
.federation
|
.federation
|
||||||
.instance_whitelist
|
.allowed_instances
|
||||||
.split(',')
|
.split(',')
|
||||||
.map(|d| d.to_string())
|
.map(|d| d.to_string())
|
||||||
.collect();
|
.collect();
|
||||||
match apub_id.domain() {
|
match apub_id.domain() {
|
||||||
Some(d) => whitelist.contains(&d.to_owned()),
|
Some(d) => allowed_instances.contains(&d.to_owned()),
|
||||||
None => false,
|
None => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ pub struct Database {
|
||||||
pub struct Federation {
|
pub struct Federation {
|
||||||
pub enabled: bool,
|
pub enabled: bool,
|
||||||
pub tls_enabled: bool,
|
pub tls_enabled: bool,
|
||||||
pub instance_whitelist: String,
|
pub allowed_instances: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
|
|
Loading…
Reference in a new issue