main
Bob Mottram 2020-08-24 10:31:31 +01:00
parent df29c0e024
commit a4db99566b
1 changed files with 23 additions and 1 deletions

View File

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