mirror of https://gitlab.com/bashrc2/epicyon
Add litepub schema
parent
60b0e3fdfb
commit
eeb8fba1f0
50
context.py
50
context.py
|
@ -11,8 +11,9 @@ validContexts = (
|
|||
"https://www.w3.org/ns/activitystreams",
|
||||
"https://w3id.org/identity/v1",
|
||||
"https://w3id.org/security/v1",
|
||||
"*/apschema/v1.9"
|
||||
"*/apschema/v1.21"
|
||||
"*/apschema/v1.9",
|
||||
"*/apschema/v1.21",
|
||||
"*/litepub-0.1.jsonld"
|
||||
)
|
||||
|
||||
|
||||
|
@ -128,6 +129,51 @@ def getApschemaV1_21() -> {}:
|
|||
}
|
||||
|
||||
|
||||
def getLitepubV0_1() -> {}:
|
||||
# https://domain/schemas/litepub-0.1.jsonld
|
||||
return {
|
||||
"@context": [
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
"https://w3id.org/security/v1",
|
||||
{
|
||||
"Emoji": "toot:Emoji",
|
||||
"Hashtag": "as:Hashtag",
|
||||
"PropertyValue": "schema:PropertyValue",
|
||||
"atomUri": "ostatus:atomUri",
|
||||
"conversation": {
|
||||
"@id": "ostatus:conversation",
|
||||
"@type": "@id"
|
||||
},
|
||||
"discoverable": "toot:discoverable",
|
||||
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
||||
"capabilities": "litepub:capabilities",
|
||||
"ostatus": "http://ostatus.org#",
|
||||
"schema": "http://schema.org#",
|
||||
"toot": "http://joinmastodon.org/ns#",
|
||||
"value": "schema:value",
|
||||
"sensitive": "as:sensitive",
|
||||
"litepub": "http://litepub.social/ns#",
|
||||
"invisible": "litepub:invisible",
|
||||
"directMessage": "litepub:directMessage",
|
||||
"listMessage": {
|
||||
"@id": "litepub:listMessage",
|
||||
"@type": "@id"
|
||||
},
|
||||
"oauthRegistrationEndpoint": {
|
||||
"@id": "litepub:oauthRegistrationEndpoint",
|
||||
"@type": "@id"
|
||||
},
|
||||
"EmojiReact": "litepub:EmojiReact",
|
||||
"ChatMessage": "litepub:ChatMessage",
|
||||
"alsoKnownAs": {
|
||||
"@id": "as:alsoKnownAs",
|
||||
"@type": "@id"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
def getV1SecuritySchema() -> {}:
|
||||
# https://w3id.org/security/v1
|
||||
return {
|
||||
|
|
|
@ -39,6 +39,7 @@ from numbers import Integral, Real
|
|||
|
||||
from context import getApschemaV1_9
|
||||
from context import getApschemaV1_21
|
||||
from context import getLitepubV0_1
|
||||
from context import getV1Schema
|
||||
from context import getV1SecuritySchema
|
||||
from context import getActivitystreamsSchema
|
||||
|
@ -412,6 +413,13 @@ def load_document(url):
|
|||
'document': getApschemaV1_21()
|
||||
}
|
||||
return doc
|
||||
elif url.endswith('/litepub-0.1.jsonld'):
|
||||
doc = {
|
||||
'contextUrl': None,
|
||||
'documentUrl': url,
|
||||
'document': getLitepubV0_1()
|
||||
}
|
||||
return doc
|
||||
return None
|
||||
except JsonLdError as e:
|
||||
raise e
|
||||
|
|
Loading…
Reference in New Issue