\n'
+ editProfileForm += \
+ '
' + translate['Profile for'] + \
+ ' ' + nickname + '@' + domainFull + '
'
editProfileForm += '
\n'
editProfileForm += \
- '
\n'
- idx = 'If you want to participate within organizations then you ' + \
- 'can indicate some skills that you have and approximate ' + \
- 'proficiency levels. This helps organizers to construct ' + \
- 'teams with an appropriate combination of skills.'
- editProfileForm += ' \n'
- editProfileForm += skillsStr
+ '
\n' + \
+ ' \n' + \
+ ' \n'
+ editProfileForm += ' \n'
+
+ if scheduledPostsExist(baseDir, nickname, domain):
+ editProfileForm += '
\n'
+ editProfileForm += \
+ ' ' + \
+ translate['Remove scheduled posts'] + '
\n'
+ editProfileForm += '
\n'
+ return editProfileForm
+
+
+def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str,
+ domain: str, port: int, httpPrefix: str,
+ defaultTimeline: str, theme: str,
+ peertubeInstances: [],
+ textModeBanner: str, city: str,
+ accessKeys: {}) -> str:
+ """Shows the edit profile screen
+ """
+ path = path.replace('/inbox', '').replace('/outbox', '')
+ path = path.replace('/shares', '')
+ nickname = getNicknameFromActor(path)
+ if not nickname:
+ return ''
+ domainFull = getFullDomain(domain, port)
+
+ actorFilename = \
+ baseDir + '/accounts/' + nickname + '@' + domain + '.json'
+ if not os.path.isfile(actorFilename):
+ return ''
+
+ # filename of the banner shown at the top
+ bannerFile, bannerFilename = \
+ getBannerFile(baseDir, nickname, domain, theme)
+
+ displayNickname = nickname
+ isBot = isGroup = followDMs = removeTwitter = ''
+ notifyLikes = hideLikeButton = mediaInstanceStr = ''
+ blogsInstanceStr = newsInstanceStr = movedTo = ''
+ bioStr = donateUrl = emailAddress = PGPpubKey = ''
+ PGPfingerprint = xmppAddress = matrixAddress = ''
+ ssbAddress = blogAddress = toxAddress = jamiAddress = ''
+ cwtchAddress = briarAddress = manuallyApprovesFollowers = ''
+
+ actorJson = loadJson(actorFilename)
+ if actorJson:
+ if actorJson.get('movedTo'):
+ movedTo = actorJson['movedTo']
+ donateUrl = getDonationUrl(actorJson)
+ xmppAddress = getXmppAddress(actorJson)
+ matrixAddress = getMatrixAddress(actorJson)
+ ssbAddress = getSSBAddress(actorJson)
+ blogAddress = getBlogAddress(actorJson)
+ toxAddress = getToxAddress(actorJson)
+ briarAddress = getBriarAddress(actorJson)
+ jamiAddress = getJamiAddress(actorJson)
+ cwtchAddress = getCwtchAddress(actorJson)
+ emailAddress = getEmailAddress(actorJson)
+ PGPpubKey = getPGPpubKey(actorJson)
+ PGPfingerprint = getPGPfingerprint(actorJson)
+ if actorJson.get('name'):
+ if not isFiltered(baseDir, nickname, domain, actorJson['name']):
+ displayNickname = actorJson['name']
+ if actorJson.get('summary'):
+ bioStr = \
+ actorJson['summary'].replace('
', '').replace('
', '')
+ if isFiltered(baseDir, nickname, domain, bioStr):
+ bioStr = ''
+ if actorJson.get('manuallyApprovesFollowers'):
+ if actorJson['manuallyApprovesFollowers']:
+ manuallyApprovesFollowers = 'checked'
+ else:
+ manuallyApprovesFollowers = ''
+ if actorJson.get('type'):
+ if actorJson['type'] == 'Service':
+ isBot = 'checked'
+ isGroup = ''
+ elif actorJson['type'] == 'Group':
+ isGroup = 'checked'
+ isBot = ''
+ if os.path.isfile(baseDir + '/accounts/' +
+ nickname + '@' + domain + '/.followDMs'):
+ followDMs = 'checked'
+ if os.path.isfile(baseDir + '/accounts/' +
+ nickname + '@' + domain + '/.removeTwitter'):
+ removeTwitter = 'checked'
+ if os.path.isfile(baseDir + '/accounts/' +
+ nickname + '@' + domain + '/.notifyLikes'):
+ notifyLikes = 'checked'
+ if os.path.isfile(baseDir + '/accounts/' +
+ nickname + '@' + domain + '/.hideLikeButton'):
+ hideLikeButton = 'checked'
+
+ mediaInstance = getConfigParam(baseDir, "mediaInstance")
+ if mediaInstance:
+ if mediaInstance is True:
+ mediaInstanceStr = 'checked'
+ blogsInstanceStr = newsInstanceStr = ''
+
+ newsInstance = getConfigParam(baseDir, "newsInstance")
+ if newsInstance:
+ if newsInstance is True:
+ newsInstanceStr = 'checked'
+ blogsInstanceStr = mediaInstanceStr = ''
+
+ blogsInstance = getConfigParam(baseDir, "blogsInstance")
+ if blogsInstance:
+ if blogsInstance is True:
+ blogsInstanceStr = 'checked'
+ mediaInstanceStr = newsInstanceStr = ''
+
+ cssFilename = baseDir + '/epicyon-profile.css'
+ if os.path.isfile(baseDir + '/epicyon.css'):
+ cssFilename = baseDir + '/epicyon.css'
+
+ instanceStr = ''
+ roleAssignStr = ''
+ peertubeStr = ''
+
+ adminNickname = getConfigParam(baseDir, 'admin')
+
+ if isArtist(baseDir, nickname) or \
+ path.startswith('/users/' + str(adminNickname) + '/'):
+ graphicsStr = _htmlEditProfileGraphicDesign(baseDir, translate)
+
+ if adminNickname:
+ if path.startswith('/users/' + adminNickname + '/'):
+ instanceStr, roleAssignStr, peertubeStr = \
+ _htmlEditProfileInstance(baseDir, translate,
+ peertubeInstances,
+ mediaInstanceStr,
+ blogsInstanceStr,
+ newsInstanceStr)
+
+ instanceTitle = \
+ getConfigParam(baseDir, 'instanceTitle')
+ editProfileForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
+
+ # keyboard navigation
+ userPathStr = '/users/' + nickname
+ userTimalineStr = '/users/' + nickname + '/' + defaultTimeline
+ menuTimeline = \
+ htmlHideFromScreenReader('🏠') + ' ' + \
+ translate['Switch to timeline view']
+ menuProfile = \
+ htmlHideFromScreenReader('👤') + ' ' + \
+ translate['Switch to profile view']
+ navLinks = {
+ menuProfile: userPathStr,
+ menuTimeline: userTimalineStr
+ }
+ navAccessKeys = {
+ menuProfile: 'p',
+ menuTimeline: 't'
+ }
+ editProfileForm += htmlKeyboardNavigation(textModeBanner,
+ navLinks, navAccessKeys)
+
+ # top banner
+ editProfileForm += \
+ _htmlEditProfileTopBanner(baseDir, nickname, domain, domainFull,
+ defaultTimeline, bannerFile,
+ path, accessKeys, translate)
+
+ # main info
+ editProfileForm += \
+ _htmlEditProfileMain(displayNickname, bioStr, movedTo, donateUrl,
+ blogAddress, actorJson, translate)
+
+ # Option checkboxes
+ editProfileForm += \
+ _htmlEditProfileOptions(manuallyApprovesFollowers,
+ isBot, isGroup, followDMs, removeTwitter,
+ notifyLikes, hideLikeButton, translate)
+
+ # Contact information
+ editProfileForm += \
+ _htmlEditProfileContactInfo(nickname, emailAddress,
+ xmppAddress, matrixAddress,
+ ssbAddress, toxAddress,
+ briarAddress, jamiAddress,
+ cwtchAddress, PGPfingerprint,
+ PGPpubKey, translate)
+
+ # Customize images and banners
+ editProfileForm += _htmlEditProfileBackground(newsInstance, translate)
+
+ # Change password
+ editProfileForm += _htmlEditProfileChangePassword(translate)
+
+ # Filtering and blocking section
+ editProfileForm += \
+ _htmlEditProfileFiltering(baseDir, nickname, domain, translate)
+
+ # git projects section
+ editProfileForm += \
+ _htmlEditProfileGitProjects(baseDir, nickname, domain, translate)
+
+ # Skills section
+ editProfileForm += \
+ _htmlEditProfileSkills(baseDir, nickname, domain, translate)
+
editProfileForm += roleAssignStr + peertubeStr + graphicsStr + instanceStr
# danger zone section
- editProfileForm += '
' + \
- translate['Danger Zone'] + '
\n'
- editProfileForm += ' \n'
- editProfileForm += '
\n'
- editProfileForm += \
- ' ' + \
- translate['Deactivate this account'] + '
\n'
- editProfileForm += '
\n'
+ editProfileForm += _htmlEditProfileDangerZone(translate)
editProfileForm += '
\n'
editProfileForm += \