Merge branch 'main' into markdown-link-rule

markdown-link-rule
Felix Ableitner 2024-01-10 11:49:54 +01:00
commit 7e5e4557fa
36 changed files with 632 additions and 620 deletions

View File

@ -2,7 +2,7 @@
# See https://github.com/woodpecker-ci/woodpecker/issues/1677 # See https://github.com/woodpecker-ci/woodpecker/issues/1677
variables: variables:
- &rust_image "rust:1.74.0" - &rust_image "rust:1.75"
- &slow_check_paths - &slow_check_paths
- path: - path:
# rust source code # rust source code
@ -100,6 +100,9 @@ steps:
region: us-east-1 region: us-east-1
cache_key: "rust-cache" cache_key: "rust-cache"
path-style: true path-style: true
backend_operation_timeout: 30m
compression_level: 0
exit_code: true
mount: mount:
- ".cargo_home" - ".cargo_home"
- "target" - "target"
@ -226,6 +229,9 @@ steps:
cache_key: "rust-cache" cache_key: "rust-cache"
region: us-east-1 region: us-east-1
path-style: true path-style: true
backend_operation_timeout: 60m
compression_level: 0
exit_code: true
mount: mount:
- ".cargo_home" - ".cargo_home"
- "target" - "target"

201
Cargo.lock generated
View File

