fix(apb): sensitive under proper extension
This commit is contained in:
parent
aa84aef66e
commit
e0331751a4
4 changed files with 27 additions and 3 deletions
|
@ -24,8 +24,12 @@ sea-orm = { version = "0.12", optional = true }
|
||||||
reqwest = { version = "0.12", features = ["json"], optional = true }
|
reqwest = { version = "0.12", features = ["json"], optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = ["activitypub-miscellaneous-terms"]
|
||||||
|
# extensions
|
||||||
|
activitypub-miscellaneous-terms = []
|
||||||
|
# builtin utils
|
||||||
orm = ["dep:sea-orm"]
|
orm = ["dep:sea-orm"]
|
||||||
fetch = ["dep:reqwest"]
|
fetch = ["dep:reqwest"]
|
||||||
|
# providers
|
||||||
unstructured = ["dep:serde_json"]
|
unstructured = ["dep:serde_json"]
|
||||||
# TODO eventually also make a structured base?
|
#TODO eventually also make a structured base?
|
||||||
|
|
|
@ -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! {
|
crate::strenum! {
|
||||||
pub enum LinkType {
|
pub enum LinkType {
|
||||||
Link,
|
Link,
|
||||||
|
|
|
@ -23,6 +23,13 @@ pub trait Actor : Object {
|
||||||
fn streams(&self) -> Node<Self::Collection> { Node::Empty }
|
fn streams(&self) -> Node<Self::Collection> { Node::Empty }
|
||||||
fn endpoints(&self) -> Node<Self::Object> { Node::Empty }
|
fn endpoints(&self) -> Node<Self::Object> { Node::Empty }
|
||||||
fn public_key(&self) -> Node<Self::PublicKey> { Node::Empty }
|
fn public_key(&self) -> Node<Self::PublicKey> { Node::Empty }
|
||||||
|
|
||||||
|
#[cfg(feature = "activitypub-miscellaneous-terms")]
|
||||||
|
fn moved_to(&self) -> Node<Self::Actor> { Node::Empty }
|
||||||
|
|
||||||
|
#[cfg(feature = "activitypub-miscellaneous-terms")]
|
||||||
|
fn manually_approves_followers(&self) -> Option<bool> { None }
|
||||||
|
|
||||||
// idk about this? everyone has it but AP doesn't mention it
|
// idk about this? everyone has it but AP doesn't mention it
|
||||||
fn discoverable(&self) -> Option<bool> { None }
|
fn discoverable(&self) -> Option<bool> { None }
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ pub trait Object : Base {
|
||||||
fn media_type(&self) -> Option<&str> { None } // also in link
|
fn media_type(&self) -> Option<&str> { None } // also in link
|
||||||
fn duration(&self) -> Option<&str> { None } // TODO how to parse xsd:duration ?
|
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<bool> { None }
|
fn sensitive(&self) -> Option<bool> { None }
|
||||||
|
|
||||||
fn as_activity(&self) -> Option<&Self::Activity> { 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_media_type(self, val: Option<&str>) -> Self; // also in link
|
||||||
fn set_duration(self, val: Option<&str>) -> Self; // TODO how to parse xsd:duration ?
|
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<bool>) -> Self;
|
fn set_sensitive(self, val: Option<bool>) -> Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,6 +152,7 @@ impl Object for serde_json::Value {
|
||||||
crate::getter! { duration -> &str }
|
crate::getter! { duration -> &str }
|
||||||
crate::getter! { url -> node Self::Link }
|
crate::getter! { url -> node Self::Link }
|
||||||
|
|
||||||
|
#[cfg(feature = "activitypub-miscellaneous-terms")]
|
||||||
crate::getter! { sensitive -> bool }
|
crate::getter! { sensitive -> bool }
|
||||||
|
|
||||||
// TODO Mastodon doesn't use a "context" field on the object but makes up a new one!!
|
// 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! { url -> node Self::Link }
|
||||||
crate::setter! { context -> node <Self as Object>::Object }
|
crate::setter! { context -> node <Self as Object>::Object }
|
||||||
|
|
||||||
|
#[cfg(feature = "activitypub-miscellaneous-terms")]
|
||||||
crate::setter! { sensitive -> bool }
|
crate::setter! { sensitive -> bool }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue