mirror of https://gitlab.com/bashrc2/epicyon
Two apschema versions
parent
758747740e
commit
60b0e3fdfb
43
context.py
43
context.py
|
@ -11,6 +11,7 @@ validContexts = (
|
||||||
"https://www.w3.org/ns/activitystreams",
|
"https://www.w3.org/ns/activitystreams",
|
||||||
"https://w3id.org/identity/v1",
|
"https://w3id.org/identity/v1",
|
||||||
"https://w3id.org/security/v1",
|
"https://w3id.org/security/v1",
|
||||||
|
"*/apschema/v1.9"
|
||||||
"*/apschema/v1.21"
|
"*/apschema/v1.21"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -54,6 +55,48 @@ def hasValidContext(postJsonObject: {}) -> bool:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def getApschemaV1_9() -> {}:
|
||||||
|
# https://domain/apschema/v1.9
|
||||||
|
return {
|
||||||
|
"@context": {
|
||||||
|
"zot": "https://hub.disroot.org/apschema#",
|
||||||
|
"id": "@id",
|
||||||
|
"type": "@type",
|
||||||
|
"commentPolicy": "as:commentPolicy",
|
||||||
|
"meData": "zot:meData",
|
||||||
|
"meDataType": "zot:meDataType",
|
||||||
|
"meEncoding": "zot:meEncoding",
|
||||||
|
"meAlgorithm": "zot:meAlgorithm",
|
||||||
|
"meCreator": "zot:meCreator",
|
||||||
|
"meSignatureValue": "zot:meSignatureValue",
|
||||||
|
"locationAddress": "zot:locationAddress",
|
||||||
|
"locationPrimary": "zot:locationPrimary",
|
||||||
|
"locationDeleted": "zot:locationDeleted",
|
||||||
|
"nomadicLocation": "zot:nomadicLocation",
|
||||||
|
"nomadicHubs": "zot:nomadicHubs",
|
||||||
|
"emojiReaction": "zot:emojiReaction",
|
||||||
|
"expires": "zot:expires",
|
||||||
|
"directMessage": "zot:directMessage",
|
||||||
|
"schema": "http://schema.org#",
|
||||||
|
"PropertyValue": "schema:PropertyValue",
|
||||||
|
"value": "schema:value",
|
||||||
|
"magicEnv": {
|
||||||
|
"@id": "zot:magicEnv",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"nomadicLocations": {
|
||||||
|
"@id": "zot:nomadicLocations",
|
||||||
|
"@type": "@id"
|
||||||
|
},
|
||||||
|
"ostatus": "http://ostatus.org#",
|
||||||
|
"conversation": "ostatus:conversation",
|
||||||
|
"diaspora": "https://diasporafoundation.org/ns/",
|
||||||
|
"guid": "diaspora:guid",
|
||||||
|
"Hashtag": "as:Hashtag"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def getApschemaV1_21() -> {}:
|
def getApschemaV1_21() -> {}:
|
||||||
# https://domain/apschema/v1.21
|
# https://domain/apschema/v1.21
|
||||||
return {
|
return {
|
||||||
|
|
10
pyjsonld.py
10
pyjsonld.py
|
@ -37,6 +37,7 @@ import traceback
|
||||||
from collections import deque, namedtuple
|
from collections import deque, namedtuple
|
||||||
from numbers import Integral, Real
|
from numbers import Integral, Real
|
||||||
|
|
||||||
|
from context import getApschemaV1_9
|
||||||
from context import getApschemaV1_21
|
from context import getApschemaV1_21
|
||||||
from context import getV1Schema
|
from context import getV1Schema
|
||||||
from context import getV1SecuritySchema
|
from context import getV1SecuritySchema
|
||||||
|
@ -397,7 +398,14 @@ def load_document(url):
|
||||||
'document': getActivitystreamsSchema()
|
'document': getActivitystreamsSchema()
|
||||||
}
|
}
|
||||||
return doc
|
return doc
|
||||||
elif url == 'https://raitisoja.com/apschema/v1.21':
|
elif url.endswith('/apschema/v1.9'):
|
||||||
|
doc = {
|
||||||
|
'contextUrl': None,
|
||||||
|
'documentUrl': url,
|
||||||
|
'document': getApschemaV1_9()
|
||||||
|
}
|
||||||
|
return doc
|
||||||
|
elif url.endswith('/apschema/v1.21'):
|
||||||
doc = {
|
doc = {
|
||||||
'contextUrl': None,
|
'contextUrl': None,
|
||||||
'documentUrl': url,
|
'documentUrl': url,
|
||||||
|
|
Loading…
Reference in New Issue