Merge branch 'main' of ssh://code.freedombone.net:2222/bashrc/epicyon into main

main
Bob Mottram 2021-03-15 10:53:46 +00:00
commit a8076601de
4 changed files with 17 additions and 7 deletions

View File

@ -1860,12 +1860,16 @@ if args.notifications:
elif args.gnunet: elif args.gnunet:
proxyType = 'gnunet' proxyType = 'gnunet'
# only store inbox posts if we are not running as a daemon
storeInboxPosts = not args.noKeyPress
runNotificationsClient(baseDir, proxyType, httpPrefix, runNotificationsClient(baseDir, proxyType, httpPrefix,
nickname, domain, port, args.password, nickname, domain, port, args.password,
args.screenreader, args.language, args.screenreader, args.language,
args.notificationSounds, args.notificationSounds,
args.notificationType, args.notificationType,
args.noKeyPress, args.noKeyPress,
storeInboxPosts,
args.debug) args.debug)
sys.exit() sys.exit()

View File

@ -2677,7 +2677,7 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
time.sleep(1) time.sleep(1)
# heartbeat to monitor whether the inbox queue is running # heartbeat to monitor whether the inbox queue is running
heartBeatCtr += 5 heartBeatCtr += 1
if heartBeatCtr >= 10: if heartBeatCtr >= 10:
# turn off broch mode after it has timed out # turn off broch mode after it has timed out
brochModeLapses(baseDir) brochModeLapses(baseDir)

View File

@ -575,6 +575,7 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
notificationSounds: bool, notificationSounds: bool,
notificationType: str, notificationType: str,
noKeyPress: bool, noKeyPress: bool,
storeInboxPosts: bool,
debug: bool) -> None: debug: bool) -> None:
"""Runs the notifications and screen reader client, """Runs the notifications and screen reader client,
which announces new inbox items which announces new inbox items
@ -766,7 +767,8 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
_storeMessage(speakerJson, 'dm') _storeMessage(speakerJson, 'dm')
else: else:
speakerJson['decrypted'] = False speakerJson['decrypted'] = False
# _storeMessage(speakerJson, 'inbox') if storeInboxPosts:
_storeMessage(speakerJson, 'inbox')
print('') print('')

View File

@ -473,24 +473,28 @@ def updateAvatarImageCache(session, baseDir: str, httpPrefix: str,
if (not os.path.isfile(avatarImageFilename) or force) and allowDownloads: if (not os.path.isfile(avatarImageFilename) or force) and allowDownloads:
try: try:
print('avatar image url: ' + avatarUrl) if debug:
print('avatar image url: ' + avatarUrl)
result = session.get(avatarUrl, result = session.get(avatarUrl,
headers=sessionHeaders, headers=sessionHeaders,
params=None) params=None)
if result.status_code < 200 or \ if result.status_code < 200 or \
result.status_code > 202: result.status_code > 202:
print('Avatar image download failed with status ' + if debug:
str(result.status_code)) print('Avatar image download failed with status ' +
str(result.status_code))
# remove partial download # remove partial download
if os.path.isfile(avatarImageFilename): if os.path.isfile(avatarImageFilename):
os.remove(avatarImageFilename) os.remove(avatarImageFilename)
else: else:
with open(avatarImageFilename, 'wb') as f: with open(avatarImageFilename, 'wb') as f:
f.write(result.content) f.write(result.content)
print('avatar image downloaded for ' + actor) if debug:
print('avatar image downloaded for ' + actor)
return avatarImageFilename.replace(baseDir + '/cache', '') return avatarImageFilename.replace(baseDir + '/cache', '')
except Exception as e: except Exception as e:
print('Failed to download avatar image: ' + str(avatarUrl)) if debug:
print('Failed to download avatar image: ' + str(avatarUrl))
print(e) print(e)
prof = 'https://www.w3.org/ns/activitystreams' prof = 'https://www.w3.org/ns/activitystreams'
if '/channel/' not in actor or '/accounts/' not in actor: if '/channel/' not in actor or '/accounts/' not in actor: