From 0056e67eb3eea148268fb33a875a30a56b318b6e Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 23 Aug 2019 20:47:03 +0100 Subject: [PATCH] Remove fields not needed by the shared inbox --- person.py | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/person.py b/person.py index ffce97441..c80d93a87 100644 --- a/person.py +++ b/person.py @@ -146,8 +146,8 @@ def createPersonBase(baseDir: str,nickname: str,domain: str,port: int, \ personType='Person' approveFollowers=False personName=nickname - inboxStr=httpPrefix+'://'+domain+'/users/'+nickname+'/inbox' personId=httpPrefix+'://'+domain+'/users/'+nickname + inboxStr=personId+'/inbox' if nickname=='inbox': # shared inbox inboxStr=httpPrefix+'://'+domain+'/actor/inbox' @@ -171,33 +171,33 @@ def createPersonBase(baseDir: str,nickname: str,domain: str,port: int, \ 'value': 'schema:value'}], 'attachment': [], 'endpoints': { - 'id': httpPrefix+'://'+domain+'/users/'+nickname+'/endpoints', + 'id': personId+'/endpoints', 'sharedInbox': httpPrefix+'://'+domain+'/inbox', }, 'capabilityAcquisitionEndpoint': httpPrefix+'://'+domain+'/caps/new', - 'followers': httpPrefix+'://'+domain+'/users/'+nickname+'/followers', - 'following': httpPrefix+'://'+domain+'/users/'+nickname+'/following', - 'shares': httpPrefix+'://'+domain+'/users/'+nickname+'/shares', + 'followers': personId+'/followers', + 'following': personId+'/following', + 'shares': personId+'/shares', 'orgSchema': None, 'skills': {}, 'roles': {}, 'availability': None, 'icon': {'mediaType': 'image/png', 'type': 'Image', - 'url': httpPrefix+'://'+domain+'/users/'+nickname+'/avatar.png'}, + 'url': personId+'/avatar.png'}, 'id': personId, 'image': {'mediaType': 'image/png', 'type': 'Image', - 'url': httpPrefix+'://'+domain+'/users/'+nickname+'/image.png'}, + 'url': personId+'/image.png'}, 'inbox': inboxStr, 'manuallyApprovesFollowers': approveFollowers, 'name': personName, - 'outbox': httpPrefix+'://'+domain+'/users/'+nickname+'/outbox', + 'outbox': personId+'/outbox', 'preferredUsername': personName, 'summary': '', 'publicKey': { - 'id': httpPrefix+'://'+domain+'/users/'+nickname+'#main-key', - 'owner': httpPrefix+'://'+domain+'/users/'+nickname, + 'id': personId+'#main-key', + 'owner': personId, 'publicKeyPem': publicKeyPem }, 'tag': [], @@ -205,6 +205,20 @@ def createPersonBase(baseDir: str,nickname: str,domain: str,port: int, \ 'url': httpPrefix+'://'+domain+'/@'+personName } + if nickname=='inbox': + # fields not needed by the shared inbox + del newPerson['outbox'] + del newPerson['icon'] + del newPerson['image'] + del newPerson['skills'] + del newPerson['shares'] + del newPerson['roles'] + del newPerson['tag'] + del newPerson['availability'] + del newPerson['followers'] + del newPerson['following'] + del newPerson['attachment'] + if saveToFile: # save person to file peopleSubdir='/accounts'