Extract Activitypub logic into separate library (#2288)

* Create example for apub lib

* some rewriting of apub lib

* Add LocalInstance struct for apub lib to avoid using Lemmy Settings

* Move ActorType trait to lemmy_apub, because its not needed in library

* Use reqwest_retry instead of custom impl, dont specify timeout on every send()

* Some improvements to example

* Moved inbox handling to library

* bug fixes

* Move context and serde helpers into library

* wip: example changes

* Add lemmy_utils feature to build only LemmyError

* Rename to activitypub_federation

* Remove lemmy_utils dep from activitypub_federation using generic error type

* Finish activitypub example

* Cleanup and fix tests

* Reorganize library files

* Remove ApubObject.to_tombstone()

* Extract activitypub library into separate git repository
This commit is contained in:
Nutomic 2022-06-02 14:33:41 +00:00 committed by GitHub
parent 1bd57ee5ca
commit a2a594b763
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
199 changed files with 1481 additions and 2234 deletions

489
Cargo.lock generated
View file

@ -2,6 +2,46 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "activitypub_federation"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78b34a144dc98c419543690aa8f182d8675ebe0610775982b8fdee84a00f70fe"
dependencies = [
"activitypub_federation_derive",
"actix-web",
"anyhow",
"async-trait",
"background-jobs",
"base64",
"chrono",
"derive_builder 0.11.2",
"http",
"http-signature-normalization-actix",
"http-signature-normalization-reqwest",
"once_cell",
"openssl",
"reqwest",
"reqwest-middleware",
"serde",
"serde_json",
"sha2",
"thiserror",
"tracing",
"url",
]
[[package]]
name = "activitypub_federation_derive"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a2aaf58676b669d3b0dedf6bbb44fa518b5a6657b2959561d77899c668dec2a"
dependencies = [
"proc-macro2 1.0.39",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
name = "activitystreams-kinds"
version = "0.2.1"
@ -94,8 +134,8 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "465a6172cf69b960917811022d8f29bc0b7fa1398bc4f78b3c466673db1213b6"
dependencies = [
"quote 1.0.17",
"syn 1.0.90",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
@ -245,9 +285,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7525bedf54704abb1d469e88d7e7e9226df73778798a69cea5022d53b2ae91bc"
dependencies = [
"actix-router",
"proc-macro2 1.0.36",
"quote 1.0.17",
"syn 1.0.90",
"proc-macro2 1.0.39",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
@ -256,9 +296,9 @@ version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d44b8fee1ced9671ba043476deddef739dd0959bf77030b26b738cc591737a7"
dependencies = [
"proc-macro2 1.0.36",
"quote 1.0.17",
"syn 1.0.90",
"proc-macro2 1.0.39",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
@ -349,9 +389,9 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10f203db73a71dfa2fb6dd22763990fa26f3d2625a6da2da900d23b87d26be27"
dependencies = [
"proc-macro2 1.0.36",
"quote 1.0.17",
"syn 1.0.90",
"proc-macro2 1.0.39",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
@ -360,9 +400,9 @@ version = "0.1.53"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed6aa3524a2dfcf9fe180c51eae2b58738348d819517ceadf95789c51fff7600"
dependencies = [
"proc-macro2 1.0.36",
"quote 1.0.17",
"syn 1.0.90",
"proc-macro2 1.0.39",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
@ -372,7 +412,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21fb6a0b39c6517edafe46f8137e53c51742425a4dae1c73ee12264a37ad7541"
dependencies = [
"chrono",
"derive_builder",
"derive_builder 0.10.2",
"diligent-date-parser",
"never",
"quick-xml",
@ -801,6 +841,16 @@ dependencies = [
"darling_macro 0.13.1",
]
[[package]]
name = "darling"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4529658bdda7fd6769b8614be250cdcfc3aeb0ee72fe66f9e41e5e5eb73eac02"
dependencies = [
"darling_core 0.14.1",
"darling_macro 0.14.1",
]
[[package]]
name = "darling_core"
version = "0.12.4"
@ -809,10 +859,10 @@ checksum = "8e91455b86830a1c21799d94524df0845183fa55bafd9aa137b01c7d1065fa36"
dependencies = [
"fnv",
"ident_case",
"proc-macro2 1.0.36",
"quote 1.0.17",
"proc-macro2 1.0.39",
"quote 1.0.18",
"strsim",
"syn 1.0.90",
"syn 1.0.95",
]
[[package]]
@ -823,10 +873,24 @@ checksum = "7a340f241d2ceed1deb47ae36c4144b2707ec7dd0b649f894cb39bb595986324"
dependencies = [
"fnv",
"ident_case",
"proc-macro2 1.0.36",
"quote 1.0.17",
"proc-macro2 1.0.39",
"quote 1.0.18",
"strsim",
"syn 1.0.90",
"syn 1.0.95",
]
[[package]]
name = "darling_core"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "649c91bc01e8b1eac09fb91e8dbc7d517684ca6be8ebc75bb9cafc894f9fdb6f"
dependencies = [
"fnv",
"ident_case",
"proc-macro2 1.0.39",
"quote 1.0.18",
"strsim",
"syn 1.0.95",
]
[[package]]
@ -836,8 +900,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29b5acf0dea37a7f66f7b25d2c5e93fd46f8f6968b1a5d7a3e02e97768afc95a"
dependencies = [
"darling_core 0.12.4",
"quote 1.0.17",
"syn 1.0.90",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
@ -847,8 +911,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72c41b3b7352feb3211a0d743dc5700a4e3b60f51bd2b368892d1e0f9a95f44b"
dependencies = [
"darling_core 0.13.1",
"quote 1.0.17",
"syn 1.0.90",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
name = "darling_macro"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddfc69c5bfcbd2fc09a0f38451d2daf0e372e367986a83906d1b0dbc88134fb5"
dependencies = [
"darling_core 0.14.1",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
@ -866,7 +941,16 @@ version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d13202debe11181040ae9063d739fa32cfcaaebe2275fe387703460ae2365b30"
dependencies = [
"derive_builder_macro",
"derive_builder_macro 0.10.2",
]
[[package]]
name = "derive_builder"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d07adf7be193b71cc36b193d0f5fe60b918a3a9db4dad0449f57bcfd519704a3"
dependencies = [
"derive_builder_macro 0.11.2",
]
[[package]]
@ -876,9 +960,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66e616858f6187ed828df7c64a6d71720d83767a7f19740b2d1b6fe6327b36e5"
dependencies = [
"darling 0.12.4",
"proc-macro2 1.0.36",
"quote 1.0.17",
"syn 1.0.90",
"proc-macro2 1.0.39",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
name = "derive_builder_core"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f91d4cfa921f1c05904dc3c57b4a32c38aed3340cce209f3a6fd1478babafc4"
dependencies = [
"darling 0.14.1",
"proc-macro2 1.0.39",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
@ -887,8 +983,18 @@ version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58a94ace95092c5acb1e97a7e846b310cfbd499652f72297da7493f618a98d73"
dependencies = [
"derive_builder_core",
"syn 1.0.90",
"derive_builder_core 0.10.2",
"syn 1.0.95",
]
[[package]]
name = "derive_builder_macro"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f0314b72bed045f3a68671b3c86328386762c93f82d98c65c3cb5e5f573dd68"
dependencies = [
"derive_builder_core 0.11.2",
"syn 1.0.95",
]
[[package]]
@ -898,10 +1004,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"
dependencies = [
"convert_case",
"proc-macro2 1.0.36",
"quote 1.0.17",
"proc-macro2 1.0.39",
"quote 1.0.18",
"rustc_version",
"syn 1.0.90",
"syn 1.0.95",
]
[[package]]
@ -946,9 +1052,9 @@ version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3"
dependencies = [
"proc-macro2 1.0.36",
"quote 1.0.17",
"syn 1.0.90",
"proc-macro2 1.0.39",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
@ -1009,12 +1115,6 @@ dependencies = [
"winapi",
]
[[package]]
name = "dissimilar"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31ad93652f40969dead8d4bf897a41e9462095152eb21c56e5830537e41179dd"
[[package]]
name = "doku"
version = "0.11.0"
@ -1032,9 +1132,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "603fe9f91b4d0e11036df029aeaeffa90b8f97e700104d5d24abb053bf9ba858"
dependencies = [
"darling 0.13.1",
"proc-macro2 1.0.36",
"quote 1.0.17",
"syn 1.0.90",
"proc-macro2 1.0.39",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
@ -1286,9 +1386,9 @@ version = "0.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512"
dependencies = [
"proc-macro2 1.0.36",
"quote 1.0.17",
"syn 1.0.90",
"proc-macro2 1.0.39",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
@ -1362,12 +1462,6 @@ dependencies = [
"wasi 0.10.0+wasi-snapshot-preview1",
]
[[package]]
name = "glob"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
[[package]]
name = "h2"
version = "0.3.12"
@ -1484,9 +1578,9 @@ dependencies = [
"log",
"mac",
"markup5ever",
"proc-macro2 1.0.36",
"quote 1.0.17",
"syn 1.0.90",
"proc-macro2 1.0.39",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
@ -1764,6 +1858,7 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
name = "lemmy_api"
version = "0.16.5"
dependencies = [
"activitypub_federation",
"actix-web",
"anyhow",
"async-trait",
@ -1774,7 +1869,6 @@ dependencies = [
"diesel",
"lemmy_api_common",
"lemmy_apub",
"lemmy_apub_lib",
"lemmy_db_schema",
"lemmy_db_views",
"lemmy_db_views_actor",
@ -1815,12 +1909,12 @@ dependencies = [
name = "lemmy_api_crud"
version = "0.16.5"
dependencies = [
"activitypub_federation",
"actix-web",
"async-trait",
"bcrypt",
"lemmy_api_common",
"lemmy_apub",
"lemmy_apub_lib",
"lemmy_db_schema",
"lemmy_db_views",
"lemmy_db_views_actor",
@ -1837,6 +1931,7 @@ dependencies = [
name = "lemmy_apub"
version = "0.16.5"
dependencies = [
"activitypub_federation",
"activitystreams-kinds",
"actix",
"actix-rt",
@ -1852,7 +1947,6 @@ dependencies = [
"http-signature-normalization-actix",
"itertools",
"lemmy_api_common",
"lemmy_apub_lib",
"lemmy_db_schema",
"lemmy_db_views",
"lemmy_db_views_actor",
@ -1873,53 +1967,16 @@ dependencies = [
"uuid",
]
[[package]]
name = "lemmy_apub_lib"
version = "0.16.5"
dependencies = [
"actix-web",
"anyhow",
"async-trait",
"background-jobs",
"base64",
"chrono",
"diesel",
"http",
"http-signature-normalization-actix",
"http-signature-normalization-reqwest",
"lemmy_apub_lib_derive",
"lemmy_utils",
"once_cell",
"openssl",
"reqwest",
"reqwest-middleware",
"serde",
"serde_json",
"sha2",
"tracing",
"url",
]
[[package]]
name = "lemmy_apub_lib_derive"
version = "0.16.5"
dependencies = [
"proc-macro2 1.0.36",
"quote 1.0.17",
"syn 1.0.90",
"trybuild",
]
[[package]]
name = "lemmy_db_schema"
version = "0.16.5"
dependencies = [
"activitypub_federation",
"bcrypt",
"chrono",
"diesel",
"diesel-derive-newtype",
"diesel_migrations",
"lemmy_apub_lib",
"lemmy_utils",
"once_cell",
"regex",
@ -1992,6 +2049,7 @@ dependencies = [
name = "lemmy_server"
version = "0.16.5"
dependencies = [
"activitypub_federation",
"actix",
"actix-web",
"clokwerk",
@ -2003,7 +2061,6 @@ dependencies = [
"lemmy_api_common",
"lemmy_api_crud",
"lemmy_apub",
"lemmy_apub_lib",
"lemmy_db_schema",
"lemmy_routes",
"lemmy_utils",
@ -2013,6 +2070,7 @@ dependencies = [
"parking_lot 0.12.0",
"reqwest",
"reqwest-middleware",
"reqwest-retry",
"reqwest-tracing",
"serde",
"tracing",
@ -2258,9 +2316,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9753f12909fd8d923f75ae5c3258cae1ed3c8ec052e1b38c93c21a6d157f789c"
dependencies = [
"migrations_internals",
"proc-macro2 1.0.36",
"quote 1.0.17",
"syn 1.0.90",
"proc-macro2 1.0.39",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
@ -2663,9 +2721,9 @@ checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55"
dependencies = [
"pest",
"pest_meta",
"proc-macro2 1.0.36",
"quote 1.0.17",
"syn 1.0.90",
"proc-macro2 1.0.39",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
@ -2761,9 +2819,9 @@ version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb"
dependencies = [
"proc-macro2 1.0.36",
"quote 1.0.17",
"syn 1.0.90",
"proc-macro2 1.0.39",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
@ -2824,9 +2882,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2 1.0.36",
"quote 1.0.17",
"syn 1.0.90",
"proc-macro2 1.0.39",
"quote 1.0.18",
"syn 1.0.95",
"version_check",
]
@ -2836,8 +2894,8 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2 1.0.36",
"quote 1.0.17",
"proc-macro2 1.0.39",
"quote 1.0.18",
"version_check",
]
@ -2847,16 +2905,16 @@ version = "0.4.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
dependencies = [
"unicode-xid 0.1.0",
"unicode-xid",
]
[[package]]
name = "proc-macro2"
version = "1.0.36"
version = "1.0.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f"
dependencies = [
"unicode-xid 0.2.2",
"unicode-ident",
]
[[package]]
@ -2897,9 +2955,9 @@ checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe"
dependencies = [
"anyhow",
"itertools",
"proc-macro2 1.0.36",
"quote 1.0.17",
"syn 1.0.90",
"proc-macro2 1.0.39",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
@ -2942,11 +3000,11 @@ dependencies = [
[[package]]
name = "quote"
version = "1.0.17"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58"
checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1"
dependencies = [
"proc-macro2 1.0.36",
"proc-macro2 1.0.39",
]
[[package]]
@ -3148,9 +3206,9 @@ dependencies = [
[[package]]
name = "reqwest-middleware"
version = "0.1.5"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b58621b8223cfc85b63d38b8d335c69b96a666d9b7561aa30a3b070ce1df31c"
checksum = "69539cea4148dce683bec9dc95be3f0397a9bb2c248a49c8296a9d21659a8cdd"
dependencies = [
"anyhow",
"async-trait",
@ -3162,6 +3220,26 @@ dependencies = [
"thiserror",
]
[[package]]
name = "reqwest-retry"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce246a729eaa6aff5e215aee42845bf5fed9893cc6cd51aeeb712f34e04dd9f3"
dependencies = [
"anyhow",
"async-trait",
"chrono",
"futures",
"http",
"hyper",
"reqwest",
"reqwest-middleware",
"retry-policies",
"task-local-extensions",
"tokio",
"tracing",
]
[[package]]
name = "reqwest-tracing"
version = "0.2.1"
@ -3178,6 +3256,17 @@ dependencies = [
"tracing-opentelemetry 0.16.0",
]
[[package]]
name = "retry-policies"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47f9e19b18c6cdd796cc70aea8a9ea5ee7b813be611c6589e3624fcdbfd05f9d"
dependencies = [
"anyhow",
"chrono",
"rand 0.8.5",
]
[[package]]
name = "rgb"
version = "0.8.32"
@ -3210,8 +3299,8 @@ checksum = "6f697b8b3f19bee20f30dc87213d05ce091c43bc733ab1bfc98b0e5cdd9943f3"
dependencies = [
"convert_case",
"lazy_static",
"proc-macro2 1.0.36",
"quote 1.0.17",
"proc-macro2 1.0.39",
"quote 1.0.18",
"regex",
"tinyjson",
]
@ -3229,7 +3318,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36e19e299f301be17927a7c05b8fa1c621e3227e6c3a0da65492701642901ff7"
dependencies = [
"atom_syndication",
"derive_builder",
"derive_builder 0.10.2",
"never",
"quick-xml",
]
@ -3366,9 +3455,9 @@ version = "1.0.136"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9"
dependencies = [
"proc-macro2 1.0.36",
"quote 1.0.17",
"syn 1.0.90",
"proc-macro2 1.0.39",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
@ -3413,9 +3502,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12e47be9471c72889ebafb5e14d5ff930d89ae7a67bbdb5f8abb564f845a927e"
dependencies = [
"darling 0.13.1",
"proc-macro2 1.0.36",
"quote 1.0.17",
"syn 1.0.90",
"proc-macro2 1.0.39",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
@ -3436,10 +3525,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2881bccd7d60fb32dfa3d7b3136385312f8ad75e2674aab2852867a09790cae8"
dependencies = [
"proc-macro-error",
"proc-macro2 1.0.36",
"quote 1.0.17",
"proc-macro2 1.0.39",
"quote 1.0.18",
"rustversion",
"syn 1.0.90",
"syn 1.0.95",
]
[[package]]
@ -3536,9 +3625,9 @@ version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "133659a15339456eeeb07572eb02a91c91e9815e9cbc89566944d2c8d3efdbf6"
dependencies = [
"proc-macro2 1.0.36",
"quote 1.0.17",
"syn 1.0.90",
"proc-macro2 1.0.39",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
@ -3585,8 +3674,8 @@ checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988"
dependencies = [
"phf_generator 0.10.0",
"phf_shared 0.10.0",
"proc-macro2 1.0.36",
"quote 1.0.17",
"proc-macro2 1.0.39",
"quote 1.0.18",
]
[[package]]
@ -3608,10 +3697,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6878079b17446e4d3eba6192bb0a2950d5b14f0ed8424b852310e5a94345d0ef"
dependencies = [
"heck 0.4.0",
"proc-macro2 1.0.36",
"quote 1.0.17",
"proc-macro2 1.0.39",
"quote 1.0.18",
"rustversion",
"syn 1.0.90",
"syn 1.0.95",
]
[[package]]
@ -3622,18 +3711,18 @@ checksum = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741"
dependencies = [
"proc-macro2 0.4.30",
"quote 0.6.13",
"unicode-xid 0.1.0",
"unicode-xid",
]
[[package]]
name = "syn"
version = "1.0.90"
version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "704df27628939572cd88d33f171cd6f896f4eaca85252c6e0a72d8d8287ee86f"
checksum = "fbaf6116ab8924f39d52792136fb74fd60a80194cf1b1c6ffa6453eef1c3f942"
dependencies = [
"proc-macro2 1.0.36",
"quote 1.0.17",
"unicode-xid 0.2.2",
"proc-macro2 1.0.39",
"quote 1.0.18",
"unicode-ident",
]
[[package]]
@ -3676,33 +3765,24 @@ dependencies = [
"utf-8",
]
[[package]]
name = "termcolor"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
dependencies = [
"winapi-util",
]
[[package]]
name = "thiserror"
version = "1.0.30"
version = "1.0.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417"
checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.30"
version = "1.0.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b"
checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a"
dependencies = [
"proc-macro2 1.0.36",
"quote 1.0.17",
"syn 1.0.90",
"proc-macro2 1.0.39",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
@ -3768,9 +3848,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "tokio"
version = "1.17.0"
version = "1.18.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee"
checksum = "4903bf0427cf68dddd5aa6a93220756f8be0c34fcfa9f5e6191e103e15a31395"
dependencies = [
"bytes",
"libc",
@ -3803,9 +3883,9 @@ version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7"
dependencies = [
"proc-macro2 1.0.36",
"quote 1.0.17",
"syn 1.0.90",
"proc-macro2 1.0.39",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
@ -3868,15 +3948,6 @@ dependencies = [
"tracing",
]
[[package]]
name = "toml"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa"
dependencies = [
"serde",
]
[[package]]
name = "tonic"
version = "0.6.2"
@ -3914,10 +3985,10 @@ version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9403f1bafde247186684b230dc6f38b5cd514584e8bec1dd32514be4745fa757"
dependencies = [
"proc-macro2 1.0.36",
"proc-macro2 1.0.39",
"prost-build",
"quote 1.0.17",
"syn 1.0.90",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
@ -3984,9 +4055,9 @@ version = "0.1.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e65ce065b4b5c53e73bb28912318cb8c9e9ad3921f1d669eb0e68b4c8143a2b"
dependencies = [
"proc-macro2 1.0.36",
"quote 1.0.17",
"syn 1.0.90",
"proc-macro2 1.0.39",
"quote 1.0.18",
"syn 1.0.95",
]
[[package]]
@ -4080,22 +4151,6 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642"
[[package]]
name = "trybuild"
version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ae8c4cee9b97b861a6e3be1d5acb6f50a86bbb68b1f3a896db8342fb6d0f94c"
dependencies = [
"dissimilar",
"glob",
"once_cell",
"serde",
"serde_derive",
"serde_json",
"termcolor",
"toml",
]
[[package]]
name = "twoway"
version = "0.2.2"
@ -4145,6 +4200,12 @@ version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f"
[[package]]
name = "unicode-ident"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee"
[[package]]
name = "unicode-normalization"
version = "0.1.19"
@ -4172,12 +4233,6 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
[[package]]
name = "unicode-xid"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
[[package]]
name = "unicode_categories"
version = "0.1.1"
@ -4295,9 +4350,9 @@ dependencies = [
"bumpalo",
"lazy_static",
"log",
"proc-macro2 1.0.36",
"quote 1.0.17",
"syn 1.0.90",
"proc-macro2 1.0.39",
"quote 1.0.18",
"syn 1.0.95",
"wasm-bindgen-shared",
]
@ -4319,7 +4374,7 @@ version = "0.2.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01"
dependencies = [
"quote 1.0.17",
"quote 1.0.18",
"wasm-bindgen-macro-support",
]
@ -4329,9 +4384,9 @@ version = "0.2.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc"
dependencies = [
"proc-macro2 1.0.36",
"quote 1.0.17",
"syn 1.0.90",
"proc-macro2 1.0.39",
"quote 1.0.18",
"syn 1.0.95",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]

View file

@ -23,8 +23,6 @@ members = [
"crates/api",
"crates/api_crud",
"crates/api_common",
"crates/apub_lib",
"crates/apub_lib_derive",
"crates/apub",
"crates/utils",
"crates/db_schema",
@ -39,12 +37,12 @@ members = [
lemmy_api = { version = "=0.16.5", path = "./crates/api" }
lemmy_api_crud = { version = "=0.16.5", path = "./crates/api_crud" }
lemmy_apub = { version = "=0.16.5", path = "./crates/apub" }
lemmy_apub_lib = { version = "=0.16.5", path = "./crates/apub_lib" }
lemmy_utils = { version = "=0.16.5", path = "./crates/utils" }
lemmy_db_schema = { version = "=0.16.5", path = "./crates/db_schema" }
lemmy_api_common = { version = "=0.16.5", path = "crates/api_common" }
lemmy_websocket = { version = "=0.16.5", path = "./crates/websocket" }
lemmy_routes = { version = "=0.16.5", path = "./crates/routes" }
activitypub_federation = "0.1.0"
diesel = "1.4.8"
diesel_migrations = "1.4.0"
serde = { version = "1.0.136", features = ["derive"] }
@ -62,6 +60,7 @@ reqwest-tracing = "0.2.1"
clokwerk = "0.3.5"
doku = "0.11.0"
parking_lot = "0.12.0"
reqwest-retry = "0.1.5"
console-subscriber = { version = "0.1.3", optional = true }
opentelemetry = { version = "0.17.0", features = ["rt-tokio"], optional = true }
opentelemetry-otlp = { version = "0.10.0", optional = true }

View file

@ -170,10 +170,10 @@ test('Remove a comment from admin and community on the same instance', async ()
});
test('Remove a comment from admin and community on different instance', async () => {
let alphaUser = await registerUser(alpha);
let alpha_user = await registerUser(alpha);
let newAlphaApi: API = {
client: alpha.client,
auth: alphaUser.jwt,
auth: alpha_user.jwt,
};
// New alpha user creates a community, post, and comment.

View file

@ -290,17 +290,17 @@ test('Enforce site ban for federated user', async () => {
// create a test user
let alphaUserJwt = await registerUser(alpha);
expect(alphaUserJwt).toBeDefined();
let alphaUser: API = {
let alpha_user: API = {
client: alpha.client,
auth: alphaUserJwt.jwt,
};
let alphaUserActorId = (await getSite(alphaUser)).my_user.local_user_view.person.actor_id;
let alphaUserActorId = (await getSite(alpha_user)).my_user.local_user_view.person.actor_id;
expect(alphaUserActorId).toBeDefined();
let alphaPerson = (await resolvePerson(alphaUser, alphaUserActorId)).person;
let alphaPerson = (await resolvePerson(alpha_user, alphaUserActorId)).person;
expect(alphaPerson).toBeDefined();
// alpha makes post in beta community, it federates to beta instance
let postRes1 = await createPost(alphaUser, betaCommunity.community.id);
let postRes1 = await createPost(alpha_user, betaCommunity.community.id);
let searchBeta1 = await searchPostLocal(beta, postRes1.post_view.post);
expect(searchBeta1.posts[0]).toBeDefined();
@ -321,7 +321,7 @@ test('Enforce site ban for federated user', async () => {
expect(unBanAlpha.banned).toBe(false);
// alpha makes new post in beta community, it federates
let postRes2 = await createPost(alphaUser, betaCommunity.community.id);
let postRes2 = await createPost(alpha_user, betaCommunity.community.id);
let searchBeta3 = await searchPostLocal(beta, postRes2.post_view.post);
expect(searchBeta3.posts[0]).toBeDefined();

View file

@ -14,7 +14,6 @@ doctest = false
[dependencies]
lemmy_apub = { version = "=0.16.5", path = "../apub" }
lemmy_apub_lib = { version = "=0.16.5", path = "../apub_lib" }
lemmy_utils = { version = "=0.16.5", path = "../utils" }
lemmy_db_schema = { version = "=0.16.5", path = "../db_schema", features = ["full"] }
lemmy_db_views = { version = "=0.16.5", path = "../db_views", features = ["full"] }
@ -22,6 +21,7 @@ lemmy_db_views_moderator = { version = "=0.16.5", path = "../db_views_moderator"
lemmy_db_views_actor = { version = "=0.16.5", path = "../db_views_actor", features = ["full"] }
lemmy_api_common = { version = "=0.16.5", path = "../api_common", features = ["full"] }
lemmy_websocket = { version = "=0.16.5", path = "../websocket" }
activitypub_federation = "0.1.0"
diesel = "1.4.8"
bcrypt = "0.12.1"
chrono = { version = "0.4.19", features = ["serde"], default-features = false }

View file

@ -17,7 +17,7 @@ use lemmy_db_schema::{
traits::Likeable,
};
use lemmy_db_views::structs::{CommentView, LocalUserView};
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{send::send_comment_ws_message, LemmyContext, UserOperation};
use std::convert::TryInto;

View file

@ -6,7 +6,7 @@ use lemmy_api_common::{
};
use lemmy_db_schema::source::comment::Comment;
use lemmy_db_views::structs::CommentView;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -9,7 +9,7 @@ use lemmy_db_schema::{
traits::Saveable,
};
use lemmy_db_views::structs::CommentView;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -1,17 +1,17 @@
use crate::Perform;
use activitypub_federation::core::object_id::ObjectId;
use actix_web::web::Data;
use lemmy_api_common::{
comment::{CommentReportResponse, CreateCommentReport},
utils::{blocking, check_community_ban, get_local_user_view_from_jwt},
};
use lemmy_apub::protocol::activities::community::report::Report;
use lemmy_apub_lib::object_id::ObjectId;
use lemmy_db_schema::{
source::comment_report::{CommentReport, CommentReportForm},
traits::Reportable,
};
use lemmy_db_views::structs::{CommentReportView, CommentView};
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{messages::SendModRoomMessage, LemmyContext, UserOperation};
/// Creates a comment report and notifies the moderators of the community

View file

@ -5,7 +5,7 @@ use lemmy_api_common::{
utils::{blocking, get_local_user_view_from_jwt},
};
use lemmy_db_views::comment_report_view::CommentReportQueryBuilder;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
/// Lists comment reports for a community if an id is supplied

View file

@ -6,7 +6,7 @@ use lemmy_api_common::{
};
use lemmy_db_schema::{source::comment_report::CommentReport, traits::Reportable};
use lemmy_db_views::structs::CommentReportView;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{messages::SendModRoomMessage, LemmyContext, UserOperation};
/// Resolves or unresolves a comment report and notifies the moderators of the community

View file

@ -17,7 +17,7 @@ use lemmy_db_schema::{
traits::{Crud, Joinable},
};
use lemmy_db_views_actor::structs::CommunityModeratorView;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{messages::SendCommunityRoomMessage, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)]

View file

@ -24,7 +24,7 @@ use lemmy_db_schema::{
traits::{Bannable, Crud, Followable},
};
use lemmy_db_views_actor::structs::PersonViewSafe;
use lemmy_utils::{utils::naive_from_unix, ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, utils::naive_from_unix, ConnectionId};
use lemmy_websocket::{messages::SendCommunityRoomMessage, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)]

View file

@ -13,7 +13,7 @@ use lemmy_db_schema::{
traits::{Blockable, Crud, Followable},
};
use lemmy_db_views_actor::structs::CommunityView;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -21,7 +21,7 @@ use lemmy_db_schema::{
traits::{Crud, Followable},
};
use lemmy_db_views_actor::structs::CommunityView;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -13,7 +13,7 @@ use lemmy_db_schema::{
traits::Crud,
utils::naive_now,
};
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{send::send_community_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)]

View file

@ -13,7 +13,7 @@ use lemmy_db_schema::{
traits::{Crud, Joinable},
};
use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView, PersonViewSafe};
use lemmy_utils::{location_info, ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, location_info, ConnectionId};
use lemmy_websocket::LemmyContext;
// TODO: we dont do anything for federation here, it should be updated the next time the community

View file

@ -1,7 +1,7 @@
use actix_web::{web, web::Data};
use captcha::Captcha;
use lemmy_api_common::{comment::*, community::*, person::*, post::*, site::*, websocket::*};
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{serialize_websocket_message, LemmyContext, UserOperation};
use serde::Deserialize;

View file

@ -12,7 +12,7 @@ use lemmy_db_schema::{
traits::Crud,
};
use lemmy_db_views_actor::structs::PersonViewSafe;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{messages::SendAllMessage, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)]

View file

@ -17,7 +17,7 @@ use lemmy_db_schema::{
traits::Crud,
};
use lemmy_db_views_actor::structs::PersonViewSafe;
use lemmy_utils::{utils::naive_from_unix, ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, utils::naive_from_unix, ConnectionId};
use lemmy_websocket::{messages::SendAllMessage, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)]

View file

@ -9,7 +9,7 @@ use lemmy_db_schema::{
traits::Blockable,
};
use lemmy_db_views_actor::structs::PersonViewSafe;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -6,7 +6,7 @@ use lemmy_api_common::{
utils::{blocking, get_local_user_view_from_jwt, password_length_check},
};
use lemmy_db_schema::source::local_user::LocalUser;
use lemmy_utils::{claims::Claims, ConnectionId, LemmyError};
use lemmy_utils::{claims::Claims, error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -8,7 +8,7 @@ use lemmy_db_schema::source::{
local_user::LocalUser,
password_reset_request::PasswordResetRequest,
};
use lemmy_utils::{claims::Claims, ConnectionId, LemmyError};
use lemmy_utils::{claims::Claims, error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -4,7 +4,7 @@ use captcha::{gen, Difficulty};
use chrono::Duration;
use lemmy_api_common::person::{CaptchaResponse, GetCaptcha, GetCaptchaResponse};
use lemmy_db_schema::utils::naive_now;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{messages::CaptchaItem, LemmyContext};
#[async_trait::async_trait(?Send)]

View file

@ -5,7 +5,7 @@ use lemmy_api_common::{
utils::{blocking, get_local_user_view_from_jwt, is_admin},
};
use lemmy_db_views_actor::structs::PersonViewSafe;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -7,7 +7,7 @@ use lemmy_api_common::{
};
use lemmy_db_schema::source::site::Site;
use lemmy_db_views::structs::LocalUserView;
use lemmy_utils::{claims::Claims, ConnectionId, LemmyError};
use lemmy_utils::{claims::Claims, error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -5,7 +5,7 @@ use lemmy_api_common::{
utils::{blocking, get_local_user_view_from_jwt},
};
use lemmy_db_views_actor::person_mention_view::PersonMentionQueryBuilder;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -5,7 +5,7 @@ use lemmy_api_common::{
utils::{blocking, get_local_user_view_from_jwt},
};
use lemmy_db_views::comment_view::CommentQueryBuilder;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -10,7 +10,7 @@ use lemmy_db_schema::source::{
private_message::PrivateMessage,
};
use lemmy_db_views::comment_view::CommentQueryBuilder;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -6,7 +6,7 @@ use lemmy_api_common::{
};
use lemmy_db_schema::{source::person_mention::PersonMention, traits::Crud};
use lemmy_db_views_actor::structs::PersonMentionView;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -6,7 +6,7 @@ use lemmy_api_common::{
};
use lemmy_db_views::structs::{CommentView, PrivateMessageView};
use lemmy_db_views_actor::structs::PersonMentionView;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -5,7 +5,7 @@ use lemmy_api_common::{
utils::{blocking, get_local_user_view_from_jwt},
};
use lemmy_db_views::structs::{CommentReportView, PostReportView};
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -5,7 +5,7 @@ use lemmy_api_common::{
utils::{blocking, send_password_reset_email},
};
use lemmy_db_views::structs::LocalUserView;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -15,9 +15,9 @@ use lemmy_db_schema::{
};
use lemmy_utils::{
claims::Claims,
error::LemmyError,
utils::{is_valid_display_name, is_valid_matrix_id},
ConnectionId,
LemmyError,
};
use lemmy_websocket::LemmyContext;

View file

@ -12,7 +12,7 @@ use lemmy_db_schema::{
traits::Crud,
};
use lemmy_db_views::structs::LocalUserView;
use lemmy_utils::LemmyError;
use lemmy_utils::error::LemmyError;
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -4,7 +4,7 @@ use lemmy_api_common::{
post::{GetSiteMetadata, GetSiteMetadataResponse},
request::fetch_site_metadata,
};
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -23,7 +23,7 @@ use lemmy_db_schema::{
source::post::{Post, PostLike, PostLikeForm},
traits::{Crud, Likeable},
};
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)]

View file

@ -21,7 +21,7 @@ use lemmy_db_schema::{
},
traits::Crud,
};
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)]

View file

@ -5,7 +5,7 @@ use lemmy_api_common::{
utils::{blocking, get_local_user_view_from_jwt, mark_post_as_read, mark_post_as_unread},
};
use lemmy_db_views::structs::PostView;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -9,7 +9,7 @@ use lemmy_db_schema::{
traits::Saveable,
};
use lemmy_db_views::structs::PostView;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -21,7 +21,7 @@ use lemmy_db_schema::{
},
traits::Crud,
};
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)]

View file

@ -1,17 +1,17 @@
use crate::Perform;
use activitypub_federation::core::object_id::ObjectId;
use actix_web::web::Data;
use lemmy_api_common::{
post::{CreatePostReport, PostReportResponse},
utils::{blocking, check_community_ban, get_local_user_view_from_jwt},
};
use lemmy_apub::protocol::activities::community::report::Report;
use lemmy_apub_lib::object_id::ObjectId;
use lemmy_db_schema::{
source::post_report::{PostReport, PostReportForm},
traits::Reportable,
};
use lemmy_db_views::structs::{PostReportView, PostView};
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{messages::SendModRoomMessage, LemmyContext, UserOperation};
/// Creates a post report and notifies the moderators of the community

View file

@ -5,7 +5,7 @@ use lemmy_api_common::{
utils::{blocking, get_local_user_view_from_jwt},
};
use lemmy_db_views::post_report_view::PostReportQueryBuilder;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
/// Lists post reports for a community if an id is supplied

View file

@ -6,7 +6,7 @@ use lemmy_api_common::{
};
use lemmy_db_schema::{source::post_report::PostReport, traits::Reportable};
use lemmy_db_views::structs::PostReportView;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{messages::SendModRoomMessage, LemmyContext, UserOperation};
/// Resolves or unresolves a post report and notifies the moderators of the community

View file

@ -5,7 +5,7 @@ use lemmy_api_common::{
utils::{blocking, get_local_user_view_from_jwt},
};
use lemmy_db_schema::{source::private_message::PrivateMessage, traits::Crud};
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{send::send_pm_ws_message, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)]

View file

@ -4,7 +4,7 @@ use lemmy_api_common::{
site::{GetSiteConfig, GetSiteConfigResponse},
utils::{get_local_user_view_from_jwt, is_admin},
};
use lemmy_utils::{settings::structs::Settings, ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, settings::structs::Settings, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -4,7 +4,7 @@ use lemmy_api_common::{
site::{GetSiteConfigResponse, SaveSiteConfig},
utils::{get_local_user_view_from_jwt, is_admin},
};
use lemmy_utils::{settings::structs::Settings, ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, settings::structs::Settings, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -13,7 +13,7 @@ use lemmy_db_schema::{
};
use lemmy_db_views::structs::SiteView;
use lemmy_db_views_actor::structs::PersonViewSafe;
use lemmy_utils::{version, ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, version, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -17,7 +17,7 @@ use lemmy_db_views_moderator::structs::{
ModStickyPostView,
ModTransferCommunityView,
};
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -13,7 +13,7 @@ use lemmy_db_schema::{
utils::diesel_option_overwrite,
};
use lemmy_db_views::structs::{LocalUserView, RegistrationApplicationView};
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -6,7 +6,7 @@ use lemmy_api_common::{
};
use lemmy_db_schema::source::site::Site;
use lemmy_db_views::registration_application_view::RegistrationApplicationQueryBuilder;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
/// Lists registration applications, filterable by undenied only.

View file

@ -6,7 +6,7 @@ use lemmy_api_common::{
};
use lemmy_db_schema::source::site::Site;
use lemmy_db_views::structs::RegistrationApplicationView;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -9,7 +9,7 @@ use lemmy_apub::fetcher::search::{search_by_apub_id, SearchableObjects};
use lemmy_db_schema::{newtypes::PersonId, utils::DbPool};
use lemmy_db_views::structs::{CommentView, PostView};
use lemmy_db_views_actor::structs::{CommunityView, PersonViewSafe};
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -11,7 +11,7 @@ use lemmy_db_views_actor::{
community_view::CommunityQueryBuilder,
person_view::PersonQueryBuilder,
};
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -1,7 +1,7 @@
use crate::Perform;
use actix_web::web::Data;
use lemmy_api_common::{utils::get_local_user_view_from_jwt, websocket::*};
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{
messages::{JoinCommunityRoom, JoinModRoom, JoinPostRoom, JoinUserRoom},
LemmyContext,

View file

@ -1,6 +1,6 @@
use crate::post::SiteMetadata;
use encoding::{all::encodings, DecoderTrap};
use lemmy_utils::{settings::structs::Settings, version::VERSION, LemmyError, REQWEST_TIMEOUT};
use lemmy_utils::{error::LemmyError, settings::structs::Settings, version::VERSION};
use percent_encoding::{utf8_percent_encode, NON_ALPHANUMERIC};
use reqwest_middleware::ClientWithMiddleware;
use serde::Deserialize;
@ -15,11 +15,7 @@ pub async fn fetch_site_metadata(
url: &Url,
) -> Result<SiteMetadata, LemmyError> {
info!("Fetching site metadata for url: {}", url);
let response = client
.get(url.as_str())
.timeout(REQWEST_TIMEOUT)
.send()
.await?;
let response = client.get(url.as_str()).send().await?;
// Can't use .text() here, because it only checks the content header, not the actual bytes
// https://github.com/LemmyNet/lemmy/issues/1964
@ -122,11 +118,7 @@ pub(crate) async fn fetch_pictrs(
utf8_percent_encode(image_url.as_str(), NON_ALPHANUMERIC) // TODO this might not be needed
);
let response = client
.get(&fetch_url)
.timeout(REQWEST_TIMEOUT)
.send()
.await?;
let response = client.get(&fetch_url).send().await?;
let response: PictrsResponse = response.json().await.map_err(LemmyError::from)?;
@ -195,11 +187,7 @@ pub async fn fetch_site_data(
#[tracing::instrument(skip_all)]
async fn is_image_content_type(client: &ClientWithMiddleware, url: &Url) -> Result<(), LemmyError> {
let response = client
.get(url.as_str())
.timeout(REQWEST_TIMEOUT)
.send()
.await?;
let response = client.get(url.as_str()).send().await?;
if response
.headers()
.get("Content-Type")

View file

@ -28,9 +28,9 @@ use lemmy_db_views_actor::structs::{
use lemmy_utils::{
claims::Claims,
email::{send_email, translations::Lang},
error::LemmyError,
settings::structs::Settings,
utils::generate_random_string,
LemmyError,
};
use rosetta_i18n::{Language, LanguageId};
use tracing::warn;

View file

@ -9,13 +9,13 @@ documentation = "https://join-lemmy.org/docs/en/index.html"
[dependencies]
lemmy_apub = { version = "=0.16.5", path = "../apub" }
lemmy_apub_lib = { version = "=0.16.5", path = "../apub_lib" }
lemmy_utils = { version = "=0.16.5", path = "../utils" }
lemmy_db_schema = { version = "=0.16.5", path = "../db_schema", features = ["full"] }
lemmy_db_views = { version = "=0.16.5", path = "../db_views", features = ["full"] }
lemmy_db_views_actor = { version = "=0.16.5", path = "../db_views_actor", features = ["full"] }
lemmy_api_common = { version = "=0.16.5", path = "../api_common", features = ["full"] }
lemmy_websocket = { version = "=0.16.5", path = "../websocket" }
activitypub_federation = "0.1.0"
bcrypt = "0.12.1"
serde_json = { version = "1.0.79", features = ["preserve_order"] }
serde = { version = "1.0.136", features = ["derive"] }

View file

@ -26,9 +26,9 @@ use lemmy_db_schema::{
};
use lemmy_db_views::structs::CommentView;
use lemmy_utils::{
error::LemmyError,
utils::{remove_slurs, scrape_text_for_mentions},
ConnectionId,
LemmyError,
};
use lemmy_websocket::{
send::{send_comment_ws_message, send_local_notifs},

View file

@ -10,7 +10,7 @@ use lemmy_db_schema::{
traits::Crud,
};
use lemmy_db_views::structs::CommentView;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{
send::{send_comment_ws_message, send_local_notifs},
LemmyContext,

View file

@ -7,7 +7,7 @@ use lemmy_api_common::{
use lemmy_apub::{fetcher::resolve_actor_identifier, objects::community::ApubCommunity};
use lemmy_db_schema::{source::community::Community, traits::DeleteableOrRemoveable};
use lemmy_db_views::comment_view::CommentQueryBuilder;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -5,7 +5,7 @@ use lemmy_api_common::{
utils::{blocking, check_private_instance, get_local_user_view_from_jwt_opt},
};
use lemmy_db_views::structs::CommentView;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -15,7 +15,7 @@ use lemmy_db_schema::{
traits::Crud,
};
use lemmy_db_views::structs::CommentView;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{
send::{send_comment_ws_message, send_local_notifs},
LemmyContext,

View file

@ -16,9 +16,9 @@ use lemmy_apub::protocol::activities::{
use lemmy_db_schema::source::comment::Comment;
use lemmy_db_views::structs::CommentView;
use lemmy_utils::{
error::LemmyError,
utils::{remove_slurs, scrape_text_for_mentions},
ConnectionId,
LemmyError,
};
use lemmy_websocket::{
send::{send_comment_ws_message, send_local_notifs},

View file

@ -1,4 +1,5 @@
use crate::PerformCrud;
use activitypub_federation::core::{object_id::ObjectId, signatures::generate_actor_keypair};
use actix_web::web::Data;
use lemmy_api_common::{
community::{CommunityResponse, CreateCommunity},
@ -12,7 +13,6 @@ use lemmy_apub::{
objects::community::ApubCommunity,
EndpointType,
};
use lemmy_apub_lib::object_id::ObjectId;
use lemmy_db_schema::{
source::{
community::{
@ -30,10 +30,9 @@ use lemmy_db_schema::{
};
use lemmy_db_views_actor::structs::CommunityView;
use lemmy_utils::{
apub::generate_actor_keypair,
error::LemmyError,
utils::{check_slurs, check_slurs_opt, is_valid_actor_name},
ConnectionId,
LemmyError,
};
use lemmy_websocket::LemmyContext;
@ -77,7 +76,9 @@ impl PerformCrud for CreateCommunity {
&context.settings().get_protocol_and_hostname(),
)?;
let community_actor_id_wrapped = ObjectId::<ApubCommunity>::new(community_actor_id.clone());
let community_dupe = community_actor_id_wrapped.dereference_local(context).await;
let community_dupe = community_actor_id_wrapped
.dereference_local::<LemmyError>(context)
.await;
if community_dupe.is_ok() {
return Err(LemmyError::from_message("community_already_exists"));
}

View file

@ -7,7 +7,7 @@ use lemmy_api_common::{
use lemmy_apub::activities::deletion::{send_apub_delete_in_community, DeletableObjects};
use lemmy_db_schema::source::community::Community;
use lemmy_db_views_actor::structs::CommunityModeratorView;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{send::send_community_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)]

View file

@ -6,7 +6,7 @@ use lemmy_api_common::{
};
use lemmy_db_schema::traits::DeleteableOrRemoveable;
use lemmy_db_views_actor::community_view::CommunityQueryBuilder;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -13,7 +13,7 @@ use lemmy_db_schema::{
traits::DeleteableOrRemoveable,
};
use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView};
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{messages::GetCommunityUsersOnline, LemmyContext};
#[async_trait::async_trait(?Send)]

View file

@ -12,7 +12,7 @@ use lemmy_db_schema::{
},
traits::Crud,
};
use lemmy_utils::{utils::naive_from_unix, ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, utils::naive_from_unix, ConnectionId};
use lemmy_websocket::{send::send_community_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)]

View file

@ -12,7 +12,7 @@ use lemmy_db_schema::{
utils::{diesel_option_overwrite_to_url, naive_now},
};
use lemmy_db_views_actor::structs::CommunityModeratorView;
use lemmy_utils::{utils::check_slurs_opt, ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, utils::check_slurs_opt, ConnectionId};
use lemmy_websocket::{send::send_community_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)]

View file

@ -1,6 +1,6 @@
use actix_web::{web, web::Data};
use lemmy_api_common::{comment::*, community::*, person::*, post::*, site::*};
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{serialize_websocket_message, LemmyContext, UserOperationCrud};
use serde::Deserialize;

View file

@ -27,6 +27,7 @@ use lemmy_db_schema::{
};
use lemmy_db_views_actor::structs::CommunityView;
use lemmy_utils::{
error::LemmyError,
utils::{
check_slurs,
check_slurs_opt,
@ -35,7 +36,6 @@ use lemmy_utils::{
is_valid_post_title,
},
ConnectionId,
LemmyError,
};
use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperationCrud};
use tracing::{warn, Instrument};

View file

@ -14,7 +14,7 @@ use lemmy_db_schema::{
source::{community::Community, post::Post},
traits::Crud,
};
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)]

View file

@ -11,7 +11,7 @@ use lemmy_db_schema::{
ListingType,
};
use lemmy_db_views::post_view::PostQueryBuilder;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
use std::str::FromStr;

View file

@ -7,7 +7,7 @@ use lemmy_api_common::{
use lemmy_db_schema::traits::DeleteableOrRemoveable;
use lemmy_db_views::{comment_view::CommentQueryBuilder, structs::PostView};
use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView};
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{messages::GetPostUsersOnline, LemmyContext};
#[async_trait::async_trait(?Send)]

View file

@ -13,7 +13,7 @@ use lemmy_db_schema::{
},
traits::Crud,
};
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)]

View file

@ -19,9 +19,9 @@ use lemmy_db_schema::{
utils::naive_now,
};
use lemmy_utils::{
error::LemmyError,
utils::{check_slurs_opt, clean_optional_text, clean_url_params, is_valid_post_title},
ConnectionId,
LemmyError,
};
use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperationCrud};

View file

@ -23,7 +23,7 @@ use lemmy_db_schema::{
traits::Crud,
};
use lemmy_db_views::structs::LocalUserView;
use lemmy_utils::{utils::remove_slurs, ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, utils::remove_slurs, ConnectionId};
use lemmy_websocket::{send::send_pm_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)]

View file

@ -6,7 +6,7 @@ use lemmy_api_common::{
};
use lemmy_apub::activities::deletion::send_apub_delete_private_message;
use lemmy_db_schema::{source::private_message::PrivateMessage, traits::Crud};
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::{send::send_pm_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)]

View file

@ -6,7 +6,7 @@ use lemmy_api_common::{
};
use lemmy_db_schema::traits::DeleteableOrRemoveable;
use lemmy_db_views::private_message_view::PrivateMessageQueryBuilder;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -9,7 +9,7 @@ use lemmy_apub::protocol::activities::{
CreateOrUpdateType,
};
use lemmy_db_schema::{source::private_message::PrivateMessage, traits::Crud};
use lemmy_utils::{utils::remove_slurs, ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, utils::remove_slurs, ConnectionId};
use lemmy_websocket::{send::send_pm_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)]

View file

@ -1,4 +1,5 @@
use crate::PerformCrud;
use activitypub_federation::core::signatures::generate_actor_keypair;
use actix_web::web::Data;
use lemmy_api_common::{
site::{CreateSite, SiteResponse},
@ -13,11 +14,10 @@ use lemmy_db_schema::{
};
use lemmy_db_views::structs::SiteView;
use lemmy_utils::{
apub::generate_actor_keypair,
error::LemmyError,
settings::structs::Settings,
utils::{check_slurs, check_slurs_opt},
ConnectionId,
LemmyError,
};
use lemmy_websocket::LemmyContext;
use url::Url;

View file

@ -13,7 +13,7 @@ use lemmy_db_views_actor::structs::{
PersonBlockView,
PersonViewSafe,
};
use lemmy_utils::{version, ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, version, ConnectionId};
use lemmy_websocket::{messages::GetUsersOnline, LemmyContext};
use tracing::info;

View file

@ -14,7 +14,7 @@ use lemmy_db_schema::{
ListingType,
};
use lemmy_db_views::structs::SiteView;
use lemmy_utils::{utils::check_slurs_opt, ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, utils::check_slurs_opt, ConnectionId};
use lemmy_websocket::{messages::SendAllMessage, LemmyContext, UserOperationCrud};
use std::{default::Default, str::FromStr};

View file

@ -1,4 +1,5 @@
use crate::PerformCrud;
use activitypub_federation::core::signatures::generate_actor_keypair;
use actix_web::web::Data;
use lemmy_api_common::{
person::{LoginResponse, Register},
@ -33,11 +34,10 @@ use lemmy_db_schema::{
use lemmy_db_views::structs::LocalUserView;
use lemmy_db_views_actor::structs::PersonViewSafe;
use lemmy_utils::{
apub::generate_actor_keypair,
claims::Claims,
error::LemmyError,
utils::{check_slurs, is_valid_actor_name},
ConnectionId,
LemmyError,
};
use lemmy_websocket::{messages::CheckCaptcha, LemmyContext};

View file

@ -6,7 +6,7 @@ use lemmy_api_common::{
utils::{delete_user_account, get_local_user_view_from_jwt},
};
use lemmy_apub::protocol::activities::deletion::delete_user::DeleteUser;
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -8,7 +8,7 @@ use lemmy_apub::{fetcher::resolve_actor_identifier, objects::person::ApubPerson}
use lemmy_db_schema::source::person::Person;
use lemmy_db_views::{comment_view::CommentQueryBuilder, post_view::PostQueryBuilder};
use lemmy_db_views_actor::structs::{CommunityModeratorView, PersonViewSafe};
use lemmy_utils::{ConnectionId, LemmyError};
use lemmy_utils::{error::LemmyError, ConnectionId};
use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]

View file

@ -14,12 +14,12 @@ doctest = false
[dependencies]
lemmy_utils = { version = "=0.16.5", path = "../utils" }
lemmy_apub_lib = { version = "=0.16.5", path = "../apub_lib" }
lemmy_db_schema = { version = "=0.16.5", path = "../db_schema", features = ["full"] }
lemmy_db_views = { version = "=0.16.5", path = "../db_views", features = ["full"] }
lemmy_db_views_actor = { version = "=0.16.5", path = "../db_views_actor", features = ["full"] }
lemmy_api_common = { version = "=0.16.5", path = "../api_common", features = ["full"] }
lemmy_websocket = { version = "=0.16.5", path = "../websocket" }
activitypub_federation = "0.1.0"
diesel = "1.4.8"
activitystreams-kinds = "0.2.1"
chrono = { version = "0.4.19", features = ["serde"], default-features = false }

View file

@ -1,8 +1,6 @@
{
"actor": "http://ds9.lemmy.ml/u/lemmy_alpha",
"to": [
"http://enterprise.lemmy.ml/c/main"
],
"to": "http://enterprise.lemmy.ml/c/main",
"object": "http://enterprise.lemmy.ml/post/7",
"summary": "report this post",
"type": "Flag",

View file

@ -1,16 +1,12 @@
{
"id": "http://enterprise.lemmy.ml/activities/create/987d05fa-f637-46d7-85be-13d112bc269f",
"actor": "http://enterprise.lemmy.ml/u/lemmy_beta",
"to": [
"http://ds9.lemmy.ml/u/lemmy_alpha"
],
"to": "http://ds9.lemmy.ml/u/lemmy_alpha",
"object": {
"type": "ChatMessage",
"id": "http://enterprise.lemmy.ml/private_message/1",
"attributedTo": "http://enterprise.lemmy.ml/u/lemmy_beta",
"to": [
"http://ds9.lemmy.ml/u/lemmy_alpha"
],
"to": "http://ds9.lemmy.ml/u/lemmy_alpha",
"content": "hello",
"mediaType": "text/html",
"source": {

View file

@ -2,9 +2,7 @@
"id": "https://enterprise.lemmy.ml/private_message/1621",
"type": "ChatMessage",
"attributedTo": "https://enterprise.lemmy.ml/u/picard",
"to": [
"https://queer.hacktivis.me/users/lanodan"
],
"to": "https://queer.hacktivis.me/users/lanodan",
"content": "<p>Hello hello, testing</p>\n",
"mediaType": "text/html",
"source": {

View file

@ -4,25 +4,26 @@ use crate::{
community::{announce::GetCommunity, send_activity_in_community},
generate_activity_id,
send_lemmy_activity,
verify_activity,
verify_is_public,
verify_mod_action,
verify_person_in_community,
},
activity_lists::AnnouncableActivities,
local_instance,
objects::{community::ApubCommunity, person::ApubPerson},
protocol::activities::block::block_user::BlockUser,
ActorType,
};
use activitypub_federation::{
core::object_id::ObjectId,
data::Data,
traits::ActivityHandler,
utils::verify_domains_match,
};
use activitystreams_kinds::{activity::BlockType, public};
use anyhow::anyhow;
use chrono::NaiveDateTime;
use lemmy_api_common::utils::{blocking, remove_user_data, remove_user_data_in_community};
use lemmy_apub_lib::{
data::Data,
object_id::ObjectId,
traits::{ActivityHandler, ActorType},
verify::verify_domains_match,
};
use lemmy_db_schema::{
source::{
community::{
@ -36,8 +37,9 @@ use lemmy_db_schema::{
},
traits::{Bannable, Crud, Followable},
};
use lemmy_utils::{settings::structs::Settings, utils::convert_datetime, LemmyError};
use lemmy_utils::{error::LemmyError, settings::structs::Settings, utils::convert_datetime};
use lemmy_websocket::LemmyContext;
use url::Url;
impl BlockUser {
pub(in crate::activities::block) async fn new(
@ -106,6 +108,15 @@ impl BlockUser {
#[async_trait::async_trait(?Send)]
impl ActivityHandler for BlockUser {
type DataType = LemmyContext;
type Error = LemmyError;
fn id(&self) -> &Url {
&self.id
}
fn actor(&self) -> &Url {
self.actor.inner()
}
#[tracing::instrument(skip_all)]
async fn verify(
@ -114,10 +125,9 @@ impl ActivityHandler for BlockUser {
request_counter: &mut i32,
) -> Result<(), LemmyError> {
verify_is_public(&self.to, &self.cc)?;
verify_activity(&self.id, self.actor.inner(), &context.settings())?;
match self
.target
.dereference(context, context.client(), request_counter)
.dereference::<LemmyError>(context, local_instance(context), request_counter)
.await?
{
SiteOrCommunity::Site(site) => {
@ -155,15 +165,15 @@ impl ActivityHandler for BlockUser {
let expires = self.expires.map(|u| u.naive_local());
let mod_person = self
.actor
.dereference(context, context.client(), request_counter)
.dereference::<LemmyError>(context, local_instance(context), request_counter)
.await?;
let blocked_person = self
.object
.dereference(context, context.client(), request_counter)
.dereference::<LemmyError>(context, local_instance(context), request_counter)
.await?;
let target = self
.target
.dereference(context, context.client(), request_counter)
.dereference::<LemmyError>(context, local_instance(context), request_counter)
.await?;
match target {
SiteOrCommunity::Site(_site) => {
@ -242,7 +252,7 @@ impl GetCommunity for BlockUser {
) -> Result<ApubCommunity, LemmyError> {
let target = self
.target
.dereference(context, context.client(), request_counter)
.dereference::<LemmyError>(context, local_instance(context), request_counter)
.await?;
match target {
SiteOrCommunity::Community(c) => Ok(c),

View file

@ -1,15 +1,13 @@
use crate::{
objects::{community::ApubCommunity, instance::ApubSite, person::ApubPerson},
protocol::objects::{group::Group, instance::Instance},
ActorType,
};
use activitypub_federation::{core::object_id::ObjectId, traits::ApubObject};
use chrono::NaiveDateTime;
use lemmy_api_common::utils::blocking;
use lemmy_apub_lib::{
object_id::ObjectId,
traits::{ActorType, ApubObject},
};
use lemmy_db_schema::{source::site::Site, utils::DbPool};
use lemmy_utils::LemmyError;
use lemmy_utils::error::LemmyError;
use lemmy_websocket::LemmyContext;
use serde::Deserialize;
use url::Url;
@ -35,7 +33,7 @@ impl ApubObject for SiteOrCommunity {
type DataType = LemmyContext;
type ApubType = InstanceOrGroup;
type DbType = ();
type TombstoneType = ();
type Error = LemmyError;
#[tracing::instrument(skip_all)]
fn last_refreshed_at(&self) -> Option<NaiveDateTime> {
@ -70,10 +68,6 @@ impl ApubObject for SiteOrCommunity {
unimplemented!()
}
fn to_tombstone(&self) -> Result<Self::TombstoneType, LemmyError> {
unimplemented!()
}
#[tracing::instrument(skip_all)]
async fn verify(
apub: &Self::ApubType,

View file

@ -4,21 +4,22 @@ use crate::{
community::{announce::GetCommunity, send_activity_in_community},
generate_activity_id,
send_lemmy_activity,
verify_activity,
verify_is_public,
},
activity_lists::AnnouncableActivities,
local_instance,
objects::{community::ApubCommunity, person::ApubPerson},
protocol::activities::block::{block_user::BlockUser, undo_block_user::UndoBlockUser},
ActorType,
};
use activitypub_federation::{
core::object_id::ObjectId,
data::Data,
traits::ActivityHandler,
utils::verify_domains_match,
};
use activitystreams_kinds::{activity::UndoType, public};
use lemmy_api_common::utils::blocking;
use lemmy_apub_lib::{
data::Data,
object_id::ObjectId,
traits::{ActivityHandler, ActorType},
verify::verify_domains_match,
};
use lemmy_db_schema::{
source::{
community::{CommunityPersonBan, CommunityPersonBanForm},
@ -27,8 +28,9 @@ use lemmy_db_schema::{
},
traits::{Bannable, Crud},
};
use lemmy_utils::LemmyError;
use lemmy_utils::error::LemmyError;
use lemmy_websocket::LemmyContext;
use url::Url;
impl UndoBlockUser {
#[tracing::instrument(skip_all)]
@ -72,6 +74,15 @@ impl UndoBlockUser {
#[async_trait::async_trait(?Send)]
impl ActivityHandler for UndoBlockUser {
type DataType = LemmyContext;
type Error = LemmyError;
fn id(&self) -> &Url {
&self.id
}
fn actor(&self) -> &Url {
self.actor.inner()
}
#[tracing::instrument(skip_all)]
async fn verify(
@ -80,7 +91,6 @@ impl ActivityHandler for UndoBlockUser {
request_counter: &mut i32,
) -> Result<(), LemmyError> {
verify_is_public(&self.to, &self.cc)?;
verify_activity(&self.id, self.actor.inner(), &context.settings())?;
verify_domains_match(self.actor.inner(), self.object.actor.inner())?;
self.object.verify(context, request_counter).await?;
Ok(())
@ -92,20 +102,21 @@ impl ActivityHandler for UndoBlockUser {
context: &Data<LemmyContext>,
request_counter: &mut i32,
) -> Result<(), LemmyError> {
let instance = local_instance(context);
let expires = self.object.expires.map(|u| u.naive_local());
let mod_person = self
.actor
.dereference(context, context.client(), request_counter)
.dereference::<LemmyError>(context, instance, request_counter)
.await?;
let blocked_person = self
.object
.object
.dereference(context, context.client(), request_counter)
.dereference::<LemmyError>(context, instance, request_counter)
.await?;
match self
.object
.target
.dereference(context, context.client(), request_counter)
.dereference::<LemmyError>(context, instance, request_counter)
.await?
{
SiteOrCommunity::Site(_site) => {

View file

@ -6,7 +6,6 @@ use crate::{
send_activity_in_community,
},
generate_activity_id,
verify_activity,
verify_add_remove_moderator_target,
verify_is_public,
verify_mod_action,
@ -14,16 +13,14 @@ use crate::{
},
activity_lists::AnnouncableActivities,
generate_moderators_url,
local_instance,
objects::{community::ApubCommunity, person::ApubPerson},
protocol::activities::community::add_mod::AddMod,
ActorType,
};
use activitypub_federation::{core::object_id::ObjectId, data::Data, traits::ActivityHandler};
use activitystreams_kinds::{activity::AddType, public};
use lemmy_api_common::utils::blocking;
use lemmy_apub_lib::{
data::Data,
object_id::ObjectId,
traits::{ActivityHandler, ActorType},
};
use lemmy_db_schema::{
source::{
community::{CommunityModerator, CommunityModeratorForm},
@ -31,8 +28,9 @@ use lemmy_db_schema::{
},
traits::{Crud, Joinable},
};
use lemmy_utils::LemmyError;
use lemmy_utils::error::LemmyError;
use lemmy_websocket::LemmyContext;
use url::Url;
impl AddMod {
#[tracing::instrument(skip_all)]
@ -66,6 +64,15 @@ impl AddMod {
#[async_trait::async_trait(?Send)]
impl ActivityHandler for AddMod {
type DataType = LemmyContext;
type Error = LemmyError;
fn id(&self) -> &Url {
&self.id
}
fn actor(&self) -> &Url {
self.actor.inner()
}
#[tracing::instrument(skip_all)]
async fn verify(
@ -74,7 +81,6 @@ impl ActivityHandler for AddMod {
request_counter: &mut i32,
) -> Result<(), LemmyError> {
verify_is_public(&self.to, &self.cc)?;
verify_activity(&self.id, self.actor.inner(), &context.settings())?;
let community = self.get_community(context, request_counter).await?;
verify_person_in_community(&self.actor, &community, context, request_counter).await?;
verify_mod_action(
@ -98,7 +104,7 @@ impl ActivityHandler for AddMod {
let community = self.get_community(context, request_counter).await?;
let new_mod = self
.object
.dereference(context, context.client(), request_counter)
.dereference::<LemmyError>(context, local_instance(context), request_counter)
.await?;
// If we had to refetch the community while parsing the activity, then the new mod has already
@ -121,7 +127,7 @@ impl ActivityHandler for AddMod {
// write mod log
let actor = self
.actor
.dereference(context, context.client(), request_counter)
.dereference::<LemmyError>(context, local_instance(context), request_counter)
.await?;
let form = ModAddCommunityForm {
mod_person_id: actor.id,

View file

@ -1,23 +1,20 @@
use crate::{
activities::{generate_activity_id, send_lemmy_activity, verify_activity, verify_is_public},
activities::{generate_activity_id, send_lemmy_activity, verify_is_public},
activity_lists::AnnouncableActivities,
http::ActivityCommonFields,
insert_activity,
objects::community::ApubCommunity,
protocol::{
activities::{community::announce::AnnounceActivity, CreateOrUpdateType},
IdOrNestedObject,
},
ActorType,
};
use activitypub_federation::{core::object_id::ObjectId, data::Data, traits::ActivityHandler};
use activitystreams_kinds::{activity::AnnounceType, public};
use lemmy_apub_lib::{
data::Data,
object_id::ObjectId,
traits::{ActivityHandler, ActorType},
};
use lemmy_utils::LemmyError;
use lemmy_utils::error::LemmyError;
use lemmy_websocket::LemmyContext;
use tracing::debug;
use url::Url;
#[async_trait::async_trait(?Send)]
pub(crate) trait GetCommunity {
@ -90,15 +87,23 @@ impl AnnounceActivity {
#[async_trait::async_trait(?Send)]
impl ActivityHandler for AnnounceActivity {
type DataType = LemmyContext;
type Error = LemmyError;
fn id(&self) -> &Url {
&self.id
}
fn actor(&self) -> &Url {
self.actor.inner()
}
#[tracing::instrument(skip_all)]
async fn verify(
&self,
context: &Data<LemmyContext>,
_context: &Data<LemmyContext>,
_request_counter: &mut i32,
) -> Result<(), LemmyError> {
verify_is_public(&self.to, &self.cc)?;
verify_activity(&self.id, self.actor.inner(), &context.settings())?;
Ok(())
}
@ -118,14 +123,12 @@ impl ActivityHandler for AnnounceActivity {
AnnouncableActivities::Page(_) => {}
_ => {
let object_value = serde_json::to_value(&object)?;
let object_data: ActivityCommonFields = serde_json::from_value(object_value.to_owned())?;
let insert =
insert_activity(&object_data.id, object_value, false, true, context.pool()).await?;
insert_activity(object.id(), object_value, false, true, context.pool()).await?;
if !insert {
debug!(
"Received duplicate activity in announce {}",
object_data.id.to_string()
object.id().to_string()
);
return Ok(());
}

View file

@ -1,11 +1,13 @@
use crate::{
activities::send_lemmy_activity,
activity_lists::AnnouncableActivities,
local_instance,
objects::community::ApubCommunity,
protocol::activities::community::announce::AnnounceActivity,
ActorType,
};
use lemmy_apub_lib::{object_id::ObjectId, traits::ActorType};
use lemmy_utils::LemmyError;
use activitypub_federation::core::object_id::ObjectId;
use lemmy_utils::error::LemmyError;
use lemmy_websocket::LemmyContext;
use url::Url;
@ -42,6 +44,6 @@ async fn get_community_from_moderators_url(
) -> Result<ApubCommunity, LemmyError> {
let community_id = Url::parse(&moderators.to_string().replace("/moderators", ""))?;
ObjectId::new(community_id)
.dereference(context, context.client(), request_counter)
.dereference::<LemmyError>(context, local_instance(context), request_counter)
.await
}

View file

@ -6,7 +6,6 @@ use crate::{
send_activity_in_community,
},
generate_activity_id,
verify_activity,
verify_add_remove_moderator_target,
verify_is_public,
verify_mod_action,
@ -14,16 +13,14 @@ use crate::{
},
activity_lists::AnnouncableActivities,
generate_moderators_url,
local_instance,
objects::{community::ApubCommunity, person::ApubPerson},
protocol::activities::community::remove_mod::RemoveMod,
ActorType,
};
use activitypub_federation::{core::object_id::ObjectId, data::Data, traits::ActivityHandler};
use activitystreams_kinds::{activity::RemoveType, public};
use lemmy_api_common::utils::blocking;
use lemmy_apub_lib::{
data::Data,
object_id::ObjectId,
traits::{ActivityHandler, ActorType},
};
use lemmy_db_schema::{
source::{
community::{CommunityModerator, CommunityModeratorForm},
@ -31,8 +28,9 @@ use lemmy_db_schema::{
},
traits::{Crud, Joinable},
};
use lemmy_utils::LemmyError;
use lemmy_utils::error::LemmyError;
use lemmy_websocket::LemmyContext;
use url::Url;
impl RemoveMod {
#[tracing::instrument(skip_all)]
@ -66,6 +64,15 @@ impl RemoveMod {
#[async_trait::async_trait(?Send)]
impl ActivityHandler for RemoveMod {
type DataType = LemmyContext;
type Error = LemmyError;
fn id(&self) -> &Url {
&self.id
}
fn actor(&self) -> &Url {
self.actor.inner()
}
#[tracing::instrument(skip_all)]
async fn verify(
@ -74,7 +81,6 @@ impl ActivityHandler for RemoveMod {
request_counter: &mut i32,
) -> Result<(), LemmyError> {
verify_is_public(&self.to, &self.cc)?;
verify_activity(&self.id, self.actor.inner(), &context.settings())?;
let community = self.get_community(context, request_counter).await?;
verify_person_in_community(&self.actor, &community, context, request_counter).await?;
verify_mod_action(
@ -98,7 +104,7 @@ impl ActivityHandler for RemoveMod {
let community = self.get_community(context, request_counter).await?;
let remove_mod = self
.object
.dereference(context, context.client(), request_counter)
.dereference::<LemmyError>(context, local_instance(context), request_counter)
.await?;
let form = CommunityModeratorForm {
@ -113,7 +119,7 @@ impl ActivityHandler for RemoveMod {
// write mod log
let actor = self
.actor
.dereference(context, context.client(), request_counter)
.dereference::<LemmyError>(context, local_instance(context), request_counter)
.await?;
let form = ModAddCommunityForm {
mod_person_id: actor.id,

View file

@ -1,21 +1,14 @@
use crate::{
activities::{
generate_activity_id,
send_lemmy_activity,
verify_activity,
verify_person_in_community,
},
activities::{generate_activity_id, send_lemmy_activity, verify_person_in_community},
local_instance,
objects::{community::ApubCommunity, person::ApubPerson},
protocol::activities::community::report::Report,
ActorType,
PostOrComment,
};
use activitypub_federation::{core::object_id::ObjectId, data::Data, traits::ActivityHandler};
use activitystreams_kinds::activity::FlagType;
use lemmy_api_common::{comment::CommentReportResponse, post::PostReportResponse, utils::blocking};
use lemmy_apub_lib::{
data::Data,
object_id::ObjectId,
traits::{ActivityHandler, ActorType},
};
use lemmy_db_schema::{
source::{
comment_report::{CommentReport, CommentReportForm},
@ -24,8 +17,9 @@ use lemmy_db_schema::{
traits::Reportable,
};
use lemmy_db_views::structs::{CommentReportView, PostReportView};
use lemmy_utils::LemmyError;
use lemmy_utils::error::LemmyError;
use lemmy_websocket::{messages::SendModRoomMessage, LemmyContext, UserOperation};
use url::Url;
impl Report {
#[tracing::instrument(skip_all)]
@ -36,7 +30,9 @@ impl Report {
reason: String,
context: &LemmyContext,
) -> Result<(), LemmyError> {
let community = community_id.dereference_local(context).await?;
let community = community_id
.dereference_local::<LemmyError>(context)
.await?;
let kind = FlagType::Flag;
let id = generate_activity_id(
kind.clone(),
@ -44,7 +40,7 @@ impl Report {
)?;
let report = Report {
actor: ObjectId::new(actor.actor_id()),
to: [ObjectId::new(community.actor_id())],
to: ObjectId::new(community.actor_id()),
object: object_id,
summary: reason,
kind,
@ -66,6 +62,15 @@ impl Report {
#[async_trait::async_trait(?Send)]
impl ActivityHandler for Report {
type DataType = LemmyContext;
type Error = LemmyError;
fn id(&self) -> &Url {
&self.id
}
fn actor(&self) -> &Url {
self.actor.inner()
}
#[tracing::instrument(skip_all)]
async fn verify(
@ -73,9 +78,9 @@ impl ActivityHandler for Report {
context: &Data<LemmyContext>,
request_counter: &mut i32,
) -> Result<(), LemmyError> {
verify_activity(&self.id, self.actor.inner(), &context.settings())?;
let community = self.to[0]
.dereference(context, context.client(), request_counter)
let community = self
.to
.dereference::<LemmyError>(context, local_instance(context), request_counter)
.await?;
verify_person_in_community(&self.actor, &community, context, request_counter).await?;
Ok(())
@ -89,11 +94,11 @@ impl ActivityHandler for Report {
) -> Result<(), LemmyError> {
let actor = self
.actor
.dereference(context, context.client(), request_counter)
.dereference::<LemmyError>(context, local_instance(context), request_counter)
.await?;
match self
.object
.dereference(context, context.client(), request_counter)
.dereference::<LemmyError>(context, local_instance(context), request_counter)
.await?
{
PostOrComment::Post(post) => {

View file

@ -2,28 +2,30 @@ use crate::{
activities::{
community::{announce::GetCommunity, send_activity_in_community},
generate_activity_id,
verify_activity,
verify_is_public,
verify_mod_action,
verify_person_in_community,
},
activity_lists::AnnouncableActivities,
local_instance,
objects::{community::ApubCommunity, person::ApubPerson},
protocol::activities::community::update::UpdateCommunity,
ActorType,
};
use activitypub_federation::{
core::object_id::ObjectId,
data::Data,
traits::{ActivityHandler, ApubObject},
};
use activitystreams_kinds::{activity::UpdateType, public};
use lemmy_api_common::utils::blocking;
use lemmy_apub_lib::{
data::Data,
object_id::ObjectId,
traits::{ActivityHandler, ActorType, ApubObject},
};
use lemmy_db_schema::{
source::community::{Community, CommunityForm},
traits::Crud,
};
use lemmy_utils::LemmyError;
use lemmy_utils::error::LemmyError;
use lemmy_websocket::{send::send_community_ws_message, LemmyContext, UserOperationCrud};
use url::Url;
impl UpdateCommunity {
#[tracing::instrument(skip_all)]
@ -54,6 +56,15 @@ impl UpdateCommunity {
#[async_trait::async_trait(?Send)]
impl ActivityHandler for UpdateCommunity {
type DataType = LemmyContext;
type Error = LemmyError;
fn id(&self) -> &Url {
&self.id
}
fn actor(&self) -> &Url {
self.actor.inner()
}
#[tracing::instrument(skip_all)]
async fn verify(
@ -62,7 +73,6 @@ impl ActivityHandler for UpdateCommunity {
request_counter: &mut i32,
) -> Result<(), LemmyError> {
verify_is_public(&self.to, &self.cc)?;
verify_activity(&self.id, self.actor.inner(), &context.settings())?;
let community = self.get_community(context, request_counter).await?;
verify_person_in_community(&self.actor, &community, context, request_counter).await?;
verify_mod_action(
@ -129,7 +139,7 @@ impl GetCommunity for UpdateCommunity {
) -> Result<ApubCommunity, LemmyError> {
let cid = ObjectId::new(self.object.id.clone());
cid
.dereference(context, context.client(), request_counter)
.dereference::<LemmyError>(context, local_instance(context), request_counter)
.await
}
}

Some files were not shown because too many files have changed in this diff Show more