From: Felix Ableitner Date: Fri, 19 Nov 2021 17:47:06 +0000 (+0100) Subject: Replace activitystreams crate with activitystreams-kinds X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/%22https:/nerdica.net/README.md?a=commitdiff_plain;h=afccd5cf6955e795bdd29b62f6ecca5b0fd06997;p=lemmy.git Replace activitystreams crate with activitystreams-kinds --- diff --git a/Cargo.lock b/Cargo.lock index 32545d2a..abb50135 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16,6 +16,16 @@ dependencies = [ "url", ] +[[package]] +name = "activitystreams-kinds" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0784e99afd032199d3ed70cefb8eb3a8d1aef15f7f2c4e68d033c4e12bb6079e" +dependencies = [ + "serde", + "url", +] + [[package]] name = "actix" version = "0.12.0" @@ -1842,7 +1852,7 @@ dependencies = [ name = "lemmy_apub" version = "0.14.1" dependencies = [ - "activitystreams", + "activitystreams-kinds", "actix", "actix-rt", "actix-web", diff --git a/crates/apub/Cargo.toml b/crates/apub/Cargo.toml index 94684413..b4ddff28 100644 --- a/crates/apub/Cargo.toml +++ b/crates/apub/Cargo.toml @@ -21,7 +21,7 @@ lemmy_db_views_actor = { version = "=0.14.1", path = "../db_views_actor" } lemmy_api_common = { version = "=0.14.1", path = "../api_common" } lemmy_websocket = { version = "=0.14.1", path = "../websocket" } diesel = "1.4.8" -activitystreams = "0.7.0-alpha.11" +activitystreams-kinds = "0.1.2" bcrypt = "0.10.1" chrono = { version = "0.4.19", features = ["serde"] } serde_json = { version = "1.0.68", features = ["preserve_order"] } diff --git a/crates/apub/src/activities/comment/create_or_update.rs b/crates/apub/src/activities/comment/create_or_update.rs index ad686251..14fc1401 100644 --- a/crates/apub/src/activities/comment/create_or_update.rs +++ b/crates/apub/src/activities/comment/create_or_update.rs @@ -12,7 +12,7 @@ use crate::{ objects::{comment::ApubComment, community::ApubCommunity, person::ApubPerson}, protocol::activities::{create_or_update::comment::CreateOrUpdateComment, CreateOrUpdateType}, }; -use activitystreams::{link::LinkExt, public}; +use activitystreams_kinds::public; use lemmy_api_common::{blocking, check_post_deleted_or_removed}; use lemmy_apub_lib::{ data::Data, @@ -65,9 +65,8 @@ impl CreateOrUpdateComment { let tagged_users: Vec> = create_or_update .tag .iter() - .map(|t| t.href()) - .flatten() - .map(|t| ObjectId::new(t.clone())) + .map(|t| t.href.clone()) + .map(ObjectId::new) .collect(); let mut inboxes = vec![]; for t in tagged_users { diff --git a/crates/apub/src/activities/community/add_mod.rs b/crates/apub/src/activities/community/add_mod.rs index 7437750d..c244f652 100644 --- a/crates/apub/src/activities/community/add_mod.rs +++ b/crates/apub/src/activities/community/add_mod.rs @@ -17,7 +17,7 @@ use crate::{ objects::{community::ApubCommunity, person::ApubPerson}, protocol::activities::community::add_mod::AddMod, }; -use activitystreams::{activity::kind::AddType, public}; +use activitystreams_kinds::{activity::AddType, public}; use lemmy_api_common::blocking; use lemmy_apub_lib::{ data::Data, diff --git a/crates/apub/src/activities/community/announce.rs b/crates/apub/src/activities/community/announce.rs index 9d76b524..2784039b 100644 --- a/crates/apub/src/activities/community/announce.rs +++ b/crates/apub/src/activities/community/announce.rs @@ -6,7 +6,7 @@ use crate::{ objects::community::ApubCommunity, protocol::activities::{community::announce::AnnounceActivity, CreateOrUpdateType}, }; -use activitystreams::{activity::kind::AnnounceType, public}; +use activitystreams_kinds::{activity::AnnounceType, public}; use lemmy_apub_lib::{ data::Data, object_id::ObjectId, diff --git a/crates/apub/src/activities/community/block_user.rs b/crates/apub/src/activities/community/block_user.rs index 0dbf47b3..0442fcc4 100644 --- a/crates/apub/src/activities/community/block_user.rs +++ b/crates/apub/src/activities/community/block_user.rs @@ -11,7 +11,7 @@ use crate::{ objects::{community::ApubCommunity, person::ApubPerson}, protocol::activities::community::block_user::BlockUserFromCommunity, }; -use activitystreams::{activity::kind::BlockType, public}; +use activitystreams_kinds::{activity::BlockType, public}; use lemmy_api_common::blocking; use lemmy_apub_lib::{ data::Data, diff --git a/crates/apub/src/activities/community/remove_mod.rs b/crates/apub/src/activities/community/remove_mod.rs index 985a2192..36312070 100644 --- a/crates/apub/src/activities/community/remove_mod.rs +++ b/crates/apub/src/activities/community/remove_mod.rs @@ -17,7 +17,7 @@ use crate::{ objects::{community::ApubCommunity, person::ApubPerson}, protocol::activities::community::remove_mod::RemoveMod, }; -use activitystreams::{activity::kind::RemoveType, public}; +use activitystreams_kinds::{activity::RemoveType, public}; use lemmy_api_common::blocking; use lemmy_apub_lib::{ data::Data, diff --git a/crates/apub/src/activities/community/report.rs b/crates/apub/src/activities/community/report.rs index f0be3e0a..7207af61 100644 --- a/crates/apub/src/activities/community/report.rs +++ b/crates/apub/src/activities/community/report.rs @@ -9,7 +9,7 @@ use crate::{ protocol::activities::community::report::Report, PostOrComment, }; -use activitystreams::activity::kind::FlagType; +use activitystreams_kinds::activity::FlagType; use lemmy_api_common::{blocking, comment::CommentReportResponse, post::PostReportResponse}; use lemmy_apub_lib::{ data::Data, diff --git a/crates/apub/src/activities/community/undo_block_user.rs b/crates/apub/src/activities/community/undo_block_user.rs index 4aabb1d4..dbd6c5d5 100644 --- a/crates/apub/src/activities/community/undo_block_user.rs +++ b/crates/apub/src/activities/community/undo_block_user.rs @@ -14,7 +14,7 @@ use crate::{ undo_block_user::UndoBlockUserFromCommunity, }, }; -use activitystreams::{activity::kind::UndoType, public}; +use activitystreams_kinds::{activity::UndoType, public}; use lemmy_api_common::blocking; use lemmy_apub_lib::{ data::Data, diff --git a/crates/apub/src/activities/community/update.rs b/crates/apub/src/activities/community/update.rs index e625fe0c..7b2af3c4 100644 --- a/crates/apub/src/activities/community/update.rs +++ b/crates/apub/src/activities/community/update.rs @@ -11,7 +11,7 @@ use crate::{ objects::{community::ApubCommunity, person::ApubPerson}, protocol::activities::community::update::UpdateCommunity, }; -use activitystreams::{activity::kind::UpdateType, public}; +use activitystreams_kinds::{activity::UpdateType, public}; use lemmy_api_common::blocking; use lemmy_apub_lib::{ data::Data, diff --git a/crates/apub/src/activities/deletion/delete.rs b/crates/apub/src/activities/deletion/delete.rs index b976a1b4..e50cfd85 100644 --- a/crates/apub/src/activities/deletion/delete.rs +++ b/crates/apub/src/activities/deletion/delete.rs @@ -10,7 +10,7 @@ use crate::{ objects::{community::ApubCommunity, person::ApubPerson}, protocol::activities::deletion::delete::Delete, }; -use activitystreams::{activity::kind::DeleteType, public}; +use activitystreams_kinds::{activity::DeleteType, public}; use anyhow::anyhow; use lemmy_api_common::blocking; use lemmy_apub_lib::{ diff --git a/crates/apub/src/activities/deletion/undo_delete.rs b/crates/apub/src/activities/deletion/undo_delete.rs index 28ad0f5a..8a867fbc 100644 --- a/crates/apub/src/activities/deletion/undo_delete.rs +++ b/crates/apub/src/activities/deletion/undo_delete.rs @@ -10,7 +10,7 @@ use crate::{ objects::{community::ApubCommunity, person::ApubPerson}, protocol::activities::deletion::{delete::Delete, undo_delete::UndoDelete}, }; -use activitystreams::{activity::kind::UndoType, public}; +use activitystreams_kinds::{activity::UndoType, public}; use anyhow::anyhow; use lemmy_api_common::blocking; use lemmy_apub_lib::{ diff --git a/crates/apub/src/activities/following/accept.rs b/crates/apub/src/activities/following/accept.rs index 15e1f2b4..6febd7d4 100644 --- a/crates/apub/src/activities/following/accept.rs +++ b/crates/apub/src/activities/following/accept.rs @@ -2,7 +2,7 @@ use crate::{ activities::{generate_activity_id, send_lemmy_activity, verify_activity}, protocol::activities::following::{accept::AcceptFollowCommunity, follow::FollowCommunity}, }; -use activitystreams::activity::kind::AcceptType; +use activitystreams_kinds::activity::AcceptType; use lemmy_api_common::blocking; use lemmy_apub_lib::{ data::Data, diff --git a/crates/apub/src/activities/following/follow.rs b/crates/apub/src/activities/following/follow.rs index 43c60028..a5c2e77f 100644 --- a/crates/apub/src/activities/following/follow.rs +++ b/crates/apub/src/activities/following/follow.rs @@ -9,7 +9,7 @@ use crate::{ objects::{community::ApubCommunity, person::ApubPerson}, protocol::activities::following::{accept::AcceptFollowCommunity, follow::FollowCommunity}, }; -use activitystreams::activity::kind::FollowType; +use activitystreams_kinds::activity::FollowType; use lemmy_api_common::blocking; use lemmy_apub_lib::{ data::Data, diff --git a/crates/apub/src/activities/following/undo_follow.rs b/crates/apub/src/activities/following/undo_follow.rs index 2a3483d4..c7b926a2 100644 --- a/crates/apub/src/activities/following/undo_follow.rs +++ b/crates/apub/src/activities/following/undo_follow.rs @@ -3,7 +3,7 @@ use crate::{ objects::{community::ApubCommunity, person::ApubPerson}, protocol::activities::following::{follow::FollowCommunity, undo_follow::UndoFollowCommunity}, }; -use activitystreams::activity::kind::UndoType; +use activitystreams_kinds::activity::UndoType; use lemmy_api_common::blocking; use lemmy_apub_lib::{ data::Data, diff --git a/crates/apub/src/activities/mod.rs b/crates/apub/src/activities/mod.rs index cac5d6e1..07fc39d2 100644 --- a/crates/apub/src/activities/mod.rs +++ b/crates/apub/src/activities/mod.rs @@ -5,7 +5,7 @@ use crate::{ insert_activity, objects::{community::ApubCommunity, person::ApubPerson}, }; -use activitystreams::public; +use activitystreams_kinds::public; use anyhow::anyhow; use lemmy_api_common::blocking; use lemmy_apub_lib::{ diff --git a/crates/apub/src/activities/post/create_or_update.rs b/crates/apub/src/activities/post/create_or_update.rs index 84c185be..2e9c8071 100644 --- a/crates/apub/src/activities/post/create_or_update.rs +++ b/crates/apub/src/activities/post/create_or_update.rs @@ -12,7 +12,7 @@ use crate::{ objects::{community::ApubCommunity, person::ApubPerson, post::ApubPost}, protocol::activities::{create_or_update::post::CreateOrUpdatePost, CreateOrUpdateType}, }; -use activitystreams::public; +use activitystreams_kinds::public; use anyhow::anyhow; use lemmy_api_common::blocking; use lemmy_apub_lib::{ diff --git a/crates/apub/src/activities/private_message/delete.rs b/crates/apub/src/activities/private_message/delete.rs index 46675442..7269078a 100644 --- a/crates/apub/src/activities/private_message/delete.rs +++ b/crates/apub/src/activities/private_message/delete.rs @@ -3,7 +3,7 @@ use crate::{ objects::{person::ApubPerson, private_message::ApubPrivateMessage}, protocol::activities::private_message::delete::DeletePrivateMessage, }; -use activitystreams::activity::kind::DeleteType; +use activitystreams_kinds::activity::DeleteType; use lemmy_api_common::blocking; use lemmy_apub_lib::{ data::Data, diff --git a/crates/apub/src/activities/private_message/undo_delete.rs b/crates/apub/src/activities/private_message/undo_delete.rs index fbb8660c..ce3cc49c 100644 --- a/crates/apub/src/activities/private_message/undo_delete.rs +++ b/crates/apub/src/activities/private_message/undo_delete.rs @@ -6,7 +6,7 @@ use crate::{ undo_delete::UndoDeletePrivateMessage, }, }; -use activitystreams::activity::kind::UndoType; +use activitystreams_kinds::activity::UndoType; use lemmy_api_common::blocking; use lemmy_apub_lib::{ data::Data, diff --git a/crates/apub/src/activities/voting/undo_vote.rs b/crates/apub/src/activities/voting/undo_vote.rs index e403a335..f913ce5f 100644 --- a/crates/apub/src/activities/voting/undo_vote.rs +++ b/crates/apub/src/activities/voting/undo_vote.rs @@ -15,7 +15,7 @@ use crate::{ }, PostOrComment, }; -use activitystreams::{activity::kind::UndoType, public}; +use activitystreams_kinds::{activity::UndoType, public}; use lemmy_api_common::blocking; use lemmy_apub_lib::{ data::Data, diff --git a/crates/apub/src/activities/voting/vote.rs b/crates/apub/src/activities/voting/vote.rs index 2253b9aa..65a92800 100644 --- a/crates/apub/src/activities/voting/vote.rs +++ b/crates/apub/src/activities/voting/vote.rs @@ -12,7 +12,7 @@ use crate::{ protocol::activities::voting::vote::{Vote, VoteType}, PostOrComment, }; -use activitystreams::public; +use activitystreams_kinds::public; use lemmy_api_common::blocking; use lemmy_apub_lib::{ data::Data, diff --git a/crates/apub/src/collections/community_moderators.rs b/crates/apub/src/collections/community_moderators.rs index 695f7aca..1b0911ab 100644 --- a/crates/apub/src/collections/community_moderators.rs +++ b/crates/apub/src/collections/community_moderators.rs @@ -4,7 +4,8 @@ use crate::{ objects::person::ApubPerson, protocol::collections::group_moderators::GroupModerators, }; -use activitystreams::{chrono::NaiveDateTime, collection::kind::OrderedCollectionType}; +use activitystreams_kinds::collection::OrderedCollectionType; +use chrono::NaiveDateTime; use lemmy_api_common::blocking; use lemmy_apub_lib::{object_id::ObjectId, traits::ApubObject, verify::verify_domains_match}; use lemmy_db_schema::{ diff --git a/crates/apub/src/collections/community_outbox.rs b/crates/apub/src/collections/community_outbox.rs index 69dfd929..de55ffa6 100644 --- a/crates/apub/src/collections/community_outbox.rs +++ b/crates/apub/src/collections/community_outbox.rs @@ -8,7 +8,7 @@ use crate::{ collections::group_outbox::GroupOutbox, }, }; -use activitystreams::collection::kind::OrderedCollectionType; +use activitystreams_kinds::collection::OrderedCollectionType; use chrono::NaiveDateTime; use lemmy_api_common::blocking; use lemmy_apub_lib::{ diff --git a/crates/apub/src/context.rs b/crates/apub/src/context.rs index 55486872..0a6e220a 100644 --- a/crates/apub/src/context.rs +++ b/crates/apub/src/context.rs @@ -1,15 +1,14 @@ -use activitystreams::{base::AnyBase, primitives::OneOrMany}; use serde::{Deserialize, Serialize}; lazy_static! { - static ref CONTEXT: OneOrMany = + static ref CONTEXT: Vec = serde_json::from_str(include_str!("../assets/lemmy/context.json")).expect("parse context"); } -#[derive(Serialize, Deserialize)] +#[derive(Serialize, Deserialize, Debug)] pub(crate) struct WithContext { #[serde(rename = "@context")] - context: OneOrMany, + context: Vec, #[serde(flatten)] inner: T, } diff --git a/crates/apub/src/fetcher/user_or_community.rs b/crates/apub/src/fetcher/user_or_community.rs index e5dc3d93..08138964 100644 --- a/crates/apub/src/fetcher/user_or_community.rs +++ b/crates/apub/src/fetcher/user_or_community.rs @@ -2,11 +2,12 @@ use crate::{ objects::{community::ApubCommunity, person::ApubPerson}, protocol::objects::{group::Group, person::Person}, }; -use activitystreams::{chrono::NaiveDateTime, url::Url}; +use chrono::NaiveDateTime; use lemmy_apub_lib::traits::{ActorType, ApubObject}; use lemmy_utils::LemmyError; use lemmy_websocket::LemmyContext; use serde::Deserialize; +use url::Url; #[derive(Clone, Debug)] pub enum UserOrCommunity { diff --git a/crates/apub/src/mentions.rs b/crates/apub/src/mentions.rs index 2cf0e757..f8de4385 100644 --- a/crates/apub/src/mentions.rs +++ b/crates/apub/src/mentions.rs @@ -2,10 +2,7 @@ use crate::{ fetcher::webfinger::webfinger_resolve_actor, objects::{comment::ApubComment, community::ApubCommunity, person::ApubPerson}, }; -use activitystreams::{ - base::BaseExt, - link::{LinkExt, Mention}, -}; +use activitystreams_kinds::link::MentionType; use lemmy_api_common::blocking; use lemmy_apub_lib::{object_id::ObjectId, traits::ActorType}; use lemmy_db_schema::{ @@ -18,8 +15,17 @@ use lemmy_utils::{ LemmyError, }; use lemmy_websocket::LemmyContext; +use serde::{Deserialize, Serialize}; use url::Url; +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct Mention { + pub href: Url, + name: Option, + #[serde(rename = "type")] + pub kind: MentionType, +} + pub struct MentionsAndAddresses { pub ccs: Vec, pub tags: Vec, @@ -38,14 +44,15 @@ pub async fn collect_non_local_mentions( let mut addressed_ccs: Vec = vec![community_id.into(), parent_creator.actor_id()]; // Add the mention tag - let mut parent_creator_tag = Mention::new(); - parent_creator_tag - .set_href(parent_creator.actor_id.clone().into()) - .set_name(format!( + let parent_creator_tag = Mention { + href: parent_creator.actor_id.clone().into(), + name: Some(format!( "@{}@{}", &parent_creator.name, &parent_creator.actor_id().domain().expect("has domain") - )); + )), + kind: MentionType::Mention, + }; let mut tags = vec![parent_creator_tag]; // Get the person IDs for any mentions @@ -64,10 +71,11 @@ pub async fn collect_non_local_mentions( let actor_id: ObjectId = ObjectId::new(actor_id); addressed_ccs.push(actor_id.to_string().parse()?); - let mut mention_tag = Mention::new(); - mention_tag - .set_href(actor_id.into()) - .set_name(mention.full_name()); + let mention_tag = Mention { + href: actor_id.into(), + name: Some(mention.full_name()), + kind: MentionType::Mention, + }; tags.push(mention_tag); } } diff --git a/crates/apub/src/objects/comment.rs b/crates/apub/src/objects/comment.rs index f15084cc..007d3def 100644 --- a/crates/apub/src/objects/comment.rs +++ b/crates/apub/src/objects/comment.rs @@ -11,7 +11,7 @@ use crate::{ }, PostOrComment, }; -use activitystreams::{object::kind::NoteType, public}; +use activitystreams_kinds::{object::NoteType, public}; use anyhow::anyhow; use chrono::NaiveDateTime; use html2md::parse_html; diff --git a/crates/apub/src/objects/community.rs b/crates/apub/src/objects/community.rs index f37d82d8..d8bc837f 100644 --- a/crates/apub/src/objects/community.rs +++ b/crates/apub/src/objects/community.rs @@ -9,7 +9,7 @@ use crate::{ Source, }, }; -use activitystreams::{actor::kind::GroupType, object::kind::ImageType}; +use activitystreams_kinds::actor::GroupType; use chrono::NaiveDateTime; use itertools::Itertools; use lemmy_api_common::blocking; @@ -81,14 +81,8 @@ impl ApubObject for ApubCommunity { content: bio, media_type: MediaTypeMarkdown::Markdown, }); - let icon = self.icon.clone().map(|url| ImageObject { - kind: ImageType::Image, - url: url.into(), - }); - let image = self.banner.clone().map(|url| ImageObject { - kind: ImageType::Image, - url: url.into(), - }); + let icon = self.icon.clone().map(ImageObject::new); + let image = self.banner.clone().map(ImageObject::new); let group = Group { kind: GroupType::Group, diff --git a/crates/apub/src/objects/person.rs b/crates/apub/src/objects/person.rs index e3fcdd2e..422862cb 100644 --- a/crates/apub/src/objects/person.rs +++ b/crates/apub/src/objects/person.rs @@ -11,7 +11,6 @@ use crate::{ Source, }, }; -use activitystreams::object::kind::ImageType; use chrono::NaiveDateTime; use lemmy_api_common::blocking; use lemmy_apub_lib::{ @@ -89,14 +88,8 @@ impl ApubObject for ApubPerson { content: bio, media_type: MediaTypeMarkdown::Markdown, }); - let icon = self.avatar.clone().map(|url| ImageObject { - kind: ImageType::Image, - url: url.into(), - }); - let image = self.banner.clone().map(|url| ImageObject { - kind: ImageType::Image, - url: url.into(), - }); + let icon = self.avatar.clone().map(ImageObject::new); + let image = self.banner.clone().map(ImageObject::new); let person = Person { kind, diff --git a/crates/apub/src/objects/post.rs b/crates/apub/src/objects/post.rs index 44dbe73b..1d4eddb9 100644 --- a/crates/apub/src/objects/post.rs +++ b/crates/apub/src/objects/post.rs @@ -7,10 +7,7 @@ use crate::{ Source, }, }; -use activitystreams::{ - object::kind::{ImageType, PageType}, - public, -}; +use activitystreams_kinds::{object::PageType, public}; use chrono::NaiveDateTime; use lemmy_api_common::blocking; use lemmy_apub_lib::{ @@ -100,10 +97,7 @@ impl ApubObject for ApubPost { content: body, media_type: MediaTypeMarkdown::Markdown, }); - let image = self.thumbnail_url.clone().map(|thumb| ImageObject { - kind: ImageType::Image, - url: thumb.into(), - }); + let image = self.thumbnail_url.clone().map(ImageObject::new); let page = Page { r#type: PageType::Page, diff --git a/crates/apub/src/protocol/activities/community/add_mod.rs b/crates/apub/src/protocol/activities/community/add_mod.rs index 75571bea..0d6edc0a 100644 --- a/crates/apub/src/protocol/activities/community/add_mod.rs +++ b/crates/apub/src/protocol/activities/community/add_mod.rs @@ -1,5 +1,5 @@ -use crate::objects::person::ApubPerson; -use activitystreams::{activity::kind::AddType, unparsed::Unparsed}; +use crate::{objects::person::ApubPerson, protocol::Unparsed}; +use activitystreams_kinds::activity::AddType; use lemmy_apub_lib::object_id::ObjectId; use serde::{Deserialize, Serialize}; use url::Url; diff --git a/crates/apub/src/protocol/activities/community/announce.rs b/crates/apub/src/protocol/activities/community/announce.rs index 2dd09404..11890c68 100644 --- a/crates/apub/src/protocol/activities/community/announce.rs +++ b/crates/apub/src/protocol/activities/community/announce.rs @@ -1,5 +1,9 @@ -use crate::{activity_lists::AnnouncableActivities, objects::community::ApubCommunity}; -use activitystreams::{activity::kind::AnnounceType, unparsed::Unparsed}; +use crate::{ + activity_lists::AnnouncableActivities, + objects::community::ApubCommunity, + protocol::Unparsed, +}; +use activitystreams_kinds::activity::AnnounceType; use lemmy_apub_lib::object_id::ObjectId; use serde::{Deserialize, Serialize}; use url::Url; diff --git a/crates/apub/src/protocol/activities/community/block_user.rs b/crates/apub/src/protocol/activities/community/block_user.rs index 0b974f69..c904fc21 100644 --- a/crates/apub/src/protocol/activities/community/block_user.rs +++ b/crates/apub/src/protocol/activities/community/block_user.rs @@ -1,5 +1,8 @@ -use crate::objects::{community::ApubCommunity, person::ApubPerson}; -use activitystreams::{activity::kind::BlockType, unparsed::Unparsed}; +use crate::{ + objects::{community::ApubCommunity, person::ApubPerson}, + protocol::Unparsed, +}; +use activitystreams_kinds::activity::BlockType; use lemmy_apub_lib::object_id::ObjectId; use serde::{Deserialize, Serialize}; use url::Url; diff --git a/crates/apub/src/protocol/activities/community/mod.rs b/crates/apub/src/protocol/activities/community/mod.rs index a7bc8141..4f1f2be9 100644 --- a/crates/apub/src/protocol/activities/community/mod.rs +++ b/crates/apub/src/protocol/activities/community/mod.rs @@ -11,6 +11,7 @@ mod tests { use crate::protocol::{ activities::community::{ add_mod::AddMod, + announce::AnnounceActivity, block_user::BlockUserFromCommunity, remove_mod::RemoveMod, report::Report, @@ -19,13 +20,10 @@ mod tests { }, tests::test_parse_lemmy_item, }; - use activitystreams::activity::Announce; - use serial_test::serial; #[actix_rt::test] - #[serial] async fn test_parse_lemmy_community() { - test_parse_lemmy_item::( + test_parse_lemmy_item::( "assets/lemmy/activities/community/announce_create_page.json", ); diff --git a/crates/apub/src/protocol/activities/community/remove_mod.rs b/crates/apub/src/protocol/activities/community/remove_mod.rs index 6e3e5458..dc456b0b 100644 --- a/crates/apub/src/protocol/activities/community/remove_mod.rs +++ b/crates/apub/src/protocol/activities/community/remove_mod.rs @@ -1,5 +1,5 @@ -use crate::objects::person::ApubPerson; -use activitystreams::{activity::kind::RemoveType, unparsed::Unparsed}; +use crate::{objects::person::ApubPerson, protocol::Unparsed}; +use activitystreams_kinds::activity::RemoveType; use lemmy_apub_lib::object_id::ObjectId; use serde::{Deserialize, Serialize}; use url::Url; diff --git a/crates/apub/src/protocol/activities/community/report.rs b/crates/apub/src/protocol/activities/community/report.rs index fbf21ec8..bf1a84f1 100644 --- a/crates/apub/src/protocol/activities/community/report.rs +++ b/crates/apub/src/protocol/activities/community/report.rs @@ -1,8 +1,9 @@ use crate::{ fetcher::post_or_comment::PostOrComment, objects::{community::ApubCommunity, person::ApubPerson}, + protocol::Unparsed, }; -use activitystreams::{activity::kind::FlagType, unparsed::Unparsed}; +use activitystreams_kinds::activity::FlagType; use lemmy_apub_lib::object_id::ObjectId; use serde::{Deserialize, Serialize}; use url::Url; diff --git a/crates/apub/src/protocol/activities/community/undo_block_user.rs b/crates/apub/src/protocol/activities/community/undo_block_user.rs index 538a7e25..f08e0c35 100644 --- a/crates/apub/src/protocol/activities/community/undo_block_user.rs +++ b/crates/apub/src/protocol/activities/community/undo_block_user.rs @@ -1,8 +1,8 @@ use crate::{ objects::person::ApubPerson, - protocol::activities::community::block_user::BlockUserFromCommunity, + protocol::{activities::community::block_user::BlockUserFromCommunity, Unparsed}, }; -use activitystreams::{activity::kind::UndoType, unparsed::Unparsed}; +use activitystreams_kinds::activity::UndoType; use lemmy_apub_lib::object_id::ObjectId; use serde::{Deserialize, Serialize}; use url::Url; diff --git a/crates/apub/src/protocol/activities/community/update.rs b/crates/apub/src/protocol/activities/community/update.rs index 9a831a1f..9bdcded9 100644 --- a/crates/apub/src/protocol/activities/community/update.rs +++ b/crates/apub/src/protocol/activities/community/update.rs @@ -1,5 +1,8 @@ -use crate::{objects::person::ApubPerson, protocol::objects::group::Group}; -use activitystreams::{activity::kind::UpdateType, unparsed::Unparsed}; +use crate::{ + objects::person::ApubPerson, + protocol::{objects::group::Group, Unparsed}, +}; +use activitystreams_kinds::activity::UpdateType; use lemmy_apub_lib::object_id::ObjectId; use serde::{Deserialize, Serialize}; use url::Url; diff --git a/crates/apub/src/protocol/activities/create_or_update/comment.rs b/crates/apub/src/protocol/activities/create_or_update/comment.rs index 6e90dedb..deef4c86 100644 --- a/crates/apub/src/protocol/activities/create_or_update/comment.rs +++ b/crates/apub/src/protocol/activities/create_or_update/comment.rs @@ -1,8 +1,8 @@ use crate::{ + mentions::Mention, objects::person::ApubPerson, - protocol::{activities::CreateOrUpdateType, objects::note::Note}, + protocol::{activities::CreateOrUpdateType, objects::note::Note, Unparsed}, }; -use activitystreams::{link::Mention, unparsed::Unparsed}; use lemmy_apub_lib::object_id::ObjectId; use serde::{Deserialize, Serialize}; use url::Url; diff --git a/crates/apub/src/protocol/activities/create_or_update/mod.rs b/crates/apub/src/protocol/activities/create_or_update/mod.rs index f5db71c2..6506c283 100644 --- a/crates/apub/src/protocol/activities/create_or_update/mod.rs +++ b/crates/apub/src/protocol/activities/create_or_update/mod.rs @@ -10,10 +10,8 @@ mod tests { tests::test_parse_lemmy_item, }, }; - use serial_test::serial; #[actix_rt::test] - #[serial] async fn test_parse_create_or_update() { test_parse_lemmy_item::( "assets/lemmy/activities/create_or_update/create_page.json", diff --git a/crates/apub/src/protocol/activities/create_or_update/post.rs b/crates/apub/src/protocol/activities/create_or_update/post.rs index e64e4840..db159c86 100644 --- a/crates/apub/src/protocol/activities/create_or_update/post.rs +++ b/crates/apub/src/protocol/activities/create_or_update/post.rs @@ -1,8 +1,7 @@ use crate::{ objects::person::ApubPerson, - protocol::{activities::CreateOrUpdateType, objects::page::Page}, + protocol::{activities::CreateOrUpdateType, objects::page::Page, Unparsed}, }; -use activitystreams::unparsed::Unparsed; use lemmy_apub_lib::object_id::ObjectId; use serde::{Deserialize, Serialize}; use url::Url; diff --git a/crates/apub/src/protocol/activities/deletion/delete.rs b/crates/apub/src/protocol/activities/deletion/delete.rs index 26aee276..49adb6e6 100644 --- a/crates/apub/src/protocol/activities/deletion/delete.rs +++ b/crates/apub/src/protocol/activities/deletion/delete.rs @@ -1,5 +1,8 @@ -use crate::{objects::person::ApubPerson, protocol::objects::tombstone::Tombstone}; -use activitystreams::{activity::kind::DeleteType, unparsed::Unparsed}; +use crate::{ + objects::person::ApubPerson, + protocol::{objects::tombstone::Tombstone, Unparsed}, +}; +use activitystreams_kinds::activity::DeleteType; use lemmy_apub_lib::object_id::ObjectId; use serde::{Deserialize, Serialize}; use serde_with::skip_serializing_none; diff --git a/crates/apub/src/protocol/activities/deletion/mod.rs b/crates/apub/src/protocol/activities/deletion/mod.rs index 647c3d50..a4e08fab 100644 --- a/crates/apub/src/protocol/activities/deletion/mod.rs +++ b/crates/apub/src/protocol/activities/deletion/mod.rs @@ -7,10 +7,8 @@ mod tests { activities::deletion::{delete::Delete, undo_delete::UndoDelete}, tests::test_parse_lemmy_item, }; - use serial_test::serial; #[actix_rt::test] - #[serial] async fn test_parse_lemmy_deletion() { test_parse_lemmy_item::("assets/lemmy/activities/deletion/remove_note.json"); test_parse_lemmy_item::("assets/lemmy/activities/deletion/delete_page.json"); diff --git a/crates/apub/src/protocol/activities/deletion/undo_delete.rs b/crates/apub/src/protocol/activities/deletion/undo_delete.rs index aa851cbc..d7608017 100644 --- a/crates/apub/src/protocol/activities/deletion/undo_delete.rs +++ b/crates/apub/src/protocol/activities/deletion/undo_delete.rs @@ -1,5 +1,8 @@ -use crate::{objects::person::ApubPerson, protocol::activities::deletion::delete::Delete}; -use activitystreams::{activity::kind::UndoType, unparsed::Unparsed}; +use crate::{ + objects::person::ApubPerson, + protocol::{activities::deletion::delete::Delete, Unparsed}, +}; +use activitystreams_kinds::activity::UndoType; use lemmy_apub_lib::object_id::ObjectId; use serde::{Deserialize, Serialize}; use url::Url; diff --git a/crates/apub/src/protocol/activities/following/accept.rs b/crates/apub/src/protocol/activities/following/accept.rs index 2d5acb3b..09d3419a 100644 --- a/crates/apub/src/protocol/activities/following/accept.rs +++ b/crates/apub/src/protocol/activities/following/accept.rs @@ -1,8 +1,8 @@ use crate::{ objects::community::ApubCommunity, - protocol::activities::following::follow::FollowCommunity, + protocol::{activities::following::follow::FollowCommunity, Unparsed}, }; -use activitystreams::{activity::kind::AcceptType, unparsed::Unparsed}; +use activitystreams_kinds::activity::AcceptType; use lemmy_apub_lib::object_id::ObjectId; use serde::{Deserialize, Serialize}; use url::Url; diff --git a/crates/apub/src/protocol/activities/following/follow.rs b/crates/apub/src/protocol/activities/following/follow.rs index fe4e4e7b..cc2cc8e0 100644 --- a/crates/apub/src/protocol/activities/following/follow.rs +++ b/crates/apub/src/protocol/activities/following/follow.rs @@ -1,5 +1,8 @@ -use crate::objects::{community::ApubCommunity, person::ApubPerson}; -use activitystreams::{activity::kind::FollowType, unparsed::Unparsed}; +use crate::{ + objects::{community::ApubCommunity, person::ApubPerson}, + protocol::Unparsed, +}; +use activitystreams_kinds::activity::FollowType; use lemmy_apub_lib::object_id::ObjectId; use serde::{Deserialize, Serialize}; use url::Url; diff --git a/crates/apub/src/protocol/activities/following/mod.rs b/crates/apub/src/protocol/activities/following/mod.rs index 473dfca3..3258dbb7 100644 --- a/crates/apub/src/protocol/activities/following/mod.rs +++ b/crates/apub/src/protocol/activities/following/mod.rs @@ -12,10 +12,8 @@ mod tests { }, tests::test_parse_lemmy_item, }; - use serial_test::serial; #[actix_rt::test] - #[serial] async fn test_parse_lemmy_accept_follow() { test_parse_lemmy_item::("assets/lemmy/activities/following/follow.json"); test_parse_lemmy_item::("assets/lemmy/activities/following/accept.json"); diff --git a/crates/apub/src/protocol/activities/following/undo_follow.rs b/crates/apub/src/protocol/activities/following/undo_follow.rs index f2feba14..f14e3a48 100644 --- a/crates/apub/src/protocol/activities/following/undo_follow.rs +++ b/crates/apub/src/protocol/activities/following/undo_follow.rs @@ -1,8 +1,8 @@ use crate::{ objects::person::ApubPerson, - protocol::activities::following::follow::FollowCommunity, + protocol::{activities::following::follow::FollowCommunity, Unparsed}, }; -use activitystreams::{activity::kind::UndoType, unparsed::Unparsed}; +use activitystreams_kinds::activity::UndoType; use lemmy_apub_lib::object_id::ObjectId; use serde::{Deserialize, Serialize}; use url::Url; diff --git a/crates/apub/src/protocol/activities/private_message/create_or_update.rs b/crates/apub/src/protocol/activities/private_message/create_or_update.rs index 756bfd5e..a319daff 100644 --- a/crates/apub/src/protocol/activities/private_message/create_or_update.rs +++ b/crates/apub/src/protocol/activities/private_message/create_or_update.rs @@ -1,8 +1,7 @@ use crate::{ objects::person::ApubPerson, - protocol::{activities::CreateOrUpdateType, objects::chat_message::ChatMessage}, + protocol::{activities::CreateOrUpdateType, objects::chat_message::ChatMessage, Unparsed}, }; -use activitystreams::unparsed::Unparsed; use lemmy_apub_lib::object_id::ObjectId; use serde::{Deserialize, Serialize}; use url::Url; diff --git a/crates/apub/src/protocol/activities/private_message/delete.rs b/crates/apub/src/protocol/activities/private_message/delete.rs index f9ad29fd..1156b0e8 100644 --- a/crates/apub/src/protocol/activities/private_message/delete.rs +++ b/crates/apub/src/protocol/activities/private_message/delete.rs @@ -1,5 +1,8 @@ -use crate::objects::{person::ApubPerson, private_message::ApubPrivateMessage}; -use activitystreams::{activity::kind::DeleteType, unparsed::Unparsed}; +use crate::{ + objects::{person::ApubPerson, private_message::ApubPrivateMessage}, + protocol::Unparsed, +}; +use activitystreams_kinds::activity::DeleteType; use lemmy_apub_lib::object_id::ObjectId; use serde::{Deserialize, Serialize}; use url::Url; diff --git a/crates/apub/src/protocol/activities/private_message/mod.rs b/crates/apub/src/protocol/activities/private_message/mod.rs index b54e66c0..de074ba6 100644 --- a/crates/apub/src/protocol/activities/private_message/mod.rs +++ b/crates/apub/src/protocol/activities/private_message/mod.rs @@ -12,10 +12,8 @@ mod tests { }, tests::test_parse_lemmy_item, }; - use serial_test::serial; #[actix_rt::test] - #[serial] async fn test_parse_lemmy_private_message() { test_parse_lemmy_item::( "assets/lemmy/activities/private_message/create.json", diff --git a/crates/apub/src/protocol/activities/private_message/undo_delete.rs b/crates/apub/src/protocol/activities/private_message/undo_delete.rs index 951f14d4..3ce26075 100644 --- a/crates/apub/src/protocol/activities/private_message/undo_delete.rs +++ b/crates/apub/src/protocol/activities/private_message/undo_delete.rs @@ -1,8 +1,8 @@ use crate::{ objects::person::ApubPerson, - protocol::activities::private_message::delete::DeletePrivateMessage, + protocol::{activities::private_message::delete::DeletePrivateMessage, Unparsed}, }; -use activitystreams::{activity::kind::UndoType, unparsed::Unparsed}; +use activitystreams_kinds::activity::UndoType; use lemmy_apub_lib::object_id::ObjectId; use serde::{Deserialize, Serialize}; use url::Url; diff --git a/crates/apub/src/protocol/activities/voting/mod.rs b/crates/apub/src/protocol/activities/voting/mod.rs index 48e30f0b..b38e7fe3 100644 --- a/crates/apub/src/protocol/activities/voting/mod.rs +++ b/crates/apub/src/protocol/activities/voting/mod.rs @@ -7,10 +7,8 @@ mod tests { activities::voting::{undo_vote::UndoVote, vote::Vote}, tests::test_parse_lemmy_item, }; - use serial_test::serial; #[actix_rt::test] - #[serial] async fn test_parse_lemmy_voting() { test_parse_lemmy_item::("assets/lemmy/activities/voting/like_note.json"); test_parse_lemmy_item::("assets/lemmy/activities/voting/dislike_page.json"); diff --git a/crates/apub/src/protocol/activities/voting/undo_vote.rs b/crates/apub/src/protocol/activities/voting/undo_vote.rs index c6c8f0b0..9a1767f2 100644 --- a/crates/apub/src/protocol/activities/voting/undo_vote.rs +++ b/crates/apub/src/protocol/activities/voting/undo_vote.rs @@ -1,5 +1,8 @@ -use crate::{objects::person::ApubPerson, protocol::activities::voting::vote::Vote}; -use activitystreams::{activity::kind::UndoType, unparsed::Unparsed}; +use crate::{ + objects::person::ApubPerson, + protocol::{activities::voting::vote::Vote, Unparsed}, +}; +use activitystreams_kinds::activity::UndoType; use lemmy_apub_lib::object_id::ObjectId; use serde::{Deserialize, Serialize}; use url::Url; diff --git a/crates/apub/src/protocol/activities/voting/vote.rs b/crates/apub/src/protocol/activities/voting/vote.rs index 977a549d..065e3b31 100644 --- a/crates/apub/src/protocol/activities/voting/vote.rs +++ b/crates/apub/src/protocol/activities/voting/vote.rs @@ -1,5 +1,8 @@ -use crate::{fetcher::post_or_comment::PostOrComment, objects::person::ApubPerson}; -use activitystreams::unparsed::Unparsed; +use crate::{ + fetcher::post_or_comment::PostOrComment, + objects::person::ApubPerson, + protocol::Unparsed, +}; use anyhow::anyhow; use lemmy_apub_lib::object_id::ObjectId; use lemmy_utils::LemmyError; diff --git a/crates/apub/src/protocol/collections/group_followers.rs b/crates/apub/src/protocol/collections/group_followers.rs index 55b92a76..032731b7 100644 --- a/crates/apub/src/protocol/collections/group_followers.rs +++ b/crates/apub/src/protocol/collections/group_followers.rs @@ -1,5 +1,5 @@ use crate::generate_followers_url; -use activitystreams::collection::kind::CollectionType; +use activitystreams_kinds::collection::CollectionType; use lemmy_api_common::blocking; use lemmy_db_schema::source::community::Community; use lemmy_db_views_actor::community_follower_view::CommunityFollowerView; diff --git a/crates/apub/src/protocol/collections/group_moderators.rs b/crates/apub/src/protocol/collections/group_moderators.rs index 9b849484..6a72b955 100644 --- a/crates/apub/src/protocol/collections/group_moderators.rs +++ b/crates/apub/src/protocol/collections/group_moderators.rs @@ -1,5 +1,5 @@ use crate::objects::person::ApubPerson; -use activitystreams::collection::kind::OrderedCollectionType; +use activitystreams_kinds::collection::OrderedCollectionType; use lemmy_apub_lib::object_id::ObjectId; use serde::{Deserialize, Serialize}; use url::Url; diff --git a/crates/apub/src/protocol/collections/group_outbox.rs b/crates/apub/src/protocol/collections/group_outbox.rs index f7c70792..2806d269 100644 --- a/crates/apub/src/protocol/collections/group_outbox.rs +++ b/crates/apub/src/protocol/collections/group_outbox.rs @@ -1,5 +1,5 @@ use crate::protocol::activities::community::announce::AnnounceActivity; -use activitystreams::collection::kind::OrderedCollectionType; +use activitystreams_kinds::collection::OrderedCollectionType; use serde::{Deserialize, Serialize}; use url::Url; diff --git a/crates/apub/src/protocol/collections/mod.rs b/crates/apub/src/protocol/collections/mod.rs index 2e2d5c20..214bd6d3 100644 --- a/crates/apub/src/protocol/collections/mod.rs +++ b/crates/apub/src/protocol/collections/mod.rs @@ -14,10 +14,8 @@ mod tests { }, tests::test_parse_lemmy_item, }; - use serial_test::serial; #[actix_rt::test] - #[serial] async fn test_parse_lemmy_collections() { test_parse_lemmy_item::("assets/lemmy/collections/group_followers.json"); let outbox = test_parse_lemmy_item::("assets/lemmy/collections/group_outbox.json"); diff --git a/crates/apub/src/protocol/collections/person_outbox.rs b/crates/apub/src/protocol/collections/person_outbox.rs index c8af0173..e616794c 100644 --- a/crates/apub/src/protocol/collections/person_outbox.rs +++ b/crates/apub/src/protocol/collections/person_outbox.rs @@ -1,5 +1,5 @@ use crate::generate_outbox_url; -use activitystreams::collection::kind::OrderedCollectionType; +use activitystreams_kinds::collection::OrderedCollectionType; use lemmy_db_schema::source::person::Person; use lemmy_utils::LemmyError; use serde::{Deserialize, Serialize}; diff --git a/crates/apub/src/protocol/mod.rs b/crates/apub/src/protocol/mod.rs index 37a29f8f..2a4acf24 100644 --- a/crates/apub/src/protocol/mod.rs +++ b/crates/apub/src/protocol/mod.rs @@ -1,8 +1,10 @@ -use activitystreams::object::kind::ImageType; +use activitystreams_kinds::object::ImageType; use serde::{Deserialize, Serialize}; use url::Url; use lemmy_apub_lib::values::MediaTypeMarkdown; +use lemmy_db_schema::newtypes::DbUrl; +use std::collections::HashMap; pub mod activities; pub(crate) mod collections; @@ -19,10 +21,23 @@ pub struct Source { #[serde(rename_all = "camelCase")] pub struct ImageObject { #[serde(rename = "type")] - pub(crate) kind: ImageType, + kind: ImageType, pub(crate) url: Url, } +impl ImageObject { + pub(crate) fn new(url: DbUrl) -> Self { + ImageObject { + kind: ImageType::Image, + url: url.into(), + } + } +} + +#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] +#[serde(transparent)] +pub struct Unparsed(HashMap); + #[cfg(test)] pub(crate) mod tests { use crate::objects::tests::file_to_json_object; diff --git a/crates/apub/src/protocol/objects/chat_message.rs b/crates/apub/src/protocol/objects/chat_message.rs index b8692913..64499ea3 100644 --- a/crates/apub/src/protocol/objects/chat_message.rs +++ b/crates/apub/src/protocol/objects/chat_message.rs @@ -1,11 +1,8 @@ use crate::{ objects::{person::ApubPerson, private_message::ApubPrivateMessage}, - protocol::Source, -}; -use activitystreams::{ - chrono::{DateTime, FixedOffset}, - unparsed::Unparsed, + protocol::{Source, Unparsed}, }; +use chrono::{DateTime, FixedOffset}; use lemmy_apub_lib::{object_id::ObjectId, values::MediaTypeHtml}; use serde::{Deserialize, Serialize}; use serde_with::skip_serializing_none; diff --git a/crates/apub/src/protocol/objects/group.rs b/crates/apub/src/protocol/objects/group.rs index 4dc1c5bd..def87859 100644 --- a/crates/apub/src/protocol/objects/group.rs +++ b/crates/apub/src/protocol/objects/group.rs @@ -5,9 +5,9 @@ use crate::{ community_outbox::ApubCommunityOutbox, }, objects::{community::ApubCommunity, get_summary_from_string_or_source}, - protocol::{objects::Endpoints, ImageObject, Source}, + protocol::{objects::Endpoints, ImageObject, Source, Unparsed}, }; -use activitystreams::{actor::kind::GroupType, unparsed::Unparsed}; +use activitystreams_kinds::actor::GroupType; use chrono::{DateTime, FixedOffset}; use lemmy_apub_lib::{object_id::ObjectId, signatures::PublicKey, verify::verify_domains_match}; use lemmy_db_schema::{naive_now, source::community::CommunityForm}; diff --git a/crates/apub/src/protocol/objects/mod.rs b/crates/apub/src/protocol/objects/mod.rs index f8cc877a..bd590d49 100644 --- a/crates/apub/src/protocol/objects/mod.rs +++ b/crates/apub/src/protocol/objects/mod.rs @@ -24,10 +24,8 @@ mod tests { tests::test_parse_lemmy_item, }, }; - use serial_test::serial; #[actix_rt::test] - #[serial] async fn test_parse_object() { test_parse_lemmy_item::("assets/lemmy/objects/person.json"); test_parse_lemmy_item::("assets/lemmy/objects/group.json"); diff --git a/crates/apub/src/protocol/objects/note.rs b/crates/apub/src/protocol/objects/note.rs index 883a1a99..be21f8f5 100644 --- a/crates/apub/src/protocol/objects/note.rs +++ b/crates/apub/src/protocol/objects/note.rs @@ -1,9 +1,10 @@ use crate::{ fetcher::post_or_comment::PostOrComment, + mentions::Mention, objects::{comment::ApubComment, person::ApubPerson, post::ApubPost}, - protocol::Source, + protocol::{Source, Unparsed}, }; -use activitystreams::{link::Mention, object::kind::NoteType, unparsed::Unparsed}; +use activitystreams_kinds::object::NoteType; use chrono::{DateTime, FixedOffset}; use lemmy_api_common::blocking; use lemmy_apub_lib::{object_id::ObjectId, values::MediaTypeHtml}; diff --git a/crates/apub/src/protocol/objects/page.rs b/crates/apub/src/protocol/objects/page.rs index dd923618..2bd5cc6d 100644 --- a/crates/apub/src/protocol/objects/page.rs +++ b/crates/apub/src/protocol/objects/page.rs @@ -1,8 +1,8 @@ use crate::{ objects::{community::ApubCommunity, person::ApubPerson, post::ApubPost}, - protocol::{ImageObject, Source}, + protocol::{ImageObject, Source, Unparsed}, }; -use activitystreams::{object::kind::PageType, unparsed::Unparsed}; +use activitystreams_kinds::object::PageType; use anyhow::anyhow; use chrono::{DateTime, FixedOffset}; use lemmy_apub_lib::{ diff --git a/crates/apub/src/protocol/objects/person.rs b/crates/apub/src/protocol/objects/person.rs index e45ea78c..f66b09aa 100644 --- a/crates/apub/src/protocol/objects/person.rs +++ b/crates/apub/src/protocol/objects/person.rs @@ -1,12 +1,12 @@ use crate::{ objects::person::ApubPerson, - protocol::{objects::Endpoints, ImageObject, Source}, + protocol::{objects::Endpoints, ImageObject, Source, Unparsed}, }; -use activitystreams::{unparsed::Unparsed, url::Url}; use chrono::{DateTime, FixedOffset}; use lemmy_apub_lib::{object_id::ObjectId, signatures::PublicKey}; use serde::{Deserialize, Serialize}; use serde_with::skip_serializing_none; +use url::Url; #[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq)] pub enum UserTypes { diff --git a/crates/apub/src/protocol/objects/tombstone.rs b/crates/apub/src/protocol/objects/tombstone.rs index 152066cb..6eb81217 100644 --- a/crates/apub/src/protocol/objects/tombstone.rs +++ b/crates/apub/src/protocol/objects/tombstone.rs @@ -1,4 +1,4 @@ -use activitystreams::object::kind::TombstoneType; +use activitystreams_kinds::object::TombstoneType; use serde::{Deserialize, Serialize}; use serde_with::skip_serializing_none; use url::Url;