Another context, version 1.20

main
Bob Mottram 2021-08-11 14:08:37 +01:00
parent 35a6a1cad1
commit 4297931867
2 changed files with 46 additions and 0 deletions

View File

@ -14,6 +14,7 @@ validContexts = (
"https://w3id.org/security/v1", "https://w3id.org/security/v1",
"*/apschema/v1.9", "*/apschema/v1.9",
"*/apschema/v1.21", "*/apschema/v1.21",
"*/apschema/v1.20",
"*/litepub-0.1.jsonld", "*/litepub-0.1.jsonld",
"https://litepub.social/litepub/context.jsonld" "https://litepub.social/litepub/context.jsonld"
) )
@ -100,6 +101,43 @@ def getApschemaV1_9() -> {}:
} }
def getApschemaV1_20() -> {}:
# https://domain/apschema/v1.20
return {
"@context":
{
"as": "https://www.w3.org/ns/activitystreams#",
"zot": "https://zap.dog/apschema#",
"toot": "http://joinmastodon.org/ns#",
"ostatus": "http://ostatus.org#",
"schema": "http://schema.org#",
"litepub": "http://litepub.social/ns#",
"sm": "http://smithereen.software/ns#",
"conversation": "ostatus:conversation",
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
"oauthRegistrationEndpoint": "litepub:oauthRegistrationEndpoint",
"sensitive": "as:sensitive",
"movedTo": "as:movedTo",
"copiedTo": "as:copiedTo",
"alsoKnownAs": "as:alsoKnownAs",
"inheritPrivacy": "as:inheritPrivacy",
"EmojiReact": "as:EmojiReact",
"commentPolicy": "zot:commentPolicy",
"topicalCollection": "zot:topicalCollection",
"eventRepeat": "zot:eventRepeat",
"emojiReaction": "zot:emojiReaction",
"expires": "zot:expires",
"directMessage": "zot:directMessage",
"Category": "zot:Category",
"replyTo": "zot:replyTo",
"PropertyValue": "schema:PropertyValue",
"value": "schema:value",
"discoverable": "toot:discoverable",
"wall": "sm:wall"
}
}
def getApschemaV1_21() -> {}: def getApschemaV1_21() -> {}:
# https://domain/apschema/v1.21 # https://domain/apschema/v1.21
return { return {

View File

@ -39,6 +39,7 @@ from collections import deque, namedtuple
from numbers import Integral, Real from numbers import Integral, Real
from context import getApschemaV1_9 from context import getApschemaV1_9
from context import getApschemaV1_20
from context import getApschemaV1_21 from context import getApschemaV1_21
from context import getLitepubV0_1 from context import getLitepubV0_1
from context import getLitepubSocial from context import getLitepubSocial
@ -408,6 +409,13 @@ def load_document(url):
'document': getApschemaV1_9() 'document': getApschemaV1_9()
} }
return doc return doc
elif url.endswith('/apschema/v1.20'):
doc = {
'contextUrl': None,
'documentUrl': url,
'document': getApschemaV1_20()
}
return doc
elif url.endswith('/apschema/v1.21'): elif url.endswith('/apschema/v1.21'):
doc = { doc = {
'contextUrl': None, 'contextUrl': None,