Improve handling of banner images

main
Bob Mottram 2020-11-03 10:11:45 +00:00
parent de67c5cb7f
commit 96f993d026
1 changed files with 11 additions and 3 deletions

View File

@ -3557,9 +3557,10 @@ def htmlProfile(rssIconAtTop: bool,
# If this is the news account then show a different banner # If this is the news account then show a different banner
if isSystemAccount(nickname): if isSystemAccount(nickname):
bannerFile, bannerFilename = getBannerFile(baseDir, nickname, domain)
profileHeaderStr = \ profileHeaderStr = \
'<img loading="lazy" class="timeline-banner" ' + \ '<img loading="lazy" class="timeline-banner" ' + \
'src="/users/news/banner.png" />\n' 'src="/users/' + nickname + '/' + bannerFile + '" />\n'
if loginButton: if loginButton:
profileHeaderStr += '<center>' + loginButton + '</center>\n' profileHeaderStr += '<center>' + loginButton + '</center>\n'
@ -6000,11 +6001,16 @@ def htmlLinksMobile(cssCache: {}, baseDir: str,
else: else:
editor = isEditor(baseDir, nickname) editor = isEditor(baseDir, nickname)
domain = domainFull
if ':' in domain:
domain = domain.split(':')[0]
htmlStr = htmlHeader(cssFilename, profileStyle) htmlStr = htmlHeader(cssFilename, profileStyle)
bannerFile, bannerFilename = getBannerFile(baseDir, nickname, domain)
htmlStr += \ htmlStr += \
'<a href="/users/' + nickname + '/' + defaultTimeline + '">' + \ '<a href="/users/' + nickname + '/' + defaultTimeline + '">' + \
'<img loading="lazy" class="timeline-banner" ' + \ '<img loading="lazy" class="timeline-banner" ' + \
'src="/users/news/banner.png" /></a>\n' 'src="/users/' + nickname + '/' + bannerFile + '" /></a>\n'
htmlStr += '<center>' + \ htmlStr += '<center>' + \
headerButtonsFrontScreen(translate, nickname, headerButtonsFrontScreen(translate, nickname,
@ -6063,10 +6069,12 @@ def htmlNewswireMobile(cssCache: {}, baseDir: str, nickname: str,
showPublishButton = editor showPublishButton = editor
htmlStr = htmlHeader(cssFilename, profileStyle) htmlStr = htmlHeader(cssFilename, profileStyle)
bannerFile, bannerFilename = getBannerFile(baseDir, nickname, domain)
htmlStr += \ htmlStr += \
'<a href="/users/' + nickname + '/' + defaultTimeline + '">' + \ '<a href="/users/' + nickname + '/' + defaultTimeline + '">' + \
'<img loading="lazy" class="timeline-banner" ' + \ '<img loading="lazy" class="timeline-banner" ' + \
'src="/users/news/banner.png" /></a>\n' 'src="/users/' + nickname + '/' + bannerFile + '" /></a>\n'
htmlStr += '<center>' + \ htmlStr += '<center>' + \
headerButtonsFrontScreen(translate, nickname, headerButtonsFrontScreen(translate, nickname,