mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-22 20:31:19 +00:00
Include apub context from file, so that it can be embedded in docs
This commit is contained in:
parent
252d87d332
commit
c21c142a9a
2 changed files with 22 additions and 27 deletions
19
crates/apub/assets/lemmy/context.json
Normal file
19
crates/apub/assets/lemmy/context.json
Normal file
|
@ -0,0 +1,19 @@
|
|||
[
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
{
|
||||
"stickied": "as:stickied",
|
||||
"pt": "https://join-lemmy.org#",
|
||||
"sc": "http://schema.org#",
|
||||
"matrixUserId": {
|
||||
"type": "sc:Text",
|
||||
"id": "as:alsoKnownAs"
|
||||
},
|
||||
"sensitive": "as:sensitive",
|
||||
"comments_enabled": {
|
||||
"type": "sc:Boolean",
|
||||
"id": "pt:commentsEnabled"
|
||||
},
|
||||
"moderators": "as:moderators"
|
||||
},
|
||||
"https://w3id.org/security/v1"
|
||||
]
|
|
@ -1,33 +1,9 @@
|
|||
use activitystreams::{base::AnyBase, context, primitives::OneOrMany};
|
||||
use activitystreams::{base::AnyBase, primitives::OneOrMany};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::json;
|
||||
use url::Url;
|
||||
|
||||
lazy_static! {
|
||||
static ref 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": {
|
||||
"type": "sc:Boolean",
|
||||
"id": "pt:commentsEnabled"
|
||||
},
|
||||
"moderators": "as:moderators",
|
||||
"matrixUserId": {
|
||||
"type": "sc:Text",
|
||||
"id": "as:alsoKnownAs"
|
||||
},
|
||||
}))
|
||||
.expect("parse context");
|
||||
OneOrMany::from(vec![
|
||||
AnyBase::from(context()),
|
||||
context_ext,
|
||||
AnyBase::from(Url::parse("https://w3id.org/security/v1").expect("parse context")),
|
||||
])
|
||||
};
|
||||
static ref CONTEXT: OneOrMany<AnyBase> =
|
||||
serde_json::from_str(include_str!("../assets/lemmy/context.json")).expect("parse context");
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
|
|
Loading…
Reference in a new issue