diff --git a/announce.py b/announce.py index f3e8419e6..e8b15990e 100644 --- a/announce.py +++ b/announce.py @@ -498,7 +498,7 @@ def sendAnnounceViaServer(baseDir: str,session, \ # get the actor inbox for the To handle inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,displayName = \ getPersonBox(baseDir,session,wfRequest,personCache, \ - projectVersion,httpPrefix,fromDomain,postToBox) + projectVersion,httpPrefix,fromNickname,fromDomain,postToBox) if not inboxUrl: if debug: diff --git a/availability.py b/availability.py index e3a25b444..68dee85a9 100644 --- a/availability.py +++ b/availability.py @@ -142,7 +142,7 @@ def sendAvailabilityViaServer(baseDir: str,session, \ # get the actor inbox for the To handle inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,displayName = \ getPersonBox(baseDir,session,wfRequest,personCache, \ - projectVersion,httpPrefix,domain,postToBox) + projectVersion,httpPrefix,nickname,domain,postToBox) if not inboxUrl: if debug: diff --git a/blocking.py b/blocking.py index fa6073aee..ebca4cea1 100644 --- a/blocking.py +++ b/blocking.py @@ -196,7 +196,8 @@ def sendBlockViaServer(baseDir: str,session, \ # get the actor inbox for the To handle inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,displayName = \ getPersonBox(baseDir,session,wfRequest,personCache, \ - projectVersion,httpPrefix,fromDomain,postToBox) + projectVersion,httpPrefix,fromNickname, \ + fromDomain,postToBox) if not inboxUrl: if debug: @@ -274,7 +275,8 @@ def sendUndoBlockViaServer(baseDir: str,session, \ # get the actor inbox for the To handle inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,displayName = \ getPersonBox(baseDir,session,wfRequest,personCache, \ - projectVersion,httpPrefix,fromDomain,postToBox) + projectVersion,httpPrefix,fromNickname, \ + fromDomain,postToBox) if not inboxUrl: if debug: diff --git a/delete.py b/delete.py index 775255015..74dd74870 100644 --- a/delete.py +++ b/delete.py @@ -127,7 +127,8 @@ def sendDeleteViaServer(baseDir: str,session, \ # get the actor inbox for the To handle inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,displayName = \ getPersonBox(baseDir,session,wfRequest,personCache, \ - projectVersion,httpPrefix,fromDomain,postToBox) + projectVersion,httpPrefix,fromNickname, \ + fromDomain,postToBox) if not inboxUrl: if debug: diff --git a/follow.py b/follow.py index 758724373..8bc9f696f 100644 --- a/follow.py +++ b/follow.py @@ -718,7 +718,8 @@ def sendFollowRequestViaServer(baseDir: str,session, \ # get the actor inbox for the To handle inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,displayName = \ getPersonBox(baseDir,session,wfRequest,personCache, \ - projectVersion,httpPrefix,fromDomain,postToBox) + projectVersion,httpPrefix,fromNickname, \ + fromDomain,postToBox) if not inboxUrl: if debug: @@ -802,7 +803,8 @@ def sendUnfollowRequestViaServer(baseDir: str,session, \ # get the actor inbox for the To handle inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,displayName = \ getPersonBox(baseDir,session,wfRequest,personCache, \ - projectVersion,httpPrefix,fromDomain,postToBox) + projectVersion,httpPrefix,fromNickname, \ + fromDomain,postToBox) if not inboxUrl: if debug: diff --git a/like.py b/like.py index 3835100ff..9bd14e9d2 100644 --- a/like.py +++ b/like.py @@ -407,7 +407,8 @@ def sendLikeViaServer(baseDir: str,session, \ # get the actor inbox for the To handle inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,displayName = \ getPersonBox(baseDir,session,wfRequest,personCache, \ - projectVersion,httpPrefix,fromDomain,postToBox) + projectVersion,httpPrefix,fromNickname, \ + fromDomain,postToBox) if not inboxUrl: if debug: @@ -485,7 +486,8 @@ def sendUndoLikeViaServer(baseDir: str,session, \ # get the actor inbox for the To handle inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,displayName = \ getPersonBox(baseDir,session,wfRequest,personCache, \ - projectVersion,httpPrefix,fromDomain,postToBox) + projectVersion,httpPrefix,fromNickname, \ + fromDomain,postToBox) if not inboxUrl: if debug: diff --git a/posts.py b/posts.py index f82f17448..5a32bc2b1 100644 --- a/posts.py +++ b/posts.py @@ -156,10 +156,14 @@ def parseUserFeed(session,feedUrl: str,asHeader: {}, \ yield item def getPersonBox(baseDir: str,session,wfRequest: {},personCache: {}, \ - projectVersion: str,httpPrefix: str,domain: str, \ + projectVersion: str,httpPrefix: str, \ + nickname: str,domain: str, \ boxName='inbox') -> (str,str,str,str,str,str,str,str): asHeader = {'Accept': 'application/activity+json; profile="https://www.w3.org/ns/activitystreams"'} - personUrl = getUserUrl(wfRequest) + if not wfRequest.get('errors'): + personUrl = getUserUrl(wfRequest) + else: + personUrl = httpPrefix+'://'+domain+'/users/'+nickname if not personUrl: return None,None,None,None,None,None,None,None personJson = getPersonFromCache(baseDir,personUrl,personCache) @@ -1084,7 +1088,8 @@ def sendPost(projectVersion: str, \ # get the actor inbox for the To handle inboxUrl,pubKeyId,pubKey,toPersonId,sharedInbox,capabilityAcquisition,avatarUrl,displayName = \ getPersonBox(baseDir,session,wfRequest,personCache, \ - projectVersion,httpPrefix,domain,postToBox) + projectVersion,httpPrefix, \ + nickname,domain,postToBox) # If there are more than one followers on the target domain # then send to the shared inbox indead of the individual inbox @@ -1182,7 +1187,8 @@ def sendPostViaServer(projectVersion: str, \ # get the actor inbox for the To handle inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,displayName = \ getPersonBox(baseDir,session,wfRequest,personCache, \ - projectVersion,httpPrefix,fromDomain,postToBox) + projectVersion,httpPrefix,fromNickname, \ + fromDomain,postToBox) if not inboxUrl: if debug: @@ -1356,7 +1362,7 @@ def sendSignedJson(postJsonObject: {},session,baseDir: str, \ # get the actor inbox/outbox/capabilities for the To handle inboxUrl,pubKeyId,pubKey,toPersonId,sharedInboxUrl,capabilityAcquisition,avatarUrl,displayName = \ getPersonBox(baseDir,session,wfRequest,personCache, \ - projectVersion,httpPrefix,domain,postToBox) + projectVersion,httpPrefix,nickname,domain,postToBox) if nickname=='capabilities': inboxUrl=capabilityAcquisition @@ -2222,7 +2228,7 @@ def getPublicPostsOfPerson(baseDir: str,nickname: str,domain: str, \ personUrl,pubKeyId,pubKey,personId,shaedInbox,capabilityAcquisition,avatarUrl,displayName= \ getPersonBox(baseDir,session,wfRequest,personCache, \ - projectVersion,httpPrefix,domain,'outbox') + projectVersion,httpPrefix,nickname,domain,'outbox') wfResult = json.dumps(wfRequest, indent=4, sort_keys=False) maxMentions=10 diff --git a/roles.py b/roles.py index 8ee6615b7..68f59aec6 100644 --- a/roles.py +++ b/roles.py @@ -315,7 +315,8 @@ def sendRoleViaServer(baseDir: str,session, \ # get the actor inbox for the To handle inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,displayName = \ getPersonBox(baseDir,session,wfRequest,personCache, \ - projectVersion,httpPrefix,delegatorDomain,postToBox) + projectVersion,httpPrefix, \ + delegatorNickname,delegatorDomain,postToBox) if not inboxUrl: if debug: diff --git a/shares.py b/shares.py index f99ad0730..11a970cf8 100644 --- a/shares.py +++ b/shares.py @@ -411,7 +411,8 @@ def sendShareViaServer(baseDir,session, \ # get the actor inbox for the To handle inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,displayName = \ getPersonBox(baseDir,session,wfRequest,personCache, \ - projectVersion,httpPrefix,fromDomain,postToBox) + projectVersion,httpPrefix, \ + fromNickname,fromDomain,postToBox) if not inboxUrl: if debug: @@ -497,7 +498,8 @@ def sendUndoShareViaServer(baseDir: str,session, \ # get the actor inbox for the To handle inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,displayName = \ getPersonBox(baseDir,session,wfRequest,personCache, \ - projectVersion,httpPrefix,fromDomain,postToBox) + projectVersion,httpPrefix, \ + fromNickname,fromDomain,postToBox) if not inboxUrl: if debug: diff --git a/skills.py b/skills.py index 0128d9f0b..aac9cf44f 100644 --- a/skills.py +++ b/skills.py @@ -186,7 +186,7 @@ def sendSkillViaServer(baseDir: str,session,nickname: str,password: str, # get the actor inbox for the To handle inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl,displayName = \ getPersonBox(baseDir,session,wfRequest,personCache, \ - projectVersion,httpPrefix,domain,postToBox) + projectVersion,httpPrefix,nickname,domain,postToBox) if not inboxUrl: if debug: diff --git a/webinterface.py b/webinterface.py index 2cc5af746..050cfbfba 100644 --- a/webinterface.py +++ b/webinterface.py @@ -1399,7 +1399,7 @@ def individualFollowAsHtml(translate: {}, \ if domain not in followUrl: inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl2,displayName = \ getPersonBox(baseDir,session,wfRequest,personCache, \ - projectVersion,httpPrefix,domain,'outbox') + projectVersion,httpPrefix,nickname,domain,'outbox') if avatarUrl2: avatarUrl=avatarUrl2 if displayName: @@ -1936,7 +1936,7 @@ def individualPostAsHtml(iconsDir: str,translate: {}, \ if fullDomain not in postJsonObject['actor']: inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl2,displayName = \ getPersonBox(baseDir,session,wfRequest,personCache, \ - projectVersion,httpPrefix,domain,'outbox') + projectVersion,httpPrefix,nickname,domain,'outbox') if avatarUrl2: avatarUrl=avatarUrl2 if displayName: