diff --git a/Cargo.lock b/Cargo.lock index 7afe4f544..d90659660 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16,17 +16,17 @@ checksum = "8f27d075294830fcab6f66e320dab524bc6d048f4a151698e153205559113772" [[package]] name = "activitypub_federation" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e16130d5914e6483f99bde5a9bb97ca62e1f359e0b9791c8ebd5c7abd50fe8e" +checksum = "e54fe65c4a4b57712d8e436f1fb86ff37e10b56f011f4233fbbfa8c669163e9d" dependencies = [ "activitystreams-kinds", "actix-web", "async-trait", - "base64 0.21.7", + "base64 0.22.1", "bytes", "chrono", - "derive_builder", + "derive_builder 0.20.0", "dyn-clone", "enum_delegate", "futures", @@ -421,47 +421,48 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.13" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", + "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" [[package]] name = "anstyle-parse" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" dependencies = [ "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.2" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" dependencies = [ "anstyle", "windows-sys 0.52.0", @@ -556,7 +557,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "571832dcff775e26562e8e6930cd483de5587301d40d3a3b85d532b6383e15a7" dependencies = [ "chrono", - "derive_builder", + "derive_builder 0.12.0", "diligent-date-parser", "never", "quick-xml 0.30.0", @@ -1059,9 +1060,9 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" [[package]] name = "colorchoice" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" [[package]] name = "combine" @@ -1477,7 +1478,16 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d67778784b508018359cbc8696edb3db78160bab2c2a28ba7f56ef6932997f8" dependencies = [ - "derive_builder_macro", + "derive_builder_macro 0.12.0", +] + +[[package]] +name = "derive_builder" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0350b5cb0331628a5916d6c5c0b72e97393b8b6b03b47a9284f4e7f5a405ffd7" +dependencies = [ + "derive_builder_macro 0.20.0", ] [[package]] @@ -1492,16 +1502,38 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "derive_builder_core" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d48cda787f839151732d396ac69e3473923d54312c070ee21e9effcaa8ca0b1d" +dependencies = [ + "darling 0.20.8", + "proc-macro2", + "quote", + "syn 2.0.60", +] + [[package]] name = "derive_builder_macro" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e" dependencies = [ - "derive_builder_core", + "derive_builder_core 0.12.0", "syn 1.0.109", ] +[[package]] +name = "derive_builder_macro" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "206868b8242f27cecce124c19fd88157fbd0dd334df2587f36417bafbc85097b" +dependencies = [ + "derive_builder_core 0.20.0", + "syn 2.0.60", +] + [[package]] name = "derive_more" version = "0.99.17" @@ -2593,6 +2625,12 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +[[package]] +name = "is_terminal_polyfill" +version = "1.70.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" + [[package]] name = "itertools" version = "0.10.5" @@ -4651,7 +4689,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7b2c77eb4450d7d5f98df52c381cd6c4e19b75dad9209a9530b85a44510219a" dependencies = [ "atom_syndication", - "derive_builder", + "derive_builder 0.12.0", "never", "quick-xml 0.30.0", ] diff --git a/Cargo.toml b/Cargo.toml index 0cf90cc62..aec09093d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -99,7 +99,7 @@ lemmy_db_views = { version = "=0.19.4-beta.6", path = "./crates/db_views" } lemmy_db_views_actor = { version = "=0.19.4-beta.6", path = "./crates/db_views_actor" } lemmy_db_views_moderator = { version = "=0.19.4-beta.6", path = "./crates/db_views_moderator" } lemmy_federate = { version = "=0.19.4-beta.6", path = "./crates/federate" } -activitypub_federation = { version = "0.5.4", default-features = false, features = [ +activitypub_federation = { version = "0.5.5", default-features = false, features = [ "actix-web", ] } diesel = "2.1.6" diff --git a/crates/apub/assets/discourse/objects/group.json b/crates/apub/assets/discourse/objects/group.json new file mode 100644 index 000000000..5ed2c8c05 --- /dev/null +++ b/crates/apub/assets/discourse/objects/group.json @@ -0,0 +1,22 @@ +{ + "id": "https://socialhub.activitypub.rocks/ap/actor/797217cf18c0e819dfafc52425590146", + "type": "Group", + "updated": "2024-04-05T12:49:51Z", + "url": "https://socialhub.activitypub.rocks/c/meeting/threadiverse-wg/88", + "name": "Threadiverse Working Group (SocialHub)", + "inbox": "https://socialhub.activitypub.rocks/ap/actor/797217cf18c0e819dfafc52425590146/inbox", + "outbox": "https://socialhub.activitypub.rocks/ap/actor/797217cf18c0e819dfafc52425590146/outbox", + "followers": "https://socialhub.activitypub.rocks/ap/actor/797217cf18c0e819dfafc52425590146/followers", + "preferredUsername": "threadiverse-wg", + "publicKey": { + "id": "https://socialhub.activitypub.rocks/ap/actor/797217cf18c0e819dfafc52425590146#main-key", + "owner": "https://socialhub.activitypub.rocks/ap/actor/797217cf18c0e819dfafc52425590146", + "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApJi4iAcW6bPiHVCxT9p0\n8DVnrDDO4QtLNy7bpRFdMFifmmmXprsuAi9D2MSwbhH49V54HtIkxBpKd2IR/UD8\nmhMDY4CNI9FHpjqLw0wtkzxcqF9urSqhn0/vWX+9oxyhIgQS5KMiIkYDMJiAc691\niEcZ8LCran23xIGl6Dk54Nr3TqTMLcjDhzQYUJbxMrLq5/knWqOKG3IF5OxK+9ZZ\n1wxDF872eJTxJLkmpag+WYNtHzvB2SGTp8j5IF1/pZ9J1c3cpYfaeolTch/B/GQn\najCB4l27U52rIIObxJqFXSY8wHyd0aAmNmxzPZ7cduRlBDhmI40cAmnCV1YQPvpk\nDwIDAQAB\n-----END PUBLIC KEY-----\n" + }, + "icon": { + "type": "Image", + "mediaType": "image/png", + "url": "https://socialhub.activitypub.rocks/uploads/default/original/1X/8faac84234dc73d074dadaa2bcf24dc746b8647f.png" + }, + "@context": "https://www.w3.org/ns/activitystreams" +} diff --git a/crates/apub/assets/discourse/objects/page.json b/crates/apub/assets/discourse/objects/page.json new file mode 100644 index 000000000..c020ce9f5 --- /dev/null +++ b/crates/apub/assets/discourse/objects/page.json @@ -0,0 +1,13 @@ +{ + "id": "https://socialhub.activitypub.rocks/ap/object/1899f65c062200daec50a4c89ed76dc9", + "type": "Note", + "audience": "https://socialhub.activitypub.rocks/ap/actor/797217cf18c0e819dfafc52425590146", + "published": "2024-04-13T14:36:19Z", + "updated": "2024-04-13T14:36:19Z", + "url": "https://socialhub.activitypub.rocks/t/our-next-meeting/4079/1", + "attributedTo": "https://socialhub.activitypub.rocks/ap/actor/495843076e9e469fbd35ccf467ae9fb1", + "name": "Our next meeting", + "context": "https://socialhub.activitypub.rocks/ap/collection/8850f6e85b57c490da915a5dfbbd5045", + "content": "

Last Meeting

\n

Recording

\nhttps://us06web.zoom.us/rec/share/4hGBTvgXJPlu8UkjkkxVARypNg5DH0eeaKlIBv71D4G3lokYyrCrg7cqBCJmL109.FsHYTZDlVvZXrgcn?startTime=1712254114000\nPasscode: z+1*4pUB\n

Minutes

\nTo refresh your memory, you can read the minutes of last week's meeting LemmyResult<()> { + test_json::("assets/discourse/objects/group.json")?; + test_json::("assets/discourse/objects/page.json")?; + test_json::("assets/discourse/objects/person.json")?; + Ok(()) + } + #[test] fn test_parse_object_nodebb() -> LemmyResult<()> { test_json::("assets/nodebb/objects/group.json")?; diff --git a/crates/apub/src/protocol/objects/page.rs b/crates/apub/src/protocol/objects/page.rs index acfd8f5fd..4d70744cf 100644 --- a/crates/apub/src/protocol/objects/page.rs +++ b/crates/apub/src/protocol/objects/page.rs @@ -42,7 +42,7 @@ pub struct Page { pub(crate) kind: PageType, pub(crate) id: ObjectId, pub(crate) attributed_to: AttributedTo, - #[serde(deserialize_with = "deserialize_one_or_many")] + #[serde(deserialize_with = "deserialize_one_or_many", default)] pub(crate) to: Vec, // If there is inReplyTo field this is actually a comment and must not be parsed #[serde(deserialize_with = "deserialize_not_present", default)]