From a4469bd727c005d1ae5f673ebbd3c58c2dfda9ca Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 4 Oct 2020 21:21:50 +0100 Subject: [PATCH 01/20] Watchdog for updating rss feeds --- daemon.py | 14 ++++++++++++++ newswire.py | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/daemon.py b/daemon.py index dabaefb56..9d3cb6be0 100644 --- a/daemon.py +++ b/daemon.py @@ -204,6 +204,8 @@ from devices import E2EEdevicesCollection from devices import E2EEvalidDevice from devices import E2EEaddDevice from newswire import getRSSfromDict +from newswire import runNewswireWatchdog +from newswire import runNewswireDaemon import os @@ -11251,11 +11253,17 @@ def runDaemon(blogsInstance: bool, mediaInstance: bool, allowDeletion, debug, maxMentions, maxEmoji, httpd.translate, unitTest, httpd.YTReplacementDomain), daemon=True) + print('Creating scheduled post thread') httpd.thrPostSchedule = \ threadWithTrace(target=runPostSchedule, args=(baseDir, httpd, 20), daemon=True) + print('Creating newswire thread') + httpd.thrNewswireDaemon = \ + threadWithTrace(target=runNewswireDaemon, + args=(baseDir, httpd), daemon=True) + # flags used when restarting the inbox queue httpd.restartInboxQueueInProgress = False httpd.restartInboxQueue = False @@ -11272,6 +11280,12 @@ def runDaemon(blogsInstance: bool, mediaInstance: bool, threadWithTrace(target=runPostScheduleWatchdog, args=(projectVersion, httpd), daemon=True) httpd.thrWatchdogSchedule.start() + + print('Creating newswire watchdog') + httpd.thrNewswireWatchdog = \ + threadWithTrace(target=runNewswireWatchdog, + args=(projectVersion, httpd), daemon=True) + httpd.thrNewswireWatchdog.start() else: httpd.thrInboxQueue.start() httpd.thrPostSchedule.start() diff --git a/newswire.py b/newswire.py index d295b1273..3a1476e7b 100644 --- a/newswire.py +++ b/newswire.py @@ -7,6 +7,7 @@ __email__ = "bob@freedombone.net" __status__ = "Production" import os +import time import requests from socket import error as SocketError import errno @@ -175,3 +176,51 @@ def getDictFromNewswire(session, baseDir: str) -> {}: result = dict(result.items() + getRSS(session, url).items()) sortedResult = OrderedDict(sorted(result.items(), reverse=False)) return sortedResult + + +def runNewswireDaemon(baseDir: str, httpd): + """Periodically updates RSS feeds + """ + # initial sleep to allow the system to start up + time.sleep(100) + while True: + # has the session been created yet? + if not httpd.session: + print('Newswire daemon waiting for session') + time.sleep(60) + continue + + # try to update the feeds + newNewswire = None + loaded = False + try: + newNewswire = getDictFromNewswire(httpd.session, baseDir) + loaded = True + except BaseException: + print('WARN: unable to update newswire') + pass + + if loaded: + httpd.newswire = newNewswire + print('Newswire updated') + # wait a while before the next feeds update + time.sleep(1200) + else: + time.sleep(120) + + +def runNewswireWatchdog(projectVersion: str, httpd) -> None: + """This tries to keep the newswire update thread running even if it dies + """ + print('Starting newswire watchdog') + newswireOriginal = \ + httpd.thrPostSchedule.clone(runNewswireDaemon) + httpd.thrNewswireDaemon.start() + while True: + time.sleep(50) + if not httpd.thrNewswireDaemon.isAlive(): + httpd.thrNewswireDaemon.kill() + httpd.thrNewswireDaemon = \ + newswireOriginal.clone(runNewswireDaemon) + httpd.thrNewswireDaemon.start() + print('Restarting newswire daemon...') From 3771d544dad719de8cbaf00b0b187dd2b7fd613b Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 4 Oct 2020 21:38:30 +0100 Subject: [PATCH 02/20] Pass newswire as parameter to timeline generator --- daemon.py | 30 ++++++++++++++++--------- webinterface.py | 58 +++++++++++++++++++++++++++++-------------------- 2 files changed, 55 insertions(+), 33 deletions(-) diff --git a/daemon.py b/daemon.py index 9d3cb6be0..8b6686176 100644 --- a/daemon.py +++ b/daemon.py @@ -5902,7 +5902,8 @@ class PubServer(BaseHTTPRequestHandler): httpPrefix, projectVersion, self._isMinimal(nickname), - YTReplacementDomain) + YTReplacementDomain, + self.server.newswire) if GETstartTime: self._benchmarkGETtimings(GETstartTime, GETtimings, 'show status done', @@ -6008,7 +6009,8 @@ class PubServer(BaseHTTPRequestHandler): httpPrefix, self.server.projectVersion, self._isMinimal(nickname), - self.server.YTReplacementDomain) + self.server.YTReplacementDomain, + self.server.newswire) msg = msg.encode('utf-8') self._set_headers('text/html', len(msg), cookie, callingDomain) @@ -6108,7 +6110,8 @@ class PubServer(BaseHTTPRequestHandler): httpPrefix, self.server.projectVersion, self._isMinimal(nickname), - self.server.YTReplacementDomain) + self.server.YTReplacementDomain, + self.server.newswire) msg = msg.encode('utf-8') self._set_headers('text/html', len(msg), cookie, callingDomain) @@ -6208,7 +6211,8 @@ class PubServer(BaseHTTPRequestHandler): httpPrefix, self.server.projectVersion, self._isMinimal(nickname), - self.server.YTReplacementDomain) + self.server.YTReplacementDomain, + self.server.newswire) msg = msg.encode('utf-8') self._set_headers('text/html', len(msg), cookie, callingDomain) @@ -6308,7 +6312,8 @@ class PubServer(BaseHTTPRequestHandler): httpPrefix, self.server.projectVersion, self._isMinimal(nickname), - self.server.YTReplacementDomain) + self.server.YTReplacementDomain, + self.server.newswire) msg = msg.encode('utf-8') self._set_headers('text/html', len(msg), cookie, callingDomain) @@ -6383,7 +6388,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.allowDeletion, httpPrefix, self.server.projectVersion, - self.server.YTReplacementDomain) + self.server.YTReplacementDomain, + self.server.newswire) msg = msg.encode('utf-8') self._set_headers('text/html', len(msg), cookie, callingDomain) @@ -6467,7 +6473,8 @@ class PubServer(BaseHTTPRequestHandler): httpPrefix, self.server.projectVersion, self._isMinimal(nickname), - self.server.YTReplacementDomain) + self.server.YTReplacementDomain, + self.server.newswire) msg = msg.encode('utf-8') self._set_headers('text/html', len(msg), cookie, callingDomain) @@ -6570,7 +6577,8 @@ class PubServer(BaseHTTPRequestHandler): httpPrefix, self.server.projectVersion, self._isMinimal(nickname), - self.server.YTReplacementDomain) + self.server.YTReplacementDomain, + self.server.newswire) msg = msg.encode('utf-8') self._set_headers('text/html', len(msg), cookie, callingDomain) @@ -6663,7 +6671,8 @@ class PubServer(BaseHTTPRequestHandler): httpPrefix, self.server.projectVersion, self._isMinimal(nickname), - self.server.YTReplacementDomain) + self.server.YTReplacementDomain, + self.server.newswire) msg = msg.encode('utf-8') self._set_headers('text/html', len(msg), cookie, callingDomain) @@ -6748,7 +6757,8 @@ class PubServer(BaseHTTPRequestHandler): True, httpPrefix, self.server.projectVersion, - self.server.YTReplacementDomain) + self.server.YTReplacementDomain, + self.server.newswire) msg = msg.encode('utf-8') self._set_headers('text/html', len(msg), cookie, callingDomain) diff --git a/webinterface.py b/webinterface.py index a867e38c6..a5bf1c3dc 100644 --- a/webinterface.py +++ b/webinterface.py @@ -5339,7 +5339,8 @@ def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str, def getRightColumnContent(baseDir: str, nickname: str, domainFull: str, httpPrefix: str, translate: {}, - iconsDir: str, moderator: bool) -> str: + iconsDir: str, moderator: bool, + newswire: {}) -> str: """Returns html content for the right column """ htmlStr = '' @@ -5413,7 +5414,8 @@ def htmlTimeline(defaultTimeline: str, httpPrefix: str, projectVersion: str, manuallyApproveFollowers: bool, minimal: bool, - YTReplacementDomain: str) -> str: + YTReplacementDomain: str, + newswire: {}) -> str: """Show the timeline as html """ timelineStartTime = time.time() @@ -6021,7 +6023,7 @@ def htmlTimeline(defaultTimeline: str, # right column rightColumnStr = getRightColumnContent(baseDir, nickname, domainFull, httpPrefix, translate, iconsDir, - moderator) + moderator, newswire) tlStr += ' ' + \ rightColumnStr + ' \n' tlStr += ' \n' @@ -6062,7 +6064,8 @@ def htmlShares(defaultTimeline: str, nickname: str, domain: str, port: int, allowDeletion: bool, httpPrefix: str, projectVersion: str, - YTReplacementDomain: str) -> str: + YTReplacementDomain: str, + newswire: {}) -> str: """Show the shares timeline as html """ manuallyApproveFollowers = \ @@ -6074,7 +6077,7 @@ def htmlShares(defaultTimeline: str, nickname, domain, port, None, 'tlshares', allowDeletion, httpPrefix, projectVersion, manuallyApproveFollowers, - False, YTReplacementDomain) + False, YTReplacementDomain, newswire) def htmlInbox(defaultTimeline: str, @@ -6084,7 +6087,8 @@ def htmlInbox(defaultTimeline: str, nickname: str, domain: str, port: int, inboxJson: {}, allowDeletion: bool, httpPrefix: str, projectVersion: str, - minimal: bool, YTReplacementDomain: str) -> str: + minimal: bool, YTReplacementDomain: str, + newswire: {}) -> str: """Show the inbox as html """ manuallyApproveFollowers = \ @@ -6096,7 +6100,7 @@ def htmlInbox(defaultTimeline: str, nickname, domain, port, inboxJson, 'inbox', allowDeletion, httpPrefix, projectVersion, manuallyApproveFollowers, - minimal, YTReplacementDomain) + minimal, YTReplacementDomain, newswire) def htmlBookmarks(defaultTimeline: str, @@ -6106,7 +6110,8 @@ def htmlBookmarks(defaultTimeline: str, nickname: str, domain: str, port: int, bookmarksJson: {}, allowDeletion: bool, httpPrefix: str, projectVersion: str, - minimal: bool, YTReplacementDomain: str) -> str: + minimal: bool, YTReplacementDomain: str, + newswire: {}) -> str: """Show the bookmarks as html """ manuallyApproveFollowers = \ @@ -6118,7 +6123,7 @@ def htmlBookmarks(defaultTimeline: str, nickname, domain, port, bookmarksJson, 'tlbookmarks', allowDeletion, httpPrefix, projectVersion, manuallyApproveFollowers, - minimal, YTReplacementDomain) + minimal, YTReplacementDomain, newswire) def htmlEvents(defaultTimeline: str, @@ -6128,7 +6133,8 @@ def htmlEvents(defaultTimeline: str, nickname: str, domain: str, port: int, bookmarksJson: {}, allowDeletion: bool, httpPrefix: str, projectVersion: str, - minimal: bool, YTReplacementDomain: str) -> str: + minimal: bool, YTReplacementDomain: str, + newswire: {}) -> str: """Show the events as html """ manuallyApproveFollowers = \ @@ -6140,7 +6146,7 @@ def htmlEvents(defaultTimeline: str, nickname, domain, port, bookmarksJson, 'tlevents', allowDeletion, httpPrefix, projectVersion, manuallyApproveFollowers, - minimal, YTReplacementDomain) + minimal, YTReplacementDomain, newswire) def htmlInboxDMs(defaultTimeline: str, @@ -6150,7 +6156,8 @@ def htmlInboxDMs(defaultTimeline: str, nickname: str, domain: str, port: int, inboxJson: {}, allowDeletion: bool, httpPrefix: str, projectVersion: str, - minimal: bool, YTReplacementDomain: str) -> str: + minimal: bool, YTReplacementDomain: str, + newswire: {}) -> str: """Show the DM timeline as html """ return htmlTimeline(defaultTimeline, recentPostsCache, maxRecentPosts, @@ -6158,7 +6165,7 @@ def htmlInboxDMs(defaultTimeline: str, itemsPerPage, session, baseDir, wfRequest, personCache, nickname, domain, port, inboxJson, 'dm', allowDeletion, httpPrefix, projectVersion, False, minimal, - YTReplacementDomain) + YTReplacementDomain, newswire) def htmlInboxReplies(defaultTimeline: str, @@ -6168,7 +6175,8 @@ def htmlInboxReplies(defaultTimeline: str, nickname: str, domain: str, port: int, inboxJson: {}, allowDeletion: bool, httpPrefix: str, projectVersion: str, - minimal: bool, YTReplacementDomain: str) -> str: + minimal: bool, YTReplacementDomain: str, + newswire: {}) -> str: """Show the replies timeline as html """ return htmlTimeline(defaultTimeline, recentPostsCache, maxRecentPosts, @@ -6176,7 +6184,7 @@ def htmlInboxReplies(defaultTimeline: str, itemsPerPage, session, baseDir, wfRequest, personCache, nickname, domain, port, inboxJson, 'tlreplies', allowDeletion, httpPrefix, projectVersion, False, - minimal, YTReplacementDomain) + minimal, YTReplacementDomain, newswire) def htmlInboxMedia(defaultTimeline: str, @@ -6186,7 +6194,8 @@ def htmlInboxMedia(defaultTimeline: str, nickname: str, domain: str, port: int, inboxJson: {}, allowDeletion: bool, httpPrefix: str, projectVersion: str, - minimal: bool, YTReplacementDomain: str) -> str: + minimal: bool, YTReplacementDomain: str, + newswire: {}) -> str: """Show the media timeline as html """ return htmlTimeline(defaultTimeline, recentPostsCache, maxRecentPosts, @@ -6194,7 +6203,7 @@ def htmlInboxMedia(defaultTimeline: str, itemsPerPage, session, baseDir, wfRequest, personCache, nickname, domain, port, inboxJson, 'tlmedia', allowDeletion, httpPrefix, projectVersion, False, - minimal, YTReplacementDomain) + minimal, YTReplacementDomain, newswire) def htmlInboxBlogs(defaultTimeline: str, @@ -6204,7 +6213,8 @@ def htmlInboxBlogs(defaultTimeline: str, nickname: str, domain: str, port: int, inboxJson: {}, allowDeletion: bool, httpPrefix: str, projectVersion: str, - minimal: bool, YTReplacementDomain: str) -> str: + minimal: bool, YTReplacementDomain: str, + newswire: {}) -> str: """Show the blogs timeline as html """ return htmlTimeline(defaultTimeline, recentPostsCache, maxRecentPosts, @@ -6212,7 +6222,7 @@ def htmlInboxBlogs(defaultTimeline: str, itemsPerPage, session, baseDir, wfRequest, personCache, nickname, domain, port, inboxJson, 'tlblogs', allowDeletion, httpPrefix, projectVersion, False, - minimal, YTReplacementDomain) + minimal, YTReplacementDomain, newswire) def htmlModeration(defaultTimeline: str, @@ -6222,7 +6232,8 @@ def htmlModeration(defaultTimeline: str, nickname: str, domain: str, port: int, inboxJson: {}, allowDeletion: bool, httpPrefix: str, projectVersion: str, - YTReplacementDomain: str) -> str: + YTReplacementDomain: str, + newswire: {}) -> str: """Show the moderation feed as html """ return htmlTimeline(defaultTimeline, recentPostsCache, maxRecentPosts, @@ -6230,7 +6241,7 @@ def htmlModeration(defaultTimeline: str, itemsPerPage, session, baseDir, wfRequest, personCache, nickname, domain, port, inboxJson, 'moderation', allowDeletion, httpPrefix, projectVersion, True, False, - YTReplacementDomain) + YTReplacementDomain, newswire) def htmlOutbox(defaultTimeline: str, @@ -6240,7 +6251,8 @@ def htmlOutbox(defaultTimeline: str, nickname: str, domain: str, port: int, outboxJson: {}, allowDeletion: bool, httpPrefix: str, projectVersion: str, - minimal: bool, YTReplacementDomain: str) -> str: + minimal: bool, YTReplacementDomain: str, + newswire: {}) -> str: """Show the Outbox as html """ manuallyApproveFollowers = \ @@ -6251,7 +6263,7 @@ def htmlOutbox(defaultTimeline: str, nickname, domain, port, outboxJson, 'outbox', allowDeletion, httpPrefix, projectVersion, manuallyApproveFollowers, minimal, - YTReplacementDomain) + YTReplacementDomain, newswire) def htmlIndividualPost(recentPostsCache: {}, maxRecentPosts: int, From a3b87d1d619e17243b633878afd9ac4a3d316f98 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 4 Oct 2020 21:53:34 +0100 Subject: [PATCH 03/20] Display of newswire feed --- epicyon-profile.css | 7 +++++++ webinterface.py | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/epicyon-profile.css b/epicyon-profile.css index eac77ae78..9f7b32b73 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -14,11 +14,13 @@ --main-header-color-roles: #282237; --main-fg-color: #dddddd; --column-left-fg-color: #dddddd; + --column-right-fg-color: #dddddd; --main-link-color: #999; --main-link-color-hover: #bbb; --main-visited-color: #888; --border-color: #505050; --border-width: 2px; + --font-size-newswire: 18px; --font-size-header: 18px; --font-size-header-mobile: 32px; --font-color-header: #ccc; @@ -221,6 +223,11 @@ a:focus { width: 50%; } +.newswireItem { + font-size: var(--font-size-newswire); + color: var(--column-right-fg-color); +} + .new-post-text { font-size: var(--font-size2); font-family: Arial, Helvetica, sans-serif; diff --git a/webinterface.py b/webinterface.py index a5bf1c3dc..a7c5ba03f 100644 --- a/webinterface.py +++ b/webinterface.py @@ -5337,6 +5337,16 @@ def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str, return htmlStr +def htmlNewswire(newswire: str) -> str: + """Converts a newswire dict into html + """ + htmlStr = '' + for dateStr, item in newswire.items(): + htmlStr += '

