Set context for outgoing actor updates

main
Bob Mottram 2021-09-30 14:28:43 +01:00
parent 84535174e7
commit ab3e3eb772
2 changed files with 77 additions and 2 deletions

View File

@ -55,6 +55,7 @@ from donate import getWebsite
from donate import setWebsite
from person import setPersonNotes
from person import getDefaultPersonContext
from person import getUpdateActorContext
from person import savePersonQrcode
from person import randomizeActorImages
from person import personUpgradeActor
@ -5819,12 +5820,12 @@ class PubServer(BaseHTTPRequestHandler):
pubStr = 'https://www.w3.org/ns/' + \
'activitystreams#Public'
pubNumber, pubDate = getStatusNumber()
pubContext = actorJson['@context'].copy()
# remove the context from the actor json and put it
# at the start of the Upgrade activity
del actorJson['@context']
updateActorContext = getUpdateActorContext()
updateActorJson = {
'@context': pubContext,
'@context': updateActorContext,
'id': actorJson['id'] + '#updates/' + pubNumber,
'type': 'Update',
'actor': actorJson['id'],

View File

@ -187,6 +187,80 @@ def randomizeActorImages(personJson: {}) -> None:
'/image' + randStr + '.' + existingExtension
def getUpdateActorContext() -> []:
"""Returns the context used on actor updates
"""
return [
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1",
{
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
"toot": "http://joinmastodon.org/ns#",
"featured":
{
"@id": "toot:featured",
"@type": "@id"
},
"featuredTags":
{
"@id": "toot:featuredTags",
"@type": "@id"
},
"alsoKnownAs":
{
"@id": "as:alsoKnownAs",
"@type": "@id"
},
"movedTo":
{
"@id": "as:movedTo",
"@type": "@id"
},
"schema": "http://schema.org#",
"PropertyValue": "schema:PropertyValue",
"value": "schema:value",
"IdentityProof": "toot:IdentityProof",
"discoverable": "toot:discoverable",
"Device": "toot:Device",
"Ed25519Signature": "toot:Ed25519Signature",
"Ed25519Key": "toot:Ed25519Key",
"Curve25519Key": "toot:Curve25519Key",
"EncryptedMessage": "toot:EncryptedMessage",
"publicKeyBase64": "toot:publicKeyBase64",
"deviceId": "toot:deviceId",
"claim":
{
"@type": "@id",
"@id": "toot:claim"
},
"fingerprintKey":
{
"@type": "@id",
"@id": "toot:fingerprintKey"
},
"identityKey":
{
"@type": "@id",
"@id": "toot:identityKey"
},
"devices":
{
"@type": "@id",
"@id": "toot:devices"
},
"messageFranking": "toot:messageFranking",
"messageType": "toot:messageType",
"cipherText": "toot:cipherText",
"suspended": "toot:suspended",
"focalPoint":
{
"@container": "@list",
"@id": "toot:focalPoint"
}
}
]
def getDefaultPersonContext() -> str:
"""Gets the default actor context
"""