From 13eada347d5902a23ae84e33a3c31af051ddf027 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 21 Jan 2021 13:17:43 +0000 Subject: [PATCH] Make actors discoverable and use the default mastodon actor context --- daemon.py | 1 + person.py | 77 ++++++++++++++++++++++++------------------------------- 2 files changed, 34 insertions(+), 44 deletions(-) diff --git a/daemon.py b/daemon.py index 1b6ccaf14..4da16e1da 100644 --- a/daemon.py +++ b/daemon.py @@ -4718,6 +4718,7 @@ class PubServer(BaseHTTPRequestHandler): 'https://w3id.org/security/v1', getDefaultPersonContext() ] + actorJson['discoverable'] = True randomizeActorImages(actorJson) saveJson(actorJson, actorFilename) webfingerUpdate(baseDir, diff --git a/person.py b/person.py index d4194e936..7f53c98b1 100644 --- a/person.py +++ b/person.py @@ -170,38 +170,33 @@ def getDefaultPersonContext() -> str: """Gets the default actor context """ return { - 'Emoji': 'toot:Emoji', - 'Hashtag': 'as:Hashtag', - 'IdentityProof': 'toot:IdentityProof', - 'PropertyValue': 'schema:PropertyValue', - 'alsoKnownAs': { - '@id': 'as:alsoKnownAs', '@type': '@id' - }, - 'focalPoint': { - '@container': '@list', '@id': 'toot:focalPoint' - }, - 'manuallyApprovesFollowers': 'as:manuallyApprovesFollowers', - 'movedTo': { - '@id': 'as:movedTo', '@type': '@id' - }, - 'schema': 'http://schema.org#', - 'value': 'schema:value', 'Curve25519Key': 'toot:Curve25519Key', 'Device': 'toot:Device', 'Ed25519Key': 'toot:Ed25519Key', 'Ed25519Signature': 'toot:Ed25519Signature', 'EncryptedMessage': 'toot:EncryptedMessage', - 'identityKey': {'@id': 'toot:identityKey', '@type': '@id'}, - 'fingerprintKey': {'@id': 'toot:fingerprintKey', '@type': '@id'}, - 'messageFranking': 'toot:messageFranking', - 'publicKeyBase64': 'toot:publicKeyBase64', + 'IdentityProof': 'toot:IdentityProof', + 'PropertyValue': 'schema:PropertyValue', + 'alsoKnownAs': {'@id': 'as:alsoKnownAs', '@type': '@id'}, + 'cipherText': 'toot:cipherText', + 'claim': {'@id': 'toot:claim', '@type': '@id'}, + 'deviceId': 'toot:deviceId', + 'devices': {'@id': 'toot:devices', '@type': '@id'}, 'discoverable': 'toot:discoverable', - 'orgSchema': 'toot:orgSchema', - 'shares': 'toot:shares', - 'skills': 'toot:skills', - 'roles': 'toot:roles', - 'availability': 'toot:availability', - 'nomadicLocations': 'toot:nomadicLocations' + 'featured': {'@id': 'toot:featured', '@type': '@id'}, + 'featuredTags': {'@id': 'toot:featuredTags', '@type': '@id'}, + 'fingerprintKey': {'@id': 'toot:fingerprintKey', '@type': '@id'}, + 'focalPoint': {'@container': '@list', '@id': 'toot:focalPoint'}, + 'identityKey': {'@id': 'toot:identityKey', '@type': '@id'}, + 'manuallyApprovesFollowers': 'as:manuallyApprovesFollowers', + 'messageFranking': 'toot:messageFranking', + 'messageType': 'toot:messageType', + 'movedTo': {'@id': 'as:movedTo', '@type': '@id'}, + 'publicKeyBase64': 'toot:publicKeyBase64', + 'schema': 'http://schema.org#', + 'suspended': 'toot:suspended', + 'toot': 'http://joinmastodon.org/ns#', + 'value': 'schema:value' } @@ -262,17 +257,18 @@ def _createPersonBase(baseDir: str, nickname: str, domain: str, port: int, 'https://w3id.org/security/v1', getDefaultPersonContext() ], - 'attachment': [], 'alsoKnownAs': [], - 'discoverable': False, + 'attachment': [], 'devices': personId + '/collections/devices', 'endpoints': { - 'id': personId+'/endpoints', - 'sharedInbox': httpPrefix+'://'+domain+'/inbox', + 'id': personId + '/endpoints', + 'sharedInbox': httpPrefix+'://' + domain + '/inbox', }, - 'followers': personId+'/followers', - 'following': personId+'/following', - 'shares': personId+'/shares', + 'featured': personId + '/collections/featured', + 'featuredTags': personId + '/collections/tags', + 'followers': personId + '/followers', + 'following': personId + '/following', + 'shares': personId + '/shares', 'orgSchema': None, 'skills': {}, 'roles': {}, @@ -290,26 +286,19 @@ def _createPersonBase(baseDir: str, nickname: str, domain: str, port: int, }, 'inbox': inboxStr, 'manuallyApprovesFollowers': approveFollowers, - 'discoverable': False, + 'discoverable': True, 'name': personName, - 'outbox': personId+'/outbox', + 'outbox': personId + '/outbox', 'preferredUsername': personName, 'summary': '', 'publicKey': { - 'id': personId+'#main-key', + 'id': personId + '#main-key', 'owner': personId, 'publicKeyPem': publicKeyPem }, 'tag': [], 'type': personType, - 'url': personUrl, - 'nomadicLocations': [{ - 'id': personId, - 'type': 'nomadicLocation', - 'locationAddress': 'acct:' + nickname + '@' + domain, - 'locationPrimary': True, - 'locationDeleted': False - }] + 'url': personUrl } if nickname == 'inbox':