' + \ + '' + item[0] + '

' + return htmlStr + + def getRightColumnContent(baseDir: str, nickname: str, domainFull: str, httpPrefix: str, translate: {}, iconsDir: str, moderator: bool, @@ -5401,6 +5411,7 @@ def getRightColumnContent(baseDir: str, nickname: str, domainFull: str, else: htmlStr += '
\n' + htmlStr += htmlNewswire(newswire) return htmlStr From ff8bdaa9cf3f8118577f6583aec32dfabc065942 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 4 Oct 2020 22:01:17 +0100 Subject: [PATCH 04/20] Debug --- daemon.py | 1 + newswire.py | 26 +++++++++++--------------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/daemon.py b/daemon.py index 8b6686176..1d574fc23 100644 --- a/daemon.py +++ b/daemon.py @@ -1069,6 +1069,7 @@ class PubServer(BaseHTTPRequestHandler): if self.path.startswith('/icons/') or \ self.path.startswith('/avatars/') or \ self.path.startswith('/favicon.ico'): + self.path.startswith('/newswire.xml'): return False # token based authenticated used by the web interface diff --git a/newswire.py b/newswire.py index 3a1476e7b..4d7b2a3a9 100644 --- a/newswire.py +++ b/newswire.py @@ -182,7 +182,7 @@ def runNewswireDaemon(baseDir: str, httpd): """Periodically updates RSS feeds """ # initial sleep to allow the system to start up - time.sleep(100) + time.sleep(70) while True: # has the session been created yet? if not httpd.session: @@ -192,21 +192,17 @@ def runNewswireDaemon(baseDir: str, httpd): # try to update the feeds newNewswire = None - loaded = False - try: - newNewswire = getDictFromNewswire(httpd.session, baseDir) - loaded = True - except BaseException: - print('WARN: unable to update newswire') - pass + # try: + newNewswire = getDictFromNewswire(httpd.session, baseDir) + # except BaseException: + # print('WARN: unable to update newswire') + # time.sleep(120) + # continue - if loaded: - httpd.newswire = newNewswire - print('Newswire updated') - # wait a while before the next feeds update - time.sleep(1200) - else: - time.sleep(120) + httpd.newswire = newNewswire + print('Newswire updated') + # wait a while before the next feeds update + time.sleep(1200) def runNewswireWatchdog(projectVersion: str, httpd) -> None: From b58298d8aaa261440e26c8e4a4fd2d82d26c43d7 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 4 Oct 2020 22:07:44 +0100 Subject: [PATCH 05/20] Fix condition --- daemon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon.py b/daemon.py index 1d574fc23..01cf419b3 100644 --- a/daemon.py +++ b/daemon.py @@ -1068,7 +1068,7 @@ class PubServer(BaseHTTPRequestHandler): if self.path.startswith('/icons/') or \ self.path.startswith('/avatars/') or \ - self.path.startswith('/favicon.ico'): + self.path.startswith('/favicon.ico') or \ self.path.startswith('/newswire.xml'): return False From 03ae084037d4d375a0b09c0fc37f7e0578ef597e Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 4 Oct 2020 22:23:33 +0100 Subject: [PATCH 06/20] Create dictionary of rss items --- newswire.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/newswire.py b/newswire.py index 4d7b2a3a9..1f43daa8d 100644 --- a/newswire.py +++ b/newswire.py @@ -173,7 +173,9 @@ def getDictFromNewswire(session, baseDir: str) -> {}: continue if url.startswith('#'): continue - result = dict(result.items() + getRSS(session, url).items()) + itemsList = getRSS(session, url) + for dateStr, item in itemsList.items(): + result[dateStr] = item sortedResult = OrderedDict(sorted(result.items(), reverse=False)) return sortedResult From 8078177a0f74fe85b6a279e4f115184732d264a6 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 4 Oct 2020 22:33:08 +0100 Subject: [PATCH 07/20] Restore exception handling for newswire update --- newswire.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/newswire.py b/newswire.py index 1f43daa8d..762eba69b 100644 --- a/newswire.py +++ b/newswire.py @@ -194,12 +194,12 @@ def runNewswireDaemon(baseDir: str, httpd): # try to update the feeds newNewswire = None - # try: - newNewswire = getDictFromNewswire(httpd.session, baseDir) - # except BaseException: - # print('WARN: unable to update newswire') - # time.sleep(120) - # continue + try: + newNewswire = getDictFromNewswire(httpd.session, baseDir) + except BaseException: + print('WARN: unable to update newswire') + time.sleep(120) + continue httpd.newswire = newNewswire print('Newswire updated') From ef2bbfa6154f6f0ad8eaa3614bcecee51ffdda9c Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 4 Oct 2020 22:37:27 +0100 Subject: [PATCH 08/20] Show newswire date --- epicyon-profile.css | 7 +++++++ webinterface.py | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/epicyon-profile.css b/epicyon-profile.css index 9f7b32b73..c6325db46 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -74,6 +74,7 @@ --column-left-header-size: 20px; --column-left-icon-size: 20%; --column-right-icon-size: 20%; + --newswire-date-color: white; } @font-face { @@ -228,6 +229,12 @@ a:focus { color: var(--column-right-fg-color); } +.newswireDate { + font-size: var(--font-size-newswire); + color: var(--newswire-date-color); + float: right; +} + .new-post-text { font-size: var(--font-size2); font-family: Arial, Helvetica, sans-serif; diff --git a/webinterface.py b/webinterface.py index a7c5ba03f..8fe8b67be 100644 --- a/webinterface.py +++ b/webinterface.py @@ -5343,7 +5343,9 @@ def htmlNewswire(newswire: str) -> str: htmlStr = '' for dateStr, item in newswire.items(): htmlStr += '

