Getting actor if webfinger fails

main2
Bob Mottram 2019-10-17 16:55:05 +01:00
parent dd82f0b7c3
commit da58015e20
11 changed files with 37 additions and 21 deletions

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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: