From 9a004c45350ffd738991bd206a10e9251fe3ed4b Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Sat, 1 Aug 2020 15:25:17 +0200 Subject: [PATCH] Update activitystreams to 0.7.0-alpha.3 (from crates.io) --- server/Cargo.lock | 30 ++++++++++--------- server/Cargo.toml | 4 +-- server/src/apub/activities.rs | 2 +- server/src/apub/comment.rs | 2 +- server/src/apub/community.rs | 9 +++--- .../src/apub/extensions/group_extensions.rs | 2 +- server/src/apub/extensions/page_extension.rs | 2 +- server/src/apub/extensions/signatures.rs | 2 +- server/src/apub/fetcher.rs | 4 +-- server/src/apub/inbox/activities/announce.rs | 2 +- server/src/apub/inbox/activities/create.rs | 2 +- server/src/apub/inbox/activities/delete.rs | 2 +- server/src/apub/inbox/activities/dislike.rs | 2 +- server/src/apub/inbox/activities/like.rs | 2 +- server/src/apub/inbox/activities/remove.rs | 2 +- server/src/apub/inbox/activities/undo.rs | 2 +- server/src/apub/inbox/activities/update.rs | 2 +- server/src/apub/inbox/community_inbox.rs | 2 +- server/src/apub/inbox/shared_inbox.rs | 2 +- server/src/apub/inbox/user_inbox.rs | 2 +- server/src/apub/mod.rs | 4 +-- server/src/apub/post.rs | 4 +-- server/src/apub/private_message.rs | 2 +- server/src/apub/user.rs | 4 +-- 24 files changed, 48 insertions(+), 45 deletions(-) diff --git a/server/Cargo.lock b/server/Cargo.lock index 3f19827be..90687982a 100644 --- a/server/Cargo.lock +++ b/server/Cargo.lock @@ -1,19 +1,10 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. [[package]] -name = "activitystreams-ext" -version = "0.1.0" -source = "git+https://yerbamate.dev/asonix/activitystreams-ext?branch=main#2799a4c606467a2f577e1f45f93c6828ec83cfdf" -dependencies = [ - "activitystreams-new", - "serde 1.0.114", - "serde_json", -] - -[[package]] -name = "activitystreams-new" -version = "0.1.0" -source = "git+https://yerbamate.dev/asonix/activitystreams-new?branch=main#857d5167dfa13054dd0d21d3d54f8147eea0d546" +name = "activitystreams" +version = "0.7.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3490e8e9d7744aada19fb2fb4e2564f8c22fd080a3561093ac91ed7d10bfe78" dependencies = [ "chrono", "mime", @@ -23,6 +14,17 @@ dependencies = [ "url", ] +[[package]] +name = "activitystreams-ext" +version = "0.1.0-alpha.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb8e19a0810cc25df3535061a08b7d8f8a734d309ea4411c57a9767e4a2ffa0e" +dependencies = [ + "activitystreams", + "serde 1.0.114", + "serde_json", +] + [[package]] name = "actix" version = "0.10.0-alpha.3" @@ -1726,8 +1728,8 @@ dependencies = [ name = "lemmy_server" version = "0.0.1" dependencies = [ + "activitystreams", "activitystreams-ext", - "activitystreams-new", "actix", "actix-files", "actix-rt", diff --git a/server/Cargo.toml b/server/Cargo.toml index 3a652f298..d245cf4d4 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -18,8 +18,8 @@ lemmy_db = { path = "./lemmy_db" } diesel = "1.4.4" diesel_migrations = "1.4.0" dotenv = "0.15.0" -activitystreams-new = { git = "https://yerbamate.dev/asonix/activitystreams-new", branch = "main" } -activitystreams-ext = { git = "https://yerbamate.dev/asonix/activitystreams-ext", branch = "main" } +activitystreams = "0.7.0-alpha.3" +activitystreams-ext = "0.1.0-alpha.2" bcrypt = "0.8.0" chrono = { version = "0.4.7", features = ["serde"] } serde_json = { version = "1.0.52", features = ["preserve_order"]} diff --git a/server/src/apub/activities.rs b/server/src/apub/activities.rs index a622c691d..9fdfe37fb 100644 --- a/server/src/apub/activities.rs +++ b/server/src/apub/activities.rs @@ -10,7 +10,7 @@ use crate::{ DbPool, LemmyError, }; -use activitystreams_new::base::AnyBase; +use activitystreams::base::AnyBase; use actix_web::client::Client; use lemmy_db::{community::Community, user::User_}; use lemmy_utils::{get_apub_protocol_string, settings::Settings}; diff --git a/server/src/apub/comment.rs b/server/src/apub/comment.rs index 650c60577..05b40dbe5 100644 --- a/server/src/apub/comment.rs +++ b/server/src/apub/comment.rs @@ -21,7 +21,7 @@ use crate::{ DbPool, LemmyError, }; -use activitystreams_new::{ +use activitystreams::{ activity::{ kind::{CreateType, DeleteType, DislikeType, LikeType, RemoveType, UndoType, UpdateType}, Create, diff --git a/server/src/apub/community.rs b/server/src/apub/community.rs index 584ef310c..96f0f84c3 100644 --- a/server/src/apub/community.rs +++ b/server/src/apub/community.rs @@ -18,8 +18,7 @@ use crate::{ DbPool, LemmyError, }; -use activitystreams_ext::Ext2; -use activitystreams_new::{ +use activitystreams::{ activity::{ kind::{AcceptType, AnnounceType, DeleteType, LikeType, RemoveType, UndoType}, Accept, @@ -37,6 +36,7 @@ use activitystreams_new::{ prelude::*, public, }; +use activitystreams_ext::Ext2; use actix_web::{body::Body, client::Client, web, HttpResponse}; use itertools::Itertools; use lemmy_db::{ @@ -403,7 +403,7 @@ pub async fn get_apub_community_followers( }) .await??; - let mut collection = UnorderedCollection::new(vec![]); + let mut collection = UnorderedCollection::new(); collection .set_context(context()) // TODO: this needs its own ID @@ -433,8 +433,9 @@ pub async fn get_apub_community_outbox( } let len = pages.len(); - let mut collection = OrderedCollection::new(pages); + let mut collection = OrderedCollection::new(); collection + .set_many_items(pages) .set_context(context()) .set_id(community.get_outbox_url()?) .set_total_items(len as u64); diff --git a/server/src/apub/extensions/group_extensions.rs b/server/src/apub/extensions/group_extensions.rs index 7dc42c4a0..3099a273e 100644 --- a/server/src/apub/extensions/group_extensions.rs +++ b/server/src/apub/extensions/group_extensions.rs @@ -1,6 +1,6 @@ use crate::LemmyError; +use activitystreams::unparsed::UnparsedMutExt; use activitystreams_ext::UnparsedExtension; -use activitystreams_new::unparsed::UnparsedMutExt; use diesel::PgConnection; use lemmy_db::{category::Category, Crud}; use serde::{Deserialize, Serialize}; diff --git a/server/src/apub/extensions/page_extension.rs b/server/src/apub/extensions/page_extension.rs index 3b0b89b5a..aa3d01604 100644 --- a/server/src/apub/extensions/page_extension.rs +++ b/server/src/apub/extensions/page_extension.rs @@ -1,5 +1,5 @@ +use activitystreams::unparsed::UnparsedMutExt; use activitystreams_ext::UnparsedExtension; -use activitystreams_new::unparsed::UnparsedMutExt; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Default, Deserialize, Serialize)] diff --git a/server/src/apub/extensions/signatures.rs b/server/src/apub/extensions/signatures.rs index 5a1cdeb82..e37bde250 100644 --- a/server/src/apub/extensions/signatures.rs +++ b/server/src/apub/extensions/signatures.rs @@ -1,6 +1,6 @@ use crate::{apub::ActorType, LemmyError}; +use activitystreams::unparsed::UnparsedMutExt; use activitystreams_ext::UnparsedExtension; -use activitystreams_new::unparsed::UnparsedMutExt; use actix_web::{client::ClientRequest, HttpRequest}; use http_signature_normalization_actix::{ digest::{DigestClient, SignExt}, diff --git a/server/src/apub/fetcher.rs b/server/src/apub/fetcher.rs index e2d505df7..51f3a50b4 100644 --- a/server/src/apub/fetcher.rs +++ b/server/src/apub/fetcher.rs @@ -15,7 +15,7 @@ use crate::{ DbPool, LemmyError, }; -use activitystreams_new::{base::BaseExt, collection::OrderedCollection, object::Note, prelude::*}; +use activitystreams::{base::BaseExt, collection::OrderedCollection, object::Note, prelude::*}; use actix_web::client::Client; use chrono::NaiveDateTime; use diesel::{result::Error::NotFound, PgConnection}; @@ -348,7 +348,7 @@ async fn fetch_remote_community( // fetch outbox (maybe make this conditional) let outbox = fetch_remote_object::(client, &community.get_outbox_url()?).await?; - let outbox_items = outbox.items().clone(); + let outbox_items = outbox.items().unwrap().clone(); for o in outbox_items.many().unwrap() { let page = PageExt::from_any_base(o)?.unwrap(); let post = PostForm::from_apub(&page, client, pool).await?; diff --git a/server/src/apub/inbox/activities/announce.rs b/server/src/apub/inbox/activities/announce.rs index 78a005fb1..8ca4856fe 100644 --- a/server/src/apub/inbox/activities/announce.rs +++ b/server/src/apub/inbox/activities/announce.rs @@ -15,7 +15,7 @@ use crate::{ DbPool, LemmyError, }; -use activitystreams_new::{activity::*, base::AnyBase, prelude::ExtendsExt}; +use activitystreams::{activity::*, base::AnyBase, prelude::ExtendsExt}; use actix_web::{client::Client, HttpResponse}; pub async fn receive_announce( diff --git a/server/src/apub/inbox/activities/create.rs b/server/src/apub/inbox/activities/create.rs index 0f5595cd0..f8a92c1c6 100644 --- a/server/src/apub/inbox/activities/create.rs +++ b/server/src/apub/inbox/activities/create.rs @@ -21,7 +21,7 @@ use crate::{ DbPool, LemmyError, }; -use activitystreams_new::{activity::Create, base::AnyBase, object::Note, prelude::*}; +use activitystreams::{activity::Create, base::AnyBase, object::Note, prelude::*}; use actix_web::{client::Client, HttpResponse}; use lemmy_db::{ comment::{Comment, CommentForm}, diff --git a/server/src/apub/inbox/activities/delete.rs b/server/src/apub/inbox/activities/delete.rs index b4fe0de48..4fb56d321 100644 --- a/server/src/apub/inbox/activities/delete.rs +++ b/server/src/apub/inbox/activities/delete.rs @@ -20,7 +20,7 @@ use crate::{ DbPool, LemmyError, }; -use activitystreams_new::{activity::Delete, base::AnyBase, object::Note, prelude::*}; +use activitystreams::{activity::Delete, base::AnyBase, object::Note, prelude::*}; use actix_web::{client::Client, HttpResponse}; use lemmy_db::{ comment::{Comment, CommentForm}, diff --git a/server/src/apub/inbox/activities/dislike.rs b/server/src/apub/inbox/activities/dislike.rs index cb12724d6..1e67d1922 100644 --- a/server/src/apub/inbox/activities/dislike.rs +++ b/server/src/apub/inbox/activities/dislike.rs @@ -19,7 +19,7 @@ use crate::{ DbPool, LemmyError, }; -use activitystreams_new::{activity::Dislike, base::AnyBase, object::Note, prelude::*}; +use activitystreams::{activity::Dislike, base::AnyBase, object::Note, prelude::*}; use actix_web::{client::Client, HttpResponse}; use lemmy_db::{ comment::{CommentForm, CommentLike, CommentLikeForm}, diff --git a/server/src/apub/inbox/activities/like.rs b/server/src/apub/inbox/activities/like.rs index da92bbff3..9061773d0 100644 --- a/server/src/apub/inbox/activities/like.rs +++ b/server/src/apub/inbox/activities/like.rs @@ -19,7 +19,7 @@ use crate::{ DbPool, LemmyError, }; -use activitystreams_new::{activity::Like, base::AnyBase, object::Note, prelude::*}; +use activitystreams::{activity::Like, base::AnyBase, object::Note, prelude::*}; use actix_web::{client::Client, HttpResponse}; use lemmy_db::{ comment::{CommentForm, CommentLike, CommentLikeForm}, diff --git a/server/src/apub/inbox/activities/remove.rs b/server/src/apub/inbox/activities/remove.rs index af3d144b8..485d28616 100644 --- a/server/src/apub/inbox/activities/remove.rs +++ b/server/src/apub/inbox/activities/remove.rs @@ -20,7 +20,7 @@ use crate::{ DbPool, LemmyError, }; -use activitystreams_new::{activity::Remove, base::AnyBase, object::Note, prelude::*}; +use activitystreams::{activity::Remove, base::AnyBase, object::Note, prelude::*}; use actix_web::{client::Client, HttpResponse}; use lemmy_db::{ comment::{Comment, CommentForm}, diff --git a/server/src/apub/inbox/activities/undo.rs b/server/src/apub/inbox/activities/undo.rs index 332364843..6c90fc814 100644 --- a/server/src/apub/inbox/activities/undo.rs +++ b/server/src/apub/inbox/activities/undo.rs @@ -20,7 +20,7 @@ use crate::{ DbPool, LemmyError, }; -use activitystreams_new::{activity::*, base::AnyBase, object::Note, prelude::*}; +use activitystreams::{activity::*, base::AnyBase, object::Note, prelude::*}; use actix_web::{client::Client, HttpResponse}; use lemmy_db::{ comment::{Comment, CommentForm, CommentLike, CommentLikeForm}, diff --git a/server/src/apub/inbox/activities/update.rs b/server/src/apub/inbox/activities/update.rs index 5da262e1f..9af1a2d38 100644 --- a/server/src/apub/inbox/activities/update.rs +++ b/server/src/apub/inbox/activities/update.rs @@ -22,7 +22,7 @@ use crate::{ DbPool, LemmyError, }; -use activitystreams_new::{activity::Update, base::AnyBase, object::Note, prelude::*}; +use activitystreams::{activity::Update, base::AnyBase, object::Note, prelude::*}; use actix_web::{client::Client, HttpResponse}; use lemmy_db::{ comment::{Comment, CommentForm}, diff --git a/server/src/apub/inbox/community_inbox.rs b/server/src/apub/inbox/community_inbox.rs index 8088ec5c3..337a89900 100644 --- a/server/src/apub/inbox/community_inbox.rs +++ b/server/src/apub/inbox/community_inbox.rs @@ -9,7 +9,7 @@ use crate::{ routes::{ChatServerParam, DbPoolParam}, LemmyError, }; -use activitystreams_new::{ +use activitystreams::{ activity::{Follow, Undo}, prelude::*, }; diff --git a/server/src/apub/inbox/shared_inbox.rs b/server/src/apub/inbox/shared_inbox.rs index 3a2d1c43f..9e0cdb3d8 100644 --- a/server/src/apub/inbox/shared_inbox.rs +++ b/server/src/apub/inbox/shared_inbox.rs @@ -23,7 +23,7 @@ use crate::{ DbPool, LemmyError, }; -use activitystreams_new::{ +use activitystreams::{ activity::{ActorAndObject, ActorAndObjectRef}, base::{AsBase, Extends}, object::AsObject, diff --git a/server/src/apub/inbox/user_inbox.rs b/server/src/apub/inbox/user_inbox.rs index be99d81a0..b46f67027 100644 --- a/server/src/apub/inbox/user_inbox.rs +++ b/server/src/apub/inbox/user_inbox.rs @@ -12,7 +12,7 @@ use crate::{ DbPool, LemmyError, }; -use activitystreams_new::{ +use activitystreams::{ activity::{Accept, Create, Delete, Undo, Update}, object::Note, prelude::*, diff --git a/server/src/apub/mod.rs b/server/src/apub/mod.rs index feb1f30fc..0af19dcd8 100644 --- a/server/src/apub/mod.rs +++ b/server/src/apub/mod.rs @@ -20,13 +20,13 @@ use crate::{ DbPool, LemmyError, }; -use activitystreams_ext::{Ext1, Ext2}; -use activitystreams_new::{ +use activitystreams::{ activity::Follow, actor::{ApActor, Group, Person}, object::{Page, Tombstone}, prelude::*, }; +use activitystreams_ext::{Ext1, Ext2}; use actix_web::{body::Body, client::Client, HttpResponse}; use chrono::NaiveDateTime; use failure::_core::fmt::Debug; diff --git a/server/src/apub/post.rs b/server/src/apub/post.rs index 39e4faf34..4b687b0ae 100644 --- a/server/src/apub/post.rs +++ b/server/src/apub/post.rs @@ -18,8 +18,7 @@ use crate::{ DbPool, LemmyError, }; -use activitystreams_ext::Ext1; -use activitystreams_new::{ +use activitystreams::{ activity::{ kind::{CreateType, DeleteType, DislikeType, LikeType, RemoveType, UndoType, UpdateType}, Create, @@ -35,6 +34,7 @@ use activitystreams_new::{ prelude::*, public, }; +use activitystreams_ext::Ext1; use actix_web::{body::Body, client::Client, web, HttpResponse}; use lemmy_db::{ community::Community, diff --git a/server/src/apub/private_message.rs b/server/src/apub/private_message.rs index f58a6bfed..69f552d3b 100644 --- a/server/src/apub/private_message.rs +++ b/server/src/apub/private_message.rs @@ -12,7 +12,7 @@ use crate::{ DbPool, LemmyError, }; -use activitystreams_new::{ +use activitystreams::{ activity::{ kind::{CreateType, DeleteType, UndoType, UpdateType}, Create, diff --git a/server/src/apub/user.rs b/server/src/apub/user.rs index 463208603..54e4552fd 100644 --- a/server/src/apub/user.rs +++ b/server/src/apub/user.rs @@ -13,8 +13,7 @@ use crate::{ DbPool, LemmyError, }; -use activitystreams_ext::Ext1; -use activitystreams_new::{ +use activitystreams::{ activity::{ kind::{FollowType, UndoType}, Follow, @@ -25,6 +24,7 @@ use activitystreams_new::{ object::{Image, Tombstone}, prelude::*, }; +use activitystreams_ext::Ext1; use actix_web::{body::Body, client::Client, web, HttpResponse}; use lemmy_db::{ naive_now,