mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-25 23:43:18 +00:00
Replace activitystreams crate with activitystreams-kinds
This commit is contained in:
parent
ffc898a7b8
commit
afccd5cf69
12
Cargo.lock
generated
12
Cargo.lock
generated
|
@ -16,6 +16,16 @@ dependencies = [
|
||||||
"url",
|
"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]]
|
[[package]]
|
||||||
name = "actix"
|
name = "actix"
|
||||||
version = "0.12.0"
|
version = "0.12.0"
|
||||||
|
@ -1842,7 +1852,7 @@ dependencies = [
|
||||||
name = "lemmy_apub"
|
name = "lemmy_apub"
|
||||||
version = "0.14.1"
|
version = "0.14.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"activitystreams",
|
"activitystreams-kinds",
|
||||||
"actix",
|
"actix",
|
||||||
"actix-rt",
|
"actix-rt",
|
||||||
"actix-web",
|
"actix-web",
|
||||||
|
|
|
@ -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_api_common = { version = "=0.14.1", path = "../api_common" }
|
||||||
lemmy_websocket = { version = "=0.14.1", path = "../websocket" }
|
lemmy_websocket = { version = "=0.14.1", path = "../websocket" }
|
||||||
diesel = "1.4.8"
|
diesel = "1.4.8"
|
||||||
activitystreams = "0.7.0-alpha.11"
|
activitystreams-kinds = "0.1.2"
|
||||||
bcrypt = "0.10.1"
|
bcrypt = "0.10.1"
|
||||||
chrono = { version = "0.4.19", features = ["serde"] }
|
chrono = { version = "0.4.19", features = ["serde"] }
|
||||||
serde_json = { version = "1.0.68", features = ["preserve_order"] }
|
serde_json = { version = "1.0.68", features = ["preserve_order"] }
|
||||||
|
|
|
@ -12,7 +12,7 @@ use crate::{
|
||||||
objects::{comment::ApubComment, community::ApubCommunity, person::ApubPerson},
|
objects::{comment::ApubComment, community::ApubCommunity, person::ApubPerson},
|
||||||
protocol::activities::{create_or_update::comment::CreateOrUpdateComment, CreateOrUpdateType},
|
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_api_common::{blocking, check_post_deleted_or_removed};
|
||||||
use lemmy_apub_lib::{
|
use lemmy_apub_lib::{
|
||||||
data::Data,
|
data::Data,
|
||||||
|
@ -65,9 +65,8 @@ impl CreateOrUpdateComment {
|
||||||
let tagged_users: Vec<ObjectId<ApubPerson>> = create_or_update
|
let tagged_users: Vec<ObjectId<ApubPerson>> = create_or_update
|
||||||
.tag
|
.tag
|
||||||
.iter()
|
.iter()
|
||||||
.map(|t| t.href())
|
.map(|t| t.href.clone())
|
||||||
.flatten()
|
.map(ObjectId::new)
|
||||||
.map(|t| ObjectId::new(t.clone()))
|
|
||||||
.collect();
|
.collect();
|
||||||
let mut inboxes = vec![];
|
let mut inboxes = vec![];
|
||||||
for t in tagged_users {
|
for t in tagged_users {
|
||||||
|
|
|
@ -17,7 +17,7 @@ use crate::{
|
||||||
objects::{community::ApubCommunity, person::ApubPerson},
|
objects::{community::ApubCommunity, person::ApubPerson},
|
||||||
protocol::activities::community::add_mod::AddMod,
|
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_api_common::blocking;
|
||||||
use lemmy_apub_lib::{
|
use lemmy_apub_lib::{
|
||||||
data::Data,
|
data::Data,
|
||||||
|
|
|
@ -6,7 +6,7 @@ use crate::{
|
||||||
objects::community::ApubCommunity,
|
objects::community::ApubCommunity,
|
||||||
protocol::activities::{community::announce::AnnounceActivity, CreateOrUpdateType},
|
protocol::activities::{community::announce::AnnounceActivity, CreateOrUpdateType},
|
||||||
};
|
};
|
||||||
use activitystreams::{activity::kind::AnnounceType, public};
|
use activitystreams_kinds::{activity::AnnounceType, public};
|
||||||
use lemmy_apub_lib::{
|
use lemmy_apub_lib::{
|
||||||
data::Data,
|
data::Data,
|
||||||
object_id::ObjectId,
|
object_id::ObjectId,
|
||||||
|
|
|
@ -11,7 +11,7 @@ use crate::{
|
||||||
objects::{community::ApubCommunity, person::ApubPerson},
|
objects::{community::ApubCommunity, person::ApubPerson},
|
||||||
protocol::activities::community::block_user::BlockUserFromCommunity,
|
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_api_common::blocking;
|
||||||
use lemmy_apub_lib::{
|
use lemmy_apub_lib::{
|
||||||
data::Data,
|
data::Data,
|
||||||
|
|
|
@ -17,7 +17,7 @@ use crate::{
|
||||||
objects::{community::ApubCommunity, person::ApubPerson},
|
objects::{community::ApubCommunity, person::ApubPerson},
|
||||||
protocol::activities::community::remove_mod::RemoveMod,
|
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_api_common::blocking;
|
||||||
use lemmy_apub_lib::{
|
use lemmy_apub_lib::{
|
||||||
data::Data,
|
data::Data,
|
||||||
|
|
|
@ -9,7 +9,7 @@ use crate::{
|
||||||
protocol::activities::community::report::Report,
|
protocol::activities::community::report::Report,
|
||||||
PostOrComment,
|
PostOrComment,
|
||||||
};
|
};
|
||||||
use activitystreams::activity::kind::FlagType;
|
use activitystreams_kinds::activity::FlagType;
|
||||||
use lemmy_api_common::{blocking, comment::CommentReportResponse, post::PostReportResponse};
|
use lemmy_api_common::{blocking, comment::CommentReportResponse, post::PostReportResponse};
|
||||||
use lemmy_apub_lib::{
|
use lemmy_apub_lib::{
|
||||||
data::Data,
|
data::Data,
|
||||||
|
|
|
@ -14,7 +14,7 @@ use crate::{
|
||||||
undo_block_user::UndoBlockUserFromCommunity,
|
undo_block_user::UndoBlockUserFromCommunity,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use activitystreams::{activity::kind::UndoType, public};
|
use activitystreams_kinds::{activity::UndoType, public};
|
||||||
use lemmy_api_common::blocking;
|
use lemmy_api_common::blocking;
|
||||||
use lemmy_apub_lib::{
|
use lemmy_apub_lib::{
|
||||||
data::Data,
|
data::Data,
|
||||||
|
|
|
@ -11,7 +11,7 @@ use crate::{
|
||||||
objects::{community::ApubCommunity, person::ApubPerson},
|
objects::{community::ApubCommunity, person::ApubPerson},
|
||||||
protocol::activities::community::update::UpdateCommunity,
|
protocol::activities::community::update::UpdateCommunity,
|
||||||
};
|
};
|
||||||
use activitystreams::{activity::kind::UpdateType, public};
|
use activitystreams_kinds::{activity::UpdateType, public};
|
||||||
use lemmy_api_common::blocking;
|
use lemmy_api_common::blocking;
|
||||||
use lemmy_apub_lib::{
|
use lemmy_apub_lib::{
|
||||||
data::Data,
|
data::Data,
|
||||||
|
|
|
@ -10,7 +10,7 @@ use crate::{
|
||||||
objects::{community::ApubCommunity, person::ApubPerson},
|
objects::{community::ApubCommunity, person::ApubPerson},
|
||||||
protocol::activities::deletion::delete::Delete,
|
protocol::activities::deletion::delete::Delete,
|
||||||
};
|
};
|
||||||
use activitystreams::{activity::kind::DeleteType, public};
|
use activitystreams_kinds::{activity::DeleteType, public};
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use lemmy_api_common::blocking;
|
use lemmy_api_common::blocking;
|
||||||
use lemmy_apub_lib::{
|
use lemmy_apub_lib::{
|
||||||
|
|
|
@ -10,7 +10,7 @@ use crate::{
|
||||||
objects::{community::ApubCommunity, person::ApubPerson},
|
objects::{community::ApubCommunity, person::ApubPerson},
|
||||||
protocol::activities::deletion::{delete::Delete, undo_delete::UndoDelete},
|
protocol::activities::deletion::{delete::Delete, undo_delete::UndoDelete},
|
||||||
};
|
};
|
||||||
use activitystreams::{activity::kind::UndoType, public};
|
use activitystreams_kinds::{activity::UndoType, public};
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use lemmy_api_common::blocking;
|
use lemmy_api_common::blocking;
|
||||||
use lemmy_apub_lib::{
|
use lemmy_apub_lib::{
|
||||||
|
|
|
@ -2,7 +2,7 @@ use crate::{
|
||||||
activities::{generate_activity_id, send_lemmy_activity, verify_activity},
|
activities::{generate_activity_id, send_lemmy_activity, verify_activity},
|
||||||
protocol::activities::following::{accept::AcceptFollowCommunity, follow::FollowCommunity},
|
protocol::activities::following::{accept::AcceptFollowCommunity, follow::FollowCommunity},
|
||||||
};
|
};
|
||||||
use activitystreams::activity::kind::AcceptType;
|
use activitystreams_kinds::activity::AcceptType;
|
||||||
use lemmy_api_common::blocking;
|
use lemmy_api_common::blocking;
|
||||||
use lemmy_apub_lib::{
|
use lemmy_apub_lib::{
|
||||||
data::Data,
|
data::Data,
|
||||||
|
|
|
@ -9,7 +9,7 @@ use crate::{
|
||||||
objects::{community::ApubCommunity, person::ApubPerson},
|
objects::{community::ApubCommunity, person::ApubPerson},
|
||||||
protocol::activities::following::{accept::AcceptFollowCommunity, follow::FollowCommunity},
|
protocol::activities::following::{accept::AcceptFollowCommunity, follow::FollowCommunity},
|
||||||
};
|
};
|
||||||
use activitystreams::activity::kind::FollowType;
|
use activitystreams_kinds::activity::FollowType;
|
||||||
use lemmy_api_common::blocking;
|
use lemmy_api_common::blocking;
|
||||||
use lemmy_apub_lib::{
|
use lemmy_apub_lib::{
|
||||||
data::Data,
|
data::Data,
|
||||||
|
|
|
@ -3,7 +3,7 @@ use crate::{
|
||||||
objects::{community::ApubCommunity, person::ApubPerson},
|
objects::{community::ApubCommunity, person::ApubPerson},
|
||||||
protocol::activities::following::{follow::FollowCommunity, undo_follow::UndoFollowCommunity},
|
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_api_common::blocking;
|
||||||
use lemmy_apub_lib::{
|
use lemmy_apub_lib::{
|
||||||
data::Data,
|
data::Data,
|
||||||
|
|
|
@ -5,7 +5,7 @@ use crate::{
|
||||||
insert_activity,
|
insert_activity,
|
||||||
objects::{community::ApubCommunity, person::ApubPerson},
|
objects::{community::ApubCommunity, person::ApubPerson},
|
||||||
};
|
};
|
||||||
use activitystreams::public;
|
use activitystreams_kinds::public;
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use lemmy_api_common::blocking;
|
use lemmy_api_common::blocking;
|
||||||
use lemmy_apub_lib::{
|
use lemmy_apub_lib::{
|
||||||
|
|
|
@ -12,7 +12,7 @@ use crate::{
|
||||||
objects::{community::ApubCommunity, person::ApubPerson, post::ApubPost},
|
objects::{community::ApubCommunity, person::ApubPerson, post::ApubPost},
|
||||||
protocol::activities::{create_or_update::post::CreateOrUpdatePost, CreateOrUpdateType},
|
protocol::activities::{create_or_update::post::CreateOrUpdatePost, CreateOrUpdateType},
|
||||||
};
|
};
|
||||||
use activitystreams::public;
|
use activitystreams_kinds::public;
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use lemmy_api_common::blocking;
|
use lemmy_api_common::blocking;
|
||||||
use lemmy_apub_lib::{
|
use lemmy_apub_lib::{
|
||||||
|
|
|
@ -3,7 +3,7 @@ use crate::{
|
||||||
objects::{person::ApubPerson, private_message::ApubPrivateMessage},
|
objects::{person::ApubPerson, private_message::ApubPrivateMessage},
|
||||||
protocol::activities::private_message::delete::DeletePrivateMessage,
|
protocol::activities::private_message::delete::DeletePrivateMessage,
|
||||||
};
|
};
|
||||||
use activitystreams::activity::kind::DeleteType;
|
use activitystreams_kinds::activity::DeleteType;
|
||||||
use lemmy_api_common::blocking;
|
use lemmy_api_common::blocking;
|
||||||
use lemmy_apub_lib::{
|
use lemmy_apub_lib::{
|
||||||
data::Data,
|
data::Data,
|
||||||
|
|
|
@ -6,7 +6,7 @@ use crate::{
|
||||||
undo_delete::UndoDeletePrivateMessage,
|
undo_delete::UndoDeletePrivateMessage,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use activitystreams::activity::kind::UndoType;
|
use activitystreams_kinds::activity::UndoType;
|
||||||
use lemmy_api_common::blocking;
|
use lemmy_api_common::blocking;
|
||||||
use lemmy_apub_lib::{
|
use lemmy_apub_lib::{
|
||||||
data::Data,
|
data::Data,
|
||||||
|
|
|
@ -15,7 +15,7 @@ use crate::{
|
||||||
},
|
},
|
||||||
PostOrComment,
|
PostOrComment,
|
||||||
};
|
};
|
||||||
use activitystreams::{activity::kind::UndoType, public};
|
use activitystreams_kinds::{activity::UndoType, public};
|
||||||
use lemmy_api_common::blocking;
|
use lemmy_api_common::blocking;
|
||||||
use lemmy_apub_lib::{
|
use lemmy_apub_lib::{
|
||||||
data::Data,
|
data::Data,
|
||||||
|
|
|
@ -12,7 +12,7 @@ use crate::{
|
||||||
protocol::activities::voting::vote::{Vote, VoteType},
|
protocol::activities::voting::vote::{Vote, VoteType},
|
||||||
PostOrComment,
|
PostOrComment,
|
||||||
};
|
};
|
||||||
use activitystreams::public;
|
use activitystreams_kinds::public;
|
||||||
use lemmy_api_common::blocking;
|
use lemmy_api_common::blocking;
|
||||||
use lemmy_apub_lib::{
|
use lemmy_apub_lib::{
|
||||||
data::Data,
|
data::Data,
|
||||||
|
|
|
@ -4,7 +4,8 @@ use crate::{
|
||||||
objects::person::ApubPerson,
|
objects::person::ApubPerson,
|
||||||
protocol::collections::group_moderators::GroupModerators,
|
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_api_common::blocking;
|
||||||
use lemmy_apub_lib::{object_id::ObjectId, traits::ApubObject, verify::verify_domains_match};
|
use lemmy_apub_lib::{object_id::ObjectId, traits::ApubObject, verify::verify_domains_match};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
|
|
|
@ -8,7 +8,7 @@ use crate::{
|
||||||
collections::group_outbox::GroupOutbox,
|
collections::group_outbox::GroupOutbox,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use activitystreams::collection::kind::OrderedCollectionType;
|
use activitystreams_kinds::collection::OrderedCollectionType;
|
||||||
use chrono::NaiveDateTime;
|
use chrono::NaiveDateTime;
|
||||||
use lemmy_api_common::blocking;
|
use lemmy_api_common::blocking;
|
||||||
use lemmy_apub_lib::{
|
use lemmy_apub_lib::{
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
use activitystreams::{base::AnyBase, primitives::OneOrMany};
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref CONTEXT: OneOrMany<AnyBase> =
|
static ref CONTEXT: Vec<serde_json::Value> =
|
||||||
serde_json::from_str(include_str!("../assets/lemmy/context.json")).expect("parse context");
|
serde_json::from_str(include_str!("../assets/lemmy/context.json")).expect("parse context");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
pub(crate) struct WithContext<T> {
|
pub(crate) struct WithContext<T> {
|
||||||
#[serde(rename = "@context")]
|
#[serde(rename = "@context")]
|
||||||
context: OneOrMany<AnyBase>,
|
context: Vec<serde_json::Value>,
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
inner: T,
|
inner: T,
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,12 @@ use crate::{
|
||||||
objects::{community::ApubCommunity, person::ApubPerson},
|
objects::{community::ApubCommunity, person::ApubPerson},
|
||||||
protocol::objects::{group::Group, person::Person},
|
protocol::objects::{group::Group, person::Person},
|
||||||
};
|
};
|
||||||
use activitystreams::{chrono::NaiveDateTime, url::Url};
|
use chrono::NaiveDateTime;
|
||||||
use lemmy_apub_lib::traits::{ActorType, ApubObject};
|
use lemmy_apub_lib::traits::{ActorType, ApubObject};
|
||||||
use lemmy_utils::LemmyError;
|
use lemmy_utils::LemmyError;
|
||||||
use lemmy_websocket::LemmyContext;
|
use lemmy_websocket::LemmyContext;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum UserOrCommunity {
|
pub enum UserOrCommunity {
|
||||||
|
|
|
@ -2,10 +2,7 @@ use crate::{
|
||||||
fetcher::webfinger::webfinger_resolve_actor,
|
fetcher::webfinger::webfinger_resolve_actor,
|
||||||
objects::{comment::ApubComment, community::ApubCommunity, person::ApubPerson},
|
objects::{comment::ApubComment, community::ApubCommunity, person::ApubPerson},
|
||||||
};
|
};
|
||||||
use activitystreams::{
|
use activitystreams_kinds::link::MentionType;
|
||||||
base::BaseExt,
|
|
||||||
link::{LinkExt, Mention},
|
|
||||||
};
|
|
||||||
use lemmy_api_common::blocking;
|
use lemmy_api_common::blocking;
|
||||||
use lemmy_apub_lib::{object_id::ObjectId, traits::ActorType};
|
use lemmy_apub_lib::{object_id::ObjectId, traits::ActorType};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
|
@ -18,8 +15,17 @@ use lemmy_utils::{
|
||||||
LemmyError,
|
LemmyError,
|
||||||
};
|
};
|
||||||
use lemmy_websocket::LemmyContext;
|
use lemmy_websocket::LemmyContext;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
pub struct Mention {
|
||||||
|
pub href: Url,
|
||||||
|
name: Option<String>,
|
||||||
|
#[serde(rename = "type")]
|
||||||
|
pub kind: MentionType,
|
||||||
|
}
|
||||||
|
|
||||||
pub struct MentionsAndAddresses {
|
pub struct MentionsAndAddresses {
|
||||||
pub ccs: Vec<Url>,
|
pub ccs: Vec<Url>,
|
||||||
pub tags: Vec<Mention>,
|
pub tags: Vec<Mention>,
|
||||||
|
@ -38,14 +44,15 @@ pub async fn collect_non_local_mentions(
|
||||||
let mut addressed_ccs: Vec<Url> = vec![community_id.into(), parent_creator.actor_id()];
|
let mut addressed_ccs: Vec<Url> = vec![community_id.into(), parent_creator.actor_id()];
|
||||||
|
|
||||||
// Add the mention tag
|
// Add the mention tag
|
||||||
let mut parent_creator_tag = Mention::new();
|
let parent_creator_tag = Mention {
|
||||||
parent_creator_tag
|
href: parent_creator.actor_id.clone().into(),
|
||||||
.set_href(parent_creator.actor_id.clone().into())
|
name: Some(format!(
|
||||||
.set_name(format!(
|
|
||||||
"@{}@{}",
|
"@{}@{}",
|
||||||
&parent_creator.name,
|
&parent_creator.name,
|
||||||
&parent_creator.actor_id().domain().expect("has domain")
|
&parent_creator.actor_id().domain().expect("has domain")
|
||||||
));
|
)),
|
||||||
|
kind: MentionType::Mention,
|
||||||
|
};
|
||||||
let mut tags = vec![parent_creator_tag];
|
let mut tags = vec![parent_creator_tag];
|
||||||
|
|
||||||
// Get the person IDs for any mentions
|
// Get the person IDs for any mentions
|
||||||
|
@ -64,10 +71,11 @@ pub async fn collect_non_local_mentions(
|
||||||
let actor_id: ObjectId<ApubPerson> = ObjectId::new(actor_id);
|
let actor_id: ObjectId<ApubPerson> = ObjectId::new(actor_id);
|
||||||
addressed_ccs.push(actor_id.to_string().parse()?);
|
addressed_ccs.push(actor_id.to_string().parse()?);
|
||||||
|
|
||||||
let mut mention_tag = Mention::new();
|
let mention_tag = Mention {
|
||||||
mention_tag
|
href: actor_id.into(),
|
||||||
.set_href(actor_id.into())
|
name: Some(mention.full_name()),
|
||||||
.set_name(mention.full_name());
|
kind: MentionType::Mention,
|
||||||
|
};
|
||||||
tags.push(mention_tag);
|
tags.push(mention_tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ use crate::{
|
||||||
},
|
},
|
||||||
PostOrComment,
|
PostOrComment,
|
||||||
};
|
};
|
||||||
use activitystreams::{object::kind::NoteType, public};
|
use activitystreams_kinds::{object::NoteType, public};
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use chrono::NaiveDateTime;
|
use chrono::NaiveDateTime;
|
||||||
use html2md::parse_html;
|
use html2md::parse_html;
|
||||||
|
|
|
@ -9,7 +9,7 @@ use crate::{
|
||||||
Source,
|
Source,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use activitystreams::{actor::kind::GroupType, object::kind::ImageType};
|
use activitystreams_kinds::actor::GroupType;
|
||||||
use chrono::NaiveDateTime;
|
use chrono::NaiveDateTime;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use lemmy_api_common::blocking;
|
use lemmy_api_common::blocking;
|
||||||
|
@ -81,14 +81,8 @@ impl ApubObject for ApubCommunity {
|
||||||
content: bio,
|
content: bio,
|
||||||
media_type: MediaTypeMarkdown::Markdown,
|
media_type: MediaTypeMarkdown::Markdown,
|
||||||
});
|
});
|
||||||
let icon = self.icon.clone().map(|url| ImageObject {
|
let icon = self.icon.clone().map(ImageObject::new);
|
||||||
kind: ImageType::Image,
|
let image = self.banner.clone().map(ImageObject::new);
|
||||||
url: url.into(),
|
|
||||||
});
|
|
||||||
let image = self.banner.clone().map(|url| ImageObject {
|
|
||||||
kind: ImageType::Image,
|
|
||||||
url: url.into(),
|
|
||||||
});
|
|
||||||
|
|
||||||
let group = Group {
|
let group = Group {
|
||||||
kind: GroupType::Group,
|
kind: GroupType::Group,
|
||||||
|
|
|
@ -11,7 +11,6 @@ use crate::{
|
||||||
Source,
|
Source,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use activitystreams::object::kind::ImageType;
|
|
||||||
use chrono::NaiveDateTime;
|
use chrono::NaiveDateTime;
|
||||||
use lemmy_api_common::blocking;
|
use lemmy_api_common::blocking;
|
||||||
use lemmy_apub_lib::{
|
use lemmy_apub_lib::{
|
||||||
|
@ -89,14 +88,8 @@ impl ApubObject for ApubPerson {
|
||||||
content: bio,
|
content: bio,
|
||||||
media_type: MediaTypeMarkdown::Markdown,
|
media_type: MediaTypeMarkdown::Markdown,
|
||||||
});
|
});
|
||||||
let icon = self.avatar.clone().map(|url| ImageObject {
|
let icon = self.avatar.clone().map(ImageObject::new);
|
||||||
kind: ImageType::Image,
|
let image = self.banner.clone().map(ImageObject::new);
|
||||||
url: url.into(),
|
|
||||||
});
|
|
||||||
let image = self.banner.clone().map(|url| ImageObject {
|
|
||||||
kind: ImageType::Image,
|
|
||||||
url: url.into(),
|
|
||||||
});
|
|
||||||
|
|
||||||
let person = Person {
|
let person = Person {
|
||||||
kind,
|
kind,
|
||||||
|
|
|
@ -7,10 +7,7 @@ use crate::{
|
||||||
Source,
|
Source,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use activitystreams::{
|
use activitystreams_kinds::{object::PageType, public};
|
||||||
object::kind::{ImageType, PageType},
|
|
||||||
public,
|
|
||||||
};
|
|
||||||
use chrono::NaiveDateTime;
|
use chrono::NaiveDateTime;
|
||||||
use lemmy_api_common::blocking;
|
use lemmy_api_common::blocking;
|
||||||
use lemmy_apub_lib::{
|
use lemmy_apub_lib::{
|
||||||
|
@ -100,10 +97,7 @@ impl ApubObject for ApubPost {
|
||||||
content: body,
|
content: body,
|
||||||
media_type: MediaTypeMarkdown::Markdown,
|
media_type: MediaTypeMarkdown::Markdown,
|
||||||
});
|
});
|
||||||
let image = self.thumbnail_url.clone().map(|thumb| ImageObject {
|
let image = self.thumbnail_url.clone().map(ImageObject::new);
|
||||||
kind: ImageType::Image,
|
|
||||||
url: thumb.into(),
|
|
||||||
});
|
|
||||||
|
|
||||||
let page = Page {
|
let page = Page {
|
||||||
r#type: PageType::Page,
|
r#type: PageType::Page,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::objects::person::ApubPerson;
|
use crate::{objects::person::ApubPerson, protocol::Unparsed};
|
||||||
use activitystreams::{activity::kind::AddType, unparsed::Unparsed};
|
use activitystreams_kinds::activity::AddType;
|
||||||
use lemmy_apub_lib::object_id::ObjectId;
|
use lemmy_apub_lib::object_id::ObjectId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
use crate::{activity_lists::AnnouncableActivities, objects::community::ApubCommunity};
|
use crate::{
|
||||||
use activitystreams::{activity::kind::AnnounceType, unparsed::Unparsed};
|
activity_lists::AnnouncableActivities,
|
||||||
|
objects::community::ApubCommunity,
|
||||||
|
protocol::Unparsed,
|
||||||
|
};
|
||||||
|
use activitystreams_kinds::activity::AnnounceType;
|
||||||
use lemmy_apub_lib::object_id::ObjectId;
|
use lemmy_apub_lib::object_id::ObjectId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
use crate::objects::{community::ApubCommunity, person::ApubPerson};
|
use crate::{
|
||||||
use activitystreams::{activity::kind::BlockType, unparsed::Unparsed};
|
objects::{community::ApubCommunity, person::ApubPerson},
|
||||||
|
protocol::Unparsed,
|
||||||
|
};
|
||||||
|
use activitystreams_kinds::activity::BlockType;
|
||||||
use lemmy_apub_lib::object_id::ObjectId;
|
use lemmy_apub_lib::object_id::ObjectId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
|
@ -11,6 +11,7 @@ mod tests {
|
||||||
use crate::protocol::{
|
use crate::protocol::{
|
||||||
activities::community::{
|
activities::community::{
|
||||||
add_mod::AddMod,
|
add_mod::AddMod,
|
||||||
|
announce::AnnounceActivity,
|
||||||
block_user::BlockUserFromCommunity,
|
block_user::BlockUserFromCommunity,
|
||||||
remove_mod::RemoveMod,
|
remove_mod::RemoveMod,
|
||||||
report::Report,
|
report::Report,
|
||||||
|
@ -19,13 +20,10 @@ mod tests {
|
||||||
},
|
},
|
||||||
tests::test_parse_lemmy_item,
|
tests::test_parse_lemmy_item,
|
||||||
};
|
};
|
||||||
use activitystreams::activity::Announce;
|
|
||||||
use serial_test::serial;
|
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
#[serial]
|
|
||||||
async fn test_parse_lemmy_community() {
|
async fn test_parse_lemmy_community() {
|
||||||
test_parse_lemmy_item::<Announce>(
|
test_parse_lemmy_item::<AnnounceActivity>(
|
||||||
"assets/lemmy/activities/community/announce_create_page.json",
|
"assets/lemmy/activities/community/announce_create_page.json",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::objects::person::ApubPerson;
|
use crate::{objects::person::ApubPerson, protocol::Unparsed};
|
||||||
use activitystreams::{activity::kind::RemoveType, unparsed::Unparsed};
|
use activitystreams_kinds::activity::RemoveType;
|
||||||
use lemmy_apub_lib::object_id::ObjectId;
|
use lemmy_apub_lib::object_id::ObjectId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
fetcher::post_or_comment::PostOrComment,
|
fetcher::post_or_comment::PostOrComment,
|
||||||
objects::{community::ApubCommunity, person::ApubPerson},
|
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 lemmy_apub_lib::object_id::ObjectId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
objects::person::ApubPerson,
|
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 lemmy_apub_lib::object_id::ObjectId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
use crate::{objects::person::ApubPerson, protocol::objects::group::Group};
|
use crate::{
|
||||||
use activitystreams::{activity::kind::UpdateType, unparsed::Unparsed};
|
objects::person::ApubPerson,
|
||||||
|
protocol::{objects::group::Group, Unparsed},
|
||||||
|
};
|
||||||
|
use activitystreams_kinds::activity::UpdateType;
|
||||||
use lemmy_apub_lib::object_id::ObjectId;
|
use lemmy_apub_lib::object_id::ObjectId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
|
mentions::Mention,
|
||||||
objects::person::ApubPerson,
|
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 lemmy_apub_lib::object_id::ObjectId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
|
@ -10,10 +10,8 @@ mod tests {
|
||||||
tests::test_parse_lemmy_item,
|
tests::test_parse_lemmy_item,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use serial_test::serial;
|
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
#[serial]
|
|
||||||
async fn test_parse_create_or_update() {
|
async fn test_parse_create_or_update() {
|
||||||
test_parse_lemmy_item::<CreateOrUpdatePost>(
|
test_parse_lemmy_item::<CreateOrUpdatePost>(
|
||||||
"assets/lemmy/activities/create_or_update/create_page.json",
|
"assets/lemmy/activities/create_or_update/create_page.json",
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
objects::person::ApubPerson,
|
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 lemmy_apub_lib::object_id::ObjectId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
use crate::{objects::person::ApubPerson, protocol::objects::tombstone::Tombstone};
|
use crate::{
|
||||||
use activitystreams::{activity::kind::DeleteType, unparsed::Unparsed};
|
objects::person::ApubPerson,
|
||||||
|
protocol::{objects::tombstone::Tombstone, Unparsed},
|
||||||
|
};
|
||||||
|
use activitystreams_kinds::activity::DeleteType;
|
||||||
use lemmy_apub_lib::object_id::ObjectId;
|
use lemmy_apub_lib::object_id::ObjectId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
|
|
|
@ -7,10 +7,8 @@ mod tests {
|
||||||
activities::deletion::{delete::Delete, undo_delete::UndoDelete},
|
activities::deletion::{delete::Delete, undo_delete::UndoDelete},
|
||||||
tests::test_parse_lemmy_item,
|
tests::test_parse_lemmy_item,
|
||||||
};
|
};
|
||||||
use serial_test::serial;
|
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
#[serial]
|
|
||||||
async fn test_parse_lemmy_deletion() {
|
async fn test_parse_lemmy_deletion() {
|
||||||
test_parse_lemmy_item::<Delete>("assets/lemmy/activities/deletion/remove_note.json");
|
test_parse_lemmy_item::<Delete>("assets/lemmy/activities/deletion/remove_note.json");
|
||||||
test_parse_lemmy_item::<Delete>("assets/lemmy/activities/deletion/delete_page.json");
|
test_parse_lemmy_item::<Delete>("assets/lemmy/activities/deletion/delete_page.json");
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
use crate::{objects::person::ApubPerson, protocol::activities::deletion::delete::Delete};
|
use crate::{
|
||||||
use activitystreams::{activity::kind::UndoType, unparsed::Unparsed};
|
objects::person::ApubPerson,
|
||||||
|
protocol::{activities::deletion::delete::Delete, Unparsed},
|
||||||
|
};
|
||||||
|
use activitystreams_kinds::activity::UndoType;
|
||||||
use lemmy_apub_lib::object_id::ObjectId;
|
use lemmy_apub_lib::object_id::ObjectId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
objects::community::ApubCommunity,
|
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 lemmy_apub_lib::object_id::ObjectId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
use crate::objects::{community::ApubCommunity, person::ApubPerson};
|
use crate::{
|
||||||
use activitystreams::{activity::kind::FollowType, unparsed::Unparsed};
|
objects::{community::ApubCommunity, person::ApubPerson},
|
||||||
|
protocol::Unparsed,
|
||||||
|
};
|
||||||
|
use activitystreams_kinds::activity::FollowType;
|
||||||
use lemmy_apub_lib::object_id::ObjectId;
|
use lemmy_apub_lib::object_id::ObjectId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
|
@ -12,10 +12,8 @@ mod tests {
|
||||||
},
|
},
|
||||||
tests::test_parse_lemmy_item,
|
tests::test_parse_lemmy_item,
|
||||||
};
|
};
|
||||||
use serial_test::serial;
|
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
#[serial]
|
|
||||||
async fn test_parse_lemmy_accept_follow() {
|
async fn test_parse_lemmy_accept_follow() {
|
||||||
test_parse_lemmy_item::<FollowCommunity>("assets/lemmy/activities/following/follow.json");
|
test_parse_lemmy_item::<FollowCommunity>("assets/lemmy/activities/following/follow.json");
|
||||||
test_parse_lemmy_item::<AcceptFollowCommunity>("assets/lemmy/activities/following/accept.json");
|
test_parse_lemmy_item::<AcceptFollowCommunity>("assets/lemmy/activities/following/accept.json");
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
objects::person::ApubPerson,
|
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 lemmy_apub_lib::object_id::ObjectId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
objects::person::ApubPerson,
|
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 lemmy_apub_lib::object_id::ObjectId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
use crate::objects::{person::ApubPerson, private_message::ApubPrivateMessage};
|
use crate::{
|
||||||
use activitystreams::{activity::kind::DeleteType, unparsed::Unparsed};
|
objects::{person::ApubPerson, private_message::ApubPrivateMessage},
|
||||||
|
protocol::Unparsed,
|
||||||
|
};
|
||||||
|
use activitystreams_kinds::activity::DeleteType;
|
||||||
use lemmy_apub_lib::object_id::ObjectId;
|
use lemmy_apub_lib::object_id::ObjectId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
|
@ -12,10 +12,8 @@ mod tests {
|
||||||
},
|
},
|
||||||
tests::test_parse_lemmy_item,
|
tests::test_parse_lemmy_item,
|
||||||
};
|
};
|
||||||
use serial_test::serial;
|
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
#[serial]
|
|
||||||
async fn test_parse_lemmy_private_message() {
|
async fn test_parse_lemmy_private_message() {
|
||||||
test_parse_lemmy_item::<CreateOrUpdatePrivateMessage>(
|
test_parse_lemmy_item::<CreateOrUpdatePrivateMessage>(
|
||||||
"assets/lemmy/activities/private_message/create.json",
|
"assets/lemmy/activities/private_message/create.json",
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
objects::person::ApubPerson,
|
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 lemmy_apub_lib::object_id::ObjectId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
|
@ -7,10 +7,8 @@ mod tests {
|
||||||
activities::voting::{undo_vote::UndoVote, vote::Vote},
|
activities::voting::{undo_vote::UndoVote, vote::Vote},
|
||||||
tests::test_parse_lemmy_item,
|
tests::test_parse_lemmy_item,
|
||||||
};
|
};
|
||||||
use serial_test::serial;
|
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
#[serial]
|
|
||||||
async fn test_parse_lemmy_voting() {
|
async fn test_parse_lemmy_voting() {
|
||||||
test_parse_lemmy_item::<Vote>("assets/lemmy/activities/voting/like_note.json");
|
test_parse_lemmy_item::<Vote>("assets/lemmy/activities/voting/like_note.json");
|
||||||
test_parse_lemmy_item::<Vote>("assets/lemmy/activities/voting/dislike_page.json");
|
test_parse_lemmy_item::<Vote>("assets/lemmy/activities/voting/dislike_page.json");
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
use crate::{objects::person::ApubPerson, protocol::activities::voting::vote::Vote};
|
use crate::{
|
||||||
use activitystreams::{activity::kind::UndoType, unparsed::Unparsed};
|
objects::person::ApubPerson,
|
||||||
|
protocol::{activities::voting::vote::Vote, Unparsed},
|
||||||
|
};
|
||||||
|
use activitystreams_kinds::activity::UndoType;
|
||||||
use lemmy_apub_lib::object_id::ObjectId;
|
use lemmy_apub_lib::object_id::ObjectId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
use crate::{fetcher::post_or_comment::PostOrComment, objects::person::ApubPerson};
|
use crate::{
|
||||||
use activitystreams::unparsed::Unparsed;
|
fetcher::post_or_comment::PostOrComment,
|
||||||
|
objects::person::ApubPerson,
|
||||||
|
protocol::Unparsed,
|
||||||
|
};
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use lemmy_apub_lib::object_id::ObjectId;
|
use lemmy_apub_lib::object_id::ObjectId;
|
||||||
use lemmy_utils::LemmyError;
|
use lemmy_utils::LemmyError;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::generate_followers_url;
|
use crate::generate_followers_url;
|
||||||
use activitystreams::collection::kind::CollectionType;
|
use activitystreams_kinds::collection::CollectionType;
|
||||||
use lemmy_api_common::blocking;
|
use lemmy_api_common::blocking;
|
||||||
use lemmy_db_schema::source::community::Community;
|
use lemmy_db_schema::source::community::Community;
|
||||||
use lemmy_db_views_actor::community_follower_view::CommunityFollowerView;
|
use lemmy_db_views_actor::community_follower_view::CommunityFollowerView;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::objects::person::ApubPerson;
|
use crate::objects::person::ApubPerson;
|
||||||
use activitystreams::collection::kind::OrderedCollectionType;
|
use activitystreams_kinds::collection::OrderedCollectionType;
|
||||||
use lemmy_apub_lib::object_id::ObjectId;
|
use lemmy_apub_lib::object_id::ObjectId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::protocol::activities::community::announce::AnnounceActivity;
|
use crate::protocol::activities::community::announce::AnnounceActivity;
|
||||||
use activitystreams::collection::kind::OrderedCollectionType;
|
use activitystreams_kinds::collection::OrderedCollectionType;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,8 @@ mod tests {
|
||||||
},
|
},
|
||||||
tests::test_parse_lemmy_item,
|
tests::test_parse_lemmy_item,
|
||||||
};
|
};
|
||||||
use serial_test::serial;
|
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
#[serial]
|
|
||||||
async fn test_parse_lemmy_collections() {
|
async fn test_parse_lemmy_collections() {
|
||||||
test_parse_lemmy_item::<GroupFollowers>("assets/lemmy/collections/group_followers.json");
|
test_parse_lemmy_item::<GroupFollowers>("assets/lemmy/collections/group_followers.json");
|
||||||
let outbox = test_parse_lemmy_item::<GroupOutbox>("assets/lemmy/collections/group_outbox.json");
|
let outbox = test_parse_lemmy_item::<GroupOutbox>("assets/lemmy/collections/group_outbox.json");
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::generate_outbox_url;
|
use crate::generate_outbox_url;
|
||||||
use activitystreams::collection::kind::OrderedCollectionType;
|
use activitystreams_kinds::collection::OrderedCollectionType;
|
||||||
use lemmy_db_schema::source::person::Person;
|
use lemmy_db_schema::source::person::Person;
|
||||||
use lemmy_utils::LemmyError;
|
use lemmy_utils::LemmyError;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
use activitystreams::object::kind::ImageType;
|
use activitystreams_kinds::object::ImageType;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use lemmy_apub_lib::values::MediaTypeMarkdown;
|
use lemmy_apub_lib::values::MediaTypeMarkdown;
|
||||||
|
use lemmy_db_schema::newtypes::DbUrl;
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
pub mod activities;
|
pub mod activities;
|
||||||
pub(crate) mod collections;
|
pub(crate) mod collections;
|
||||||
|
@ -19,10 +21,23 @@ pub struct Source {
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ImageObject {
|
pub struct ImageObject {
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
pub(crate) kind: ImageType,
|
kind: ImageType,
|
||||||
pub(crate) url: Url,
|
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<String, serde_json::Value>);
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub(crate) mod tests {
|
pub(crate) mod tests {
|
||||||
use crate::objects::tests::file_to_json_object;
|
use crate::objects::tests::file_to_json_object;
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
objects::{person::ApubPerson, private_message::ApubPrivateMessage},
|
objects::{person::ApubPerson, private_message::ApubPrivateMessage},
|
||||||
protocol::Source,
|
protocol::{Source, Unparsed},
|
||||||
};
|
|
||||||
use activitystreams::{
|
|
||||||
chrono::{DateTime, FixedOffset},
|
|
||||||
unparsed::Unparsed,
|
|
||||||
};
|
};
|
||||||
|
use chrono::{DateTime, FixedOffset};
|
||||||
use lemmy_apub_lib::{object_id::ObjectId, values::MediaTypeHtml};
|
use lemmy_apub_lib::{object_id::ObjectId, values::MediaTypeHtml};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
|
|
|
@ -5,9 +5,9 @@ use crate::{
|
||||||
community_outbox::ApubCommunityOutbox,
|
community_outbox::ApubCommunityOutbox,
|
||||||
},
|
},
|
||||||
objects::{community::ApubCommunity, get_summary_from_string_or_source},
|
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 chrono::{DateTime, FixedOffset};
|
||||||
use lemmy_apub_lib::{object_id::ObjectId, signatures::PublicKey, verify::verify_domains_match};
|
use lemmy_apub_lib::{object_id::ObjectId, signatures::PublicKey, verify::verify_domains_match};
|
||||||
use lemmy_db_schema::{naive_now, source::community::CommunityForm};
|
use lemmy_db_schema::{naive_now, source::community::CommunityForm};
|
||||||
|
|
|
@ -24,10 +24,8 @@ mod tests {
|
||||||
tests::test_parse_lemmy_item,
|
tests::test_parse_lemmy_item,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use serial_test::serial;
|
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
#[serial]
|
|
||||||
async fn test_parse_object() {
|
async fn test_parse_object() {
|
||||||
test_parse_lemmy_item::<Person>("assets/lemmy/objects/person.json");
|
test_parse_lemmy_item::<Person>("assets/lemmy/objects/person.json");
|
||||||
test_parse_lemmy_item::<Group>("assets/lemmy/objects/group.json");
|
test_parse_lemmy_item::<Group>("assets/lemmy/objects/group.json");
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
fetcher::post_or_comment::PostOrComment,
|
fetcher::post_or_comment::PostOrComment,
|
||||||
|
mentions::Mention,
|
||||||
objects::{comment::ApubComment, person::ApubPerson, post::ApubPost},
|
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 chrono::{DateTime, FixedOffset};
|
||||||
use lemmy_api_common::blocking;
|
use lemmy_api_common::blocking;
|
||||||
use lemmy_apub_lib::{object_id::ObjectId, values::MediaTypeHtml};
|
use lemmy_apub_lib::{object_id::ObjectId, values::MediaTypeHtml};
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
objects::{community::ApubCommunity, person::ApubPerson, post::ApubPost},
|
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 anyhow::anyhow;
|
||||||
use chrono::{DateTime, FixedOffset};
|
use chrono::{DateTime, FixedOffset};
|
||||||
use lemmy_apub_lib::{
|
use lemmy_apub_lib::{
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
objects::person::ApubPerson,
|
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 chrono::{DateTime, FixedOffset};
|
||||||
use lemmy_apub_lib::{object_id::ObjectId, signatures::PublicKey};
|
use lemmy_apub_lib::{object_id::ObjectId, signatures::PublicKey};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq)]
|
#[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq)]
|
||||||
pub enum UserTypes {
|
pub enum UserTypes {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use activitystreams::object::kind::TombstoneType;
|
use activitystreams_kinds::object::TombstoneType;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
Loading…
Reference in a new issue