From 2f12c9833a770032171f3aa030a2b57e37866faf Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 14 Mar 2021 21:29:40 +0000 Subject: [PATCH 1/3] Less verbose --- webapp_utils.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/webapp_utils.py b/webapp_utils.py index eca9c1fa0..c3cbcfc56 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -473,24 +473,28 @@ def updateAvatarImageCache(session, baseDir: str, httpPrefix: str, if (not os.path.isfile(avatarImageFilename) or force) and allowDownloads: try: - print('avatar image url: ' + avatarUrl) + if debug: + print('avatar image url: ' + avatarUrl) result = session.get(avatarUrl, headers=sessionHeaders, params=None) if result.status_code < 200 or \ result.status_code > 202: - print('Avatar image download failed with status ' + - str(result.status_code)) + if debug: + print('Avatar image download failed with status ' + + str(result.status_code)) # remove partial download if os.path.isfile(avatarImageFilename): os.remove(avatarImageFilename) else: with open(avatarImageFilename, 'wb') as f: f.write(result.content) - print('avatar image downloaded for ' + actor) + if debug: + print('avatar image downloaded for ' + actor) return avatarImageFilename.replace(baseDir + '/cache', '') except Exception as e: - print('Failed to download avatar image: ' + str(avatarUrl)) + if debug: + print('Failed to download avatar image: ' + str(avatarUrl)) print(e) prof = 'https://www.w3.org/ns/activitystreams' if '/channel/' not in actor or '/accounts/' not in actor: From 08775141b08996a042db582469024bdb74278016 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 14 Mar 2021 21:37:33 +0000 Subject: [PATCH 2/3] Less frequent heartbeat --- inbox.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inbox.py b/inbox.py index bc9b1183e..e69605af7 100644 --- a/inbox.py +++ b/inbox.py @@ -2677,7 +2677,7 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int, time.sleep(1) # heartbeat to monitor whether the inbox queue is running - heartBeatCtr += 5 + heartBeatCtr += 1 if heartBeatCtr >= 10: # turn off broch mode after it has timed out brochModeLapses(baseDir) From 59b21129f2ceb553acd9f9b9a58b2f120c859006 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 15 Mar 2021 10:52:08 +0000 Subject: [PATCH 3/3] Notifier stores inbox posts if not running as a daemon --- epicyon.py | 4 ++++ notifications_client.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/epicyon.py b/epicyon.py index f88e8a30a..89b1ebb72 100644 --- a/epicyon.py +++ b/epicyon.py @@ -1860,12 +1860,16 @@ if args.notifications: elif args.gnunet: proxyType = 'gnunet' + # only store inbox posts if we are not running as a daemon + storeInboxPosts = not args.noKeyPress + runNotificationsClient(baseDir, proxyType, httpPrefix, nickname, domain, port, args.password, args.screenreader, args.language, args.notificationSounds, args.notificationType, args.noKeyPress, + storeInboxPosts, args.debug) sys.exit() diff --git a/notifications_client.py b/notifications_client.py index ef1798767..77a05b6fb 100644 --- a/notifications_client.py +++ b/notifications_client.py @@ -575,6 +575,7 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str, notificationSounds: bool, notificationType: str, noKeyPress: bool, + storeInboxPosts: bool, debug: bool) -> None: """Runs the notifications and screen reader client, which announces new inbox items @@ -766,7 +767,8 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str, _storeMessage(speakerJson, 'dm') else: speakerJson['decrypted'] = False - # _storeMessage(speakerJson, 'inbox') + if storeInboxPosts: + _storeMessage(speakerJson, 'inbox') print('')