From 4a7c6c69767b1d2d76509540f17fbb49db00c636 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 4 Sep 2021 17:11:48 +0100 Subject: [PATCH] Generate html for announce first --- inbox.py | 63 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/inbox.py b/inbox.py index 1fc522f93..cce871569 100644 --- a/inbox.py +++ b/inbox.py @@ -1529,6 +1529,40 @@ def _receiveAnnounce(recentPostsCache: {}, print('DEBUG: Downloading announce post ' + messageJson['actor'] + ' -> ' + messageJson['object']) domainFull = getFullDomain(domain, port) + + # generate html + pageNumber = 1 + showPublishedDateOnly = False + showIndividualPostIcons = True + manuallyApproveFollowers = \ + followerApprovalActive(baseDir, nickname, domain) + notDM = True + # if debug: + print('Generating html for announce ' + messageJson['id']) + announceHtml = \ + individualPostAsHtml(signingPrivateKeyPem, True, + recentPostsCache, maxRecentPosts, + translate, pageNumber, baseDir, + session, cachedWebfingers, personCache, + nickname, domain, port, messageJson, + None, True, allowDeletion, + httpPrefix, __version__, + 'inbox', YTReplacementDomain, + showPublishedDateOnly, + peertubeInstances, + allowLocalNetworkAccess, + themeName, systemLanguage, + maxLikeCount, notDM, + showIndividualPostIcons, + manuallyApproveFollowers, + False, True, False) + if not announceHtml: + print('WARN: Unable to generate html for announce ' + + str(messageJson)) + else: + # if debug: + print('Generated announce html ' + announceHtml.replace('\n', '')) + postJsonObject = downloadAnnounce(session, baseDir, httpPrefix, nickname, domain, @@ -1605,35 +1639,6 @@ def _receiveAnnounce(recentPostsCache: {}, time.sleep(5) if debug: print('DEBUG: announced/repeated post arrived in inbox') - - pageNumber = 1 - showPublishedDateOnly = False - showIndividualPostIcons = True - manuallyApproveFollowers = \ - followerApprovalActive(baseDir, nickname, domain) - notDM = True - #if debug: - print('Generating html for announce ' + postJsonObject['id']) - announceHtml = \ - individualPostAsHtml(signingPrivateKeyPem, True, - recentPostsCache, maxRecentPosts, - translate, pageNumber, baseDir, - session, cachedWebfingers, personCache, - nickname, domain, port, postJsonObject, - None, True, allowDeletion, - httpPrefix, __version__, - 'inbox', YTReplacementDomain, - showPublishedDateOnly, - peertubeInstances, - allowLocalNetworkAccess, - themeName, systemLanguage, - maxLikeCount, notDM, - showIndividualPostIcons, - manuallyApproveFollowers, - False, True, False) - if not announceHtml: - print('WARN: Unable to generate html for announce ' + - postJsonObject['id']) return True