Merge pull request 'Update activitystreams to 0.7.0-alpha.3 (from crates.io)' (#75) from update-activitystreams into main

Reviewed-on: https://yerbamate.dev/LemmyNet/lemmy/pulls/75
This commit is contained in:
dessalines 2020-08-01 15:30:04 +00:00
commit f190b272b9
24 changed files with 48 additions and 45 deletions

30
server/Cargo.lock generated vendored
View file

@ -1,19 +1,10 @@
# This file is automatically @generated by Cargo. # This file is automatically @generated by Cargo.
# It is not intended for manual editing. # It is not intended for manual editing.
[[package]] [[package]]
name = "activitystreams-ext" name = "activitystreams"
version = "0.1.0" version = "0.7.0-alpha.3"
source = "git+https://yerbamate.dev/asonix/activitystreams-ext?branch=main#2799a4c606467a2f577e1f45f93c6828ec83cfdf" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ checksum = "e3490e8e9d7744aada19fb2fb4e2564f8c22fd080a3561093ac91ed7d10bfe78"
"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"
dependencies = [ dependencies = [
"chrono", "chrono",
"mime", "mime",
@ -23,6 +14,17 @@ dependencies = [
"url", "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]] [[package]]
name = "actix" name = "actix"
version = "0.10.0-alpha.3" version = "0.10.0-alpha.3"
@ -1726,8 +1728,8 @@ dependencies = [
name = "lemmy_server" name = "lemmy_server"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"activitystreams",
"activitystreams-ext", "activitystreams-ext",
"activitystreams-new",
"actix", "actix",
"actix-files", "actix-files",
"actix-rt", "actix-rt",

4
server/Cargo.toml vendored
View file

@ -18,8 +18,8 @@ lemmy_db = { path = "./lemmy_db" }
diesel = "1.4.4" diesel = "1.4.4"
diesel_migrations = "1.4.0" diesel_migrations = "1.4.0"
dotenv = "0.15.0" dotenv = "0.15.0"
activitystreams-new = { git = "https://yerbamate.dev/asonix/activitystreams-new", branch = "main" } activitystreams = "0.7.0-alpha.3"
activitystreams-ext = { git = "https://yerbamate.dev/asonix/activitystreams-ext", branch = "main" } activitystreams-ext = "0.1.0-alpha.2"
bcrypt = "0.8.0" bcrypt = "0.8.0"
chrono = { version = "0.4.7", features = ["serde"] } chrono = { version = "0.4.7", features = ["serde"] }
serde_json = { version = "1.0.52", features = ["preserve_order"]} serde_json = { version = "1.0.52", features = ["preserve_order"]}

View file

@ -10,7 +10,7 @@ use crate::{
DbPool, DbPool,
LemmyError, LemmyError,
}; };
use activitystreams_new::base::AnyBase; use activitystreams::base::AnyBase;
use actix_web::client::Client; use actix_web::client::Client;
use lemmy_db::{community::Community, user::User_}; use lemmy_db::{community::Community, user::User_};
use lemmy_utils::{get_apub_protocol_string, settings::Settings}; use lemmy_utils::{get_apub_protocol_string, settings::Settings};

View file

@ -21,7 +21,7 @@ use crate::{
DbPool, DbPool,
LemmyError, LemmyError,
}; };
use activitystreams_new::{ use activitystreams::{
activity::{ activity::{
kind::{CreateType, DeleteType, DislikeType, LikeType, RemoveType, UndoType, UpdateType}, kind::{CreateType, DeleteType, DislikeType, LikeType, RemoveType, UndoType, UpdateType},
Create, Create,

View file

@ -18,8 +18,7 @@ use crate::{
DbPool, DbPool,
LemmyError, LemmyError,
}; };
use activitystreams_ext::Ext2; use activitystreams::{
use activitystreams_new::{
activity::{ activity::{
kind::{AcceptType, AnnounceType, DeleteType, LikeType, RemoveType, UndoType}, kind::{AcceptType, AnnounceType, DeleteType, LikeType, RemoveType, UndoType},
Accept, Accept,
@ -37,6 +36,7 @@ use activitystreams_new::{
prelude::*, prelude::*,
public, public,
}; };
use activitystreams_ext::Ext2;
use actix_web::{body::Body, client::Client, web, HttpResponse}; use actix_web::{body::Body, client::Client, web, HttpResponse};
use itertools::Itertools; use itertools::Itertools;
use lemmy_db::{ use lemmy_db::{
@ -403,7 +403,7 @@ pub async fn get_apub_community_followers(
}) })
.await??; .await??;
let mut collection = UnorderedCollection::new(vec![]); let mut collection = UnorderedCollection::new();
collection collection
.set_context(context()) .set_context(context())
// TODO: this needs its own ID // TODO: this needs its own ID
@ -433,8 +433,9 @@ pub async fn get_apub_community_outbox(
} }
let len = pages.len(); let len = pages.len();
let mut collection = OrderedCollection::new(pages); let mut collection = OrderedCollection::new();
collection collection
.set_many_items(pages)
.set_context(context()) .set_context(context())
.set_id(community.get_outbox_url()?) .set_id(community.get_outbox_url()?)
.set_total_items(len as u64); .set_total_items(len as u64);

View file

@ -1,6 +1,6 @@
use crate::LemmyError; use crate::LemmyError;
use activitystreams::unparsed::UnparsedMutExt;
use activitystreams_ext::UnparsedExtension; use activitystreams_ext::UnparsedExtension;
use activitystreams_new::unparsed::UnparsedMutExt;
use diesel::PgConnection; use diesel::PgConnection;
use lemmy_db::{category::Category, Crud}; use lemmy_db::{category::Category, Crud};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};

View file

@ -1,5 +1,5 @@
use activitystreams::unparsed::UnparsedMutExt;
use activitystreams_ext::UnparsedExtension; use activitystreams_ext::UnparsedExtension;
use activitystreams_new::unparsed::UnparsedMutExt;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Default, Deserialize, Serialize)] #[derive(Clone, Debug, Default, Deserialize, Serialize)]

View file

@ -1,6 +1,6 @@
use crate::{apub::ActorType, LemmyError}; use crate::{apub::ActorType, LemmyError};
use activitystreams::unparsed::UnparsedMutExt;
use activitystreams_ext::UnparsedExtension; use activitystreams_ext::UnparsedExtension;
use activitystreams_new::unparsed::UnparsedMutExt;
use actix_web::{client::ClientRequest, HttpRequest}; use actix_web::{client::ClientRequest, HttpRequest};
use http_signature_normalization_actix::{ use http_signature_normalization_actix::{
digest::{DigestClient, SignExt}, digest::{DigestClient, SignExt},

View file

@ -15,7 +15,7 @@ use crate::{
DbPool, DbPool,
LemmyError, 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 actix_web::client::Client;
use chrono::NaiveDateTime; use chrono::NaiveDateTime;
use diesel::{result::Error::NotFound, PgConnection}; use diesel::{result::Error::NotFound, PgConnection};
@ -348,7 +348,7 @@ async fn fetch_remote_community(
// fetch outbox (maybe make this conditional) // fetch outbox (maybe make this conditional)
let outbox = let outbox =
fetch_remote_object::<OrderedCollection>(client, &community.get_outbox_url()?).await?; fetch_remote_object::<OrderedCollection>(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() { for o in outbox_items.many().unwrap() {
let page = PageExt::from_any_base(o)?.unwrap(); let page = PageExt::from_any_base(o)?.unwrap();
let post = PostForm::from_apub(&page, client, pool).await?; let post = PostForm::from_apub(&page, client, pool).await?;

View file

@ -15,7 +15,7 @@ use crate::{
DbPool, DbPool,
LemmyError, LemmyError,
}; };
use activitystreams_new::{activity::*, base::AnyBase, prelude::ExtendsExt}; use activitystreams::{activity::*, base::AnyBase, prelude::ExtendsExt};
use actix_web::{client::Client, HttpResponse}; use actix_web::{client::Client, HttpResponse};
pub async fn receive_announce( pub async fn receive_announce(

View file

@ -21,7 +21,7 @@ use crate::{
DbPool, DbPool,
LemmyError, 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 actix_web::{client::Client, HttpResponse};
use lemmy_db::{ use lemmy_db::{
comment::{Comment, CommentForm}, comment::{Comment, CommentForm},

View file

@ -20,7 +20,7 @@ use crate::{
DbPool, DbPool,
LemmyError, 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 actix_web::{client::Client, HttpResponse};
use lemmy_db::{ use lemmy_db::{
comment::{Comment, CommentForm}, comment::{Comment, CommentForm},

View file

@ -19,7 +19,7 @@ use crate::{
DbPool, DbPool,
LemmyError, 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 actix_web::{client::Client, HttpResponse};
use lemmy_db::{ use lemmy_db::{
comment::{CommentForm, CommentLike, CommentLikeForm}, comment::{CommentForm, CommentLike, CommentLikeForm},

View file

@ -19,7 +19,7 @@ use crate::{
DbPool, DbPool,
LemmyError, 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 actix_web::{client::Client, HttpResponse};
use lemmy_db::{ use lemmy_db::{
comment::{CommentForm, CommentLike, CommentLikeForm}, comment::{CommentForm, CommentLike, CommentLikeForm},

View file

@ -20,7 +20,7 @@ use crate::{
DbPool, DbPool,
LemmyError, 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 actix_web::{client::Client, HttpResponse};
use lemmy_db::{ use lemmy_db::{
comment::{Comment, CommentForm}, comment::{Comment, CommentForm},

View file

@ -20,7 +20,7 @@ use crate::{
DbPool, DbPool,
LemmyError, 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 actix_web::{client::Client, HttpResponse};
use lemmy_db::{ use lemmy_db::{
comment::{Comment, CommentForm, CommentLike, CommentLikeForm}, comment::{Comment, CommentForm, CommentLike, CommentLikeForm},

View file

@ -22,7 +22,7 @@ use crate::{
DbPool, DbPool,
LemmyError, 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 actix_web::{client::Client, HttpResponse};
use lemmy_db::{ use lemmy_db::{
comment::{Comment, CommentForm}, comment::{Comment, CommentForm},

View file

@ -9,7 +9,7 @@ use crate::{
routes::{ChatServerParam, DbPoolParam}, routes::{ChatServerParam, DbPoolParam},
LemmyError, LemmyError,
}; };
use activitystreams_new::{ use activitystreams::{
activity::{Follow, Undo}, activity::{Follow, Undo},
prelude::*, prelude::*,
}; };

View file

@ -23,7 +23,7 @@ use crate::{
DbPool, DbPool,
LemmyError, LemmyError,
}; };
use activitystreams_new::{ use activitystreams::{
activity::{ActorAndObject, ActorAndObjectRef}, activity::{ActorAndObject, ActorAndObjectRef},
base::{AsBase, Extends}, base::{AsBase, Extends},
object::AsObject, object::AsObject,

View file

@ -12,7 +12,7 @@ use crate::{
DbPool, DbPool,
LemmyError, LemmyError,
}; };
use activitystreams_new::{ use activitystreams::{
activity::{Accept, Create, Delete, Undo, Update}, activity::{Accept, Create, Delete, Undo, Update},
object::Note, object::Note,
prelude::*, prelude::*,

View file

@ -20,13 +20,13 @@ use crate::{
DbPool, DbPool,
LemmyError, LemmyError,
}; };
use activitystreams_ext::{Ext1, Ext2}; use activitystreams::{
use activitystreams_new::{
activity::Follow, activity::Follow,
actor::{ApActor, Group, Person}, actor::{ApActor, Group, Person},
object::{Page, Tombstone}, object::{Page, Tombstone},
prelude::*, prelude::*,
}; };
use activitystreams_ext::{Ext1, Ext2};
use actix_web::{body::Body, client::Client, HttpResponse}; use actix_web::{body::Body, client::Client, HttpResponse};
use chrono::NaiveDateTime; use chrono::NaiveDateTime;
use failure::_core::fmt::Debug; use failure::_core::fmt::Debug;

View file

@ -18,8 +18,7 @@ use crate::{
DbPool, DbPool,
LemmyError, LemmyError,
}; };
use activitystreams_ext::Ext1; use activitystreams::{
use activitystreams_new::{
activity::{ activity::{
kind::{CreateType, DeleteType, DislikeType, LikeType, RemoveType, UndoType, UpdateType}, kind::{CreateType, DeleteType, DislikeType, LikeType, RemoveType, UndoType, UpdateType},
Create, Create,
@ -35,6 +34,7 @@ use activitystreams_new::{
prelude::*, prelude::*,
public, public,
}; };
use activitystreams_ext::Ext1;
use actix_web::{body::Body, client::Client, web, HttpResponse}; use actix_web::{body::Body, client::Client, web, HttpResponse};
use lemmy_db::{ use lemmy_db::{
community::Community, community::Community,

View file

@ -12,7 +12,7 @@ use crate::{
DbPool, DbPool,
LemmyError, LemmyError,
}; };
use activitystreams_new::{ use activitystreams::{
activity::{ activity::{
kind::{CreateType, DeleteType, UndoType, UpdateType}, kind::{CreateType, DeleteType, UndoType, UpdateType},
Create, Create,

View file

@ -13,8 +13,7 @@ use crate::{
DbPool, DbPool,
LemmyError, LemmyError,
}; };
use activitystreams_ext::Ext1; use activitystreams::{
use activitystreams_new::{
activity::{ activity::{
kind::{FollowType, UndoType}, kind::{FollowType, UndoType},
Follow, Follow,
@ -25,6 +24,7 @@ use activitystreams_new::{
object::{Image, Tombstone}, object::{Image, Tombstone},
prelude::*, prelude::*,
}; };
use activitystreams_ext::Ext1;
use actix_web::{body::Body, client::Client, web, HttpResponse}; use actix_web::{body::Body, client::Client, web, HttpResponse};
use lemmy_db::{ use lemmy_db::{
naive_now, naive_now,