From 8982a470acca4c5fba1403298cc54e4a34efada3 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 7 Oct 2020 21:03:39 +0100 Subject: [PATCH] Cached html location --- newsdaemon.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/newsdaemon.py b/newsdaemon.py index b2f4f5abd..382a130bd 100644 --- a/newsdaemon.py +++ b/newsdaemon.py @@ -53,6 +53,7 @@ def convertRSStoActivityPub(baseDir: str, httpPrefix: str, OrderedDict(sorted(newswire.items(), reverse=False)) for dateStr, item in newswireReverse.items(): + originalDateStr = dateStr # convert the date to the format used by ActivityPub dateStr = dateStr.replace(' ', 'T') dateStr = dateStr.replace('+00:00', 'Z') @@ -67,9 +68,12 @@ def convertRSStoActivityPub(baseDir: str, httpPrefix: str, if os.path.isfile(filename): # if a local post exists as html then change the link # to the local one - htmlFilename = filename.replace('.json', '.html') + htmlFilename = \ + baseDir + '/accounts/news@' + domain + \ + '/postcache/' + newPostId.replace('/', '#') + '.html' if os.path.isfile(htmlFilename): - item[1] = '/users/news/statuses/' + statusNumber + '.html' + newswire[originalDateStr][1] = \ + '/users/news/statuses/' + statusNumber + '.html' # don't create the post if it already exists continue