From a4db99566bb11bfca21eb9acb869b7ca8f00d12d Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 24 Aug 2020 10:31:31 +0100 Subject: [PATCH] Comments --- webinterface.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/webinterface.py b/webinterface.py index cabbd6ac..41b278c5 100644 --- a/webinterface.py +++ b/webinterface.py @@ -4585,7 +4585,7 @@ def htmlTimeline(defaultTimeline: str, if boxName == 'tlshares': os.remove(newShareFile) - # should the Moderation button be highlighted? + # should the Moderation/reports button be highlighted? newReport = False newReportFile = accountDir + '/.newReport' if os.path.isfile(newReportFile): @@ -4593,11 +4593,16 @@ def htmlTimeline(defaultTimeline: str, if boxName == 'moderation': os.remove(newReportFile) + # directory where icons are found + # This changes depending upon theme iconsDir = getIconsDir(baseDir) + + # the css filename cssFilename = baseDir + '/epicyon-profile.css' if os.path.isfile(baseDir + '/epicyon.css'): cssFilename = baseDir + '/epicyon.css' + # filename of the banner shown at the top bannerFile = 'banner.png' bannerFilename = baseDir + '/accounts/' + \ nickname + '@' + domain + '/' + bannerFile @@ -4613,16 +4618,20 @@ def htmlTimeline(defaultTimeline: str, bannerFile = 'banner.webp' with open(cssFilename, 'r') as cssFile: + # load css profileStyle = \ cssFile.read().replace('banner.png', '/users/' + nickname + '/' + bannerFile) + # replace any https within the css with whatever prefix is needed if httpPrefix != 'https': profileStyle = \ profileStyle.replace('https://', httpPrefix + '://') + # is the user a moderator? moderator = isModerator(baseDir, nickname) + # the appearance of buttons - highlighted or not inboxButton = 'button' blogsButton = 'button' dmButton = 'button' @@ -4670,15 +4679,18 @@ def htmlTimeline(defaultTimeline: str, elif boxName == 'tlevents' or boxName == 'events': eventsButton = 'buttonselected' + # get the full domain, including any port number fullDomain = domain if port != 80 and port != 443: if ':' not in domain: fullDomain = domain + ':' + str(port) + usersPath = '/users/' + nickname actor = httpPrefix + '://' + fullDomain + usersPath showIndividualPostIcons = True + # show an icon for new follow approvals followApprovals = '' followRequestsFilename = \ baseDir + '/accounts/' + \ @@ -4698,6 +4710,7 @@ def htmlTimeline(defaultTimeline: str, '" src="/' + iconsDir + '/person.png"/>\n' break + # moderation / reports button moderationButtonStr = '' if moderator and not minimal: moderationButtonStr = \ @@ -4707,6 +4720,7 @@ def htmlTimeline(defaultTimeline: str, htmlHighlightLabel(translate['Mod'], newReport) + \ ' \n' + # shares, bookmarks and events buttons sharesButtonStr = '' bookmarksButtonStr = '' eventsButtonStr = '' @@ -4835,6 +4849,7 @@ def htmlTimeline(defaultTimeline: str, '\n' # typically the blogs button + # but may change if this is a blogging oriented instance if defaultTimeline != 'tlblogs': if not minimal: tlStr += \ @@ -4850,14 +4865,19 @@ def htmlTimeline(defaultTimeline: str, inboxButton + '">' + translate['Inbox'] + \ '\n' + # button for the outbox tlStr += \ ' \n' + + # add other buttons tlStr += \ sharesButtonStr + bookmarksButtonStr + eventsButtonStr + \ moderationButtonStr + newPostButtonStr + + # the search button tlStr += \ ' | ' + \
         translate['Search and follow'] + '\n' + # the calendar button calendarAltText = translate['Calendar'] if newCalendarEvent: # indicate that the calendar icon is highlighted @@ -4875,6 +4896,7 @@ def htmlTimeline(defaultTimeline: str, calendarImage + '" title="' + translate['Calendar'] + \ '" alt="| ' + calendarAltText + '" class="timelineicon"/>\n' + # the show/hide button, for a simpler header appearance tlStr += \ '