diff --git a/apb/Cargo.toml b/apb/Cargo.toml index d37b0b5a..8486c178 100644 --- a/apb/Cargo.toml +++ b/apb/Cargo.toml @@ -32,6 +32,8 @@ activitypub-fe = [] # https://ns.alemi.dev/as/fe/# ostatus = [] # https://ostatus.org# , but it redirects and 403??? just need this for conversation toot = [] # http://joinmastodon.org/ns# , mastodon is weird tho?? litepub = [] # incomplete, https://litepub.social/ +# full jsonld utilities +jsonld = [] # builtin utils send = [] orm = ["dep:sea-orm"] diff --git a/upub/core/src/server/jsonld.rs b/apb/src/jsonld.rs similarity index 96% rename from upub/core/src/server/jsonld.rs rename to apb/src/jsonld.rs index 9d1c8b57..7e3012a4 100644 --- a/upub/core/src/server/jsonld.rs +++ b/apb/src/jsonld.rs @@ -1,5 +1,4 @@ -use apb::Object; - +use crate::Object; pub trait LD { fn ld_context(self) -> Self; @@ -13,7 +12,7 @@ impl LD for serde_json::Value { ctx.insert("sensitive".to_string(), serde_json::Value::String("as:sensitive".into())); ctx.insert("quoteUrl".to_string(), serde_json::Value::String("as:quoteUrl".into())); match o_type { - Some(apb::ObjectType::Actor(_)) => { + Some(crate::ObjectType::Actor(_)) => { ctx.insert("counters".to_string(), serde_json::Value::String("https://ns.alemi.dev/as/counters/#".into())); ctx.insert("followingCount".to_string(), serde_json::Value::String("counters:followingCount".into())); ctx.insert("followersCount".to_string(), serde_json::Value::String("counters:followersCount".into())); diff --git a/apb/src/lib.rs b/apb/src/lib.rs index fad080f4..00afef1b 100644 --- a/apb/src/lib.rs +++ b/apb/src/lib.rs @@ -99,6 +99,12 @@ pub mod target; mod key; pub use key::{PublicKey, PublicKeyMut}; +#[cfg(feature = "jsonld")] +mod jsonld; + +#[cfg(feature = "jsonld")] +pub use jsonld::LD; + mod types; pub use types::{ base::{Base, BaseMut, BaseType}, diff --git a/upub/core/src/server/mod.rs b/upub/core/src/server/mod.rs index 07af4454..4df38565 100644 --- a/upub/core/src/server/mod.rs +++ b/upub/core/src/server/mod.rs @@ -10,6 +10,5 @@ pub mod auth; pub mod httpsign; pub mod normalizer; pub mod side_effects; -pub mod jsonld; pub use context::Context;