lemmy/crates/apub/src/extensions/context.rs

29 lines
722 B
Rust
Raw Normal View History

use activitystreams::{base::AnyBase, context};
use lemmy_utils::LemmyError;
use serde_json::json;
2021-03-22 12:11:32 +00:00
use url::Url;
pub(crate) fn lemmy_context() -> Result<Vec<AnyBase>, LemmyError> {
let context_ext = AnyBase::from_arbitrary_json(json!(
{
"sc": "http://schema.org#",
"sensitive": "as:sensitive",
"stickied": "as:stickied",
2021-03-21 01:03:53 +00:00
"pt": "https://join.lemmy.ml#",
"comments_enabled": {
2021-03-21 01:00:32 +00:00
"type": "sc:Boolean",
"id": "pt:commentsEnabled"
},
2021-03-24 16:43:18 +00:00
"moderators": "as:moderators",
"matrixUserId": {
"type": "sc:Text",
"id": "as:alsoKnownAs"
},
}))?;
2021-03-22 12:11:32 +00:00
Ok(vec![
AnyBase::from(context()),
context_ext,
AnyBase::from(Url::parse("https://w3id.org/security/v1")?),
])
}