' + \ - '' + item[0] + '

' + '' + item[0] + '
' + htmlStr += '

' return htmlStr From 951577460dc571e8aca6fcbcf1709333a543279c Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 4 Oct 2020 22:44:18 +0100 Subject: [PATCH 09/20] Human readable UT --- webinterface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webinterface.py b/webinterface.py index 8fe8b67be..bdae2054c 100644 --- a/webinterface.py +++ b/webinterface.py @@ -5345,7 +5345,7 @@ def htmlNewswire(newswire: str) -> str: htmlStr += '

' + \ '' + item[0] + '
' htmlStr += '

' + htmlStr += dateStr.replace('+00:00', ' UT') + '

' return htmlStr From ece3569b2204bcf1856ed178009a84cc664bcf43 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 4 Oct 2020 22:45:46 +0100 Subject: [PATCH 10/20] Reverse order --- newswire.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newswire.py b/newswire.py index 762eba69b..9b3b9e2d2 100644 --- a/newswire.py +++ b/newswire.py @@ -176,7 +176,7 @@ def getDictFromNewswire(session, baseDir: str) -> {}: itemsList = getRSS(session, url) for dateStr, item in itemsList.items(): result[dateStr] = item - sortedResult = OrderedDict(sorted(result.items(), reverse=False)) + sortedResult = OrderedDict(sorted(result.items(), reverse=True)) return sortedResult From ffd1f6f88cd65b66f285c93884b0eece3870d021 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 4 Oct 2020 22:48:14 +0100 Subject: [PATCH 11/20] Tidier --- webinterface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webinterface.py b/webinterface.py index bdae2054c..26a5bee79 100644 --- a/webinterface.py +++ b/webinterface.py @@ -5345,7 +5345,7 @@ def htmlNewswire(newswire: str) -> str: htmlStr += '

