Try two ways of getting the shared inbox

alt-html-css
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 # remove the context from the actor json and put it
# at the start of the Upgrade activity # at the start of the Upgrade activity
del actorJson['@context'] del actorJson['@context']
# NOTE: there is deliberately no cc here
updateActorJson = { updateActorJson = {
'@context': pubContext, '@context': pubContext,
'id': actorJson['id'] + '#updates/' + pubNumber, 'id': actorJson['id'] + '#updates/' + pubNumber,
'type': 'Update', 'type': 'Update',
'actor': actorJson['id'], 'actor': actorJson['id'],
'to': [pubStr], 'to': [pubStr],
'cc': [actorJson['id'] + '/followers'],
'object': actorJson 'object': actorJson
} }
print('Sending actor update: ' + str(updateActorJson)) 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: def hasSharedInbox(session, httpPrefix: str, domain: str) -> bool:
"""Returns true if the given domain has a shared inbox """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, tryHandles = [
httpPrefix, {}, domain + '@' + domain,
None, __version__) 'inbox@' + domain
if wfRequest: ]
if isinstance(wfRequest, dict): for handle in tryHandles:
if not wfRequest.get('errors'): wfRequest = webfingerHandle(session, handle,
return True httpPrefix, {},
None, __version__)
if wfRequest:
if isinstance(wfRequest, dict):
if not wfRequest.get('errors'):
return True
return False return False
@ -2424,8 +2430,8 @@ def sendToFollowers(session, baseDir: str,
if debug: if debug:
if withSharedInbox: if withSharedInbox:
print(followerDomain + ' has shared inbox') print(followerDomain + ' has shared inbox')
else: if not withSharedInbox:
print(followerDomain + ' does not have a shared inbox') print(followerDomain + ' does not have a shared inbox')
toPort = port toPort = port
index = 0 index = 0