Remove fields not needed by the shared inbox

master
Bob Mottram 2019-08-23 20:47:03 +01:00
parent fc925e7705
commit 0056e67eb3
1 changed files with 24 additions and 10 deletions

View File

@ -146,8 +146,8 @@ def createPersonBase(baseDir: str,nickname: str,domain: str,port: int, \
personType='Person' personType='Person'
approveFollowers=False approveFollowers=False
personName=nickname personName=nickname
inboxStr=httpPrefix+'://'+domain+'/users/'+nickname+'/inbox'
personId=httpPrefix+'://'+domain+'/users/'+nickname personId=httpPrefix+'://'+domain+'/users/'+nickname
inboxStr=personId+'/inbox'
if nickname=='inbox': if nickname=='inbox':
# shared inbox # shared inbox
inboxStr=httpPrefix+'://'+domain+'/actor/inbox' inboxStr=httpPrefix+'://'+domain+'/actor/inbox'
@ -171,33 +171,33 @@ def createPersonBase(baseDir: str,nickname: str,domain: str,port: int, \
'value': 'schema:value'}], 'value': 'schema:value'}],
'attachment': [], 'attachment': [],
'endpoints': { 'endpoints': {
'id': httpPrefix+'://'+domain+'/users/'+nickname+'/endpoints', 'id': personId+'/endpoints',
'sharedInbox': httpPrefix+'://'+domain+'/inbox', 'sharedInbox': httpPrefix+'://'+domain+'/inbox',
}, },
'capabilityAcquisitionEndpoint': httpPrefix+'://'+domain+'/caps/new', 'capabilityAcquisitionEndpoint': httpPrefix+'://'+domain+'/caps/new',
'followers': httpPrefix+'://'+domain+'/users/'+nickname+'/followers', 'followers': personId+'/followers',
'following': httpPrefix+'://'+domain+'/users/'+nickname+'/following', 'following': personId+'/following',
'shares': httpPrefix+'://'+domain+'/users/'+nickname+'/shares', 'shares': personId+'/shares',
'orgSchema': None, 'orgSchema': None,
'skills': {}, 'skills': {},
'roles': {}, 'roles': {},
'availability': None, 'availability': None,
'icon': {'mediaType': 'image/png', 'icon': {'mediaType': 'image/png',
'type': 'Image', 'type': 'Image',
'url': httpPrefix+'://'+domain+'/users/'+nickname+'/avatar.png'}, 'url': personId+'/avatar.png'},
'id': personId, 'id': personId,
'image': {'mediaType': 'image/png', 'image': {'mediaType': 'image/png',
'type': 'Image', 'type': 'Image',
'url': httpPrefix+'://'+domain+'/users/'+nickname+'/image.png'}, 'url': personId+'/image.png'},
'inbox': inboxStr, 'inbox': inboxStr,
'manuallyApprovesFollowers': approveFollowers, 'manuallyApprovesFollowers': approveFollowers,
'name': personName, 'name': personName,
'outbox': httpPrefix+'://'+domain+'/users/'+nickname+'/outbox', 'outbox': personId+'/outbox',
'preferredUsername': personName, 'preferredUsername': personName,
'summary': '', 'summary': '',
'publicKey': { 'publicKey': {
'id': httpPrefix+'://'+domain+'/users/'+nickname+'#main-key', 'id': personId+'#main-key',
'owner': httpPrefix+'://'+domain+'/users/'+nickname, 'owner': personId,
'publicKeyPem': publicKeyPem 'publicKeyPem': publicKeyPem
}, },
'tag': [], 'tag': [],
@ -205,6 +205,20 @@ def createPersonBase(baseDir: str,nickname: str,domain: str,port: int, \
'url': httpPrefix+'://'+domain+'/@'+personName '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: if saveToFile:
# save person to file # save person to file
peopleSubdir='/accounts' peopleSubdir='/accounts'