' + \ '' + item[0] + '
' htmlStr += '

' + htmlStr += dateStr.replace('+00:00', '') + '

' return htmlStr From d49deb5faedcafb191254b455ff1cf7c83e5f849 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 4 Oct 2020 22:52:02 +0100 Subject: [PATCH 12/20] Left padding of newswire column --- epicyon-profile.css | 1 + 1 file changed, 1 insertion(+) diff --git a/epicyon-profile.css b/epicyon-profile.css index c6325db46..f0c0d3f2e 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -1021,6 +1021,7 @@ aside .toggle-inside li { .col-right { background-color: var(--column-left-color); color: var(--column-left-fg-color); + padding-left: 10px; padding-right: 30px; font-size: var(--font-size-links); width: var(--column-right-width); From a547616487c2cf1d3de15450895dd418de892924 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 4 Oct 2020 22:53:36 +0100 Subject: [PATCH 13/20] Smaller newswire font --- epicyon-profile.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epicyon-profile.css b/epicyon-profile.css index f0c0d3f2e..7b16255bf 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -20,7 +20,7 @@ --main-visited-color: #888; --border-color: #505050; --border-width: 2px; - --font-size-newswire: 18px; + --font-size-newswire: 16px; --font-size-header: 18px; --font-size-header-mobile: 32px; --font-color-header: #ccc; From 4f32cfebc80c78d5925dbad92cb3ed65c3634372 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 4 Oct 2020 22:55:09 +0100 Subject: [PATCH 14/20] Extra newline --- webinterface.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webinterface.py b/webinterface.py index 26a5bee79..c01916449 100644 --- a/webinterface.py +++ b/webinterface.py @@ -5343,9 +5343,9 @@ def htmlNewswire(newswire: str) -> str: htmlStr = '' for dateStr, item in newswire.items(): htmlStr += '

