From 5303be3942ac0b88fa90b4dc6e099ffc9b9d70e6 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 23 Aug 2019 15:08:10 +0100 Subject: [PATCH] Setting shared inbox actor to @domain@domain --- inbox.py | 1 + posts.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/inbox.py b/inbox.py index 02cb1b67..10eff510 100644 --- a/inbox.py +++ b/inbox.py @@ -239,6 +239,7 @@ def savePostToInboxQueue(baseDir: str,httpPrefix: str, \ sharedInboxItem=False if nickname=='inbox': + nickname=originalDomain sharedInboxItem=True newQueueItem = { diff --git a/posts.py b/posts.py index ca789634..8597d333 100644 --- a/posts.py +++ b/posts.py @@ -948,6 +948,11 @@ def sendPost(projectVersion: str, \ """ withDigest=True + if toNickname=='inbox': + # shared inbox actor on @domain@domain + toNickname=toDomain + + toDomainOriginal=toDomain if toPort: if toPort!=80 and toPort!=443: if ':' not in toDomain: @@ -979,7 +984,7 @@ def sendPost(projectVersion: str, \ return 2 else: if noOfFollowersOnDomain(baseDir,handle,toDomain)>1 and sharedInbox: - inboxUrl=sharedInbox + inboxUrl=sharedInbox.replace('/inbox','/'+toDomainOriginal) if not inboxUrl: return 3 @@ -1003,7 +1008,7 @@ def sendPost(projectVersion: str, \ if toDomain not in inboxUrl: return 7 - postPath=inboxUrl.split(toDomain)[1] + postPath=inboxUrl.split(toDomain,1)[1] # convert json to string so that there are no # subsequent conversions after creating message body digest @@ -1174,6 +1179,7 @@ def sendSignedJson(postJsonObject: {},session,baseDir: str, \ toNickname=toDomain sharedInbox=True + toDomainOriginal=toDomain if toPort: if toPort!=80 and toPort!=443: if ':' not in toDomain: @@ -1208,7 +1214,7 @@ def sendSignedJson(postJsonObject: {},session,baseDir: str, \ return 2 else: if sharedInbox and sharedInboxUrl: - inboxUrl=sharedInboxUrl + inboxUrl=sharedInboxUrl.replace('/inbox','/'+toDomainOriginal) if not inboxUrl: if debug: