mirror of https://gitlab.com/bashrc2/epicyon
Litepub social context
parent
c22c6cc91a
commit
98a1d70565
30
context.py
30
context.py
|
@ -13,7 +13,8 @@ validContexts = (
|
||||||
"https://w3id.org/security/v1",
|
"https://w3id.org/security/v1",
|
||||||
"*/apschema/v1.9",
|
"*/apschema/v1.9",
|
||||||
"*/apschema/v1.21",
|
"*/apschema/v1.21",
|
||||||
"*/litepub-0.1.jsonld"
|
"*/litepub-0.1.jsonld",
|
||||||
|
"https://litepub.social/litepub/context.jsonld"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -129,6 +130,33 @@ def getApschemaV1_21() -> {}:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def getLitepubSocial() -> {}:
|
||||||
|
# https://litepub.social/litepub/context.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'
|
||||||
|
},
|
||||||
|
'manuallyApprovesFollowers': 'as:manuallyApprovesFollowers',
|
||||||
|
'ostatus': 'http://ostatus.org#',
|
||||||
|
'schema': 'http://schema.org',
|
||||||
|
'sensitive': 'as:sensitive',
|
||||||
|
'toot': 'http://joinmastodon.org/ns#',
|
||||||
|
'totalItems': 'as:totalItems',
|
||||||
|
'value': 'schema:value'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def getLitepubV0_1() -> {}:
|
def getLitepubV0_1() -> {}:
|
||||||
# https://domain/schemas/litepub-0.1.jsonld
|
# https://domain/schemas/litepub-0.1.jsonld
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -40,6 +40,7 @@ from numbers import Integral, Real
|
||||||
from context import getApschemaV1_9
|
from context import getApschemaV1_9
|
||||||
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 getV1Schema
|
from context import getV1Schema
|
||||||
from context import getV1SecuritySchema
|
from context import getV1SecuritySchema
|
||||||
from context import getActivitystreamsSchema
|
from context import getActivitystreamsSchema
|
||||||
|
@ -420,6 +421,13 @@ def load_document(url):
|
||||||
'document': getLitepubV0_1()
|
'document': getLitepubV0_1()
|
||||||
}
|
}
|
||||||
return doc
|
return doc
|
||||||
|
elif url == 'https://litepub.social/litepub/context.jsonld':
|
||||||
|
doc = {
|
||||||
|
'contextUrl': None,
|
||||||
|
'documentUrl': url,
|
||||||
|
'document': getLitepubSocial()
|
||||||
|
}
|
||||||
|
return doc
|
||||||
return None
|
return None
|
||||||
except JsonLdError as e:
|
except JsonLdError as e:
|
||||||
raise e
|
raise e
|
||||||
|
|
Loading…
Reference in New Issue