From d8d6751c2f68e79a2b7038f9fa13480a4b1967c0 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 18 Dec 2020 11:05:31 +0000 Subject: [PATCH] Try two ways of getting the shared inbox --- daemon.py | 2 +- posts.py | 24 +++++++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/daemon.py b/daemon.py index 6c76b5a2e..321a313c6 100644 --- a/daemon.py +++ b/daemon.py @@ -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)) diff --git a/posts.py b/posts.py index 8338cd023..705de387a 100644 --- a/posts.py +++ b/posts.py @@ -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