Try two ways of getting the shared inbox

merge-requests/30/head
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,8 +2342,14 @@ 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 = [
domain + '@' + domain,
'inbox@' + domain
]
for handle in tryHandles:
wfRequest = webfingerHandle(session, handle,
httpPrefix, {}, httpPrefix, {},
None, __version__) None, __version__)
if wfRequest: if wfRequest:
@ -2424,7 +2430,7 @@ 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