lemmy/crates/apub/src/context.rs

29 lines
765 B
Rust
Raw Normal View History

use activitystreams::{base::AnyBase, context, primitives::OneOrMany};
use serde_json::json;
2021-03-22 12:11:32 +00:00
use url::Url;
pub(crate) fn lemmy_context() -> OneOrMany<AnyBase> {
let context_ext = AnyBase::from_arbitrary_json(json!(
{
"sc": "http://schema.org#",
"sensitive": "as:sensitive",
"stickied": "as:stickied",
"pt": "https://join-lemmy.org#",
"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"
},
}))
.expect("parse context");
OneOrMany::from(vec![
2021-03-22 12:11:32 +00:00
AnyBase::from(context()),
context_ext,
AnyBase::from(Url::parse("https://w3id.org/security/v1").expect("parse context")),
2021-03-22 12:11:32 +00:00
])
}