chore(apb): moved jsonld under apb as feature

This commit is contained in:
əlemi 2024-05-31 21:29:51 +02:00
parent a3a1338c28
commit 78bc514012
Signed by: alemi
GPG key ID: A4895B84D311642C
4 changed files with 10 additions and 4 deletions

View file

@ -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 ostatus = [] # https://ostatus.org# , but it redirects and 403??? just need this for conversation
toot = [] # http://joinmastodon.org/ns# , mastodon is weird tho?? toot = [] # http://joinmastodon.org/ns# , mastodon is weird tho??
litepub = [] # incomplete, https://litepub.social/ litepub = [] # incomplete, https://litepub.social/
# full jsonld utilities
jsonld = []
# builtin utils # builtin utils
send = [] send = []
orm = ["dep:sea-orm"] orm = ["dep:sea-orm"]

View file

@ -1,5 +1,4 @@
use apb::Object; use crate::Object;
pub trait LD { pub trait LD {
fn ld_context(self) -> Self; 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("sensitive".to_string(), serde_json::Value::String("as:sensitive".into()));
ctx.insert("quoteUrl".to_string(), serde_json::Value::String("as:quoteUrl".into())); ctx.insert("quoteUrl".to_string(), serde_json::Value::String("as:quoteUrl".into()));
match o_type { 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("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("followingCount".to_string(), serde_json::Value::String("counters:followingCount".into()));
ctx.insert("followersCount".to_string(), serde_json::Value::String("counters:followersCount".into())); ctx.insert("followersCount".to_string(), serde_json::Value::String("counters:followersCount".into()));

View file

@ -99,6 +99,12 @@ pub mod target;
mod key; mod key;
pub use key::{PublicKey, PublicKeyMut}; pub use key::{PublicKey, PublicKeyMut};
#[cfg(feature = "jsonld")]
mod jsonld;
#[cfg(feature = "jsonld")]
pub use jsonld::LD;
mod types; mod types;
pub use types::{ pub use types::{
base::{Base, BaseMut, BaseType}, base::{Base, BaseMut, BaseType},

View file

@ -10,6 +10,5 @@ pub mod auth;
pub mod httpsign; pub mod httpsign;
pub mod normalizer; pub mod normalizer;
pub mod side_effects; pub mod side_effects;
pub mod jsonld;
pub use context::Context; pub use context::Context;