From fb7ea6494a54a074b0d9274ee1a41dd7811feaba Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 12 Nov 2020 22:33:00 +0000 Subject: [PATCH] New profile header --- daemon.py | 14 +++------- epicyon-profile.css | 25 ++++++++++++++++++ webapp_profile.py | 63 +++++++++++++++++++++++++++++++-------------- 3 files changed, 71 insertions(+), 31 deletions(-) diff --git a/daemon.py b/daemon.py index ffafcc62..cb5a2c53 100644 --- a/daemon.py +++ b/daemon.py @@ -3419,11 +3419,10 @@ class PubServer(BaseHTTPRequestHandler): profileMediaTypesUploaded = {} for mType in profileMediaTypes: # some images can only be changed by the admin - if mType == 'instanceLogo' or \ - mType == 'image': + if mType == 'instanceLogo': if nickname != adminNickname: print('WARN: only the admin can change ' + - 'instance logo or profile backgrounds') + 'instance logo') continue if debug: @@ -3442,13 +3441,6 @@ class PubServer(BaseHTTPRequestHandler): ' image or font was found in POST') continue - # NOTE: profile background comes from the news system user - # perhaps at some future time profile background will be - # per account - currNick = nickname - if mType == 'image': - currNick = 'news' - # Note: a .temp extension is used here so that at no # time is an image with metadata publicly exposed, # even for a few mS @@ -3458,7 +3450,7 @@ class PubServer(BaseHTTPRequestHandler): else: filenameBase = \ baseDir + '/accounts/' + \ - currNick + '@' + domain + \ + nickname + '@' + domain + \ '/' + mType + '.temp' filename, attachmentMediaType = \ diff --git a/epicyon-profile.css b/epicyon-profile.css index 44d28bc8..90147fde 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -251,6 +251,31 @@ a:focus { border: 2px solid var(--focus-color); } +.profileHeader { + font-family: Arial, Helvetica, sans-serif; + position: relative; + overflow: hidden; + margin: 10px; + min-width: 230px; + max-width: 315px; + width: 100%; + color: #ffffff; + text-align: left; + line-height: 1.4em; + background-color: #141414; +} + +.profileHeader .title { + border-radius: 50%; + position: absolute; + bottom: 100%; + left: 25px; + z-index: 1; + max-width: 90px; + opacity: 1; + box-shadow: 0 0 15px rgba(0, 0, 0, 0.3); +} + .hero-image { background-image: linear-gradient(rgba(0, 0, 0, 0.0), rgba(0, 0, 0, 0.5)), url("/users/news/image.png"); height: 50%; diff --git a/webapp_profile.py b/webapp_profile.py index c1bb7644..10d256e1 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -268,6 +268,42 @@ def htmlProfileAfterSearch(cssCache: {}, return htmlHeaderWithExternalStyle(cssFilename) + profileStr + htmlFooter() +def getProfileHeader(baseDir: str, nickname: str, domain: str, + domainFull: str, translate: {}, iconsDir: str, + defaultTimeline: str, + displayName: str, + avatarDescription: str, + profileDescriptionShort: str, + loginButton: str) -> str: + """The header of the profile screen, containing background + image and avatar + """ + htmlStr = '
\n' + htmlStr += ' \n' + htmlStr += ' \n' + htmlStr += '
\n' + htmlStr += \ + ' ' + \
+        avatarDescription + '\n' + htmlStr += '

' + displayName + '

\n' + htmlStr += \ + '

@' + nickname + '@' + domainFull + '
\n' + htmlStr += \ + '' + \ + '

\n' + htmlStr += '

' + profileDescriptionShort + '

\n' + htmlStr += loginButton + htmlStr += '
\n' + htmlStr += '
\n' + return htmlStr + + def htmlProfile(rssIconAtTop: bool, cssCache: {}, iconsAsButtons: bool, defaultTimeline: str, @@ -497,26 +533,13 @@ def htmlProfile(rssIconAtTop: bool, profileHeaderStr += ' \n' profileHeaderStr += ' \n' else: - profileHeaderStr = '
\n' - profileHeaderStr += '
\n' - profileHeaderStr += \ - ' ' + \
-            avatarDescription + '\n' - profileHeaderStr += '

' + displayName + '

\n' - iconsDir = getIconsDir(baseDir) - profileHeaderStr += \ - '

@' + nickname + '@' + domainFull + '
' - profileHeaderStr += \ - '' + \ - '

\n' - profileHeaderStr += '

' + profileDescriptionShort + '

\n' - profileHeaderStr += loginButton - profileHeaderStr += '
\n' - profileHeaderStr += '
\n' + profileHeaderStr = \ + getProfileHeader(baseDir, nickname, domain, + domainFull, translate, iconsDir, + defaultTimeline, displayName, + avatarDescription, + profileDescriptionShort, + loginButton) profileStr = \ linkToTimelineStart + profileHeaderStr + \