@ -10,9 +10,9 @@ checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3"
[[package]] [[package]]
name = "activitypub_federation" name = "activitypub_federation"
version = "0.5.0-beta.6" version = "0.5.1-beta.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e0aafb8ad437a019bac2e11d47fad6131974dace1855640a09d0e71d26571c1" checksum = "866db431760d14a7360f12e75ad48f3265b5b89cd2303e548a02bcc8983e4fcd"
dependencies = [ dependencies = [
"activitystreams-kinds", "activitystreams-kinds",
"actix-web", "actix-web",
@ -106,9 +106,9 @@ dependencies = [
[[package]] [[package]]
name = "actix-http" name = "actix-http"
version = "3.4.0" version = "3.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a92ef85799cba03f76e4f7c10f533e66d87c9a7e7055f3391f09000ad8351bc9" checksum = "129d4c88e98860e1758c5de288d1632b07970a16d59bdf7b8d66053d582bb71f"
dependencies = [ dependencies = [
"actix-codec", "actix-codec",
"actix-rt", "actix-rt",
@ -151,7 +151,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb"
dependencies = [ dependencies = [
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -261,9 +261,9 @@ dependencies = [
[[package]] [[package]]
name = "actix-web" name = "actix-web"
version = "4.4.0" version = "4.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e4a5b5e29603ca8c94a77c65cf874718ceb60292c5a5c3e5f4ace041af462b9" checksum = "e43428f3bf11dee6d166b00ec2df4e3aa8cc1606aaa0b7433c146852e2f4e03b"
dependencies = [ dependencies = [
"actix-codec", "actix-codec",
"actix-http", "actix-http",
@ -309,7 +309,7 @@ dependencies = [
"actix-router", "actix-router",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -527,18 +527,18 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
name = "async-trait" name = "async-trait"
version = "0.1.74" version = "0.1.77"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -911,7 +911,7 @@ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -1256,7 +1256,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"strsim", "strsim",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -1289,7 +1289,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5"
dependencies = [ dependencies = [
"darling_core 0.20.3", "darling_core 0.20.3",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -1454,7 +1454,7 @@ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -1465,7 +1465,7 @@ checksum = "c7267437d5b12df60ae29bd97f8d120f1c3a6272d6f213551afa56bbb2ecfbb7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -1477,7 +1477,7 @@ dependencies = [
"diesel_table_macro_syntax", "diesel_table_macro_syntax",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -1507,7 +1507,7 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5" checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5"
dependencies = [ dependencies = [
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -1699,7 +1699,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -1887,9 +1887,9 @@ dependencies = [
[[package]] [[package]]
name = "futures" name = "futures"
version = "0.3.29" version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0"
dependencies = [ dependencies = [
"futures-channel", "futures-channel",
"futures-core", "futures-core",
@ -1902,9 +1902,9 @@ dependencies = [
[[package]] [[package]]
name = "futures-channel" name = "futures-channel"
version = "0.3.29" version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-sink", "futures-sink",
@ -1912,15 +1912,15 @@ dependencies = [
[[package]] [[package]]
name = "futures-core" name = "futures-core"
version = "0.3.29" version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d"
[[package]] [[package]]
name = "futures-executor" name = "futures-executor"
version = "0.3.29" version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-task", "futures-task",
@ -1929,38 +1929,38 @@ dependencies = [
[[package]] [[package]]
name = "futures-io" name = "futures-io"
version = "0.3.29" version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1"
[[package]] [[package]]
name = "futures-macro" name = "futures-macro"
version = "0.3.29" version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
name = "futures-sink" name = "futures-sink"
version = "0.3.29" version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5"
[[package]] [[package]]
name = "futures-task" name = "futures-task"
version = "0.3.29" version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004"
[[package]] [[package]]
name = "futures-util" name = "futures-util"
version = "0.3.29" version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48"
dependencies = [ dependencies = [
"futures-channel", "futures-channel",
"futures-core", "futures-core",
@ -2529,7 +2529,7 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "lemmy_api" name = "lemmy_api"
version = "0.19.1-rc.2" version = "0.19.2-rc.5"
dependencies = [ dependencies = [
"activitypub_federation", "activitypub_federation",
"actix-web", "actix-web",
@ -2558,7 +2558,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_api_common" name = "lemmy_api_common"
version = "0.19.1-rc.2" version = "0.19.2-rc.5"
dependencies = [ dependencies = [
"activitypub_federation", "activitypub_federation",
"actix-web", "actix-web",
@ -2598,7 +2598,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_api_crud" name = "lemmy_api_crud"
version = "0.19.1-rc.2" version = "0.19.2-rc.5"
dependencies = [ dependencies = [
"activitypub_federation", "activitypub_federation",
"actix-web", "actix-web",
@ -2620,7 +2620,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_apub" name = "lemmy_apub"
version = "0.19.1-rc.2" version = "0.19.2-rc.5"
dependencies = [ dependencies = [
"activitypub_federation", "activitypub_federation",
"actix-web", "actix-web",
@ -2658,7 +2658,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_db_schema" name = "lemmy_db_schema"
version = "0.19.1-rc.2" version = "0.19.2-rc.5"
dependencies = [ dependencies = [
"activitypub_federation", "activitypub_federation",
"async-trait", "async-trait",
@ -2695,7 +2695,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_db_views" name = "lemmy_db_views"
version = "0.19.1-rc.2" version = "0.19.2-rc.5"
dependencies = [ dependencies = [
"actix-web", "actix-web",
"chrono", "chrono",
@ -2715,7 +2715,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_db_views_actor" name = "lemmy_db_views_actor"
version = "0.19.1-rc.2" version = "0.19.2-rc.5"
dependencies = [ dependencies = [
"chrono", "chrono",
"diesel", "diesel",
@ -2733,7 +2733,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_db_views_moderator" name = "lemmy_db_views_moderator"
version = "0.19.1-rc.2" version = "0.19.2-rc.5"
dependencies = [ dependencies = [
"diesel", "diesel",
"diesel-async", "diesel-async",
@ -2745,7 +2745,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_federate" name = "lemmy_federate"
version = "0.19.1-rc.2" version = "0.19.2-rc.5"
dependencies = [ dependencies = [
"activitypub_federation", "activitypub_federation",
"anyhow", "anyhow",
@ -2768,7 +2768,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_routes" name = "lemmy_routes"
version = "0.19.1-rc.2" version = "0.19.2-rc.5"
dependencies = [ dependencies = [
"activitypub_federation", "activitypub_federation",
"actix-web", "actix-web",
@ -2793,7 +2793,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_server" name = "lemmy_server"
version = "0.19.1-rc.2" version = "0.19.2-rc.5"
dependencies = [ dependencies = [
"activitypub_federation", "activitypub_federation",
"actix-cors", "actix-cors",
@ -2836,7 +2836,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_utils" name = "lemmy_utils"
version = "0.19.1-rc.2" version = "0.19.2-rc.5"
dependencies = [ dependencies = [
"actix-web", "actix-web",
"anyhow", "anyhow",
@ -3145,7 +3145,7 @@ checksum = "ddece26afd34c31585c74a4db0630c376df271c285d682d1e55012197830b6df"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -3230,9 +3230,9 @@ dependencies = [
[[package]] [[package]]
name = "moka" name = "moka"
version = "0.12.1" version = "0.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8017ec3548ffe7d4cef7ac0e12b044c01164a74c0f3119420faeaf13490ad8b" checksum = "f353abec74660d4b8533c2516c86eb062f1ec8ca49a2758f4f2b1b60b06b0c6e"
dependencies = [ dependencies = [
"async-lock", "async-lock",
"async-trait", "async-trait",
@ -3385,9 +3385,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]] [[package]]
name = "openssl" name = "openssl"
version = "0.10.61" version = "0.10.62"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b8419dc8cc6d866deb801274bba2e6f8f6108c1bb7fcc10ee5ab864931dbb45" checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671"
dependencies = [ dependencies = [
"bitflags 2.4.1", "bitflags 2.4.1",
"cfg-if", "cfg-if",
@ -3406,7 +3406,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -3417,9 +3417,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]] [[package]]
name = "openssl-sys" name = "openssl-sys"
version = "0.9.97" version = "0.9.98"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3eaad34cdd97d81de97964fc7f29e2d104f483840d906ef56daa1912338460b" checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7"
dependencies = [ dependencies = [
"cc", "cc",
"libc", "libc",
@ -3832,7 +3832,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -3972,9 +3972,9 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.70" version = "1.0.75"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" checksum = "907a61bd0f64c2f29cd1cf1dc34d05176426a3f504a78010f08416ddb7b13708"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
@ -4052,7 +4052,7 @@ dependencies = [
"itertools 0.11.0", "itertools 0.11.0",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -4137,9 +4137,9 @@ dependencies = [
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.33" version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
@ -4197,7 +4197,7 @@ checksum = "b8f439da1766942fe069954da6058b2e6c1760eb878bae76f5be9fc29f56f574"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -4261,7 +4261,7 @@ dependencies = [
"quote", "quote",
"refinery-core", "refinery-core",
"regex", "regex",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -4316,9 +4316,9 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
[[package]] [[package]]
name = "reqwest" name = "reqwest"
version = "0.11.22" version = "0.11.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41"
dependencies = [ dependencies = [
"async-compression", "async-compression",
"base64 0.21.5", "base64 0.21.5",
@ -4698,9 +4698,9 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.193" version = "1.0.194"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" checksum = "0b114498256798c94a0689e1a15fec6005dee8ac1f41de56404b67afc2a4b773"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
@ -4716,20 +4716,20 @@ dependencies = [
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.193" version = "1.0.194"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" checksum = "a3385e45322e8f9931410f01b3031ec534c3947d0e94c18049af4d9f9907d4e0"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.108" version = "1.0.111"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4"
dependencies = [ dependencies = [
"indexmap 2.1.0", "indexmap 2.1.0",
"itoa", "itoa",
@ -4793,7 +4793,7 @@ dependencies = [
"darling 0.20.3", "darling 0.20.3",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -4818,7 +4818,7 @@ checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -4961,7 +4961,7 @@ checksum = "0eb01866308440fc64d6c44d9e86c5cc17adfe33c4d6eed55da9145044d0ffc1"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -5093,7 +5093,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"rustversion", "rustversion",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -5115,9 +5115,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.40" version = "2.0.48"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13fa70a4ee923979ffb522cacce59d34421ebdea5625e1073c4326ef9d2dd42e" checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -5222,22 +5222,22 @@ dependencies = [
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.50" version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.50" version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -5302,9 +5302,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.35.0" version = "1.35.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "841d45b238a16291a4e1584e61820b8ae57d696cc5015c459c229ccc6990cc1c" checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104"
dependencies = [ dependencies = [
"backtrace", "backtrace",
"bytes", "bytes",
@ -5338,7 +5338,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -5675,7 +5675,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -5838,7 +5838,7 @@ dependencies = [
"Inflector", "Inflector",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
"termcolor", "termcolor",
] ]
@ -5859,7 +5859,7 @@ checksum = "29a3151c41d0b13e3d011f98adc24434560ef06673a155a6c7f66b9879eecce2"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -6039,7 +6039,7 @@ dependencies = [
"once_cell", "once_cell",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -6073,7 +6073,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -6494,7 +6494,7 @@ checksum = "be912bf68235a88fbefd1b73415cb218405958d1655b2ece9035a19920bdf6ba"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.40", "syn 2.0.48",
] ]
[[package]] [[package]]
@ -6505,20 +6505,19 @@ checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d"
[[package]] [[package]]
name = "zstd" name = "zstd"
version = "0.12.4" version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" checksum = "bffb3309596d527cfcba7dfc6ed6052f1d39dfbd7c867aa2e865e4a449c10110"
dependencies = [ dependencies = [
"zstd-safe", "zstd-safe",
] ]
[[package]] [[package]]
name = "zstd-safe" name = "zstd-safe"
version = "6.0.6" version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" checksum = "43747c7422e2924c11144d5229878b98180ef8b06cca4ab5af37afc8a8d8ea3e"
dependencies = [ dependencies = [
"libc",
"zstd-sys", "zstd-sys",
] ]

View File

@ -1,5 +1,5 @@
[workspace.package] [workspace.package]
version = "0.19.1-rc.2" version = "0.19.2-rc.5"
publish = false publish = false
edition = "2021" edition = "2021"
description = "A link aggregator for the fediverse" description = "A link aggregator for the fediverse"
@ -85,17 +85,17 @@ unused_self = "deny"
unwrap_used = "deny" unwrap_used = "deny"
[workspace.dependencies] [workspace.dependencies]
lemmy_api = { version = "=0.19.1-rc.2", path = "./crates/api" } lemmy_api = { version = "=0.19.2-rc.5", path = "./crates/api" }
lemmy_api_crud = { version = "=0.19.1-rc.2", path = "./crates/api_crud" } lemmy_api_crud = { version = "=0.19.2-rc.5", path = "./crates/api_crud" }
lemmy_apub = { version = "=0.19.1-rc.2", path = "./crates/apub" } lemmy_apub = { version = "=0.19.2-rc.5", path = "./crates/apub" }
lemmy_utils = { version = "=0.19.1-rc.2", path = "./crates/utils" } lemmy_utils = { version = "=0.19.2-rc.5", path = "./crates/utils" }
lemmy_db_schema = { version = "=0.19.1-rc.2", path = "./crates/db_schema" } lemmy_db_schema = { version = "=0.19.2-rc.5", path = "./crates/db_schema" }
lemmy_api_common = { version = "=0.19.1-rc.2", path = "./crates/api_common" } lemmy_api_common = { version = "=0.19.2-rc.5", path = "./crates/api_common" }
lemmy_routes = { version = "=0.19.1-rc.2", path = "./crates/routes" } lemmy_routes = { version = "=0.19.2-rc.5", path = "./crates/routes" }
lemmy_db_views = { version = "=0.19.1-rc.2", path = "./crates/db_views" } lemmy_db_views = { version = "=0.19.2-rc.5", path = "./crates/db_views" }
lemmy_db_views_actor = { version = "=0.19.1-rc.2", path = "./crates/db_views_actor" } lemmy_db_views_actor = { version = "=0.19.2-rc.5", path = "./crates/db_views_actor" }
lemmy_db_views_moderator = { version = "=0.19.1-rc.2", path = "./crates/db_views_moderator" } lemmy_db_views_moderator = { version = "=0.19.2-rc.5", path = "./crates/db_views_moderator" }
activitypub_federation = { version = "0.5.0-beta.6", default-features = false, features = [ activitypub_federation = { version = "0.5.1-beta.1", default-features = false, features = [
"actix-web", "actix-web",
] } ] }
diesel = "2.1.4" diesel = "2.1.4"
@ -166,7 +166,7 @@ lemmy_utils = { workspace = true }
lemmy_db_schema = { workspace = true } lemmy_db_schema = { workspace = true }
lemmy_api_common = { workspace = true } lemmy_api_common = { workspace = true }
lemmy_routes = { workspace = true } lemmy_routes = { workspace = true }
lemmy_federate = { version = "0.19.1-rc.2", path = "crates/federate" } lemmy_federate = { version = "0.19.2-rc.5", path = "crates/federate" }
activitypub_federation = { workspace = true } activitypub_federation = { workspace = true }
diesel = { workspace = true } diesel = { workspace = true }
diesel-async = { workspace = true } diesel-async = { workspace = true }

View File

@ -31,6 +31,7 @@ import {
searchPostLocal, searchPostLocal,
resolveBetaCommunity, resolveBetaCommunity,
longDelay, longDelay,
delay,
} from "./shared"; } from "./shared";
import { EditSite } from "lemmy-js-client"; import { EditSite } from "lemmy-js-client";
@ -377,7 +378,9 @@ test("User blocks instance, communities are hidden", async () => {
test("Community follower count is federated", async () => { test("Community follower count is federated", async () => {
// Follow the beta community from alpha // Follow the beta community from alpha
let resolved = await resolveBetaCommunity(alpha); let community = await createCommunity(beta);
let community_id = community.community_view.community.actor_id;
let resolved = await resolveCommunity(alpha, community_id);
if (!resolved.community) { if (!resolved.community) {
throw "Missing beta community"; throw "Missing beta community";
} }
@ -385,7 +388,7 @@ test("Community follower count is federated", async () => {
await followCommunity(alpha, true, resolved.community.community.id); await followCommunity(alpha, true, resolved.community.community.id);
let followed = ( let followed = (
await waitUntil( await waitUntil(
() => resolveBetaCommunity(alpha), () => resolveCommunity(alpha, community_id),
c => c.community?.subscribed === "Subscribed", c => c.community?.subscribed === "Subscribed",
) )
).community; ).community;
@ -394,7 +397,7 @@ test("Community follower count is federated", async () => {
expect(followed?.counts.subscribers).toBe(1); expect(followed?.counts.subscribers).toBe(1);
// Follow the community from gamma // Follow the community from gamma
resolved = await resolveBetaCommunity(gamma); resolved = await resolveCommunity(gamma, community_id);
if (!resolved.community) { if (!resolved.community) {
throw "Missing beta community"; throw "Missing beta community";
} }
@ -402,7 +405,7 @@ test("Community follower count is federated", async () => {
await followCommunity(gamma, true, resolved.community.community.id); await followCommunity(gamma, true, resolved.community.community.id);
followed = ( followed = (
await waitUntil( await waitUntil(
() => resolveBetaCommunity(gamma), () => resolveCommunity(gamma, community_id),
c => c.community?.subscribed === "Subscribed", c => c.community?.subscribed === "Subscribed",
) )
).community; ).community;
@ -411,7 +414,7 @@ test("Community follower count is federated", async () => {
expect(followed?.counts?.subscribers).toBe(2); expect(followed?.counts?.subscribers).toBe(2);
// Follow the community from delta // Follow the community from delta
resolved = await resolveBetaCommunity(delta); resolved = await resolveCommunity(delta, community_id);
if (!resolved.community) { if (!resolved.community) {
throw "Missing beta community"; throw "Missing beta community";
} }
@ -419,7 +422,7 @@ test("Community follower count is federated", async () => {
await followCommunity(delta, true, resolved.community.community.id); await followCommunity(delta, true, resolved.community.community.id);
followed = ( followed = (
await waitUntil( await waitUntil(
() => resolveBetaCommunity(delta), () => resolveCommunity(delta, community_id),
c => c.community?.subscribed === "Subscribed", c => c.community?.subscribed === "Subscribed",
) )
).community; ).community;
@ -480,3 +483,31 @@ test("Dont receive community activities after unsubscribe", async () => {
let postResBeta = searchPostLocal(beta, postRes.post_view.post); let postResBeta = searchPostLocal(beta, postRes.post_view.post);
expect((await postResBeta).posts.length).toBe(0); expect((await postResBeta).posts.length).toBe(0);
}); });
test("Fetch community, includes posts", async () => {
let communityRes = await createCommunity(alpha);
expect(communityRes.community_view.community.name).toBeDefined();
expect(communityRes.community_view.counts.subscribers).toBe(1);
let postRes = await createPost(
alpha,
communityRes.community_view.community.id,
);
expect(postRes.post_view.post).toBeDefined();
let resolvedCommunity = await waitUntil(
() =>
resolveCommunity(beta, communityRes.community_view.community.actor_id),
c => c.community?.community.id != undefined,
);
let betaCommunity = resolvedCommunity.community;
expect(betaCommunity?.community.actor_id).toBe(
communityRes.community_view.community.actor_id,
);
await longDelay();
let post_listing = await getPosts(beta, "All", betaCommunity?.community.id);
expect(post_listing.posts.length).toBe(1);
expect(post_listing.posts[0].post.ap_id).toBe(postRes.post_view.post.ap_id);
});

View File

@ -798,10 +798,12 @@ export async function listCommentReports(
export function getPosts( export function getPosts(
api: LemmyHttp, api: LemmyHttp,
listingType?: ListingType, listingType?: ListingType,
community_id?: number,
): Promise<GetPostsResponse> { ): Promise<GetPostsResponse> {
let form: GetPosts = { let form: GetPosts = {
type_: listingType, type_: listingType,
limit: 50, limit: 50,
community_id,
}; };
return api.getPosts(form); return api.getPosts(form);
} }

View File

@ -34,7 +34,7 @@
# Name of the postgres database for lemmy # Name of the postgres database for lemmy
database: "string" database: "string"
# Maximum number of active sql connections # Maximum number of active sql connections
pool_size: 95 pool_size: 30
} }
# Pictrs image server configuration. # Pictrs image server configuration.
pictrs: { pictrs: {

View File

@ -1,25 +0,0 @@
[
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1",
{
"lemmy": "https://join-lemmy.org/ns#",
"litepub": "http://litepub.social/ns#",
"pt": "https://joinpeertube.org/ns#",
"sc": "http://schema.org/",
"ChatMessage": "litepub:ChatMessage",
"commentsEnabled": "pt:commentsEnabled",
"sensitive": "as:sensitive",
"matrixUserId": "lemmy:matrixUserId",
"postingRestrictedToMods": "lemmy:postingRestrictedToMods",
"removeData": "lemmy:removeData",
"stickied": "lemmy:stickied",
"moderators": {
"@type": "@id",
"@id": "lemmy:moderators"
},
"expires": "as:endTime",
"distinguished": "lemmy:distinguished",
"language": "sc:inLanguage",
"identifier": "sc:identifier"
}
]

View File

@ -0,0 +1,13 @@
{
"@context": "https://www.w3.org/ns/activitystreams",
"id": "https://mastodon.example/ccb4f39a-506a-490e-9a8c-71831c7713a4",
"type": "Flag",
"actor": "https://mastodon.example/actor",
"content": "Please take a look at this user and their posts",
"object": [
"https://example.com/users/1",
"https://example.com/posts/380590",
"https://example.com/posts/380591"
],
"to": "https://example.com/users/1"
}

View File

@ -0,0 +1,12 @@
{
"@context": "https://www.w3.org/ns/activitystreams",
"id": "https://some-mbin.instance/f/object/2721ffc3-f8a9-417e-a124-af057434a3af#accept",
"type": "Accept",
"actor": "https://some-mbin.instance/m/someMag",
"object": {
"id": "https://some-other.instance/f/object/c51ea652-e594-4920-a989-f5350f0cec05",
"type": "Follow",
"actor": "https://some-other.instance/u/someUser",
"object": "https://some-mbin.instance/m/someMag"
}
}

View File

@ -0,0 +1,11 @@
{
"@context": ["https://www.w3.org/ns/activitystreams"],
"id": "https://mbin-test1/reports/45f8a01d-a73e-4575-bffa-c9f24c61f458",
"type": "Flag",
"actor": "https://mbin-test1/u/BentiGorlich",
"object": ["https://lemmy-test/post/4", "https://lemmy-test/u/BentiGorlich"],
"audience": "https://lemmy-test/c/test_mag",
"summary": "dikjhgasdpas dsaü",
"content": "dikjhgasdpas dsaü",
"to": ["https://lemmy-test/c/test_mag"]
}

View File

@ -2,7 +2,10 @@ use crate::{
activities::{generate_activity_id, send_lemmy_activity, verify_person_in_community}, activities::{generate_activity_id, send_lemmy_activity, verify_person_in_community},
insert_received_activity, insert_received_activity,
objects::{community::ApubCommunity, instance::ApubSite, person::ApubPerson}, objects::{community::ApubCommunity, instance::ApubSite, person::ApubPerson},
protocol::{activities::community::report::Report, InCommunity}, protocol::{
activities::community::report::{Report, ReportObject},
InCommunity,
},
PostOrComment, PostOrComment,
}; };
use activitypub_federation::{ use activitypub_federation::{
@ -45,8 +48,9 @@ impl Report {
let report = Report { let report = Report {
actor: actor.id().into(), actor: actor.id().into(),
to: [community.id().into()], to: [community.id().into()],
object: object_id.clone(), object: ReportObject::Lemmy(object_id.clone()),
summary: reason, summary: Some(reason),
content: None,
kind, kind,
id: id.clone(), id: id.clone(),
audience: Some(community.id().into()), audience: Some(community.id().into()),
@ -97,6 +101,7 @@ impl ActivityHandler for Report {
#[tracing::instrument(skip_all)] #[tracing::instrument(skip_all)]
async fn receive(self, context: &Data<Self::DataType>) -> Result<(), LemmyError> { async fn receive(self, context: &Data<Self::DataType>) -> Result<(), LemmyError> {
let actor = self.actor.dereference(context).await?; let actor = self.actor.dereference(context).await?;
let reason = self.reason()?;
match self.object.dereference(context).await? { match self.object.dereference(context).await? {
PostOrComment::Post(post) => { PostOrComment::Post(post) => {
let report_form = PostReportForm { let report_form = PostReportForm {
@ -104,7 +109,7 @@ impl ActivityHandler for Report {
post_id: post.id, post_id: post.id,
original_post_name: post.name.clone(), original_post_name: post.name.clone(),
original_post_url: post.url.clone(), original_post_url: post.url.clone(),
reason: self.summary.clone(), reason,
original_post_body: post.body.clone(), original_post_body: post.body.clone(),
}; };
PostReport::report(&mut context.pool(), &report_form).await?; PostReport::report(&mut context.pool(), &report_form).await?;
@ -114,7 +119,7 @@ impl ActivityHandler for Report {
creator_id: actor.id, creator_id: actor.id,
comment_id: comment.id, comment_id: comment.id,
original_comment_text: comment.content.clone(), original_comment_text: comment.content.clone(),
reason: self.summary.clone(), reason,
}; };
CommentReport::report(&mut context.pool(), &report_form).await?; CommentReport::report(&mut context.pool(), &report_form).await?;
} }

View File

@ -23,13 +23,11 @@ use crate::{
create_or_update::{note::CreateOrUpdateNote, page::CreateOrUpdatePage}, create_or_update::{note::CreateOrUpdateNote, page::CreateOrUpdatePage},
CreateOrUpdateType, CreateOrUpdateType,
}, },
CONTEXT,
}; };
use activitypub_federation::{ use activitypub_federation::{
config::Data, config::Data,
fetch::object_id::ObjectId, fetch::object_id::ObjectId,
kinds::{activity::AnnounceType, public}, kinds::{activity::AnnounceType, public},
protocol::context::WithContext,
traits::{ActivityHandler, Actor}, traits::{ActivityHandler, Actor},
}; };
use anyhow::anyhow; use anyhow::anyhow;
@ -44,7 +42,6 @@ use lemmy_db_schema::source::{
use lemmy_db_views_actor::structs::{CommunityPersonBanView, CommunityView}; use lemmy_db_views_actor::structs::{CommunityPersonBanView, CommunityView};
use lemmy_utils::error::{LemmyError, LemmyErrorExt, LemmyErrorType, LemmyResult}; use lemmy_utils::error::{LemmyError, LemmyErrorExt, LemmyErrorType, LemmyResult};
use serde::Serialize; use serde::Serialize;
use std::ops::Deref;
use tracing::info; use tracing::info;
use url::{ParseError, Url}; use url::{ParseError, Url};
use uuid::Uuid; use uuid::Uuid;
@ -204,7 +201,6 @@ where
Activity: ActivityHandler<Error = LemmyError>, Activity: ActivityHandler<Error = LemmyError>,
{ {
info!("Saving outgoing activity to queue {}", activity.id()); info!("Saving outgoing activity to queue {}", activity.id());
let activity = WithContext::new(activity, CONTEXT.deref().clone());
let form = SentActivityForm { let form = SentActivityForm {
ap_id: activity.id().clone().into(), ap_id: activity.id().clone().into(),

View File

@ -35,7 +35,7 @@ use url::Url;
/// This could theoretically be defined as an enum with variants `GroupInboxActivities` and /// This could theoretically be defined as an enum with variants `GroupInboxActivities` and
/// `PersonInboxActivities`. In practice we need to write it out manually so that priorities /// `PersonInboxActivities`. In practice we need to write it out manually so that priorities
/// are handled correctly. /// are handled correctly.
#[derive(Debug, Deserialize, Serialize)] #[derive(Debug, Deserialize, Serialize, Clone)]
#[serde(untagged)] #[serde(untagged)]
#[enum_delegate::implement(ActivityHandler)] #[enum_delegate::implement(ActivityHandler)]
pub enum SharedInboxActivities { pub enum SharedInboxActivities {

View File

@ -401,7 +401,7 @@ mod tests {
let mut backup = export_settings(export_user.clone(), context.reset_request_count()).await?; let mut backup = export_settings(export_user.clone(), context.reset_request_count()).await?;
for _ in 0..251 { for _ in 0..2501 {
backup backup
.followed_communities .followed_communities
.push("http://example.com".parse()?); .push("http://example.com".parse()?);

View File

@ -96,11 +96,15 @@ impl Collection for ApubCommunityOutbox {
// process items in parallel, to avoid long delay from fetch_site_metadata() and other processing // process items in parallel, to avoid long delay from fetch_site_metadata() and other processing
join_all(outbox_activities.into_iter().map(|activity| { join_all(outbox_activities.into_iter().map(|activity| {
async { async {
// use separate request counter for each item, otherwise there will be problems with // Receiving announce requires at least one local community follower for anti spam purposes.
// parallel processing // This won't be the case for newly fetched communities, so we extract the inner activity
let verify = activity.verify(data).await; // and handle it directly to bypass this check.
if verify.is_ok() { let inner = activity.object.object(data).await.map(TryInto::try_into);
activity.receive(data).await.ok(); if let Ok(Ok(AnnouncableActivities::CreateOrUpdatePost(inner))) = inner {
let verify = inner.verify(data).await;
if verify.is_ok() {
inner.receive(data).await.ok();
}
} }
} }
})) }))

View File

@ -2,7 +2,7 @@ use crate::{
activity_lists::SharedInboxActivities, activity_lists::SharedInboxActivities,
fetcher::user_or_community::UserOrCommunity, fetcher::user_or_community::UserOrCommunity,
protocol::objects::tombstone::Tombstone, protocol::objects::tombstone::Tombstone,
CONTEXT, FEDERATION_CONTEXT,
}; };
use activitypub_federation::{ use activitypub_federation::{
actix_web::inbox::receive_activity, actix_web::inbox::receive_activity,
@ -43,7 +43,7 @@ fn create_apub_response<T>(data: &T) -> LemmyResult<HttpResponse>
where where
T: Serialize, T: Serialize,
{ {
let json = serde_json::to_string_pretty(&WithContext::new(data, CONTEXT.clone()))?; let json = serde_json::to_string_pretty(&WithContext::new(data, FEDERATION_CONTEXT.clone()))?;
Ok( Ok(
HttpResponse::Ok() HttpResponse::Ok()
@ -54,7 +54,10 @@ where
fn create_apub_tombstone_response<T: Into<Url>>(id: T) -> LemmyResult<HttpResponse> { fn create_apub_tombstone_response<T: Into<Url>>(id: T) -> LemmyResult<HttpResponse> {
let tombstone = Tombstone::new(id.into()); let tombstone = Tombstone::new(id.into());
let json = serde_json::to_string_pretty(&WithContext::new(tombstone, CONTEXT.deref().clone()))?; let json = serde_json::to_string_pretty(&WithContext::new(
tombstone,
FEDERATION_CONTEXT.deref().clone(),
))?;
Ok( Ok(
HttpResponse::Gone() HttpResponse::Gone()
@ -96,13 +99,6 @@ pub(crate) async fn get_activity(
if sensitive { if sensitive {
Ok(HttpResponse::Forbidden().finish()) Ok(HttpResponse::Forbidden().finish())
} else { } else {
// Don't use create_apub_response() to avoid duplicate context (the activity stored in db create_apub_response(&activity.data)
// already includes context).
let json = serde_json::to_string_pretty(&activity.data)?;
Ok(
HttpResponse::Ok()
.content_type(FEDERATION_CONTENT_TYPE)
.body(json),
)
} }
} }

View File

@ -12,6 +12,7 @@ use lemmy_db_schema::{
use lemmy_utils::error::{LemmyError, LemmyErrorType, LemmyResult}; use lemmy_utils::error::{LemmyError, LemmyErrorType, LemmyResult};
use moka::future::Cache; use moka::future::Cache;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use serde_json::Value;
use std::{sync::Arc, time::Duration}; use std::{sync::Arc, time::Duration};
use url::Url; use url::Url;
@ -32,8 +33,14 @@ pub const FEDERATION_HTTP_FETCH_LIMIT: u32 = 50;
/// changes take effect quickly. /// changes take effect quickly.
const BLOCKLIST_CACHE_DURATION: Duration = Duration::from_secs(60); const BLOCKLIST_CACHE_DURATION: Duration = Duration::from_secs(60);
static CONTEXT: Lazy<Vec<serde_json::Value>> = Lazy::new(|| { /// Only include a basic context to save space and bandwidth. The main context is hosted statically
serde_json::from_str(include_str!("../assets/lemmy/context.json")).expect("parse context") /// on join-lemmy.org. Include activitystreams explicitly for better compat, but this could
/// theoretically also be moved.
pub static FEDERATION_CONTEXT: Lazy<Value> = Lazy::new(|| {
Value::Array(vec![
Value::String("https://join-lemmy.org/context.json".to_string()),
Value::String("https://www.w3.org/ns/activitystreams".to_string()),
])
}); });
#[derive(Clone)] #[derive(Clone)]

View File

@ -37,9 +37,8 @@ use lemmy_db_schema::{
utils::naive_now, utils::naive_now,
}; };
use lemmy_db_views_actor::structs::CommunityFollowerView; use lemmy_db_views_actor::structs::CommunityFollowerView;
use lemmy_utils::{error::LemmyError, utils::markdown::markdown_to_html}; use lemmy_utils::{error::LemmyError, spawn_try_task, utils::markdown::markdown_to_html};
use std::ops::Deref; use std::ops::Deref;
use tracing::debug;
use url::Url; use url::Url;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
@ -182,21 +181,16 @@ impl Object for ApubCommunity {
// Fetching mods and outbox is not necessary for Lemmy to work, so ignore errors. Besides, // Fetching mods and outbox is not necessary for Lemmy to work, so ignore errors. Besides,
// we need to ignore these errors so that tests can work entirely offline. // we need to ignore these errors so that tests can work entirely offline.
let fetch_outbox = group.outbox.dereference(&community, context); let community_ = community.clone();
let fetch_followers = group.followers.dereference(&community, context); let context_ = context.reset_request_count();
spawn_try_task(async move {
if let Some(moderators) = group.attributed_to { group.outbox.dereference(&community_, &context_).await?;
let fetch_moderators = moderators.dereference(&community, context); group.followers.dereference(&community_, &context_).await?;
// Fetch mods, outbox and followers in parallel if let Some(moderators) = group.attributed_to {
let res = tokio::join!(fetch_outbox, fetch_moderators, fetch_followers); moderators.dereference(&community_, &context_).await?;
res.0.map_err(|e| debug!("{}", e)).ok(); }
res.1.map_err(|e| debug!("{}", e)).ok(); Ok(())
res.2.map_err(|e| debug!("{}", e)).ok(); });
} else {
let res = tokio::join!(fetch_outbox, fetch_followers);
res.0.map_err(|e| debug!("{}", e)).ok();
res.1.map_err(|e| debug!("{}", e)).ok();
}
Ok(community) Ok(community)
} }
@ -281,8 +275,6 @@ pub(crate) mod tests {
let url = Url::parse("https://enterprise.lemmy.ml/c/tenforward")?; let url = Url::parse("https://enterprise.lemmy.ml/c/tenforward")?;
ApubCommunity::verify(&json, &url, &context2).await?; ApubCommunity::verify(&json, &url, &context2).await?;
let community = ApubCommunity::from_json(json, &context2).await?; let community = ApubCommunity::from_json(json, &context2).await?;
// this makes requests to the (intentionally broken) outbox and followers collections
assert_eq!(context2.request_count(), 2);
Ok(community) Ok(community)
} }

View File

@ -11,7 +11,7 @@ use activitypub_federation::{
protocol::helpers::deserialize_one, protocol::helpers::deserialize_one,
}; };
use lemmy_api_common::context::LemmyContext; use lemmy_api_common::context::LemmyContext;
use lemmy_utils::error::LemmyError; use lemmy_utils::error::{LemmyError, LemmyErrorType, LemmyResult};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use url::Url; use url::Url;
@ -21,14 +21,54 @@ pub struct Report {
pub(crate) actor: ObjectId<ApubPerson>, pub(crate) actor: ObjectId<ApubPerson>,
#[serde(deserialize_with = "deserialize_one")] #[serde(deserialize_with = "deserialize_one")]
pub(crate) to: [ObjectId<ApubCommunity>; 1], pub(crate) to: [ObjectId<ApubCommunity>; 1],
pub(crate) object: ObjectId<PostOrComment>, pub(crate) object: ReportObject,
pub(crate) summary: String, /// Report reason as sent by Lemmy
pub(crate) summary: Option<String>,
/// Report reason as sent by Mastodon
pub(crate) content: Option<String>,
#[serde(rename = "type")] #[serde(rename = "type")]
pub(crate) kind: FlagType, pub(crate) kind: FlagType,
pub(crate) id: Url, pub(crate) id: Url,
pub(crate) audience: Option<ObjectId<ApubCommunity>>, pub(crate) audience: Option<ObjectId<ApubCommunity>>,
} }
impl Report {
pub fn reason(&self) -> LemmyResult<String> {
self
.summary
.clone()
.or(self.content.clone())
.ok_or(LemmyErrorType::CouldntFindObject.into())
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(untagged)]
pub(crate) enum ReportObject {
Lemmy(ObjectId<PostOrComment>),
/// Mastodon sends an array containing user id and one or more post ids
Mastodon(Vec<Url>),
}
impl ReportObject {
pub async fn dereference(self, context: &Data<LemmyContext>) -> LemmyResult<PostOrComment> {
match self {
ReportObject::Lemmy(l) => l.dereference(context).await,
ReportObject::Mastodon(objects) => {
for o in objects {
// Find the first reported item which can be dereferenced as post or comment (Lemmy can
// only handle one item per report).
let deref = ObjectId::from(o).dereference(context).await;
if deref.is_ok() {
return deref;
}
}
Err(LemmyErrorType::CouldntFindObject.into())
}
}
}
}
#[async_trait::async_trait] #[async_trait::async_trait]
impl InCommunity for Report { impl InCommunity for Report {
async fn community(&self, context: &Data<LemmyContext>) -> Result<ApubCommunity, LemmyError> { async fn community(&self, context: &Data<LemmyContext>) -> Result<ApubCommunity, LemmyError> {

View File

@ -18,10 +18,10 @@ pub enum CreateOrUpdateType {
mod tests { mod tests {
use crate::protocol::{ use crate::protocol::{
activities::{ activities::{
community::announce::AnnounceActivity, community::{announce::AnnounceActivity, report::Report},
create_or_update::{note::CreateOrUpdateNote, page::CreateOrUpdatePage}, create_or_update::{note::CreateOrUpdateNote, page::CreateOrUpdatePage},
deletion::delete::Delete, deletion::delete::Delete,
following::{follow::Follow, undo_follow::UndoFollow}, following::{accept::AcceptFollow, follow::Follow, undo_follow::UndoFollow},
voting::{undo_vote::UndoVote, vote::Vote}, voting::{undo_vote::UndoVote, vote::Vote},
}, },
tests::test_json, tests::test_json,
@ -50,6 +50,7 @@ mod tests {
test_json::<UndoFollow>("assets/mastodon/activities/undo_follow.json")?; test_json::<UndoFollow>("assets/mastodon/activities/undo_follow.json")?;
test_json::<Vote>("assets/mastodon/activities/like_page.json")?; test_json::<Vote>("assets/mastodon/activities/like_page.json")?;
test_json::<UndoVote>("assets/mastodon/activities/undo_like_page.json")?; test_json::<UndoVote>("assets/mastodon/activities/undo_like_page.json")?;
test_json::<Report>("assets/mastodon/activities/flag.json")?;
Ok(()) Ok(())
} }
@ -88,4 +89,11 @@ mod tests {
test_json::<AnnounceActivity>("assets/peertube/activities/announce_video.json")?; test_json::<AnnounceActivity>("assets/peertube/activities/announce_video.json")?;
Ok(()) Ok(())
} }
#[test]
fn test_parse_mbin_activities() -> LemmyResult<()> {
test_json::<AcceptFollow>("assets/mbin/activities/accept.json")?;
test_json::<Report>("assets/mbin/activities/flag.json")?;
Ok(())
}
} }

View File

@ -216,3 +216,12 @@ pub enum PostFeatureType {
/// Features to the top of the community. /// Features to the top of the community.
Community, Community,
} }
/// Wrapper for assert_eq! macro. Checks that vec matches the given length, and prints the
/// vec on failure.
#[macro_export]
macro_rules! assert_length {
($len:expr, $vec:expr) => {{
assert_eq!($len, $vec.len(), "Vec has wrong length: {:?}", $vec)
}};
}

View File

@ -39,7 +39,7 @@ use rustls::{
use std::{ use std::{
ops::{Deref, DerefMut}, ops::{Deref, DerefMut},
sync::Arc, sync::Arc,
time::{Duration, SystemTime}, time::SystemTime,
}; };
use tracing::{error, info}; use tracing::{error, info};
use url::Url; use url::Url;
@ -48,7 +48,6 @@ const FETCH_LIMIT_DEFAULT: i64 = 10;
pub const FETCH_LIMIT_MAX: i64 = 50; pub const FETCH_LIMIT_MAX: i64 = 50;
pub const SITEMAP_LIMIT: i64 = 50000; pub const SITEMAP_LIMIT: i64 = 50000;
pub const SITEMAP_DAYS: i64 = 31; pub const SITEMAP_DAYS: i64 = 31;
const POOL_TIMEOUT: Option<Duration> = Some(Duration::from_secs(5));
pub const RANK_DEFAULT: f64 = 0.0001; pub const RANK_DEFAULT: f64 = 0.0001;
pub type ActualDbPool = Pool<AsyncPgConnection>; pub type ActualDbPool = Pool<AsyncPgConnection>;
@ -273,9 +272,6 @@ pub async fn build_db_pool() -> Result<ActualDbPool, LemmyError> {
}; };
let pool = Pool::builder(manager) let pool = Pool::builder(manager)
.max_size(SETTINGS.database.pool_size) .max_size(SETTINGS.database.pool_size)
.wait_timeout(POOL_TIMEOUT)
.create_timeout(POOL_TIMEOUT)
.recycle_timeout(POOL_TIMEOUT)
.runtime(Runtime::Tokio1) .runtime(Runtime::Tokio1)
.build()?; .build()?;

View File

@ -399,6 +399,7 @@ mod tests {
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
aggregates::structs::CommentAggregates, aggregates::structs::CommentAggregates,
assert_length,
impls::actor_language::UNDETERMINED_ID, impls::actor_language::UNDETERMINED_ID,
newtypes::LanguageId, newtypes::LanguageId,
source::{ source::{
@ -637,7 +638,7 @@ mod tests {
); );
// Make sure its 1, not showing the blocked comment // Make sure its 1, not showing the blocked comment
assert_eq!(5, read_comment_views_with_person.len()); assert_length!(5, read_comment_views_with_person);
let read_comment_from_blocked_person = CommentView::read( let read_comment_from_blocked_person = CommentView::read(
pool, pool,
@ -664,7 +665,7 @@ mod tests {
read_liked_comment_views[0] read_liked_comment_views[0]
); );
assert_eq!(1, read_liked_comment_views.len()); assert_length!(1, read_liked_comment_views);
let read_disliked_comment_views: Vec<CommentView> = CommentQuery { let read_disliked_comment_views: Vec<CommentView> = CommentQuery {
local_user: (Some(&data.timmy_local_user_view)), local_user: (Some(&data.timmy_local_user_view)),
@ -708,8 +709,8 @@ mod tests {
.unwrap(); .unwrap();
// Make sure the comment parent-limited fetch is correct // Make sure the comment parent-limited fetch is correct
assert_eq!(6, read_comment_views_top_path.len()); assert_length!(6, read_comment_views_top_path);
assert_eq!(4, read_comment_views_child_path.len()); assert_length!(4, read_comment_views_child_path);
// Make sure it contains the parent, but not the comment from the other tree // Make sure it contains the parent, but not the comment from the other tree
let child_comments = read_comment_views_child_path let child_comments = read_comment_views_child_path
@ -733,7 +734,7 @@ mod tests {
expected_comment_view(&data, pool).await, expected_comment_view(&data, pool).await,
read_comment_views_top_max_depth[0] read_comment_views_top_max_depth[0]
); );
assert_eq!(1, read_comment_views_top_max_depth.len()); assert_length!(1, read_comment_views_top_max_depth);
let child_path = data.inserted_comment_1.path.clone(); let child_path = data.inserted_comment_1.path.clone();
let read_comment_views_parent_max_depth = CommentQuery { let read_comment_views_parent_max_depth = CommentQuery {
@ -752,7 +753,7 @@ mod tests {
.comment .comment
.content .content
.eq("Comment 3")); .eq("Comment 3"));
assert_eq!(3, read_comment_views_parent_max_depth.len()); assert_length!(3, read_comment_views_parent_max_depth);
cleanup(data, pool).await; cleanup(data, pool).await;
} }
@ -773,7 +774,7 @@ mod tests {
.list(pool) .list(pool)
.await .await
.unwrap(); .unwrap();
assert_eq!(5, all_languages.len()); assert_length!(5, all_languages);
// change user lang to finnish, should only show one post in finnish and one undetermined // change user lang to finnish, should only show one post in finnish and one undetermined
let finnish_id = Language::read_id_from_code(pool, Some("fi")) let finnish_id = Language::read_id_from_code(pool, Some("fi"))
@ -794,7 +795,7 @@ mod tests {
.list(pool) .list(pool)
.await .await
.unwrap(); .unwrap();
assert_eq!(2, finnish_comments.len()); assert_length!(2, finnish_comments);
let finnish_comment = finnish_comments let finnish_comment = finnish_comments
.iter() .iter()
.find(|c| c.comment.language_id == finnish_id); .find(|c| c.comment.language_id == finnish_id);
@ -819,7 +820,7 @@ mod tests {
.list(pool) .list(pool)
.await .await
.unwrap(); .unwrap();
assert_eq!(1, undetermined_comment.len()); assert_length!(1, undetermined_comment);
cleanup(data, pool).await; cleanup(data, pool).await;
} }

View File

@ -196,6 +196,7 @@ mod tests {
structs::LocalUserView, structs::LocalUserView,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
assert_length,
source::{ source::{
community::{Community, CommunityInsertForm, CommunityModerator, CommunityModeratorForm}, community::{Community, CommunityInsertForm, CommunityModerator, CommunityModeratorForm},
instance::Instance, instance::Instance,
@ -383,7 +384,7 @@ mod tests {
.list(pool, &timmy_view) .list(pool, &timmy_view)
.await .await
.unwrap(); .unwrap();
assert_eq!(reports_after_resolve.len(), 1); assert_length!(1, reports_after_resolve);
assert_eq!(reports_after_resolve[0].creator.id, inserted_sara.id); assert_eq!(reports_after_resolve[0].creator.id, inserted_sara.id);
// Make sure the counts are correct // Make sure the counts are correct

File diff suppressed because it is too large Load Diff

View File

@ -112,6 +112,7 @@ mod tests {
use crate::private_message_report_view::PrivateMessageReportQuery; use crate::private_message_report_view::PrivateMessageReportQuery;
use lemmy_db_schema::{ use lemmy_db_schema::{
assert_length,
source::{ source::{
instance::Instance, instance::Instance,
person::{Person, PersonInsertForm}, person::{Person, PersonInsertForm},
@ -171,7 +172,7 @@ mod tests {
.list(pool) .list(pool)
.await .await
.unwrap(); .unwrap();
assert_eq!(1, reports.len()); assert_length!(1, reports);
assert!(!reports[0].private_message_report.resolved); assert!(!reports[0].private_message_report.resolved);
assert_eq!(inserted_timmy.name, reports[0].private_message_creator.name); assert_eq!(inserted_timmy.name, reports[0].private_message_creator.name);
assert_eq!(inserted_jessica.name, reports[0].creator.name); assert_eq!(inserted_jessica.name, reports[0].creator.name);
@ -197,7 +198,7 @@ mod tests {
.list(pool) .list(pool)
.await .await
.unwrap(); .unwrap();
assert_eq!(1, reports.len()); assert_length!(1, reports);
assert!(reports[0].private_message_report.resolved); assert!(reports[0].private_message_report.resolved);
assert!(reports[0].resolver.is_some()); assert!(reports[0].resolver.is_some());
assert_eq!( assert_eq!(

View File

@ -159,6 +159,7 @@ mod tests {
use crate::{private_message_view::PrivateMessageQuery, structs::PrivateMessageView}; use crate::{private_message_view::PrivateMessageQuery, structs::PrivateMessageView};
use lemmy_db_schema::{ use lemmy_db_schema::{
assert_length,
source::{ source::{
instance::Instance, instance::Instance,
person::{Person, PersonInsertForm}, person::{Person, PersonInsertForm},
@ -251,7 +252,7 @@ mod tests {
.await .await
.unwrap(); .unwrap();
assert_eq!(timmy_messages.len(), 3); assert_length!(3, &timmy_messages);
assert_eq!(timmy_messages[0].creator.id, jess.id); assert_eq!(timmy_messages[0].creator.id, jess.id);
assert_eq!(timmy_messages[0].recipient.id, timmy.id); assert_eq!(timmy_messages[0].recipient.id, timmy.id);
assert_eq!(timmy_messages[1].creator.id, timmy.id); assert_eq!(timmy_messages[1].creator.id, timmy.id);
@ -268,7 +269,7 @@ mod tests {
.await .await
.unwrap(); .unwrap();
assert_eq!(timmy_unread_messages.len(), 2); assert_length!(2, &timmy_unread_messages);
assert_eq!(timmy_unread_messages[0].creator.id, jess.id); assert_eq!(timmy_unread_messages[0].creator.id, jess.id);
assert_eq!(timmy_unread_messages[0].recipient.id, timmy.id); assert_eq!(timmy_unread_messages[0].recipient.id, timmy.id);
assert_eq!(timmy_unread_messages[1].creator.id, sara.id); assert_eq!(timmy_unread_messages[1].creator.id, sara.id);
@ -283,7 +284,7 @@ mod tests {
.await .await
.unwrap(); .unwrap();
assert_eq!(timmy_sara_messages.len(), 2); assert_length!(2, &timmy_sara_messages);
assert_eq!(timmy_sara_messages[0].creator.id, timmy.id); assert_eq!(timmy_sara_messages[0].creator.id, timmy.id);
assert_eq!(timmy_sara_messages[0].recipient.id, sara.id); assert_eq!(timmy_sara_messages[0].recipient.id, sara.id);
assert_eq!(timmy_sara_messages[1].creator.id, sara.id); assert_eq!(timmy_sara_messages[1].creator.id, sara.id);
@ -298,7 +299,7 @@ mod tests {
.await .await
.unwrap(); .unwrap();
assert_eq!(timmy_sara_unread_messages.len(), 1); assert_length!(1, &timmy_sara_unread_messages);
assert_eq!(timmy_sara_unread_messages[0].creator.id, sara.id); assert_eq!(timmy_sara_unread_messages[0].creator.id, sara.id);
assert_eq!(timmy_sara_unread_messages[0].recipient.id, timmy.id); assert_eq!(timmy_sara_unread_messages[0].recipient.id, timmy.id);
@ -328,7 +329,7 @@ mod tests {
.await .await
.unwrap(); .unwrap();
assert_eq!(timmy_messages.len(), 1); assert_length!(1, &timmy_messages);
let timmy_unread_messages = PrivateMessageView::get_unread_messages(pool, timmy.id) let timmy_unread_messages = PrivateMessageView::get_unread_messages(pool, timmy.id)
.await .await

View File

@ -159,6 +159,7 @@ mod tests {
use super::*; use super::*;
use diesel::NotFound; use diesel::NotFound;
use lemmy_db_schema::{ use lemmy_db_schema::{
assert_length,
source::{ source::{
instance::Instance, instance::Instance,
local_user::{LocalUser, LocalUserInsertForm, LocalUserUpdateForm}, local_user::{LocalUser, LocalUserInsertForm, LocalUserUpdateForm},
@ -257,7 +258,7 @@ mod tests {
.list(pool) .list(pool)
.await .await
.unwrap(); .unwrap();
assert_eq!(list.len(), 1); assert_length!(1, list);
assert_eq!(list[0].person.id, data.bob.id); assert_eq!(list[0].person.id, data.bob.id);
cleanup(data, pool).await; cleanup(data, pool).await;
@ -282,7 +283,7 @@ mod tests {
.unwrap(); .unwrap();
let list = PersonView::banned(pool).await.unwrap(); let list = PersonView::banned(pool).await.unwrap();
assert_eq!(list.len(), 1); assert_length!(1, list);
assert_eq!(list[0].person.id, data.alice.id); assert_eq!(list[0].person.id, data.alice.id);
cleanup(data, pool).await; cleanup(data, pool).await;
@ -307,7 +308,7 @@ mod tests {
.unwrap(); .unwrap();
let list = PersonView::admins(pool).await.unwrap(); let list = PersonView::admins(pool).await.unwrap();
assert_eq!(list.len(), 1); assert_length!(1, list);
assert_eq!(list[0].person.id, data.alice.id); assert_eq!(list[0].person.id, data.alice.id);
let is_admin = PersonView::read(pool, data.alice.id) let is_admin = PersonView::read(pool, data.alice.id)

View File

@ -5,11 +5,15 @@ use crate::util::{
LEMMY_TEST_FAST_FEDERATION, LEMMY_TEST_FAST_FEDERATION,
WORK_FINISHED_RECHECK_DELAY, WORK_FINISHED_RECHECK_DELAY,
}; };
use activitypub_federation::{activity_sending::SendActivityTask, config::Data}; use activitypub_federation::{
activity_sending::SendActivityTask,
config::Data,
protocol::context::WithContext,
};
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use chrono::{DateTime, TimeZone, Utc}; use chrono::{DateTime, TimeZone, Utc};
use lemmy_api_common::{context::LemmyContext, federate_retry_sleep_duration}; use lemmy_api_common::{context::LemmyContext, federate_retry_sleep_duration};
use lemmy_apub::activity_lists::SharedInboxActivities; use lemmy_apub::{activity_lists::SharedInboxActivities, FEDERATION_CONTEXT};
use lemmy_db_schema::{ use lemmy_db_schema::{
newtypes::{ActivityId, CommunityId, InstanceId}, newtypes::{ActivityId, CommunityId, InstanceId},
source::{ source::{
@ -25,6 +29,7 @@ use once_cell::sync::Lazy;
use reqwest::Url; use reqwest::Url;
use std::{ use std::{
collections::{HashMap, HashSet}, collections::{HashMap, HashSet},
ops::Deref,
time::Duration, time::Duration,
}; };
use tokio::{sync::mpsc::UnboundedSender, time::sleep}; use tokio::{sync::mpsc::UnboundedSender, time::sleep};
@ -152,7 +157,15 @@ impl InstanceWorker {
self.save_and_send_state(pool).await?; self.save_and_send_state(pool).await?;
latest_id latest_id
}; };
if id == latest_id { if id >= latest_id {
if id > latest_id {
tracing::error!(
"{}: last successful id {} is higher than latest id {} in database (did the db get cleared?)",
self.instance.domain,
id.0,
latest_id.0
);
}
// no more work to be done, wait before rechecking // no more work to be done, wait before rechecking
tokio::select! { tokio::select! {
() = sleep(*WORK_FINISHED_RECHECK_DELAY) => {}, () = sleep(*WORK_FINISHED_RECHECK_DELAY) => {},
@ -218,9 +231,10 @@ impl InstanceWorker {
.await .await
.context("failed getting actor instance (was it marked deleted / removed?)")?; .context("failed getting actor instance (was it marked deleted / removed?)")?;
let object = WithContext::new(object.clone(), FEDERATION_CONTEXT.deref().clone());
let inbox_urls = inbox_urls.into_iter().collect(); let inbox_urls = inbox_urls.into_iter().collect();
let requests = let requests =
SendActivityTask::prepare(object, actor.as_ref(), inbox_urls, &self.context).await?; SendActivityTask::prepare(&object, actor.as_ref(), inbox_urls, &self.context).await?;
for task in requests { for task in requests {
// usually only one due to shared inbox // usually only one due to shared inbox
tracing::debug!("sending out {}", task); tracing::debug!("sending out {}", task);

View File

@ -16,7 +16,7 @@ pub struct LemmyError {
} }
/// Maximum number of items in an array passed as API parameter. See [[LemmyErrorType::TooManyItems]] /// Maximum number of items in an array passed as API parameter. See [[LemmyErrorType::TooManyItems]]
pub const MAX_API_PARAM_ELEMENTS: usize = 1000; pub const MAX_API_PARAM_ELEMENTS: usize = 10_000;
impl<T> From<T> for LemmyError impl<T> From<T> for LemmyError
where where

View File

@ -116,7 +116,7 @@ pub struct DatabaseConfig {
pub(crate) connection: DatabaseConnection, pub(crate) connection: DatabaseConnection,
/// Maximum number of active sql connections /// Maximum number of active sql connections
#[default(95)] #[default(30)]
pub pool_size: usize, pub pool_size: usize,
} }

@ -1 +1 @@
Subproject commit 06a610696af829248954e411ebe2cf3906092244 Subproject commit 2139975ef383077e4709a4f2cae42922fd63b860

View File

@ -1,10 +1,11 @@
# syntax=docker/dockerfile:1.6 # syntax=docker/dockerfile:1.6
ARG RUST_VERSION=1.72.1 ARG RUST_VERSION=1.75
ARG CARGO_BUILD_FEATURES=default ARG CARGO_BUILD_FEATURES=default
ARG RUST_RELEASE_MODE=debug ARG RUST_RELEASE_MODE=debug
ARG AMD_BUILDER_IMAGE=rust:${RUST_VERSION} ARG AMD_BUILDER_IMAGE=rust:${RUST_VERSION}
ARG ARM_BUILDER_IMAGE="ghcr.io/raskyld/aarch64-lemmy-linux-gnu:v0.1.0" # Repo: https://github.com/raskyld/lemmy-cross-toolchains
ARG ARM_BUILDER_IMAGE="ghcr.io/raskyld/aarch64-lemmy-linux-gnu:v0.2.0"
ARG AMD_RUNNER_IMAGE=debian:bookworm-slim ARG AMD_RUNNER_IMAGE=debian:bookworm-slim
ARG ARM_RUNNER_IMAGE=debian:bookworm-slim ARG ARM_RUNNER_IMAGE=debian:bookworm-slim

View File

@ -25,7 +25,7 @@ services:
lemmy: lemmy:
# use "image" to pull down an already compiled lemmy. make sure to comment out "build". # use "image" to pull down an already compiled lemmy. make sure to comment out "build".
# image: dessalines/lemmy:0.19.0 # image: dessalines/lemmy:0.19.1
# platform: linux/x86_64 # no arm64 support. uncomment platform if using m1. # platform: linux/x86_64 # no arm64 support. uncomment platform if using m1.
# use "build" to build your local lemmy server image for development. make sure to comment out "image". # use "build" to build your local lemmy server image for development. make sure to comment out "image".
# run: docker compose up --build # run: docker compose up --build
@ -55,7 +55,7 @@ services:
lemmy-ui: lemmy-ui:
# use "image" to pull down an already compiled lemmy-ui. make sure to comment out "build". # use "image" to pull down an already compiled lemmy-ui. make sure to comment out "build".
image: dessalines/lemmy-ui:0.19.0 image: dessalines/lemmy-ui:0.19.1
# platform: linux/x86_64 # no arm64 support. uncomment platform if using m1. # platform: linux/x86_64 # no arm64 support. uncomment platform if using m1.
# use "build" to build your local lemmy ui image for development. make sure to comment out "image". # use "build" to build your local lemmy ui image for development. make sure to comment out "image".
# run: docker compose up --build # run: docker compose up --build

View File

@ -2,7 +2,7 @@ version: "3.7"
x-ui-default: &ui-default x-ui-default: &ui-default
init: true init: true
image: dessalines/lemmy-ui:0.19.0 image: dessalines/lemmy-ui:0.19.1
# assuming lemmy-ui is cloned besides lemmy directory # assuming lemmy-ui is cloned besides lemmy directory
# build: # build:
# context: ../../../lemmy-ui # context: ../../../lemmy-ui

View File

@ -85,16 +85,19 @@ where
let mut res = svc.call(req).await?; let mut res = svc.call(req).await?;
// Add cache-control header. If user is authenticated, mark as private. Otherwise cache // Add cache-control header if none is present
// up to one minute. if !res.headers().contains_key(CACHE_CONTROL) {
let cache_value = if jwt.is_some() { // If user is authenticated, mark as private. Otherwise cache
"private" // up to one minute.
} else { let cache_value = if jwt.is_some() {
"public, max-age=60" "private"
}; } else {
res "public, max-age=60"
.headers_mut() };
.insert(CACHE_CONTROL, HeaderValue::from_static(cache_value)); res
.headers_mut()
.insert(CACHE_CONTROL, HeaderValue::from_static(cache_value));
}
Ok(res) Ok(res)
}) })
} }