diff --git a/ansible/VERSION b/ansible/VERSION index cfdfa5f8a..207435bc0 100644 --- a/ansible/VERSION +++ b/ansible/VERSION @@ -1 +1 @@ -v0.7.47 +v0.7.49 diff --git a/ansible/templates/nginx.conf b/ansible/templates/nginx.conf index 092f85520..886ce0b78 100644 --- a/ansible/templates/nginx.conf +++ b/ansible/templates/nginx.conf @@ -51,9 +51,6 @@ server { # Upload limit for pictrs client_max_body_size 20M; - # Rate limit - limit_req zone=lemmy_ratelimit burst=30 nodelay; - location / { proxy_pass http://0.0.0.0:8536; proxy_set_header X-Real-IP $remote_addr; @@ -67,6 +64,9 @@ server { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; + + # Rate limit + limit_req zone=lemmy_ratelimit burst=30 nodelay; } # Redirect pictshare images to pictrs @@ -74,6 +74,14 @@ server { return 301 /pictrs/image/$1; } + # Separate location block to disable rate limiting for images + location /pictrs { + proxy_pass http://0.0.0.0:8536/pictrs; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + location /iframely/ { proxy_pass http://0.0.0.0:8061/; proxy_set_header X-Real-IP $remote_addr; diff --git a/docker/federation/run-federation-test.bash b/docker/federation/run-federation-test.bash index bc73fff63..77cc981f4 100755 --- a/docker/federation/run-federation-test.bash +++ b/docker/federation/run-federation-test.bash @@ -6,7 +6,7 @@ pushd ../../server/ || exit cargo build & popd || exit -if [ "$1" = "-yarn" ]; then +if [ "$1" != "--no-yarn-build" ]; then pushd ../../ui/ || exit yarn yarn build diff --git a/docker/prod/docker-compose.yml b/docker/prod/docker-compose.yml index d63b3d4b6..3ec778f47 100644 --- a/docker/prod/docker-compose.yml +++ b/docker/prod/docker-compose.yml @@ -12,7 +12,7 @@ services: restart: always lemmy: - image: dessalines/lemmy:v0.7.47 + image: dessalines/lemmy:v0.7.49 ports: - "127.0.0.1:8536:8536" restart: always diff --git a/docker/travis/docker_push.sh b/docker/travis/docker_push.sh index aa87bb723..9edd87242 100644 --- a/docker/travis/docker_push.sh +++ b/docker/travis/docker_push.sh @@ -1,5 +1,5 @@ #!/bin/sh echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin docker tag dessalines/lemmy:travis \ - dessalines/lemmy:v0.7.47 -docker push dessalines/lemmy:v0.7.47 + dessalines/lemmy:v0.7.49 +docker push dessalines/lemmy:v0.7.49 diff --git a/server/lemmy_utils/src/settings.rs b/server/lemmy_utils/src/settings.rs index 8e5da6acb..16fd424cb 100644 --- a/server/lemmy_utils/src/settings.rs +++ b/server/lemmy_utils/src/settings.rs @@ -129,6 +129,20 @@ impl Settings { fs::read_to_string(CONFIG_FILE) } + pub fn get_allowed_instances(&self) -> Vec { + let mut allowed_instances: Vec = self + .federation + .allowed_instances + .split(',') + .map(|d| d.to_string()) + .collect(); + + // The defaults.hjson config always returns a [""] + allowed_instances.retain(|d| !d.eq("")); + + allowed_instances + } + pub fn save_config_file(data: &str) -> Result { fs::write(CONFIG_FILE, data)?; diff --git a/server/src/api/site.rs b/server/src/api/site.rs index dcbd62167..515c3e5be 100644 --- a/server/src/api/site.rs +++ b/server/src/api/site.rs @@ -130,6 +130,7 @@ pub struct GetSiteResponse { pub online: usize, version: String, my_user: Option, + federated_instances: Vec, } #[derive(Serialize, Deserialize)] @@ -433,6 +434,7 @@ impl Perform for Oper { online, version: version::VERSION.to_string(), my_user, + federated_instances: Settings::get().get_allowed_instances(), }) } } @@ -659,6 +661,7 @@ impl Perform for Oper { online: 0, version: version::VERSION.to_string(), my_user: Some(user), + federated_instances: Settings::get().get_allowed_instances(), }) } } diff --git a/server/src/apub/mod.rs b/server/src/apub/mod.rs index f67471982..491762680 100644 --- a/server/src/apub/mod.rs +++ b/server/src/apub/mod.rs @@ -76,12 +76,8 @@ fn check_is_apub_id_valid(apub_id: &Url) -> Result<(), LemmyError> { return Err(anyhow!("invalid apub id scheme: {:?}", apub_id.scheme()).into()); } - let mut allowed_instances: Vec = Settings::get() - .federation - .allowed_instances - .split(',') - .map(|d| d.to_string()) - .collect(); + let mut allowed_instances: Vec = Settings::get().get_allowed_instances(); + // need to allow this explicitly because apub activities might contain objects from our local // instance. replace is needed to remove the port in our federation test setup. let settings = Settings::get(); diff --git a/server/src/routes/index.rs b/server/src/routes/index.rs index b579a1958..88a36c398 100644 --- a/server/src/routes/index.rs +++ b/server/src/routes/index.rs @@ -40,7 +40,8 @@ pub fn config(cfg: &mut web::ServiceConfig) { ) .route("/search", web::get().to(index)) .route("/sponsors", web::get().to(index)) - .route("/password_change/{token}", web::get().to(index)); + .route("/password_change/{token}", web::get().to(index)) + .route("/instances", web::get().to(index)); } async fn index() -> Result { diff --git a/server/src/version.rs b/server/src/version.rs index e2bdf3b23..d09ba7474 100644 --- a/server/src/version.rs +++ b/server/src/version.rs @@ -1 +1 @@ -pub const VERSION: &str = "v0.7.47"; +pub const VERSION: &str = "v0.7.49"; diff --git a/ui/src/components/admin-settings.tsx b/ui/src/components/admin-settings.tsx index 8157d4a3a..fe50b1e94 100644 --- a/ui/src/components/admin-settings.tsx +++ b/ui/src/components/admin-settings.tsx @@ -48,6 +48,7 @@ export class AdminSettings extends Component { banned: [], online: null, version: null, + federated_instances: null, }, siteConfigForm: { config_hjson: null, diff --git a/ui/src/components/footer.tsx b/ui/src/components/footer.tsx index e911370fa..6e7acb7a0 100644 --- a/ui/src/components/footer.tsx +++ b/ui/src/components/footer.tsx @@ -51,6 +51,11 @@ export class Footer extends Component { {i18n.t('modlog')} +