Make actors discoverable and use the default mastodon actor context

merge-requests/30/head
Bob Mottram 2021-01-21 13:17:43 +00:00
parent 372a9567c8
commit 13eada347d
2 changed files with 34 additions and 44 deletions

View File

@ -4718,6 +4718,7 @@ class PubServer(BaseHTTPRequestHandler):
'https://w3id.org/security/v1', 'https://w3id.org/security/v1',
getDefaultPersonContext() getDefaultPersonContext()
] ]
actorJson['discoverable'] = True
randomizeActorImages(actorJson) randomizeActorImages(actorJson)
saveJson(actorJson, actorFilename) saveJson(actorJson, actorFilename)
webfingerUpdate(baseDir, webfingerUpdate(baseDir,

View File

@ -170,38 +170,33 @@ def getDefaultPersonContext() -> str:
"""Gets the default actor context """Gets the default actor context
""" """
return { 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', 'Curve25519Key': 'toot:Curve25519Key',
'Device': 'toot:Device', 'Device': 'toot:Device',
'Ed25519Key': 'toot:Ed25519Key', 'Ed25519Key': 'toot:Ed25519Key',
'Ed25519Signature': 'toot:Ed25519Signature', 'Ed25519Signature': 'toot:Ed25519Signature',
'EncryptedMessage': 'toot:EncryptedMessage', 'EncryptedMessage': 'toot:EncryptedMessage',
'identityKey': {'@id': 'toot:identityKey', '@type': '@id'}, 'IdentityProof': 'toot:IdentityProof',
'fingerprintKey': {'@id': 'toot:fingerprintKey', '@type': '@id'}, 'PropertyValue': 'schema:PropertyValue',
'messageFranking': 'toot:messageFranking', 'alsoKnownAs': {'@id': 'as:alsoKnownAs', '@type': '@id'},
'publicKeyBase64': 'toot:publicKeyBase64', 'cipherText': 'toot:cipherText',
'claim': {'@id': 'toot:claim', '@type': '@id'},
'deviceId': 'toot:deviceId',
'devices': {'@id': 'toot:devices', '@type': '@id'},
'discoverable': 'toot:discoverable', 'discoverable': 'toot:discoverable',
'orgSchema': 'toot:orgSchema', 'featured': {'@id': 'toot:featured', '@type': '@id'},
'shares': 'toot:shares', 'featuredTags': {'@id': 'toot:featuredTags', '@type': '@id'},
'skills': 'toot:skills', 'fingerprintKey': {'@id': 'toot:fingerprintKey', '@type': '@id'},
'roles': 'toot:roles', 'focalPoint': {'@container': '@list', '@id': 'toot:focalPoint'},
'availability': 'toot:availability', 'identityKey': {'@id': 'toot:identityKey', '@type': '@id'},
'nomadicLocations': 'toot:nomadicLocations' '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', 'https://w3id.org/security/v1',
getDefaultPersonContext() getDefaultPersonContext()
], ],
'attachment': [],
'alsoKnownAs': [], 'alsoKnownAs': [],
'discoverable': False, 'attachment': [],
'devices': personId + '/collections/devices', 'devices': personId + '/collections/devices',
'endpoints': { 'endpoints': {
'id': personId+'/endpoints', 'id': personId + '/endpoints',
'sharedInbox': httpPrefix+'://'+domain+'/inbox', 'sharedInbox': httpPrefix+'://' + domain + '/inbox',
}, },
'followers': personId+'/followers', 'featured': personId + '/collections/featured',
'following': personId+'/following', 'featuredTags': personId + '/collections/tags',
'shares': personId+'/shares', 'followers': personId + '/followers',
'following': personId + '/following',
'shares': personId + '/shares',
'orgSchema': None, 'orgSchema': None,
'skills': {}, 'skills': {},
'roles': {}, 'roles': {},
@ -290,26 +286,19 @@ def _createPersonBase(baseDir: str, nickname: str, domain: str, port: int,
}, },
'inbox': inboxStr, 'inbox': inboxStr,
'manuallyApprovesFollowers': approveFollowers, 'manuallyApprovesFollowers': approveFollowers,
'discoverable': False, 'discoverable': True,
'name': personName, 'name': personName,
'outbox': personId+'/outbox', 'outbox': personId + '/outbox',
'preferredUsername': personName, 'preferredUsername': personName,
'summary': '', 'summary': '',
'publicKey': { 'publicKey': {
'id': personId+'#main-key', 'id': personId + '#main-key',
'owner': personId, 'owner': personId,
'publicKeyPem': publicKeyPem 'publicKeyPem': publicKeyPem
}, },
'tag': [], 'tag': [],
'type': personType, 'type': personType,
'url': personUrl, 'url': personUrl
'nomadicLocations': [{
'id': personId,
'type': 'nomadicLocation',
'locationAddress': 'acct:' + nickname + '@' + domain,
'locationPrimary': True,
'locationDeleted': False
}]
} }
if nickname == 'inbox': if nickname == 'inbox':