' + \ - '' + item[0] + '
' - htmlStr += '

' + '' + item[0] + '' + htmlStr += '


' return htmlStr From fed52f148b3f18948e07d1f720f2fb9e45b23f56 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 4 Oct 2020 22:57:22 +0100 Subject: [PATCH 15/20] Newswire line spacing --- epicyon-profile.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/epicyon-profile.css b/epicyon-profile.css index 7b16255bf..fc8c5d8aa 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -66,6 +66,7 @@ --quote-font-weight: normal; --quote-font-size: 120%; --line-spacing: 130%; + --line-spacing-newswire: 100%; --column-left-width: 10vw; --column-center-width: 80vw; --column-right-width: 10vw; @@ -227,6 +228,7 @@ a:focus { .newswireItem { font-size: var(--font-size-newswire); color: var(--column-right-fg-color); + line-height: var(--line-spacing-newswire); } .newswireDate { From a9386ead07022f95be4dcc18bc48cd18fc538336 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 4 Oct 2020 23:00:29 +0100 Subject: [PATCH 16/20] No extra newline --- webinterface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webinterface.py b/webinterface.py index c01916449..b381ae3af 100644 --- a/webinterface.py +++ b/webinterface.py @@ -5345,7 +5345,7 @@ def htmlNewswire(newswire: str) -> str: htmlStr += '

