diff --git a/daemon.py b/daemon.py index eeb62240a..24efff0ea 100644 --- a/daemon.py +++ b/daemon.py @@ -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'], diff --git a/person.py b/person.py index bf84b4c75..b9969dd89 100644 --- a/person.py +++ b/person.py @@ -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 """