From 985359918f43234892f83d4b1de3116252cc9199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93liver=20Garc=C3=ADa=20Albertos?= <3skuero@gmail.com> Date: Thu, 22 Jun 2023 08:34:51 +0100 Subject: [PATCH 1/7] logger: Use forwarded instead of peer IP address (#3223) --- src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 1bc00f70c..f6ca79540 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -165,7 +165,10 @@ pub async fn start_lemmy_server() -> Result<(), LemmyError> { }; App::new() - .wrap(middleware::Logger::default()) + .wrap(middleware::Logger::new( + // This is the default log format save for the usage of %{r}a over %a to guarantee to record the client's (forwarded) IP and not the last peer address, since the latter is frequently just a reverse proxy + "%{r}a '%r' %s %b '%{Referer}i' '%{User-Agent}i' %T", + )) .wrap(cors_config) .wrap(TracingLogger::::new()) .app_data(Data::new(context)) From 862ceefc56da2594c6d18956d01fe707a7a4fd29 Mon Sep 17 00:00:00 2001 From: ShittyKopper <106974765+ShittyKopper@users.noreply.github.com> Date: Thu, 22 Jun 2023 11:22:15 +0300 Subject: [PATCH 2/7] docker-compose: Add init to UI (#3248) * docker-compose: Add init to UI Prevents waiting 10 seconds to shutdown * docker-compose: Update to version 3.7 --- docker/docker-compose.yml | 3 ++- docker/federation/docker-compose.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index b3b3b8b38..2846f547a 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,4 +1,4 @@ -version: "3.3" +version: "3.7" x-logging: &default-logging driver: "json-file" @@ -80,6 +80,7 @@ services: - lemmy restart: always logging: *default-logging + init: true pictrs: image: asonix/pictrs:0.4.0-beta.19 diff --git a/docker/federation/docker-compose.yml b/docker/federation/docker-compose.yml index 49049e083..569f264c4 100644 --- a/docker/federation/docker-compose.yml +++ b/docker/federation/docker-compose.yml @@ -1,6 +1,7 @@ -version: "3.3" +version: "3.7" x-ui-default: &ui-default + init: true image: dessalines/lemmy-ui:0.17.3 # assuming lemmy-ui is cloned besides lemmy directory # build: From 434beadb58ebe0ffbeab87a6205caccab4acdacf Mon Sep 17 00:00:00 2001 From: Nutomic Date: Thu, 22 Jun 2023 13:46:07 +0200 Subject: [PATCH 3/7] Use Rust 1.70 for Docker and CI (#3265) --- .woodpecker.yml | 2 +- docker/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 488ec9b3b..c2f6505c9 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -2,7 +2,7 @@ # See https://github.com/woodpecker-ci/woodpecker/issues/1677 variables: - - &muslrust_image "clux/muslrust:1.67.0" + - &muslrust_image "clux/muslrust:1.70.0" # Broken for cron jobs currently, see # https://github.com/woodpecker-ci/woodpecker/issues/1716 diff --git a/docker/Dockerfile b/docker/Dockerfile index 429379031..5943e1710 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM clux/muslrust:1.67.0 as builder +FROM clux/muslrust:1.70.0 as builder WORKDIR /app ARG CARGO_BUILD_TARGET=x86_64-unknown-linux-musl From 08e25d0e63e20849b35beb09627597a44fe09425 Mon Sep 17 00:00:00 2001 From: Nutomic Date: Thu, 22 Jun 2023 13:46:37 +0200 Subject: [PATCH 4/7] Remove translation part from docs links (#3260) Co-authored-by: Dessalines --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 30248e46a..f759c1cde 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@
Join Lemmy · - Documentation + Documentation · Matrix Chat · @@ -40,7 +40,7 @@ · Releases · - Code of Conduct + Code of Conduct

@@ -77,7 +77,7 @@ Each Lemmy server can set its own moderation policy; appointing site-wide admins - Open source, [AGPL License](/LICENSE). - Self hostable, easy to deploy. - - Comes with [Docker](https://join-lemmy.org/docs/en/administration/install_docker.html) and [Ansible](https://join-lemmy.org/docs/en/administration/install_ansible.html). + - Comes with [Docker](https://join-lemmy.org/docs/administration/install_docker.html) and [Ansible](https://join-lemmy.org/docs/administration/install_ansible.html). - Clean, mobile-friendly interface. - Only a minimum of a username and password is required to sign up! - User avatar support. @@ -111,8 +111,8 @@ Each Lemmy server can set its own moderation policy; appointing site-wide admins ## Installation -- [Docker](https://join-lemmy.org/docs/en/administration/install_docker.html) -- [Ansible](https://join-lemmy.org/docs/en/administration/install_ansible.html) +- [Docker](https://join-lemmy.org/docs/administration/install_docker.html) +- [Ansible](https://join-lemmy.org/docs/administration/install_ansible.html) ## Lemmy Projects @@ -154,9 +154,9 @@ Lemmy is free, open-source software, meaning no advertising, monetizing, or vent ## Contributing -- [Contributing instructions](https://join-lemmy.org/docs/en/contributors/01-overview.html) -- [Docker Development](https://join-lemmy.org/docs/en/contributors/03-docker-development.html) -- [Local Development](https://join-lemmy.org/docs/en/contributors/02-local-development.html) +- [Contributing instructions](https://join-lemmy.org/docs/contributors/01-overview.html) +- [Docker Development](https://join-lemmy.org/docs/contributors/03-docker-development.html) +- [Local Development](https://join-lemmy.org/docs/contributors/02-local-development.html) ### Translations From 4f2fb68d6b469e7a531d9537a79c82d6c2202245 Mon Sep 17 00:00:00 2001 From: kartikynwa Date: Thu, 22 Jun 2023 17:22:31 +0530 Subject: [PATCH 5/7] Add migration to mark local communities as such (#3257) --- .../down.sql | 2 ++ .../up.sql | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 migrations/2023-06-22-051755_fix_local_communities_marked_non_local/down.sql create mode 100644 migrations/2023-06-22-051755_fix_local_communities_marked_non_local/up.sql diff --git a/migrations/2023-06-22-051755_fix_local_communities_marked_non_local/down.sql b/migrations/2023-06-22-051755_fix_local_communities_marked_non_local/down.sql new file mode 100644 index 000000000..ae8c4c786 --- /dev/null +++ b/migrations/2023-06-22-051755_fix_local_communities_marked_non_local/down.sql @@ -0,0 +1,2 @@ +-- Add a no-op statement to prevent `diesel migration redo` errors +SELECT 1; diff --git a/migrations/2023-06-22-051755_fix_local_communities_marked_non_local/up.sql b/migrations/2023-06-22-051755_fix_local_communities_marked_non_local/up.sql new file mode 100644 index 000000000..cbe3be9e5 --- /dev/null +++ b/migrations/2023-06-22-051755_fix_local_communities_marked_non_local/up.sql @@ -0,0 +1,5 @@ +update community c +set local=true +from local_site ls + join site s on ls.site_id=s.id +where c.instance_id=s.instance_id and not c.local; From ffce66abb89a33d93f653b64946cc0fc75cceff2 Mon Sep 17 00:00:00 2001 From: Nutomic Date: Thu, 22 Jun 2023 14:35:12 +0200 Subject: [PATCH 6/7] Update apub library to 0.4.4 (#3258) Co-authored-by: Dessalines --- Cargo.lock | 71 ++-------------------------------- Cargo.toml | 2 +- crates/apub/src/objects/mod.rs | 1 + src/lib.rs | 26 +++++++------ 4 files changed, 19 insertions(+), 81 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f769fa501..7c0119520 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,15 +14,14 @@ dependencies = [ [[package]] name = "activitypub_federation" -version = "0.4.1" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f85cab86a72489b908adfeec61a4f104124b01784b9a5bb721c988727c363dad" +checksum = "27540f6c4b72c91176610ed5279061a021387f972c7c6f42c41032b78a808267" dependencies = [ "activitystreams-kinds", "actix-web", "anyhow", "async-trait", - "background-jobs", "base64 0.21.2", "bytes", "chrono", @@ -46,6 +45,7 @@ dependencies = [ "serde_json", "sha2", "thiserror", + "tokio", "tracing", "url", ] @@ -418,15 +418,6 @@ dependencies = [ "syn 1.0.103", ] -[[package]] -name = "async-mutex" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e" -dependencies = [ - "event-listener", -] - [[package]] name = "async-stream" version = "0.3.3" @@ -602,56 +593,6 @@ dependencies = [ "tower-service", ] -[[package]] -name = "background-jobs" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793a813f9145c5f3a27b8dcd834c0927de68bbd60d53a369e5894f3cc5759020" -dependencies = [ - "background-jobs-actix", - "background-jobs-core", -] - -[[package]] -name = "background-jobs-actix" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8660626a2d8781b50cbe0e3b63d8e2a7e08a90e80fa2bca8e8cc19deff72ebf4" -dependencies = [ - "actix-rt", - "anyhow", - "async-mutex", - "async-trait", - "background-jobs-core", - "num_cpus", - "serde", - "serde_json", - "thiserror", - "tokio", - "tracing", - "tracing-futures", - "uuid", -] - -[[package]] -name = "background-jobs-core" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e78e842fe2ae461319e3d1843c12e301630e65650332b02032ac70b0dfc66f" -dependencies = [ - "actix-rt", - "anyhow", - "async-trait", - "event-listener", - "serde", - "serde_json", - "thiserror", - "time 0.3.15", - "tracing", - "tracing-futures", - "uuid", -] - [[package]] name = "backtrace" version = "0.3.67" @@ -1762,12 +1703,6 @@ dependencies = [ "libc", ] -[[package]] -name = "event-listener" -version = "2.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" - [[package]] name = "eyre" version = "0.6.8" diff --git a/Cargo.toml b/Cargo.toml index 14398c5ff..bbeae05e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -59,7 +59,7 @@ lemmy_routes = { version = "=0.18.0-rc.5", path = "./crates/routes" } lemmy_db_views = { version = "=0.18.0-rc.5", path = "./crates/db_views" } lemmy_db_views_actor = { version = "=0.18.0-rc.5", path = "./crates/db_views_actor" } lemmy_db_views_moderator = { version = "=0.18.0-rc.5", path = "./crates/db_views_moderator" } -activitypub_federation = { version = "0.4.1", default-features = false, features = ["actix-web"] } +activitypub_federation = { version = "0.4.4", default-features = false, features = ["actix-web"] } diesel = "2.1.0" diesel_migrations = "2.1.0" diesel-async = "0.3.1" diff --git a/crates/apub/src/objects/mod.rs b/crates/apub/src/objects/mod.rs index 5d133e9b8..b204efb08 100644 --- a/crates/apub/src/objects/mod.rs +++ b/crates/apub/src/objects/mod.rs @@ -106,6 +106,7 @@ pub(crate) mod tests { .domain("example.com") .app_data(context) .build() + .await .unwrap(); config.to_request_data() } diff --git a/src/lib.rs b/src/lib.rs index f6ca79540..86cf400b6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -139,21 +139,23 @@ pub async fn start_lemmy_server() -> Result<(), LemmyError> { }); } + let federation_config = FederationConfig::builder() + .domain(settings.hostname.clone()) + .app_data(context.clone()) + .client(client.clone()) + .http_fetch_limit(FEDERATION_HTTP_FETCH_LIMIT) + .worker_count(local_site.federation_worker_count as usize) + .debug(cfg!(debug_assertions)) + .http_signature_compat(true) + .url_verifier(Box::new(VerifyUrlData(context.pool().clone()))) + .build() + .await + .expect("configure federation"); + // Create Http server with websocket support let settings_bind = settings.clone(); HttpServer::new(move || { let context = context.clone(); - let federation_config = FederationConfig::builder() - .domain(settings.hostname.clone()) - .app_data(context.clone()) - .client(client.clone()) - .http_fetch_limit(FEDERATION_HTTP_FETCH_LIMIT) - .worker_count(local_site.federation_worker_count as u64) - .debug(cfg!(debug_assertions)) - .http_signature_compat(true) - .url_verifier(Box::new(VerifyUrlData(context.pool().clone()))) - .build() - .expect("configure federation"); let cors_config = if cfg!(debug_assertions) { Cors::permissive() @@ -173,7 +175,7 @@ pub async fn start_lemmy_server() -> Result<(), LemmyError> { .wrap(TracingLogger::::new()) .app_data(Data::new(context)) .app_data(Data::new(rate_limit_cell.clone())) - .wrap(FederationMiddleware::new(federation_config)) + .wrap(FederationMiddleware::new(federation_config.clone())) // The routes .configure(|cfg| api_routes_http::config(cfg, rate_limit_cell)) .configure(|cfg| { From 60baebcb144126c7a155ef912aa4f9f4921633fc Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 22 Jun 2023 08:55:08 -0400 Subject: [PATCH 7/7] Version 0.18.0-rc.6 --- Cargo.lock | 22 +++++++++++----------- Cargo.toml | 22 +++++++++++----------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7c0119520..cee02f798 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2518,7 +2518,7 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "lemmy_api" -version = "0.18.0-rc.5" +version = "0.18.0-rc.6" dependencies = [ "actix-web", "anyhow", @@ -2541,7 +2541,7 @@ dependencies = [ [[package]] name = "lemmy_api_common" -version = "0.18.0-rc.5" +version = "0.18.0-rc.6" dependencies = [ "actix-rt", "actix-web", @@ -2570,7 +2570,7 @@ dependencies = [ [[package]] name = "lemmy_api_crud" -version = "0.18.0-rc.5" +version = "0.18.0-rc.6" dependencies = [ "activitypub_federation", "actix-web", @@ -2589,7 +2589,7 @@ dependencies = [ [[package]] name = "lemmy_apub" -version = "0.18.0-rc.5" +version = "0.18.0-rc.6" dependencies = [ "activitypub_federation", "actix-rt", @@ -2627,7 +2627,7 @@ dependencies = [ [[package]] name = "lemmy_db_schema" -version = "0.18.0-rc.5" +version = "0.18.0-rc.6" dependencies = [ "activitypub_federation", "async-trait", @@ -2659,7 +2659,7 @@ dependencies = [ [[package]] name = "lemmy_db_views" -version = "0.18.0-rc.5" +version = "0.18.0-rc.6" dependencies = [ "diesel", "diesel-async", @@ -2676,7 +2676,7 @@ dependencies = [ [[package]] name = "lemmy_db_views_actor" -version = "0.18.0-rc.5" +version = "0.18.0-rc.6" dependencies = [ "diesel", "diesel-async", @@ -2689,7 +2689,7 @@ dependencies = [ [[package]] name = "lemmy_db_views_moderator" -version = "0.18.0-rc.5" +version = "0.18.0-rc.6" dependencies = [ "diesel", "diesel-async", @@ -2701,7 +2701,7 @@ dependencies = [ [[package]] name = "lemmy_routes" -version = "0.18.0-rc.5" +version = "0.18.0-rc.6" dependencies = [ "activitypub_federation", "actix-web", @@ -2726,7 +2726,7 @@ dependencies = [ [[package]] name = "lemmy_server" -version = "0.18.0-rc.5" +version = "0.18.0-rc.6" dependencies = [ "activitypub_federation", "actix-cors", @@ -2763,7 +2763,7 @@ dependencies = [ [[package]] name = "lemmy_utils" -version = "0.18.0-rc.5" +version = "0.18.0-rc.6" dependencies = [ "actix-web", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index bbeae05e3..c05c1a57e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "0.18.0-rc.5" +version = "0.18.0-rc.6" edition = "2021" description = "A link aggregator for the fediverse" license = "AGPL-3.0" @@ -49,16 +49,16 @@ members = [ ] [workspace.dependencies] -lemmy_api = { version = "=0.18.0-rc.5", path = "./crates/api" } -lemmy_api_crud = { version = "=0.18.0-rc.5", path = "./crates/api_crud" } -lemmy_apub = { version = "=0.18.0-rc.5", path = "./crates/apub" } -lemmy_utils = { version = "=0.18.0-rc.5", path = "./crates/utils" } -lemmy_db_schema = { version = "=0.18.0-rc.5", path = "./crates/db_schema" } -lemmy_api_common = { version = "=0.18.0-rc.5", path = "./crates/api_common" } -lemmy_routes = { version = "=0.18.0-rc.5", path = "./crates/routes" } -lemmy_db_views = { version = "=0.18.0-rc.5", path = "./crates/db_views" } -lemmy_db_views_actor = { version = "=0.18.0-rc.5", path = "./crates/db_views_actor" } -lemmy_db_views_moderator = { version = "=0.18.0-rc.5", path = "./crates/db_views_moderator" } +lemmy_api = { version = "=0.18.0-rc.6", path = "./crates/api" } +lemmy_api_crud = { version = "=0.18.0-rc.6", path = "./crates/api_crud" } +lemmy_apub = { version = "=0.18.0-rc.6", path = "./crates/apub" } +lemmy_utils = { version = "=0.18.0-rc.6", path = "./crates/utils" } +lemmy_db_schema = { version = "=0.18.0-rc.6", path = "./crates/db_schema" } +lemmy_api_common = { version = "=0.18.0-rc.6", path = "./crates/api_common" } +lemmy_routes = { version = "=0.18.0-rc.6", path = "./crates/routes" } +lemmy_db_views = { version = "=0.18.0-rc.6", path = "./crates/db_views" } +lemmy_db_views_actor = { version = "=0.18.0-rc.6", path = "./crates/db_views_actor" } +lemmy_db_views_moderator = { version = "=0.18.0-rc.6", path = "./crates/db_views_moderator" } activitypub_federation = { version = "0.4.4", default-features = false, features = ["actix-web"] } diesel = "2.1.0" diesel_migrations = "2.1.0"