' + \ '' + item[0] + '' htmlStr += '


' + htmlStr += dateStr.replace('+00:00', '') + '

' return htmlStr From 6826030e3e40e01fdf0a59bcdeb8e5d07110f619 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 4 Oct 2020 23:04:57 +0100 Subject: [PATCH 17/20] Newswire font size --- epicyon-profile.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epicyon-profile.css b/epicyon-profile.css index fc8c5d8aa..ebf9d99a4 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -20,12 +20,12 @@ --main-visited-color: #888; --border-color: #505050; --border-width: 2px; - --font-size-newswire: 16px; --font-size-header: 18px; --font-size-header-mobile: 32px; --font-color-header: #ccc; --font-size-button-mobile: 34px; --font-size-links: 18px; + --font-size-newswire: 18px; --font-size: 30px; --font-size2: 24px; --font-size3: 38px; From 602714906a7bca2cafab085cf213181559950d42 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 4 Oct 2020 23:08:13 +0100 Subject: [PATCH 18/20] Date format --- newswire.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/newswire.py b/newswire.py index 9b3b9e2d2..5324f2e20 100644 --- a/newswire.py +++ b/newswire.py @@ -145,10 +145,14 @@ def getRSSfromDict(baseDir: str, newswire: {}, None, domainFull, 'Newswire', translate) for published, fields in newswire.items(): + try: + pubDate = datetime.strptime(published, "%Y-%m-%dT%H:%M:%S+00:00") + except BaseException: + continue rssStr += '\n' rssStr += ' ' + fields[0] + '\n' rssStr += ' ' + fields[1] + '\n' - pubDate = datetime.strptime(published, "%Y-%m-%dT%H:%M:%SZ") + rssDateStr = pubDate.strftime("%a, %d %b %Y %H:%M:%S UT") rssStr += ' ' + rssDateStr + '\n' rssStr += '\n' From a5291d41060194b56c694768bbf10306b7f61bd7 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 4 Oct 2020 23:12:27 +0100 Subject: [PATCH 19/20] Date format --- newswire.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/newswire.py b/newswire.py index 5324f2e20..ec0ba834f 100644 --- a/newswire.py +++ b/newswire.py @@ -145,14 +145,15 @@ def getRSSfromDict(baseDir: str, newswire: {}, None, domainFull, 'Newswire', translate) for published, fields in newswire.items(): + published = published.replace('+00:00', 'Z') try: - pubDate = datetime.strptime(published, "%Y-%m-%dT%H:%M:%S+00:00") + pubDate = datetime.strptime(published, "%Y-%m-%dT%H:%M:%SZ") except BaseException: continue rssStr += '\n' rssStr += ' ' + fields[0] + '\n' rssStr += ' ' + fields[1] + '\n' - + rssDateStr = pubDate.strftime("%a, %d %b %Y %H:%M:%S UT") rssStr += ' ' + rssDateStr + '\n' rssStr += '\n' From aa1e481b1095d377d60ce3a4321062cb595fcc2a Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 4 Oct 2020 23:16:00 +0100 Subject: [PATCH 20/20] Date format --- newswire.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/newswire.py b/newswire.py index ec0ba834f..111ad6bf7 100644 --- a/newswire.py +++ b/newswire.py @@ -145,7 +145,8 @@ def getRSSfromDict(baseDir: str, newswire: {}, None, domainFull, 'Newswire', translate) for published, fields in newswire.items(): - published = published.replace('+00:00', 'Z') + published = published.replace('+00:00', 'Z').strip() + published = published.replace(' ', 'T') try: pubDate = datetime.strptime(published, "%Y-%m-%dT%H:%M:%SZ") except BaseException: