From: Felix Date: Thu, 30 Apr 2020 16:30:01 +0000 (+0200) Subject: update activitystreams lib X-Git-Url: http://these/git/ui/assets/%7BsortingHelpUrl%7D?a=commitdiff_plain;h=461114c143aebf02f70de2b21d8b1272f67f12a2;p=lemmy.git update activitystreams lib --- diff --git a/server/Cargo.lock b/server/Cargo.lock index 56e81b47..714422b6 100644 --- a/server/Cargo.lock +++ b/server/Cargo.lock @@ -2,9 +2,9 @@ # It is not intended for manual editing. [[package]] name = "activitystreams" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae98a55a86fc3150f278b225644cd46b5359f4d75067eae6dc3a52b409c537fb" +checksum = "dd5b29a0f2c64cc56f2b79ec29cab68a9dab3b714d811a55668d072f18a8638e" dependencies = [ "activitystreams-derive", "chrono", @@ -17,9 +17,9 @@ dependencies = [ [[package]] name = "activitystreams-derive" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20d0384ae423a1df266f216e351ce9b40e8d369467d9242c086121154b4327dd" +checksum = "985d3ca1ee226e83f4118e0235bc11d9fce39c4eec8d53739a21b01dd0b3f30f" dependencies = [ "proc-macro2", "quote", diff --git a/server/Cargo.toml b/server/Cargo.toml index 2777dd2c..ab76d06f 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" 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.5.0-alpha.16" +activitystreams = "0.6.0" bcrypt = "0.6.2" chrono = { version = "0.4.7", features = ["serde"] } failure = "0.1.5" diff --git a/server/src/apub/mod.rs b/server/src/apub/mod.rs index f72eb17e..03c43bdc 100644 --- a/server/src/apub/mod.rs +++ b/server/src/apub/mod.rs @@ -67,7 +67,6 @@ use chrono::NaiveDateTime; use fetcher::{get_or_fetch_and_upsert_remote_community, get_or_fetch_and_upsert_remote_user}; use signatures::verify; use signatures::{sign, PublicKey, PublicKeyExtension}; -use activitystreams::primitives::XsdString; type GroupExt = Ext, PublicKeyExtension>; type PersonExt = Ext, PublicKeyExtension>; @@ -171,13 +170,13 @@ fn create_tombstone( tombstone .object_props .set_id(object_id)? - .set_published(convert_datetime(published)); + .set_published(convert_datetime(published))?; if let Some(updated) = updated { tombstone .object_props .set_updated(convert_datetime(updated))?; } - tombstone.tombstone_props.set_former_type_object_box(XsdString::from_string(former_type))?; + tombstone.tombstone_props.set_former_type_xsd_string(former_type)?; Ok(tombstone) } else { Err(format_err!( diff --git a/server/src/apub/shared_inbox.rs b/server/src/apub/shared_inbox.rs index 692e6f2b..7d3826f2 100644 --- a/server/src/apub/shared_inbox.rs +++ b/server/src/apub/shared_inbox.rs @@ -82,7 +82,7 @@ fn receive_create_post( .to_owned() .unwrap() .to_owned() - .to_concrete::()?; + .into_concrete::()?; let user_uri = create .create_props @@ -131,7 +131,7 @@ fn receive_create_comment( .to_owned() .unwrap() .to_owned() - .to_concrete::()?; + .into_concrete::()?; let user_uri = create .create_props @@ -185,7 +185,7 @@ fn receive_update_post( .to_owned() .unwrap() .to_owned() - .to_concrete::()?; + .into_concrete::()?; let user_uri = update .update_props @@ -235,7 +235,7 @@ fn receive_like_post( .to_owned() .unwrap() .to_owned() - .to_concrete::()?; + .into_concrete::()?; let user_uri = like.like_props.get_actor_xsd_any_uri().unwrap().to_string(); @@ -288,7 +288,7 @@ fn receive_dislike_post( .to_owned() .unwrap() .to_owned() - .to_concrete::()?; + .into_concrete::()?; let user_uri = dislike .dislike_props @@ -345,7 +345,7 @@ fn receive_update_comment( .to_owned() .unwrap() .to_owned() - .to_concrete::()?; + .into_concrete::()?; let user_uri = update .update_props @@ -400,7 +400,7 @@ fn receive_like_comment( .to_owned() .unwrap() .to_owned() - .to_concrete::()?; + .into_concrete::()?; let user_uri = like.like_props.get_actor_xsd_any_uri().unwrap().to_string(); @@ -458,7 +458,7 @@ fn receive_dislike_comment( .to_owned() .unwrap() .to_owned() - .to_concrete::()?; + .into_concrete::()?; let user_uri = dislike .dislike_props @@ -520,11 +520,10 @@ fn receive_delete( .to_owned() .unwrap() .to_owned() - .to_concrete::()?; - // TODO: not sure how to handle formerType (should be a string) - // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-formertype - let former_type: &str = tombstone.tombstone_props.get_former_type_object_box().unwrap().to_concrete::(); - match former_type { + .into_concrete::()?; + let former_type = tombstone.tombstone_props.get_former_type_xsd_string().unwrap().to_string(); + // TODO: handle these + match former_type.as_str() { "Group" => {}, d => return Err(format_err!("Delete type {} not supported", d)), }