diff --git a/apb/Cargo.toml b/apb/Cargo.toml index be8270af..b80300c0 100644 --- a/apb/Cargo.toml +++ b/apb/Cargo.toml @@ -24,8 +24,12 @@ sea-orm = { version = "0.12", optional = true } reqwest = { version = "0.12", features = ["json"], optional = true } [features] -default = [] +default = ["activitypub-miscellaneous-terms"] +# extensions +activitypub-miscellaneous-terms = [] +# builtin utils orm = ["dep:sea-orm"] fetch = ["dep:reqwest"] +# providers unstructured = ["dep:serde_json"] -# TODO eventually also make a structured base? +#TODO eventually also make a structured base? diff --git a/apb/src/types/link.rs b/apb/src/types/link.rs index 438dd535..2a7921fb 100644 --- a/apb/src/types/link.rs +++ b/apb/src/types/link.rs @@ -1,3 +1,13 @@ +#[cfg(feature = "activitypub-miscellaneous-terms")] +crate::strenum! { + pub enum LinkType { + Link, + Hashtag, + Mention; + }; +} + +#[cfg(not(feature = "activitypub-miscellaneous-terms"))] crate::strenum! { pub enum LinkType { Link, diff --git a/apb/src/types/object/actor.rs b/apb/src/types/object/actor.rs index ea8f37de..93895b7d 100644 --- a/apb/src/types/object/actor.rs +++ b/apb/src/types/object/actor.rs @@ -23,6 +23,13 @@ pub trait Actor : Object { fn streams(&self) -> Node { Node::Empty } fn endpoints(&self) -> Node { Node::Empty } fn public_key(&self) -> Node { Node::Empty } + + #[cfg(feature = "activitypub-miscellaneous-terms")] + fn moved_to(&self) -> Node { Node::Empty } + + #[cfg(feature = "activitypub-miscellaneous-terms")] + fn manually_approves_followers(&self) -> Option { None } + // idk about this? everyone has it but AP doesn't mention it fn discoverable(&self) -> Option { None } } diff --git a/apb/src/types/object/mod.rs b/apb/src/types/object/mod.rs index 7241d343..0670a38a 100644 --- a/apb/src/types/object/mod.rs +++ b/apb/src/types/object/mod.rs @@ -68,7 +68,7 @@ pub trait Object : Base { fn media_type(&self) -> Option<&str> { None } // also in link fn duration(&self) -> Option<&str> { None } // TODO how to parse xsd:duration ? - // TODO i really need this but it isn't part of AP! + #[cfg(feature = "activitypub-miscellaneous-terms")] fn sensitive(&self) -> Option { None } fn as_activity(&self) -> Option<&Self::Activity> { None } @@ -112,6 +112,7 @@ pub trait ObjectMut : BaseMut { fn set_media_type(self, val: Option<&str>) -> Self; // also in link fn set_duration(self, val: Option<&str>) -> Self; // TODO how to parse xsd:duration ? + #[cfg(feature = "activitypub-miscellaneous-terms")] fn set_sensitive(self, val: Option) -> Self; } @@ -151,6 +152,7 @@ impl Object for serde_json::Value { crate::getter! { duration -> &str } crate::getter! { url -> node Self::Link } + #[cfg(feature = "activitypub-miscellaneous-terms")] crate::getter! { sensitive -> bool } // TODO Mastodon doesn't use a "context" field on the object but makes up a new one!! @@ -229,5 +231,6 @@ impl ObjectMut for serde_json::Value { crate::setter! { url -> node Self::Link } crate::setter! { context -> node ::Object } + #[cfg(feature = "activitypub-miscellaneous-terms")] crate::setter! { sensitive -> bool } }