Try two ways of getting the shared inbox

main
Bob Mottram 2020-12-18 11:05:31 +00:00
parent a15b2be343
commit d8d6751c2f
2 changed files with 16 additions and 10 deletions

View File

@ -4543,13 +4543,13 @@ class PubServer(BaseHTTPRequestHandler):
# remove the context from the actor json and put it
# at the start of the Upgrade activity
del actorJson['@context']
# NOTE: there is deliberately no cc here
updateActorJson = {
'@context': pubContext,
'id': actorJson['id'] + '#updates/' + pubNumber,
'type': 'Update',
'actor': actorJson['id'],
'to': [pubStr],
'cc': [actorJson['id'] + '/followers'],
'object': actorJson
}
print('Sending actor update: ' + str(updateActorJson))

View File

@ -2342,14 +2342,20 @@ def sendToNamedAddresses(session, baseDir: str,
def hasSharedInbox(session, httpPrefix: str, domain: str) -> bool:
"""Returns true if the given domain has a shared inbox
This tries the new and the old way of webfingering the shared inbox
"""
wfRequest = webfingerHandle(session, domain + '@' + domain,
httpPrefix, {},
None, __version__)
if wfRequest:
if isinstance(wfRequest, dict):
if not wfRequest.get('errors'):
return True
tryHandles = [
domain + '@' + domain,
'inbox@' + domain
]
for handle in tryHandles:
wfRequest = webfingerHandle(session, handle,
httpPrefix, {},
None, __version__)
if wfRequest:
if isinstance(wfRequest, dict):
if not wfRequest.get('errors'):
return True
return False
@ -2424,8 +2430,8 @@ def sendToFollowers(session, baseDir: str,
if debug:
if withSharedInbox:
print(followerDomain + ' has shared inbox')
else:
print(followerDomain + ' does not have a shared inbox')
if not withSharedInbox:
print(followerDomain + ' does not have a shared inbox')
toPort = port
index = 0