Avatar url

main
Bob Mottram 2020-11-12 22:41:41 +00:00
parent fb7ea6494a
commit c18dd9fb2b
1 changed files with 12 additions and 10 deletions

View File

@ -208,6 +208,7 @@ def htmlProfileAfterSearch(cssCache: {},
avatarDescription = avatarDescription.replace('</p>', '') avatarDescription = avatarDescription.replace('</p>', '')
if '<' in avatarDescription: if '<' in avatarDescription:
avatarDescription = removeHtml(avatarDescription) avatarDescription = removeHtml(avatarDescription)
profileStr = ' <div class="hero-image">\n' profileStr = ' <div class="hero-image">\n'
profileStr += ' <div class="hero-text">\n' profileStr += ' <div class="hero-text">\n'
if avatarUrl: if avatarUrl:
@ -221,6 +222,7 @@ def htmlProfileAfterSearch(cssCache: {},
profileStr += ' <p>' + profileDescriptionShort + '</p>\n' profileStr += ' <p>' + profileDescriptionShort + '</p>\n'
profileStr += ' </div>\n' profileStr += ' </div>\n'
profileStr += '</div>\n' profileStr += '</div>\n'
profileStr += '<div class="container">\n' profileStr += '<div class="container">\n'
profileStr += ' <form method="POST" action="' + \ profileStr += ' <form method="POST" action="' + \
backUrl + '/followconfirm">\n' backUrl + '/followconfirm">\n'
@ -274,7 +276,7 @@ def getProfileHeader(baseDir: str, nickname: str, domain: str,
displayName: str, displayName: str,
avatarDescription: str, avatarDescription: str,
profileDescriptionShort: str, profileDescriptionShort: str,
loginButton: str) -> str: loginButton: str, avatarUrl: str) -> str:
"""The header of the profile screen, containing background """The header of the profile screen, containing background
image and avatar image and avatar
""" """
@ -285,8 +287,8 @@ def getProfileHeader(baseDir: str, nickname: str, domain: str,
htmlStr += ' <img src="/users/' + nickname + '/image.png" /></a>\n' htmlStr += ' <img src="/users/' + nickname + '/image.png" /></a>\n'
htmlStr += ' <figcaption>\n' htmlStr += ' <figcaption>\n'
htmlStr += \ htmlStr += \
' <img loading="lazy" src="/users/' + nickname + '/avatar.png' + \ ' <img loading="lazy" src="' + avatarUrl + '" ' \
'" title="' + avatarDescription + '" alt="' + \ 'title="' + avatarDescription + '" alt="' + \
avatarDescription + '" class="title">\n' avatarDescription + '" class="title">\n'
htmlStr += ' <h1>' + displayName + '</h1>\n' htmlStr += ' <h1>' + displayName + '</h1>\n'
htmlStr += \ htmlStr += \
@ -533,13 +535,14 @@ def htmlProfile(rssIconAtTop: bool,
profileHeaderStr += ' </td>\n' profileHeaderStr += ' </td>\n'
profileHeaderStr += ' <td valign="top" class="col-center">\n' profileHeaderStr += ' <td valign="top" class="col-center">\n'
else: else:
avatarUrl = profileJson['icon']['url']
profileHeaderStr = \ profileHeaderStr = \
getProfileHeader(baseDir, nickname, domain, getProfileHeader(baseDir, nickname, domain,
domainFull, translate, iconsDir, domainFull, translate, iconsDir,
defaultTimeline, displayName, defaultTimeline, displayName,
avatarDescription, avatarDescription,
profileDescriptionShort, profileDescriptionShort,
loginButton) loginButton, avatarUrl)
profileStr = \ profileStr = \
linkToTimelineStart + profileHeaderStr + \ linkToTimelineStart + profileHeaderStr + \
@ -1228,12 +1231,11 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str,
' <input type="file" id="avatar" name="avatar"' ' <input type="file" id="avatar" name="avatar"'
editProfileForm += ' accept="' + imageFormats + '">\n' editProfileForm += ' accept="' + imageFormats + '">\n'
if nickname == adminNickname: editProfileForm += \
editProfileForm += \ ' <br><label class="labels">' + \
' <br><label class="labels">' + \ translate['Background image'] + '</label>\n'
translate['Background image'] + '</label>\n' editProfileForm += ' <input type="file" id="image" name="image"'
editProfileForm += ' <input type="file" id="image" name="image"' editProfileForm += ' accept="' + imageFormats + '">\n'
editProfileForm += ' accept="' + imageFormats + '">\n'
editProfileForm += ' <br><label class="labels">' + \ editProfileForm += ' <br><label class="labels">' + \
translate['Timeline banner image'] + '</label>\n' translate['Timeline banner image'] + '</label>\n'