diff --git a/daemon.py b/daemon.py index 1553440e6..b21e3322d 100644 --- a/daemon.py +++ b/daemon.py @@ -2237,8 +2237,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.cachedWebfingers, self.server.personCache, debug, - self.server.projectVersion, - self.server.allowNewsFollowers) + self.server.projectVersion) if callingDomain.endswith('.onion') and onionDomain: originPathStr = 'http://' + onionDomain + usersPath elif (callingDomain.endswith('.i2p') and i2pDomain): @@ -13364,7 +13363,6 @@ def runDaemon(sendThreadsTimeoutMins: int, fullWidthTimelineButtonHeader: bool, showPublishAsIcon: bool, maxFollowers: int, - allowNewsFollowers: bool, maxNewsPosts: int, maxMirroredArticles: int, maxNewswireFeedSizeKb: int, @@ -13515,9 +13513,6 @@ def runDaemon(sendThreadsTimeoutMins: int, # maximum number of posts in the news timeline/outbox httpd.maxNewsPosts = maxNewsPosts - # whether or not to allow followers of the news account - httpd.allowNewsFollowers = allowNewsFollowers - # The maximum number of tags per post which can be # attached to RSS feeds pulled in via the newswire httpd.maxTags = 32 @@ -13704,7 +13699,6 @@ def runDaemon(sendThreadsTimeoutMins: int, httpd.translate, unitTest, httpd.YTReplacementDomain, httpd.showPublishedDateOnly, - httpd.allowNewsFollowers, httpd.maxFollowers, httpd.allowLocalNetworkAccess, httpd.peertubeInstances), daemon=True) diff --git a/epicyon-profile.css b/epicyon-profile.css index 840b54b9c..b3184c4c4 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -999,11 +999,17 @@ div.container { color: var(--column-right-fg-color); line-height: var(--line-spacing-newswire); } + .newswireItem img { + width: 20px; + } .newswireItemModerated { font-size: var(--font-size-newswire); color: var(--newswire-item-moderated-color); line-height: var(--line-spacing-newswire); } + .newswireItemModerated img { + width: 20px; + } .newswireDateModerated { font-size: var(--font-size-newswire); font-weight: bold; @@ -1019,6 +1025,9 @@ div.container { color: var(--column-right-fg-color-voted-on); line-height: var(--line-spacing-newswire); } + .newswireItemVotedOn img { + width: 20px; + } .newswireDate { font-size: var(--font-size-newswire); color: var(--newswire-date-color); @@ -1685,11 +1694,17 @@ div.container { color: var(--column-right-fg-color); line-height: var(--line-spacing-newswire); } + .newswireItem img { + width: 40px; + } .newswireItemModerated { font-size: var(--font-size-newswire-mobile); color: var(--newswire-item-moderated-color); line-height: var(--line-spacing-newswire); } + .newswireItemModerated img { + width: 40px; + } .newswireDateModerated { font-size: var(--font-size-newswire-mobile); font-weight: bold; @@ -1705,6 +1720,9 @@ div.container { color: var(--column-right-fg-color-voted-on); line-height: var(--line-spacing-newswire); } + .newswireItemVotedOn img { + width: 40px; + } .newswireDate { font-size: var(--font-size-newswire-mobile); color: var(--newswire-date-color); diff --git a/epicyon.py b/epicyon.py index 3c111e4bf..a8d25be4b 100644 --- a/epicyon.py +++ b/epicyon.py @@ -243,11 +243,6 @@ parser.add_argument("--fullWidthTimelineButtonHeader", help="Whether to show the timeline " + "button header containing inbox and outbox " + "as the full width of the screen") -parser.add_argument("--allowNewsFollowers", - dest='allowNewsFollowers', - type=str2bool, nargs='?', - const=True, default=False, - help="Whether to allow the news account to be followed") parser.add_argument("--iconsAsButtons", dest='iconsAsButtons', type=str2bool, nargs='?', @@ -2095,11 +2090,6 @@ sendThreadsTimeoutMins = \ if sendThreadsTimeoutMins is not None: args.sendThreadsTimeoutMins = int(sendThreadsTimeoutMins) -allowNewsFollowers = \ - getConfigParam(baseDir, 'allowNewsFollowers') -if allowNewsFollowers is not None: - args.allowNewsFollowers = bool(allowNewsFollowers) - showPublishAsIcon = \ getConfigParam(baseDir, 'showPublishAsIcon') if showPublishAsIcon is not None: @@ -2154,7 +2144,6 @@ if __name__ == "__main__": args.fullWidthTimelineButtonHeader, args.showPublishAsIcon, args.maxFollowers, - args.allowNewsFollowers, args.maxNewsPosts, args.maxMirroredArticles, args.maxNewswireFeedSizeKb, diff --git a/follow.py b/follow.py index f3c209670..0c9e2598a 100644 --- a/follow.py +++ b/follow.py @@ -68,14 +68,9 @@ def createInitialLastSeen(baseDir: str, httpPrefix: str) -> None: def _preApprovedFollower(baseDir: str, nickname: str, domain: str, - approveHandle: str, - allowNewsFollowers: bool) -> bool: + approveHandle: str) -> bool: """Is the given handle an already manually approved follower? """ - # optionally allow the news account to be followed - if nickname == 'news' and allowNewsFollowers: - return True - handle = nickname + '@' + domain accountDir = baseDir + '/accounts/' + handle approvedFilename = accountDir + '/approved.txt' @@ -460,13 +455,12 @@ def getFollowingFeed(baseDir: str, domain: str, port: int, path: str, def _followApprovalRequired(baseDir: str, nicknameToFollow: str, domainToFollow: str, debug: bool, - followRequestHandle: str, - allowNewsFollowers: bool) -> bool: + followRequestHandle: str) -> bool: """ Returns the policy for follower approvals """ # has this handle already been manually approved? if _preApprovedFollower(baseDir, nicknameToFollow, domainToFollow, - followRequestHandle, allowNewsFollowers): + followRequestHandle): return False manuallyApproveFollows = False @@ -600,7 +594,6 @@ def receiveFollowRequest(session, baseDir: str, httpPrefix: str, cachedWebfingers: {}, personCache: {}, messageJson: {}, federationList: [], debug: bool, projectVersion: str, - allowNewsFollowers: bool, maxFollowers: int) -> bool: """Receives a follow request within the POST section of HTTPServer """ @@ -651,11 +644,10 @@ def receiveFollowRequest(session, baseDir: str, httpPrefix: str, 'nickname for the account followed') return True if isSystemAccount(nicknameToFollow): - if not (nicknameToFollow == 'news' and allowNewsFollowers): - if debug: - print('DEBUG: Cannot follow system account - ' + - nicknameToFollow) - return True + if debug: + print('DEBUG: Cannot follow system account - ' + + nicknameToFollow) + return True if maxFollowers > 0: if _getNoOfFollowers(baseDir, nicknameToFollow, domainToFollow, @@ -683,8 +675,7 @@ def receiveFollowRequest(session, baseDir: str, httpPrefix: str, # what is the followers policy? approveHandle = nickname + '@' + domainFull if _followApprovalRequired(baseDir, nicknameToFollow, - domainToFollow, debug, approveHandle, - allowNewsFollowers): + domainToFollow, debug, approveHandle): print('Follow approval is required') if domain.endswith('.onion'): if _noOfFollowRequests(baseDir, @@ -877,7 +868,7 @@ def sendFollowRequest(session, baseDir: str, clientToServer: bool, federationList: [], sendThreads: [], postLog: [], cachedWebfingers: {}, personCache: {}, debug: bool, - projectVersion: str, allowNewsFollowers: bool) -> {}: + projectVersion: str) -> {}: """Gets the json object for sending a follow request """ if not domainPermitted(followDomain, federationList): @@ -910,7 +901,7 @@ def sendFollowRequest(session, baseDir: str, } if _followApprovalRequired(baseDir, nickname, domain, debug, - followHandle, allowNewsFollowers): + followHandle): # Remove any follow requests rejected for the account being followed. # It's assumed that if you are following someone then you are # ok with them following back. If this isn't the case then a rejected diff --git a/fonts/Barlow-Regular.woff2 b/fonts/Barlow-Regular.woff2 new file mode 100644 index 000000000..c69eb9734 Binary files /dev/null and b/fonts/Barlow-Regular.woff2 differ diff --git a/fonts/LICENSES b/fonts/LICENSES index d5b038e9b..c7c79734a 100644 --- a/fonts/LICENSES +++ b/fonts/LICENSES @@ -1,6 +1,7 @@ # Font Licenses Absortile is under GPL. See https://www.ffonts.net/Absortile.font +Barlow-Regular is under SIL Open Font License. See https://tribby.com/fonts/barlow Bedstead is under CC0. See below and https://fontlibrary.org/en/font/bedstead bgrove is under GPL. See http://www.free-fonts-download.com/basic/bloominggrove-font CheGuevaraTextSans-Regular is under CC0. See https://fonts2u.com/cheguevara-text-sans-regular.font diff --git a/inbox.py b/inbox.py index eb04fe079..a83c1fec6 100644 --- a/inbox.py +++ b/inbox.py @@ -2449,7 +2449,6 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int, maxEmoji: int, translate: {}, unitTest: bool, YTReplacementDomain: str, showPublishedDateOnly: bool, - allowNewsFollowers: bool, maxFollowers: int, allowLocalNetworkAccess: bool, peertubeInstances: []) -> None: """Processes received items and moves them to the appropriate @@ -2739,7 +2738,6 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int, queueJson['post'], federationList, debug, projectVersion, - allowNewsFollowers, maxFollowers): if os.path.isfile(queueFilename): os.remove(queueFilename) diff --git a/tests.py b/tests.py index 32dd0b01a..7fcdccd03 100644 --- a/tests.py +++ b/tests.py @@ -322,11 +322,12 @@ def createServerAlice(path: str, domain: str, port: int, maxNewswirePosts = 20 dormantMonths = 3 sendThreadsTimeoutMins = 30 + maxFollowers = 10 print('Server running: Alice') runDaemon(sendThreadsTimeoutMins, dormantMonths, maxNewswirePosts, allowLocalNetworkAccess, - 2048, False, True, False, False, True, 10, False, + 2048, False, True, False, False, True, maxFollowers, 0, 100, 1024, 5, False, 0, False, 1, False, False, False, 5, True, True, 'en', __version__, @@ -418,11 +419,12 @@ def createServerBob(path: str, domain: str, port: int, maxNewswirePosts = 20 dormantMonths = 3 sendThreadsTimeoutMins = 30 + maxFollowers = 10 print('Server running: Bob') runDaemon(sendThreadsTimeoutMins, dormantMonths, maxNewswirePosts, allowLocalNetworkAccess, - 2048, False, True, False, False, True, 10, False, + 2048, False, True, False, False, True, maxFollowers, 0, 100, 1024, 5, False, 0, False, 1, False, False, False, 5, True, True, 'en', __version__, @@ -464,11 +466,12 @@ def createServerEve(path: str, domain: str, port: int, federationList: [], maxNewswirePosts = 20 dormantMonths = 3 sendThreadsTimeoutMins = 30 + maxFollowers = 10 print('Server running: Eve') runDaemon(sendThreadsTimeoutMins, dormantMonths, maxNewswirePosts, allowLocalNetworkAccess, - 2048, False, True, False, False, True, 10, False, + 2048, False, True, False, False, True, maxFollowers, 0, 100, 1024, 5, False, 0, False, 1, False, False, False, 5, True, True, 'en', __version__, @@ -851,7 +854,7 @@ def testFollowBetweenServers(): clientToServer, federationList, aliceSendThreads, alicePostLog, aliceCachedWebfingers, alicePersonCache, - True, __version__, False) + True, __version__) print('sendResult: ' + str(sendResult)) for t in range(16): diff --git a/theme/zen/icons/add.png b/theme/zen/icons/add.png index 1c9132e5a..d7dbfe87f 100644 Binary files a/theme/zen/icons/add.png and b/theme/zen/icons/add.png differ diff --git a/theme/zen/icons/bookmark.png b/theme/zen/icons/bookmark.png index e95708dc2..b925adb55 100644 Binary files a/theme/zen/icons/bookmark.png and b/theme/zen/icons/bookmark.png differ diff --git a/theme/zen/icons/bookmark_inactive.png b/theme/zen/icons/bookmark_inactive.png index bb2dcd448..aad738e94 100644 Binary files a/theme/zen/icons/bookmark_inactive.png and b/theme/zen/icons/bookmark_inactive.png differ diff --git a/theme/zen/icons/calendar.png b/theme/zen/icons/calendar.png index 89d1785cb..5a5e687d9 100644 Binary files a/theme/zen/icons/calendar.png and b/theme/zen/icons/calendar.png differ diff --git a/theme/zen/icons/calendar_notify.png b/theme/zen/icons/calendar_notify.png index 164e6fc06..8fe306838 100644 Binary files a/theme/zen/icons/calendar_notify.png and b/theme/zen/icons/calendar_notify.png differ diff --git a/theme/zen/icons/categoriesrss.png b/theme/zen/icons/categoriesrss.png index 35d5393b1..ea0ed6359 100644 Binary files a/theme/zen/icons/categoriesrss.png and b/theme/zen/icons/categoriesrss.png differ diff --git a/theme/zen/icons/delete.png b/theme/zen/icons/delete.png index 66afa0f2d..4b75e4d0e 100644 Binary files a/theme/zen/icons/delete.png and b/theme/zen/icons/delete.png differ diff --git a/theme/zen/icons/dm.png b/theme/zen/icons/dm.png index 7dca859d4..1c966cff2 100644 Binary files a/theme/zen/icons/dm.png and b/theme/zen/icons/dm.png differ diff --git a/theme/zen/icons/download.png b/theme/zen/icons/download.png index f1307ea69..d30884cee 100644 Binary files a/theme/zen/icons/download.png and b/theme/zen/icons/download.png differ diff --git a/theme/zen/icons/edit.png b/theme/zen/icons/edit.png index f1a6f2c13..4ad9a854b 100644 Binary files a/theme/zen/icons/edit.png and b/theme/zen/icons/edit.png differ diff --git a/theme/zen/icons/edit_notify.png b/theme/zen/icons/edit_notify.png index 627daa8b8..0058e1824 100644 Binary files a/theme/zen/icons/edit_notify.png and b/theme/zen/icons/edit_notify.png differ diff --git a/theme/zen/icons/favicon.ico b/theme/zen/icons/favicon.ico index c7cb1bbbe..ce80228f6 100644 Binary files a/theme/zen/icons/favicon.ico and b/theme/zen/icons/favicon.ico differ diff --git a/theme/zen/icons/like.png b/theme/zen/icons/like.png index 6c990d201..7eb61c6ab 100644 Binary files a/theme/zen/icons/like.png and b/theme/zen/icons/like.png differ diff --git a/theme/zen/icons/like_inactive.png b/theme/zen/icons/like_inactive.png index dad1f29bd..412c1037f 100644 Binary files a/theme/zen/icons/like_inactive.png and b/theme/zen/icons/like_inactive.png differ diff --git a/theme/zen/icons/links.png b/theme/zen/icons/links.png index fcfde934a..cb8be555c 100644 Binary files a/theme/zen/icons/links.png and b/theme/zen/icons/links.png differ diff --git a/theme/zen/icons/logorss.png b/theme/zen/icons/logorss.png index 64257681b..1f6027fd9 100644 Binary files a/theme/zen/icons/logorss.png and b/theme/zen/icons/logorss.png differ diff --git a/theme/zen/icons/logout.png b/theme/zen/icons/logout.png index 4be063f93..593062f64 100644 Binary files a/theme/zen/icons/logout.png and b/theme/zen/icons/logout.png differ diff --git a/theme/zen/icons/mute.png b/theme/zen/icons/mute.png index 8a4e7bc3c..b10ac76bf 100644 Binary files a/theme/zen/icons/mute.png and b/theme/zen/icons/mute.png differ diff --git a/theme/zen/icons/new.png b/theme/zen/icons/new.png index 699ec1357..9372e9fd3 100644 Binary files a/theme/zen/icons/new.png and b/theme/zen/icons/new.png differ diff --git a/theme/zen/icons/newpost.png b/theme/zen/icons/newpost.png index 5dbab7ece..85460f91e 100644 Binary files a/theme/zen/icons/newpost.png and b/theme/zen/icons/newpost.png differ diff --git a/theme/zen/icons/newswire.png b/theme/zen/icons/newswire.png index 52a890ceb..0e31b34ef 100644 Binary files a/theme/zen/icons/newswire.png and b/theme/zen/icons/newswire.png differ diff --git a/theme/zen/icons/pagedown.png b/theme/zen/icons/pagedown.png index 9f2940418..6aa71212f 100644 Binary files a/theme/zen/icons/pagedown.png and b/theme/zen/icons/pagedown.png differ diff --git a/theme/zen/icons/pageup.png b/theme/zen/icons/pageup.png index 8fd333387..4acfff78a 100644 Binary files a/theme/zen/icons/pageup.png and b/theme/zen/icons/pageup.png differ diff --git a/theme/zen/icons/person.png b/theme/zen/icons/person.png index 6f31602b0..973dba919 100644 Binary files a/theme/zen/icons/person.png and b/theme/zen/icons/person.png differ diff --git a/theme/zen/icons/prev.png b/theme/zen/icons/prev.png index 55417e4a2..26d173534 100644 Binary files a/theme/zen/icons/prev.png and b/theme/zen/icons/prev.png differ diff --git a/theme/zen/icons/publish.png b/theme/zen/icons/publish.png index bac2b1219..37fdf5888 100644 Binary files a/theme/zen/icons/publish.png and b/theme/zen/icons/publish.png differ diff --git a/theme/zen/icons/repeat.png b/theme/zen/icons/repeat.png index 4e1050158..572fc079e 100644 Binary files a/theme/zen/icons/repeat.png and b/theme/zen/icons/repeat.png differ diff --git a/theme/zen/icons/repeat_inactive.png b/theme/zen/icons/repeat_inactive.png index 7f09272c1..2a40ff6b7 100644 Binary files a/theme/zen/icons/repeat_inactive.png and b/theme/zen/icons/repeat_inactive.png differ diff --git a/theme/zen/icons/reply.png b/theme/zen/icons/reply.png index 729679230..0e0c038fc 100644 Binary files a/theme/zen/icons/reply.png and b/theme/zen/icons/reply.png differ diff --git a/theme/zen/icons/scope_blog.png b/theme/zen/icons/scope_blog.png index bac2b1219..71a533713 100644 Binary files a/theme/zen/icons/scope_blog.png and b/theme/zen/icons/scope_blog.png differ diff --git a/theme/zen/icons/scope_dm.png b/theme/zen/icons/scope_dm.png index c58d6f774..1b156cb1f 100644 Binary files a/theme/zen/icons/scope_dm.png and b/theme/zen/icons/scope_dm.png differ diff --git a/theme/zen/icons/scope_event.png b/theme/zen/icons/scope_event.png index 89d1785cb..7c597d200 100644 Binary files a/theme/zen/icons/scope_event.png and b/theme/zen/icons/scope_event.png differ diff --git a/theme/zen/icons/scope_followers.png b/theme/zen/icons/scope_followers.png index 8f8c4ea38..9c499af3c 100644 Binary files a/theme/zen/icons/scope_followers.png and b/theme/zen/icons/scope_followers.png differ diff --git a/theme/zen/icons/scope_public.png b/theme/zen/icons/scope_public.png index 0a0f195ad..3413f3008 100644 Binary files a/theme/zen/icons/scope_public.png and b/theme/zen/icons/scope_public.png differ diff --git a/theme/zen/icons/scope_question.png b/theme/zen/icons/scope_question.png index 64a4f52ef..7ad41dfe5 100644 Binary files a/theme/zen/icons/scope_question.png and b/theme/zen/icons/scope_question.png differ diff --git a/theme/zen/icons/scope_reminder.png b/theme/zen/icons/scope_reminder.png index f6c43242d..0d2e407fb 100644 Binary files a/theme/zen/icons/scope_reminder.png and b/theme/zen/icons/scope_reminder.png differ diff --git a/theme/zen/icons/scope_report.png b/theme/zen/icons/scope_report.png index eaefd6c67..d7a7f71d3 100644 Binary files a/theme/zen/icons/scope_report.png and b/theme/zen/icons/scope_report.png differ diff --git a/theme/zen/icons/scope_share.png b/theme/zen/icons/scope_share.png index 062660473..bb1c5109a 100644 Binary files a/theme/zen/icons/scope_share.png and b/theme/zen/icons/scope_share.png differ diff --git a/theme/zen/icons/scope_unlisted.png b/theme/zen/icons/scope_unlisted.png index e31d1c050..6208d613e 100644 Binary files a/theme/zen/icons/scope_unlisted.png and b/theme/zen/icons/scope_unlisted.png differ diff --git a/theme/zen/icons/search.png b/theme/zen/icons/search.png index 6d04492f4..4adac8604 100644 Binary files a/theme/zen/icons/search.png and b/theme/zen/icons/search.png differ diff --git a/theme/zen/icons/separator_right.png b/theme/zen/icons/separator_right.png new file mode 100644 index 000000000..3f31f0fce Binary files /dev/null and b/theme/zen/icons/separator_right.png differ diff --git a/theme/zen/icons/showhide.png b/theme/zen/icons/showhide.png index b0dfc8e96..143701e29 100644 Binary files a/theme/zen/icons/showhide.png and b/theme/zen/icons/showhide.png differ diff --git a/theme/zen/icons/unmute.png b/theme/zen/icons/unmute.png index c4aa2f1f8..5bbea2669 100644 Binary files a/theme/zen/icons/unmute.png and b/theme/zen/icons/unmute.png differ diff --git a/theme/zen/left_col_image.png b/theme/zen/left_col_image.png index d683dd2f6..268bbd86f 100644 Binary files a/theme/zen/left_col_image.png and b/theme/zen/left_col_image.png differ diff --git a/theme/zen/theme.json b/theme/zen/theme.json index bd63fcac9..1635106c7 100644 --- a/theme/zen/theme.json +++ b/theme/zen/theme.json @@ -1,4 +1,17 @@ { + "dropdown-bg-color-hover": "#463b35", + "main-fg-color": "#d5c7b7", + "column-left-fg-color": "#d5c7b7", + "button-text": "#d5c7b7", + "button-selected-text": "#d5c7b7", + "login-bg-color": "#212e3f", + "lines-color": "#b6a188", + "day-number": "black", + "day-number2": "#bbb", + "column-left-header-background": "#8b674e", + "column-left-header-color": "#d5c7b7", + "post-separator-margin-top": "10px", + "post-separator-margin-bottom": "10px", "newswire-publish-icon": "True", "full-width-timeline-buttons": "False", "icons-as-buttons": "False", @@ -6,9 +19,9 @@ "publish-button-at-top": "False", "banner-height": "25vh", "banner-height-mobile": "10vh", - "newswire-date-color": "yellow", + "newswire-date-color": "#ffd974", "main-bg-color": "#5c4e41", - "login-bg-color": "#5c4e41", + "calendar-bg-color": "#5c4e41", "options-bg-color": "#5c4e41", "post-bg-color": "#5c4e41", "timeline-posts-background-color": "#5c4e41", @@ -18,23 +31,24 @@ "link-bg-color": "#5c4e41", "main-bg-color-reply": "#5c4e41", "main-bg-color-report": "#5c4e41", - "day-number2": "#5c4e41", "border-color": "#463b35", "border-width": "7px", "border-width-header": "7px", - "main-link-color": "#dddddd", + "main-link-color": "#d5c7b7", "main-link-color-hover": "white", - "options-main-link-color": "#dddddd", + "options-main-link-color": "#d5c7b7", "options-main-link-color-hover": "white", - "title-color": "#dddddd", - "main-visited-color": "#dddddd", - "options-main-visited-color": "#dddddd", - "button-background-hover": "#a63b35", + "title-color": "#d5c7b7", + "main-visited-color": "#d5c7b7", + "options-main-visited-color": "#d5c7b7", + "button-background-hover": "#5f3b00", "publish-button-background": "#463b35", "button-background": "#463b35", "button-selected": "#26201d", "main-bg-color-dm": "#5c4a40", "main-header-color-roles": "#5c4e41", "dropdown-bg-color": "#504e41", - "dropdown-bg-color-hover": "#444" + "header-font": "'Barlow-Regular'", + "*font-family": "'Barlow-Regular'", + "*src": "url('fonts/Barlow-Regular.woff2') format('woff2')" } diff --git a/webapp_column_right.py b/webapp_column_right.py index 9e915382c..36e1daada 100644 --- a/webapp_column_right.py +++ b/webapp_column_right.py @@ -187,6 +187,25 @@ def getRightColumnContent(baseDir: str, nickname: str, domainFull: str, return htmlStr +def getBrokenFavSubstitute() -> str: + """Substitute link used if a favicon is not available + """ + return " onerror=\"this.onerror=null; this.src=''\"" + + +def getFavicon(url: str) -> str: + """Returns a favicon url from the given article link + """ + if '://' not in url: + return None + domain = url.split('://')[1] + if '/' not in domain: + return url + '/favicon.ico' + else: + domain = domain.split('/')[0] + return url.split('://')[0] + '://' + domain + '/favicon.ico' + + def _htmlNewswire(baseDir: str, newswire: {}, nickname: str, moderator: bool, translate: {}, positiveVoting: bool) -> str: """Converts a newswire dict into html @@ -212,6 +231,13 @@ def _htmlNewswire(baseDir: str, newswire: {}, nickname: str, moderator: bool, dateStrLink = dateStr.replace('T', ' ') dateStrLink = dateStrLink.replace('Z', '') + url = item[1] + faviconUrl = getFavicon(url) + faviconLink = '' + if faviconUrl: + faviconLink = \ + '' moderatedItem = item[5] htmlStr += separatorStr if moderatedItem and 'vote:' + nickname in item[2]: @@ -224,9 +250,10 @@ def _htmlNewswire(baseDir: str, newswire: {}, nickname: str, moderator: bool, title = removeLongWords(item[0], 16, []).replace('\n', '
') htmlStr += '

' + \ - '' + \ - '' + title + \ + '' + \ + faviconLink + title + \ '' + totalVotesStr if moderator: htmlStr += \ @@ -252,9 +279,9 @@ def _htmlNewswire(baseDir: str, newswire: {}, nickname: str, moderator: bool, title = removeLongWords(item[0], 16, []).replace('\n', '
') if moderator and moderatedItem: htmlStr += '

' + \ - '' + \ - title + '' + totalVotesStr + faviconLink + title + '' + totalVotesStr htmlStr += ' ' + dateShown htmlStr += '' + \ - title + '' + \ + faviconLink + title + '' + \ totalVotesStr htmlStr += ' ' htmlStr += dateShown + '

\n'