From 0ddcbdcd9667802686431ad95998f798f42c2485 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 4 Jul 2019 11:19:15 +0100 Subject: [PATCH] Include destination filename in queue items --- inbox.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/inbox.py b/inbox.py index 1916f56c..69a25789 100644 --- a/inbox.py +++ b/inbox.py @@ -65,14 +65,24 @@ def savePostToInboxQueue(baseDir: str,httpPrefix: str,keyId: str,nickname: str, currTime=datetime.datetime.utcnow() published=currTime.strftime("%Y-%m-%dT%H:%M:%SZ") + + inboxQueueDir = createInboxQueueDir(nickname,domain,baseDir) + + handle=nickname+'@'+domain + destination=baseDir+'/accounts/'+handle+'/inbox/'+postId.replace('/','#')+'.json' + if os.path.isfile(destination): + # inbox item already exists + return None + filename=inboxQueueDir+'/'+postId.replace('/','#')+'.json' + newBufferItem = { 'published': published, 'keyId': keyid, - 'post': postJson + 'post': postJson, + 'filename': filename, + 'destination': destination } - inboxQueueDir = createInboxQueueDir(nickname,domain,baseDir) - filename=inboxQueueDir+'/'+postId.replace('/','#')+'.json' with open(filename, 'w') as fp: commentjson.dump(newQueueItem, fp, indent=4, sort_keys=False) return filename