"syn",
]
+[[package]]
+name = "activitystreams-ext"
+version = "0.1.0"
+source = "git+https://git.asonix.dog/asonix/activitystreams-ext#862426e504832256a6b26e1ec2198c0bda22139b"
+dependencies = [
+ "activitystreams-new",
+ "serde 1.0.110",
+ "serde_json 1.0.53",
+]
+
[[package]]
name = "activitystreams-new"
version = "0.1.0"
-source = "git+https://git.asonix.dog/asonix/activitystreams-sketch#2fb52d32bbce9716c76e08579cf5c716366945fe"
+source = "git+https://git.asonix.dog/asonix/activitystreams-sketch#2cd88752996d702b355f0cd2c8dc991af00b3cae"
dependencies = [
"activitystreams",
"serde 1.0.110",
version = "0.0.1"
dependencies = [
"activitystreams",
+ "activitystreams-ext",
"activitystreams-new",
"actix",
"actix-files",
[[package]]
name = "pin-project"
-version = "0.4.16"
+version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "81d480cb4e89522ccda96d0eed9af94180b7a5f93fb28f66e1fd7d68431663d1"
+checksum = "edc93aeee735e60ecb40cf740eb319ff23eab1c5748abfdb5c180e4ce49f7791"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
-version = "0.4.16"
+version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a82996f11efccb19b685b14b5df818de31c1edcee3daa256ab5775dd98e72feb"
+checksum = "e58db2081ba5b4c93bd6be09c40fd36cb9193a8336c384f3b40012e531aa7e40"
dependencies = [
"proc-macro2",
"quote",
[[package]]
name = "ppv-lite86"
-version = "0.2.7"
+version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d1e4df3c96bec4c7ce0e32fe5960c98ffc869443ec9592a0411ca1ee96e5e2f0"
+checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea"
[[package]]
name = "pq-sys"
[[package]]
name = "quote"
-version = "1.0.5"
+version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "42934bc9c8ab0d3b273a16d8551c8f0fcff46be73276ca083ec2414c15c4ba5e"
+checksum = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea"
dependencies = [
"proc-macro2",
]
[[package]]
name = "typed-builder"
-version = "0.5.1"
-source = "git+https://git.asonix.dog/asonix/typed-builder#3dadcaaa6184ef720093c8f0632a7d423d2537b0"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "85fc4459191c621a53ef6c6ca5642e6e0e5ccc61f3e5b8ad6b6ab5317f0200fb"
dependencies = [
"proc-macro2",
"quote",
authors = ["Dessalines <happydooby@gmail.com>"]
edition = "2018"
-[patch.crates-io]
-typed-builder = { git = "https://git.asonix.dog/asonix/typed-builder" }
-
[dependencies]
diesel = { version = "1.4.4", features = ["postgres","chrono","r2d2","64-column-tables","serde_json"] }
diesel_migrations = "1.4.0"
dotenv = "0.15.0"
activitystreams = "0.6.2"
-activitystreams-new = { version = "0.1.0", git = "https://git.asonix.dog/asonix/activitystreams-sketch" }
+activitystreams-new = { git = "https://git.asonix.dog/asonix/activitystreams-sketch" }
+activitystreams-ext = { git = "https://git.asonix.dog/asonix/activitystreams-ext" }
bcrypt = "0.8.0"
chrono = { version = "0.4.7", features = ["serde"] }
failure = "0.1.8"
collection::UnorderedCollection,
context,
endpoint::EndpointProperties,
- ext::Extensible,
object::{properties::ObjectProperties, Tombstone},
BaseBox,
};
+use activitystreams_ext::Ext3;
use actix_web::{body::Body, web::Path, HttpResponse, Result};
use diesel::PgConnection;
use failure::Error;
let group_extension = GroupExtension::new(conn, self.category_id, self.nsfw)?;
- Ok(
- group
- .extend(group_extension)
- .extend(actor_props)
- .extend(self.get_public_key_ext()),
- )
+ Ok(Ext3::new(
+ group,
+ group_extension,
+ actor_props,
+ self.get_public_key_ext(),
+ ))
}
fn to_tombstone(&self) -> Result<Tombstone, Error> {
delete
.delete_props
.set_actor_xsd_any_uri(creator.actor_id.to_owned())?
- .set_object_base_box(group)?;
+ .set_object_base_box(BaseBox::from_concrete(group)?)?;
insert_activity(&conn, self.creator_id, &delete, true)?;
delete
.delete_props
.set_actor_xsd_any_uri(creator.actor_id.to_owned())?
- .set_object_base_box(group)?;
+ .set_object_base_box(BaseBox::from_concrete(group)?)?;
// TODO
// Undo that fake activity
remove
.remove_props
.set_actor_xsd_any_uri(mod_.actor_id.to_owned())?
- .set_object_base_box(group)?;
+ .set_object_base_box(BaseBox::from_concrete(group)?)?;
insert_activity(&conn, mod_.id, &remove, true)?;
remove
.remove_props
.set_actor_xsd_any_uri(mod_.actor_id.to_owned())?
- .set_object_base_box(group)?;
+ .set_object_base_box(BaseBox::from_concrete(group)?)?;
// Undo that fake activity
let undo_id = format!("{}/undo/remove/{}", self.actor_id, uuid::Uuid::new_v4());
/// Parse an ActivityPub group received from another instance into a Lemmy community.
fn from_apub(group: &GroupExt, conn: &PgConnection) -> Result<Self, Error> {
- let group_extensions: &GroupExtension = &group.base.base.extension;
- let oprops = &group.base.base.base.object_props;
- let aprops = &group.base.extension;
- let public_key: &PublicKey = &group.extension.public_key;
+ let group_extensions: &GroupExtension = &group.ext_one;
+ let oprops = &group.inner.object_props;
+ let aprops = &group.ext_two;
+ let public_key: &PublicKey = &group.ext_three.public_key;
let mut creator_and_moderator_uris = oprops.get_many_attributed_to_xsd_any_uris().unwrap();
let creator = creator_and_moderator_uris
};
match fetch_remote_object::<SearchAcceptedObjects>(&query_url)? {
SearchAcceptedObjects::Person(p) => {
- let user_uri = p.base.base.object_props.get_id().unwrap().to_string();
+ let user_uri = p.inner.object_props.get_id().unwrap().to_string();
let user = get_or_fetch_and_upsert_remote_user(&user_uri, &conn)?;
response.users = vec![UserView::read(conn, user.id)?];
}
SearchAcceptedObjects::Group(g) => {
- let community_uri = g.base.base.base.object_props.get_id().unwrap().to_string();
+ let community_uri = g.inner.object_props.get_id().unwrap().to_string();
let community = get_or_fetch_and_upsert_remote_community(&community_uri, &conn)?;
// TODO Maybe at some point in the future, fetch all the history of a community
// fetch_community_outbox(&c, conn)?;
// Also add the community moderators too
let creator_and_moderator_uris = group
- .base
- .base
- .base
+ .inner
.object_props
.get_many_attributed_to_xsd_any_uris()
.unwrap();
use activitystreams::{
activity::Follow,
actor::{properties::ApActorProperties, Group, Person},
- ext::Ext,
object::{Page, Tombstone},
};
+use activitystreams_ext::{Ext1, Ext2, Ext3};
use actix_web::{body::Body, HttpResponse, Result};
use chrono::NaiveDateTime;
use diesel::PgConnection;
use serde::Serialize;
use url::Url;
-type GroupExt = Ext<Ext<Ext<Group, GroupExtension>, ApActorProperties>, PublicKeyExtension>;
-type PersonExt = Ext<Ext<Person, ApActorProperties>, PublicKeyExtension>;
-type PageExt = Ext<Page, PageExtension>;
+type GroupExt = Ext3<Group, GroupExtension, ApActorProperties, PublicKeyExtension>;
+type PersonExt = Ext2<Person, ApActorProperties, PublicKeyExtension>;
+type PageExt = Ext1<Page, PageExtension>;
pub static APUB_JSON_CONTENT_TYPE: &str = "application/activity+json";
use activitystreams::{
activity::{Create, Delete, Dislike, Like, Remove, Undo, Update},
context,
- ext::Extensible,
object::{kind::PageType, properties::ObjectProperties, Page, Tombstone},
+ BaseBox,
};
+use activitystreams_ext::Ext1;
use actix_web::{body::Body, web::Path, HttpResponse, Result};
use diesel::PgConnection;
use failure::Error;
comments_enabled: !self.locked,
sensitive: self.nsfw,
};
- Ok(page.extend(ext))
+ Ok(Ext1::new(page, ext))
}
fn to_tombstone(&self) -> Result<Tombstone, Error> {
/// Parse an ActivityPub page received from another instance into a Lemmy post.
fn from_apub(page: &PageExt, conn: &PgConnection) -> Result<PostForm, Error> {
- let ext = &page.extension;
- let page = &page.base;
- let oprops = &page.object_props;
+ let ext = &page.ext_one;
+ let oprops = &page.inner.object_props;
let creator_actor_id = &oprops.get_attributed_to_xsd_any_uri().unwrap().to_string();
let creator = get_or_fetch_and_upsert_remote_user(&creator_actor_id, &conn)?;
let community_actor_id = &oprops.get_to_xsd_any_uri().unwrap().to_string();
create
.create_props
.set_actor_xsd_any_uri(creator.actor_id.to_owned())?
- .set_object_base_box(page)?;
+ .set_object_base_box(BaseBox::from_concrete(page)?)?;
insert_activity(&conn, creator.id, &create, true)?;
update
.update_props
.set_actor_xsd_any_uri(creator.actor_id.to_owned())?
- .set_object_base_box(page)?;
+ .set_object_base_box(BaseBox::from_concrete(page)?)?;
insert_activity(&conn, creator.id, &update, true)?;
delete
.delete_props
.set_actor_xsd_any_uri(creator.actor_id.to_owned())?
- .set_object_base_box(page)?;
+ .set_object_base_box(BaseBox::from_concrete(page)?)?;
insert_activity(&conn, self.creator_id, &delete, true)?;
delete
.delete_props
.set_actor_xsd_any_uri(creator.actor_id.to_owned())?
- .set_object_base_box(page)?;
+ .set_object_base_box(BaseBox::from_concrete(page)?)?;
// TODO
// Undo that fake activity
remove
.remove_props
.set_actor_xsd_any_uri(mod_.actor_id.to_owned())?
- .set_object_base_box(page)?;
+ .set_object_base_box(BaseBox::from_concrete(page)?)?;
insert_activity(&conn, mod_.id, &remove, true)?;
remove
.remove_props
.set_actor_xsd_any_uri(mod_.actor_id.to_owned())?
- .set_object_base_box(page)?;
+ .set_object_base_box(BaseBox::from_concrete(page)?)?;
// Undo that fake activity
let undo_id = format!("{}/undo/remove/{}", self.ap_id, uuid::Uuid::new_v4());
like
.like_props
.set_actor_xsd_any_uri(creator.actor_id.to_owned())?
- .set_object_base_box(page)?;
+ .set_object_base_box(BaseBox::from_concrete(page)?)?;
insert_activity(&conn, creator.id, &like, true)?;
dislike
.dislike_props
.set_actor_xsd_any_uri(creator.actor_id.to_owned())?
- .set_object_base_box(page)?;
+ .set_object_base_box(BaseBox::from_concrete(page)?)?;
insert_activity(&conn, creator.id, &dislike, true)?;
like
.like_props
.set_actor_xsd_any_uri(creator.actor_id.to_owned())?
- .set_object_base_box(page)?;
+ .set_object_base_box(BaseBox::from_concrete(page)?)?;
// TODO
// Undo that fake activity
actor::{properties::ApActorProperties, Person},
context,
endpoint::EndpointProperties,
- ext::Extensible,
object::{properties::ObjectProperties, Tombstone},
};
+use activitystreams_ext::Ext2;
use actix_web::{body::Body, web::Path, HttpResponse, Result};
use diesel::PgConnection;
use failure::Error;
.set_following(self.get_following_url())?
.set_liked(self.get_liked_url())?;
- Ok(person.extend(actor_props).extend(self.get_public_key_ext()))
+ Ok(Ext2::new(person, actor_props, self.get_public_key_ext()))
}
fn to_tombstone(&self) -> Result<Tombstone, Error> {
unimplemented!()
type ApubType = PersonExt;
/// Parse an ActivityPub person received from another instance into a Lemmy user.
fn from_apub(person: &PersonExt, _conn: &PgConnection) -> Result<Self, Error> {
- let oprops = &person.base.base.object_props;
- let aprops = &person.base.extension;
- let public_key: &PublicKey = &person.extension.public_key;
+ let oprops = &person.inner.object_props;
+ let aprops = &person.ext_one;
+ let public_key: &PublicKey = &person.ext_two.public_key;
Ok(UserForm {
name: oprops.get_name_xsd_string().unwrap().to_string(),