mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
098e7b170a
commit
c50d30393c
|
@ -60,6 +60,30 @@ from webapp_post import individualPostAsHtml
|
||||||
from webapp_timeline import htmlIndividualShare
|
from webapp_timeline import htmlIndividualShare
|
||||||
|
|
||||||
|
|
||||||
|
def _editText(label: str, name: str, value: str = "") -> str:
|
||||||
|
"""Returns html for editing a text field
|
||||||
|
"""
|
||||||
|
return \
|
||||||
|
'<label class="labels">' + label + '</label><br>\n' + \
|
||||||
|
' <input type="text" name="' + name + '" value="' + \
|
||||||
|
value + '">\n'
|
||||||
|
|
||||||
|
|
||||||
|
def _editTextArea(label: str, name: str, value: str = "",
|
||||||
|
height: int = 600,
|
||||||
|
placeholder: str = "",
|
||||||
|
spellcheck: bool = False) -> str:
|
||||||
|
"""Returns html for editing a textarea field
|
||||||
|
"""
|
||||||
|
return \
|
||||||
|
'<label class="labels">' + label + '</label><br>\n' + \
|
||||||
|
' <textarea id="message" placeholder=' + \
|
||||||
|
'"' + placeholder + '" name="' + name + '" ' + \
|
||||||
|
'style="height:' + height + 'px" spellcheck="' + \
|
||||||
|
str(spellcheck).lower() + '">' + \
|
||||||
|
value + '</textarea>\n'
|
||||||
|
|
||||||
|
|
||||||
def htmlProfileAfterSearch(cssCache: {},
|
def htmlProfileAfterSearch(cssCache: {},
|
||||||
recentPostsCache: {}, maxRecentPosts: int,
|
recentPostsCache: {}, maxRecentPosts: int,
|
||||||
translate: {},
|
translate: {},
|
||||||
|
@ -205,24 +229,22 @@ def htmlProfileAfterSearch(cssCache: {},
|
||||||
followIsPermitted = False
|
followIsPermitted = False
|
||||||
|
|
||||||
if followIsPermitted:
|
if followIsPermitted:
|
||||||
profileStr += '<div class="container">\n'
|
|
||||||
profileStr += ' <form method="POST" action="' + \
|
|
||||||
backUrl + '/followconfirm">\n'
|
|
||||||
profileStr += ' <center>\n'
|
|
||||||
profileStr += \
|
profileStr += \
|
||||||
|
'<div class="container">\n' + \
|
||||||
|
' <form method="POST" action="' + \
|
||||||
|
backUrl + '/followconfirm">\n' + \
|
||||||
|
' <center>\n' + \
|
||||||
' <input type="hidden" name="actor" value="' + \
|
' <input type="hidden" name="actor" value="' + \
|
||||||
personUrl + '">\n'
|
personUrl + '">\n' + \
|
||||||
profileStr += \
|
|
||||||
' <button type="submit" class="button" name="submitYes" ' + \
|
' <button type="submit" class="button" name="submitYes" ' + \
|
||||||
'accesskey="' + accessKeys['followButton'] + '">' + \
|
'accesskey="' + accessKeys['followButton'] + '">' + \
|
||||||
translate['Follow'] + '</button>\n'
|
translate['Follow'] + '</button>\n' + \
|
||||||
profileStr += \
|
|
||||||
' <button type="submit" class="button" name="submitView" ' + \
|
' <button type="submit" class="button" name="submitView" ' + \
|
||||||
'accesskey="' + accessKeys['viewButton'] + '">' + \
|
'accesskey="' + accessKeys['viewButton'] + '">' + \
|
||||||
translate['View'] + '</button>\n'
|
translate['View'] + '</button>\n' + \
|
||||||
profileStr += ' </center>\n'
|
' </center>\n' + \
|
||||||
profileStr += ' </form>\n'
|
' </form>\n' + \
|
||||||
profileStr += '</div>\n'
|
'</div>\n'
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
for item in parseUserFeed(session, outboxUrl, asHeader,
|
for item in parseUserFeed(session, outboxUrl, asHeader,
|
||||||
|
@ -277,15 +299,15 @@ def _getProfileHeader(baseDir: str, httpPrefix: str,
|
||||||
"""The header of the profile screen, containing background
|
"""The header of the profile screen, containing background
|
||||||
image and avatar
|
image and avatar
|
||||||
"""
|
"""
|
||||||
htmlStr = '\n\n <figure class="profileHeader">\n'
|
htmlStr = \
|
||||||
htmlStr += ' <a href="/users/' + \
|
'\n\n <figure class="profileHeader">\n' + \
|
||||||
|
' <a href="/users/' + \
|
||||||
nickname + '/' + defaultTimeline + '" title="' + \
|
nickname + '/' + defaultTimeline + '" title="' + \
|
||||||
translate['Switch to timeline view'] + '">\n'
|
translate['Switch to timeline view'] + '">\n' + \
|
||||||
htmlStr += ' <img class="profileBackground" ' + \
|
' <img class="profileBackground" ' + \
|
||||||
'alt="" ' + \
|
'alt="" ' + \
|
||||||
'src="/users/' + nickname + '/image_' + theme + '.png" /></a>\n'
|
'src="/users/' + nickname + '/image_' + theme + '.png" /></a>\n' + \
|
||||||
htmlStr += ' <figcaption>\n'
|
' <figcaption>\n' + \
|
||||||
htmlStr += \
|
|
||||||
' <a href="/users/' + \
|
' <a href="/users/' + \
|
||||||
nickname + '/' + defaultTimeline + '" title="' + \
|
nickname + '/' + defaultTimeline + '" title="' + \
|
||||||
translate['Switch to timeline view'] + '">\n' + \
|
translate['Switch to timeline view'] + '">\n' + \
|
||||||
|
@ -344,13 +366,13 @@ def _getProfileHeader(baseDir: str, httpPrefix: str,
|
||||||
'/qrcode.png" alt="' + translate['QR Code'] + '" title="' + \
|
'/qrcode.png" alt="' + translate['QR Code'] + '" title="' + \
|
||||||
translate['QR Code'] + '">' + \
|
translate['QR Code'] + '">' + \
|
||||||
'<img class="qrcode" alt="' + translate['QR Code'] + \
|
'<img class="qrcode" alt="' + translate['QR Code'] + \
|
||||||
'" src="/icons/qrcode.png" /></a></p>\n'
|
'" src="/icons/qrcode.png" /></a></p>\n' + \
|
||||||
htmlStr += ' <p>' + profileDescriptionShort + '</p>\n'
|
' <p>' + profileDescriptionShort + '</p>\n' + loginButton
|
||||||
htmlStr += loginButton
|
|
||||||
if pinnedContent:
|
if pinnedContent:
|
||||||
htmlStr += pinnedContent.replace('<p>', '<p>📎', 1)
|
htmlStr += pinnedContent.replace('<p>', '<p>📎', 1)
|
||||||
htmlStr += ' </figcaption>\n'
|
htmlStr += \
|
||||||
htmlStr += ' </figure>\n\n'
|
' </figcaption>\n' + \
|
||||||
|
' </figure>\n\n'
|
||||||
return htmlStr
|
return htmlStr
|
||||||
|
|
||||||
|
|
||||||
|
@ -370,24 +392,25 @@ def _getProfileHeaderAfterSearch(baseDir: str,
|
||||||
"""The header of a searched for handle, containing background
|
"""The header of a searched for handle, containing background
|
||||||
image and avatar
|
image and avatar
|
||||||
"""
|
"""
|
||||||
htmlStr = '\n\n <figure class="profileHeader">\n'
|
htmlStr = \
|
||||||
htmlStr += ' <a href="/users/' + \
|
'\n\n <figure class="profileHeader">\n' + \
|
||||||
|
' <a href="/users/' + \
|
||||||
nickname + '/' + defaultTimeline + '" title="' + \
|
nickname + '/' + defaultTimeline + '" title="' + \
|
||||||
translate['Switch to timeline view'] + '" ' + \
|
translate['Switch to timeline view'] + '" ' + \
|
||||||
'accesskey="' + accessKeys['menuTimeline'] + '">\n'
|
'accesskey="' + accessKeys['menuTimeline'] + '">\n' + \
|
||||||
htmlStr += ' <img class="profileBackground" ' + \
|
' <img class="profileBackground" ' + \
|
||||||
'alt="" ' + \
|
'alt="" ' + \
|
||||||
'src="' + imageUrl + '" /></a>\n'
|
'src="' + imageUrl + '" /></a>\n' + \
|
||||||
htmlStr += ' <figcaption>\n'
|
' <figcaption>\n'
|
||||||
if avatarUrl:
|
if avatarUrl:
|
||||||
htmlStr += ' <a href="/users/' + \
|
|
||||||
nickname + '/' + defaultTimeline + '" title="' + \
|
|
||||||
translate['Switch to timeline view'] + '">\n'
|
|
||||||
htmlStr += \
|
htmlStr += \
|
||||||
|
' <a href="/users/' + \
|
||||||
|
nickname + '/' + defaultTimeline + '" title="' + \
|
||||||
|
translate['Switch to timeline view'] + '">\n' + \
|
||||||
' <img loading="lazy" src="' + avatarUrl + '" ' + \
|
' <img loading="lazy" src="' + avatarUrl + '" ' + \
|
||||||
'alt="" class="title"></a>\n'
|
'alt="" class="title"></a>\n'
|
||||||
htmlStr += ' <h1>' + displayName + '</h1>\n'
|
|
||||||
htmlStr += \
|
htmlStr += \
|
||||||
|
' <h1>' + displayName + '</h1>\n' + \
|
||||||
' <p><b>@' + searchNickname + '@' + searchDomainFull + '</b><br>\n'
|
' <p><b>@' + searchNickname + '@' + searchDomainFull + '</b><br>\n'
|
||||||
if joinedDate:
|
if joinedDate:
|
||||||
htmlStr += ' <p>' + translate['Joined'] + ' ' + \
|
htmlStr += ' <p>' + translate['Joined'] + ' ' + \
|
||||||
|
@ -428,9 +451,10 @@ def _getProfileHeaderAfterSearch(baseDir: str,
|
||||||
if ctr > 0:
|
if ctr > 0:
|
||||||
htmlStr += otherAccountshtml
|
htmlStr += otherAccountshtml
|
||||||
|
|
||||||
htmlStr += ' <p>' + profileDescriptionShort + '</p>\n'
|
htmlStr += \
|
||||||
htmlStr += ' </figcaption>\n'
|
' <p>' + profileDescriptionShort + '</p>\n' + \
|
||||||
htmlStr += ' </figure>\n\n'
|
' </figcaption>\n' + \
|
||||||
|
' </figure>\n\n'
|
||||||
return htmlStr
|
return htmlStr
|
||||||
|
|
||||||
|
|
||||||
|
@ -1156,12 +1180,9 @@ def _htmlEditProfileInstance(baseDir: str, translate: {},
|
||||||
|
|
||||||
instanceStr += \
|
instanceStr += \
|
||||||
' <label class="labels">' + \
|
' <label class="labels">' + \
|
||||||
translate['Instance Logo'] + '</label>'
|
translate['Instance Logo'] + '</label>' + \
|
||||||
instanceStr += \
|
' <input type="file" id="instanceLogo" name="instanceLogo"' + \
|
||||||
' <input type="file" id="instanceLogo" name="instanceLogo"'
|
' accept="' + imageFormats + '"><br>\n' + \
|
||||||
instanceStr += ' accept="' + imageFormats + '"><br>\n'
|
|
||||||
|
|
||||||
instanceStr += \
|
|
||||||
' <br><label class="labels">' + \
|
' <br><label class="labels">' + \
|
||||||
translate['Security'] + '</label><br>\n'
|
translate['Security'] + '</label><br>\n'
|
||||||
|
|
||||||
|
@ -1216,20 +1237,17 @@ def _htmlEditProfileInstance(baseDir: str, translate: {},
|
||||||
# Instance type
|
# Instance type
|
||||||
instanceStr += \
|
instanceStr += \
|
||||||
' <br><label class="labels">' + \
|
' <br><label class="labels">' + \
|
||||||
translate['Type of instance'] + '</label><br>\n'
|
translate['Type of instance'] + '</label><br>\n' + \
|
||||||
instanceStr += \
|
|
||||||
' <input type="checkbox" class="profilecheckbox" ' + \
|
' <input type="checkbox" class="profilecheckbox" ' + \
|
||||||
'name="mediaInstance" ' + mediaInstanceStr + '> ' + \
|
'name="mediaInstance" ' + mediaInstanceStr + '> ' + \
|
||||||
translate['This is a media instance'] + '<br>\n'
|
translate['This is a media instance'] + '<br>\n' + \
|
||||||
instanceStr += \
|
|
||||||
' <input type="checkbox" class="profilecheckbox" ' + \
|
' <input type="checkbox" class="profilecheckbox" ' + \
|
||||||
'name="blogsInstance" ' + blogsInstanceStr + '> ' + \
|
'name="blogsInstance" ' + blogsInstanceStr + '> ' + \
|
||||||
translate['This is a blogging instance'] + '<br>\n'
|
translate['This is a blogging instance'] + '<br>\n' + \
|
||||||
instanceStr += \
|
|
||||||
' <input type="checkbox" class="profilecheckbox" ' + \
|
' <input type="checkbox" class="profilecheckbox" ' + \
|
||||||
'name="newsInstance" ' + newsInstanceStr + '> ' + \
|
'name="newsInstance" ' + newsInstanceStr + '> ' + \
|
||||||
translate['This is a news instance'] + '<br>\n'
|
translate['This is a news instance'] + '<br>\n' + \
|
||||||
instanceStr += ' </div></details>\n'
|
' </div></details>\n'
|
||||||
|
|
||||||
# Role assignments section
|
# Role assignments section
|
||||||
moderators = ''
|
moderators = ''
|
||||||
|
@ -1238,14 +1256,14 @@ def _htmlEditProfileInstance(baseDir: str, translate: {},
|
||||||
with open(moderatorsFile, 'r') as f:
|
with open(moderatorsFile, 'r') as f:
|
||||||
moderators = f.read()
|
moderators = f.read()
|
||||||
# site moderators
|
# site moderators
|
||||||
roleAssignStr = '<details><summary class="cw">' + \
|
roleAssignStr = \
|
||||||
translate['Role Assignment'] + '</summary>\n'
|
'<details><summary class="cw">' + \
|
||||||
roleAssignStr += '<div class="container">'
|
translate['Role Assignment'] + '</summary>\n' + \
|
||||||
roleAssignStr += ' <b><label class="labels">' + \
|
'<div class="container">' + \
|
||||||
translate['Moderators'] + '</label></b><br>\n'
|
' <b><label class="labels">' + \
|
||||||
roleAssignStr += ' ' + \
|
translate['Moderators'] + '</label></b><br>\n' + \
|
||||||
translate['A list of moderator nicknames. One per line.']
|
' ' + \
|
||||||
roleAssignStr += \
|
translate['A list of moderator nicknames. One per line.'] + \
|
||||||
' <textarea id="message" name="moderators" placeholder="' + \
|
' <textarea id="message" name="moderators" placeholder="' + \
|
||||||
translate['List of moderator nicknames'] + \
|
translate['List of moderator nicknames'] + \
|
||||||
'..." style="height:200px" spellcheck="false">' + \
|
'..." style="height:200px" spellcheck="false">' + \
|
||||||
|
@ -1257,11 +1275,11 @@ def _htmlEditProfileInstance(baseDir: str, translate: {},
|
||||||
if os.path.isfile(editorsFile):
|
if os.path.isfile(editorsFile):
|
||||||
with open(editorsFile, 'r') as f:
|
with open(editorsFile, 'r') as f:
|
||||||
editors = f.read()
|
editors = f.read()
|
||||||
roleAssignStr += ' <b><label class="labels">' + \
|
|
||||||
translate['Site Editors'] + '</label></b><br>\n'
|
|
||||||
roleAssignStr += ' ' + \
|
|
||||||
translate['A list of editor nicknames. One per line.']
|
|
||||||
roleAssignStr += \
|
roleAssignStr += \
|
||||||
|
' <b><label class="labels">' + \
|
||||||
|
translate['Site Editors'] + '</label></b><br>\n' + \
|
||||||
|
' ' + \
|
||||||
|
translate['A list of editor nicknames. One per line.'] + \
|
||||||
' <textarea id="message" name="editors" placeholder="" ' + \
|
' <textarea id="message" name="editors" placeholder="" ' + \
|
||||||
'style="height:200px" spellcheck="false">' + \
|
'style="height:200px" spellcheck="false">' + \
|
||||||
editors + '</textarea>'
|
editors + '</textarea>'
|
||||||
|
@ -1272,9 +1290,9 @@ def _htmlEditProfileInstance(baseDir: str, translate: {},
|
||||||
if os.path.isfile(counselorsFile):
|
if os.path.isfile(counselorsFile):
|
||||||
with open(counselorsFile, 'r') as f:
|
with open(counselorsFile, 'r') as f:
|
||||||
counselors = f.read()
|
counselors = f.read()
|
||||||
roleAssignStr += ' <b><label class="labels">' + \
|
|
||||||
translate['Counselors'] + '</label></b><br>\n'
|
|
||||||
roleAssignStr += \
|
roleAssignStr += \
|
||||||
|
' <b><label class="labels">' + \
|
||||||
|
translate['Counselors'] + '</label></b><br>\n' + \
|
||||||
' <textarea id="message" name="counselors" ' + \
|
' <textarea id="message" name="counselors" ' + \
|
||||||
'placeholder="" ' + \
|
'placeholder="" ' + \
|
||||||
'style="height:200px" spellcheck="false">' + \
|
'style="height:200px" spellcheck="false">' + \
|
||||||
|
@ -1286,24 +1304,23 @@ def _htmlEditProfileInstance(baseDir: str, translate: {},
|
||||||
if os.path.isfile(artistsFile):
|
if os.path.isfile(artistsFile):
|
||||||
with open(artistsFile, 'r') as f:
|
with open(artistsFile, 'r') as f:
|
||||||
artists = f.read()
|
artists = f.read()
|
||||||
roleAssignStr += ' <b><label class="labels">' + \
|
|
||||||
translate['Artists'] + '</label></b><br>\n'
|
|
||||||
roleAssignStr += \
|
roleAssignStr += \
|
||||||
|
' <b><label class="labels">' + \
|
||||||
|
translate['Artists'] + '</label></b><br>\n' + \
|
||||||
' <textarea id="message" name="artists" ' + \
|
' <textarea id="message" name="artists" ' + \
|
||||||
'placeholder="" ' + \
|
'placeholder="" ' + \
|
||||||
'style="height:200px" spellcheck="false">' + \
|
'style="height:200px" spellcheck="false">' + \
|
||||||
artists + '</textarea>'
|
artists + '</textarea>' + \
|
||||||
roleAssignStr += ' </div></details>\n'
|
' </div></details>\n'
|
||||||
|
|
||||||
# Video section
|
# Video section
|
||||||
peertubeStr = ' <details><summary class="cw">' + \
|
|
||||||
translate['Video Settings'] + '</summary>\n'
|
|
||||||
peertubeStr += ' <div class="container">\n'
|
|
||||||
peertubeStr += \
|
|
||||||
' <b><label class="labels">' + \
|
|
||||||
translate['Peertube Instances'] + '</label></b>\n'
|
|
||||||
idx = 'Show video previews for the following Peertube sites.'
|
idx = 'Show video previews for the following Peertube sites.'
|
||||||
peertubeStr += \
|
peertubeStr = \
|
||||||
|
' <details><summary class="cw">' + \
|
||||||
|
translate['Video Settings'] + '</summary>\n' + \
|
||||||
|
' <div class="container">\n' + \
|
||||||
|
' <b><label class="labels">' + \
|
||||||
|
translate['Peertube Instances'] + '</label></b>\n' + \
|
||||||
' <br><label class="labels">' + \
|
' <br><label class="labels">' + \
|
||||||
translate[idx] + '</label>\n'
|
translate[idx] + '</label>\n'
|
||||||
peertubeInstancesStr = ''
|
peertubeInstancesStr = ''
|
||||||
|
@ -1312,8 +1329,7 @@ def _htmlEditProfileInstance(baseDir: str, translate: {},
|
||||||
peertubeStr += \
|
peertubeStr += \
|
||||||
' <textarea id="message" name="ptInstances" ' + \
|
' <textarea id="message" name="ptInstances" ' + \
|
||||||
'style="height:200px" spellcheck="false">' + \
|
'style="height:200px" spellcheck="false">' + \
|
||||||
peertubeInstancesStr + '</textarea>\n'
|
peertubeInstancesStr + '</textarea>\n' + \
|
||||||
peertubeStr += \
|
|
||||||
' <br><b><label class="labels">' + \
|
' <br><b><label class="labels">' + \
|
||||||
translate['YouTube Replacement Domain'] + '</label></b>\n'
|
translate['YouTube Replacement Domain'] + '</label></b>\n'
|
||||||
YTReplacementDomain = getConfigParam(baseDir, "youtubedomain")
|
YTReplacementDomain = getConfigParam(baseDir, "youtubedomain")
|
||||||
|
@ -1321,8 +1337,8 @@ def _htmlEditProfileInstance(baseDir: str, translate: {},
|
||||||
YTReplacementDomain = ''
|
YTReplacementDomain = ''
|
||||||
peertubeStr += \
|
peertubeStr += \
|
||||||
' <input type="text" name="ytdomain" value="' + \
|
' <input type="text" name="ytdomain" value="' + \
|
||||||
YTReplacementDomain + '">\n'
|
YTReplacementDomain + '">\n' + \
|
||||||
peertubeStr += ' </div></details>\n'
|
' </div></details>\n'
|
||||||
|
|
||||||
libretranslateUrl = getConfigParam(baseDir, 'libretranslateUrl')
|
libretranslateUrl = getConfigParam(baseDir, 'libretranslateUrl')
|
||||||
libretranslateApiKey = getConfigParam(baseDir, 'libretranslateApiKey')
|
libretranslateApiKey = getConfigParam(baseDir, 'libretranslateApiKey')
|
||||||
|
@ -1337,16 +1353,16 @@ def _htmlEditProfileInstance(baseDir: str, translate: {},
|
||||||
def _htmlEditProfileDangerZone(translate: {}) -> str:
|
def _htmlEditProfileDangerZone(translate: {}) -> str:
|
||||||
"""danger zone section of Edit Profile screen
|
"""danger zone section of Edit Profile screen
|
||||||
"""
|
"""
|
||||||
editProfileForm = ' <details><summary class="cw">' + \
|
editProfileForm = \
|
||||||
translate['Danger Zone'] + '</summary>\n'
|
' <details><summary class="cw">' + \
|
||||||
editProfileForm += ' <div class="container">\n'
|
translate['Danger Zone'] + '</summary>\n' + \
|
||||||
editProfileForm += ' <b><label class="labels">' + \
|
' <div class="container">\n' + \
|
||||||
translate['Danger Zone'] + '</label></b><br>\n'
|
' <b><label class="labels">' + \
|
||||||
editProfileForm += \
|
translate['Danger Zone'] + '</label></b><br>\n' + \
|
||||||
' <input type="checkbox" class=dangercheckbox" ' + \
|
' <input type="checkbox" class=dangercheckbox" ' + \
|
||||||
'name="deactivateThisAccount"> ' + \
|
'name="deactivateThisAccount"> ' + \
|
||||||
translate['Deactivate this account'] + '<br>\n'
|
translate['Deactivate this account'] + '<br>\n' + \
|
||||||
editProfileForm += ' </div></details>\n'
|
' </div></details>\n'
|
||||||
return editProfileForm
|
return editProfileForm
|
||||||
|
|
||||||
|
|
||||||
|
@ -1364,8 +1380,7 @@ def _htmlEditProfileSkills(baseDir: str, nickname: str, domain: str,
|
||||||
skillsStr += \
|
skillsStr += \
|
||||||
'<p><input type="text" placeholder="' + translate['Skill'] + \
|
'<p><input type="text" placeholder="' + translate['Skill'] + \
|
||||||
' ' + str(skillCtr) + '" name="skillName' + str(skillCtr) + \
|
' ' + str(skillCtr) + '" name="skillName' + str(skillCtr) + \
|
||||||
'" value="' + skillDesc + '" style="width:40%">'
|
'" value="' + skillDesc + '" style="width:40%">' + \
|
||||||
skillsStr += \
|
|
||||||
'<input type="range" min="1" max="100" ' + \
|
'<input type="range" min="1" max="100" ' + \
|
||||||
'class="slider" name="skillValue' + \
|
'class="slider" name="skillValue' + \
|
||||||
str(skillCtr) + '" value="' + str(skillValue) + '"></p>'
|
str(skillCtr) + '" value="' + str(skillValue) + '"></p>'
|
||||||
|
@ -1374,26 +1389,24 @@ def _htmlEditProfileSkills(baseDir: str, nickname: str, domain: str,
|
||||||
skillsStr += \
|
skillsStr += \
|
||||||
'<p><input type="text" placeholder="Skill ' + str(skillCtr) + \
|
'<p><input type="text" placeholder="Skill ' + str(skillCtr) + \
|
||||||
'" name="skillName' + str(skillCtr) + \
|
'" name="skillName' + str(skillCtr) + \
|
||||||
'" value="" style="width:40%">'
|
'" value="" style="width:40%">' + \
|
||||||
skillsStr += \
|
|
||||||
'<input type="range" min="1" max="100" ' + \
|
'<input type="range" min="1" max="100" ' + \
|
||||||
'class="slider" name="skillValue' + \
|
'class="slider" name="skillValue' + \
|
||||||
str(skillCtr) + '" value="50"></p>'
|
str(skillCtr) + '" value="50"></p>' + \
|
||||||
skillsStr += ' </div></details>\n'
|
' </div></details>\n'
|
||||||
|
|
||||||
editProfileForm = '<details><summary class="cw">' + \
|
|
||||||
translate['Skills'] + '</summary>\n'
|
|
||||||
editProfileForm += ' <div class="container">\n'
|
|
||||||
editProfileForm += \
|
|
||||||
' <b><label class="labels">' + \
|
|
||||||
translate['Skills'] + '</label></b><br>\n'
|
|
||||||
idx = 'If you want to participate within organizations then you ' + \
|
idx = 'If you want to participate within organizations then you ' + \
|
||||||
'can indicate some skills that you have and approximate ' + \
|
'can indicate some skills that you have and approximate ' + \
|
||||||
'proficiency levels. This helps organizers to construct ' + \
|
'proficiency levels. This helps organizers to construct ' + \
|
||||||
'teams with an appropriate combination of skills.'
|
'teams with an appropriate combination of skills.'
|
||||||
editProfileForm += ' <label class="labels">' + \
|
editProfileForm = \
|
||||||
translate[idx] + '</label>\n'
|
'<details><summary class="cw">' + \
|
||||||
editProfileForm += skillsStr
|
translate['Skills'] + '</summary>\n' + \
|
||||||
|
' <div class="container">\n' + \
|
||||||
|
' <b><label class="labels">' + \
|
||||||
|
translate['Skills'] + '</label></b><br>\n' + \
|
||||||
|
' <label class="labels">' + \
|
||||||
|
translate[idx] + '</label>\n' + skillsStr
|
||||||
return editProfileForm
|
return editProfileForm
|
||||||
|
|
||||||
|
|
||||||
|
@ -1408,18 +1421,17 @@ def _htmlEditProfileGitProjects(baseDir: str, nickname: str, domain: str,
|
||||||
with open(gitProjectsFilename, 'r') as gitProjectsFile:
|
with open(gitProjectsFilename, 'r') as gitProjectsFile:
|
||||||
gitProjectsStr = gitProjectsFile.read()
|
gitProjectsStr = gitProjectsFile.read()
|
||||||
|
|
||||||
editProfileForm = '<details><summary class="cw">' + \
|
|
||||||
translate['Git Projects'] + '</summary>\n'
|
|
||||||
editProfileForm += ' <div class="container">\n'
|
|
||||||
idx = 'List of project names that you wish to receive git patches for'
|
idx = 'List of project names that you wish to receive git patches for'
|
||||||
editProfileForm += \
|
editProfileForm = \
|
||||||
|
'<details><summary class="cw">' + \
|
||||||
|
translate['Git Projects'] + '</summary>\n' + \
|
||||||
|
' <div class="container">\n' + \
|
||||||
' <label class="labels">' + \
|
' <label class="labels">' + \
|
||||||
translate[idx] + '</label>\n'
|
translate[idx] + '</label>\n' + \
|
||||||
editProfileForm += \
|
|
||||||
' <textarea id="message" name="gitProjects" ' + \
|
' <textarea id="message" name="gitProjects" ' + \
|
||||||
'style="height:100px" spellcheck="false">' + \
|
'style="height:100px" spellcheck="false">' + \
|
||||||
gitProjectsStr + '</textarea>\n'
|
gitProjectsStr + '</textarea>\n' + \
|
||||||
editProfileForm += ' </div></details>\n'
|
' </div></details>\n'
|
||||||
return editProfileForm
|
return editProfileForm
|
||||||
|
|
||||||
|
|
||||||
|
@ -1517,71 +1529,56 @@ def _htmlEditProfileFiltering(baseDir: str, nickname: str, domain: str,
|
||||||
|
|
||||||
editProfileForm += \
|
editProfileForm += \
|
||||||
' <b><label class="labels">' + \
|
' <b><label class="labels">' + \
|
||||||
translate['Filtered words'] + '</label></b>\n'
|
translate['Filtered words'] + '</label></b>\n' + \
|
||||||
editProfileForm += ' <br><label class="labels">' + \
|
' <br><label class="labels">' + \
|
||||||
translate['One per line'] + '</label>\n'
|
translate['One per line'] + '</label>\n' + \
|
||||||
editProfileForm += ' <textarea id="message" ' + \
|
' <textarea id="message" ' + \
|
||||||
'name="filteredWords" style="height:200px" spellcheck="false">' + \
|
'name="filteredWords" style="height:200px" spellcheck="false">' + \
|
||||||
filterStr + '</textarea>\n'
|
filterStr + '</textarea>\n' + \
|
||||||
|
|
||||||
editProfileForm += \
|
|
||||||
' <br><b><label class="labels">' + \
|
' <br><b><label class="labels">' + \
|
||||||
translate['Word Replacements'] + '</label></b>\n'
|
translate['Word Replacements'] + '</label></b>\n' + \
|
||||||
editProfileForm += ' <br><label class="labels">A -> B</label>\n'
|
' <br><label class="labels">A -> B</label>\n' + \
|
||||||
editProfileForm += \
|
|
||||||
' <textarea id="message" name="switchWords" ' + \
|
' <textarea id="message" name="switchWords" ' + \
|
||||||
'style="height:200px" spellcheck="false">' + \
|
'style="height:200px" spellcheck="false">' + \
|
||||||
switchStr + '</textarea>\n'
|
switchStr + '</textarea>\n' + \
|
||||||
|
|
||||||
editProfileForm += \
|
|
||||||
' <br><b><label class="labels">' + \
|
' <br><b><label class="labels">' + \
|
||||||
translate['Autogenerated Hashtags'] + '</label></b>\n'
|
translate['Autogenerated Hashtags'] + '</label></b>\n' + \
|
||||||
editProfileForm += ' <br><label class="labels">A -> #B</label>\n'
|
' <br><label class="labels">A -> #B</label>\n' + \
|
||||||
editProfileForm += \
|
|
||||||
' <textarea id="message" name="autoTags" ' + \
|
' <textarea id="message" name="autoTags" ' + \
|
||||||
'style="height:200px" spellcheck="false">' + \
|
'style="height:200px" spellcheck="false">' + \
|
||||||
autoTags + '</textarea>\n'
|
autoTags + '</textarea>\n' + \
|
||||||
|
|
||||||
editProfileForm += \
|
|
||||||
' <br><b><label class="labels">' + \
|
' <br><b><label class="labels">' + \
|
||||||
translate['Autogenerated Content Warnings'] + '</label></b>\n'
|
translate['Autogenerated Content Warnings'] + '</label></b>\n' + \
|
||||||
editProfileForm += ' <br><label class="labels">A -> B</label>\n'
|
' <br><label class="labels">A -> B</label>\n' + \
|
||||||
editProfileForm += \
|
|
||||||
' <textarea id="message" name="autoCW" ' + \
|
' <textarea id="message" name="autoCW" ' + \
|
||||||
'style="height:200px" spellcheck="true">' + autoCW + '</textarea>\n'
|
'style="height:200px" spellcheck="true">' + autoCW + '</textarea>\n'
|
||||||
|
|
||||||
editProfileForm += \
|
|
||||||
' <br><b><label class="labels">' + \
|
|
||||||
translate['Blocked accounts'] + '</label></b>\n'
|
|
||||||
idx = 'Blocked accounts, one per line, in the form ' + \
|
idx = 'Blocked accounts, one per line, in the form ' + \
|
||||||
'nickname@domain or *@blockeddomain'
|
'nickname@domain or *@blockeddomain'
|
||||||
editProfileForm += \
|
editProfileForm += \
|
||||||
' <br><label class="labels">' + translate[idx] + '</label>\n'
|
' <br><b><label class="labels">' + \
|
||||||
editProfileForm += \
|
translate['Blocked accounts'] + '</label></b>\n' + \
|
||||||
|
' <br><label class="labels">' + translate[idx] + '</label>\n' + \
|
||||||
' <textarea id="message" name="blocked" style="height:200px" ' + \
|
' <textarea id="message" name="blocked" style="height:200px" ' + \
|
||||||
'spellcheck="false">' + blockedStr + '</textarea>\n'
|
'spellcheck="false">' + blockedStr + '</textarea>\n'
|
||||||
|
|
||||||
editProfileForm += \
|
|
||||||
' <br><b><label class="labels">' + \
|
|
||||||
translate['Direct Message permitted instances'] + '</label></b>\n'
|
|
||||||
idx = 'Direct messages are always allowed from these instances.'
|
idx = 'Direct messages are always allowed from these instances.'
|
||||||
editProfileForm += \
|
editProfileForm += \
|
||||||
|
' <br><b><label class="labels">' + \
|
||||||
|
translate['Direct Message permitted instances'] + '</label></b>\n' + \
|
||||||
' <br><label class="labels">' + \
|
' <br><label class="labels">' + \
|
||||||
translate[idx] + '</label>\n'
|
translate[idx] + '</label>\n' + \
|
||||||
editProfileForm += \
|
|
||||||
' <textarea id="message" name="dmAllowedInstances" ' + \
|
' <textarea id="message" name="dmAllowedInstances" ' + \
|
||||||
'style="height:200px" spellcheck="false">' + \
|
'style="height:200px" spellcheck="false">' + \
|
||||||
dmAllowedInstancesStr + '</textarea>\n'
|
dmAllowedInstancesStr + '</textarea>\n'
|
||||||
|
|
||||||
editProfileForm += \
|
|
||||||
' <br><b><label class="labels">' + \
|
|
||||||
translate['Federation list'] + '</label></b>\n'
|
|
||||||
idx = 'Federate only with a defined set of instances. ' + \
|
idx = 'Federate only with a defined set of instances. ' + \
|
||||||
'One domain name per line.'
|
'One domain name per line.'
|
||||||
editProfileForm += \
|
editProfileForm += \
|
||||||
|
' <br><b><label class="labels">' + \
|
||||||
|
translate['Federation list'] + '</label></b>\n' + \
|
||||||
' <br><label class="labels">' + \
|
' <br><label class="labels">' + \
|
||||||
translate[idx] + '</label>\n'
|
translate[idx] + '</label>\n' + \
|
||||||
editProfileForm += \
|
|
||||||
' <textarea id="message" name="allowedInstances" ' + \
|
' <textarea id="message" name="allowedInstances" ' + \
|
||||||
'style="height:200px" spellcheck="false">' + \
|
'style="height:200px" spellcheck="false">' + \
|
||||||
allowedInstancesStr + '</textarea>\n'
|
allowedInstancesStr + '</textarea>\n'
|
||||||
|
@ -1593,8 +1590,7 @@ def _htmlEditProfileFiltering(baseDir: str, nickname: str, domain: str,
|
||||||
userAgentsBlockedStr += ua
|
userAgentsBlockedStr += ua
|
||||||
editProfileForm += \
|
editProfileForm += \
|
||||||
' <br><b><label class="labels">' + \
|
' <br><b><label class="labels">' + \
|
||||||
translate['Blocked User Agents'] + '</label></b>\n'
|
translate['Blocked User Agents'] + '</label></b>\n' + \
|
||||||
editProfileForm += \
|
|
||||||
' <textarea id="message" name="userAgentsBlockedStr" ' + \
|
' <textarea id="message" name="userAgentsBlockedStr" ' + \
|
||||||
'style="height:200px" spellcheck="false">' + \
|
'style="height:200px" spellcheck="false">' + \
|
||||||
userAgentsBlockedStr + '</textarea>\n'
|
userAgentsBlockedStr + '</textarea>\n'
|
||||||
|
@ -1662,29 +1658,21 @@ def _htmlEditProfileBackground(newsInstance: bool, translate: {}) -> str:
|
||||||
' <label class="labels">' + \
|
' <label class="labels">' + \
|
||||||
translate['Background image'] + '</label>\n' + \
|
translate['Background image'] + '</label>\n' + \
|
||||||
' <input type="file" id="image" name="image"' + \
|
' <input type="file" id="image" name="image"' + \
|
||||||
' accept="' + imageFormats + '">\n'
|
' accept="' + imageFormats + '">\n' + \
|
||||||
|
|
||||||
editProfileForm += \
|
|
||||||
' <br><label class="labels">' + \
|
' <br><label class="labels">' + \
|
||||||
translate['Timeline banner image'] + '</label>\n' + \
|
translate['Timeline banner image'] + '</label>\n' + \
|
||||||
' <input type="file" id="banner" name="banner"' + \
|
' <input type="file" id="banner" name="banner"' + \
|
||||||
' accept="' + imageFormats + '">\n'
|
' accept="' + imageFormats + '">\n' + \
|
||||||
|
|
||||||
editProfileForm += \
|
|
||||||
' <br><label class="labels">' + \
|
' <br><label class="labels">' + \
|
||||||
translate['Search banner image'] + '</label>\n' + \
|
translate['Search banner image'] + '</label>\n' + \
|
||||||
' <input type="file" id="search_banner" ' + \
|
' <input type="file" id="search_banner" ' + \
|
||||||
'name="search_banner"' + \
|
'name="search_banner"' + \
|
||||||
' accept="' + imageFormats + '">\n'
|
' accept="' + imageFormats + '">\n' + \
|
||||||
|
|
||||||
editProfileForm += \
|
|
||||||
' <br><label class="labels">' + \
|
' <br><label class="labels">' + \
|
||||||
translate['Left column image'] + '</label>\n' + \
|
translate['Left column image'] + '</label>\n' + \
|
||||||
' <input type="file" id="left_col_image" ' + \
|
' <input type="file" id="left_col_image" ' + \
|
||||||
'name="left_col_image"' + \
|
'name="left_col_image"' + \
|
||||||
' accept="' + imageFormats + '">\n'
|
' accept="' + imageFormats + '">\n' + \
|
||||||
|
|
||||||
editProfileForm += \
|
|
||||||
' <br><label class="labels">' + \
|
' <br><label class="labels">' + \
|
||||||
translate['Right column image'] + '</label>\n' + \
|
translate['Right column image'] + '</label>\n' + \
|
||||||
' <input type="file" id="right_col_image" ' + \
|
' <input type="file" id="right_col_image" ' + \
|
||||||
|
@ -1695,6 +1683,20 @@ def _htmlEditProfileBackground(newsInstance: bool, translate: {}) -> str:
|
||||||
return editProfileForm
|
return editProfileForm
|
||||||
|
|
||||||
|
|
||||||
|
def _beginEditSection(label: str) -> str:
|
||||||
|
"""returns the html for begining a dropdown section on edit profile screen
|
||||||
|
"""
|
||||||
|
return \
|
||||||
|
' <details><summary class="cw">' + label + '</summary>\n' + \
|
||||||
|
'<div class="container">'
|
||||||
|
|
||||||
|
|
||||||
|
def _endEditSection() -> str:
|
||||||
|
"""returns the html for ending a dropdown section on edit profile screen
|
||||||
|
"""
|
||||||
|
return ' </div></details>\n'
|
||||||
|
|
||||||
|
|
||||||
def _htmlEditProfileContactInfo(nickname: str,
|
def _htmlEditProfileContactInfo(nickname: str,
|
||||||
emailAddress: str,
|
emailAddress: str,
|
||||||
xmppAddress: str,
|
xmppAddress: str,
|
||||||
|
@ -1709,63 +1711,30 @@ def _htmlEditProfileContactInfo(nickname: str,
|
||||||
translate: {}) -> str:
|
translate: {}) -> str:
|
||||||
"""Contact Information section of edit profile screen
|
"""Contact Information section of edit profile screen
|
||||||
"""
|
"""
|
||||||
editProfileForm = ' <details><summary class="cw">' + \
|
editProfileForm = _beginEditSection(translate['Contact Details'])
|
||||||
translate['Contact Details'] + '</summary>\n'
|
|
||||||
editProfileForm += '<div class="container">'
|
|
||||||
editProfileForm += '<label class="labels">' + \
|
|
||||||
translate['Email'] + '</label><br>\n'
|
|
||||||
editProfileForm += \
|
|
||||||
' <input type="text" name="email" value="' + emailAddress + '">\n'
|
|
||||||
editProfileForm += \
|
|
||||||
'<label class="labels">' + translate['XMPP'] + '</label><br>\n'
|
|
||||||
editProfileForm += \
|
|
||||||
' <input type="text" name="xmppAddress" value="' + \
|
|
||||||
xmppAddress + '">\n'
|
|
||||||
editProfileForm += '<label class="labels">' + \
|
|
||||||
translate['Matrix'] + '</label><br>\n'
|
|
||||||
editProfileForm += \
|
|
||||||
' <input type="text" name="matrixAddress" value="' + \
|
|
||||||
matrixAddress + '">\n'
|
|
||||||
|
|
||||||
|
editProfileForm += _editText(translate['Email'],
|
||||||
|
'email', emailAddress)
|
||||||
|
editProfileForm += _editText(translate['XMPP'],
|
||||||
|
'xmppAddress', xmppAddress)
|
||||||
|
editProfileForm += _editText(translate['Matrix'],
|
||||||
|
'matrixAddress', matrixAddress)
|
||||||
|
editProfileForm += _editText('SSB', 'ssbAddress', ssbAddress)
|
||||||
|
editProfileForm += _editText('Tox', 'toxAddress', toxAddress)
|
||||||
|
editProfileForm += _editText('Briar', 'briarAddress', briarAddress)
|
||||||
|
editProfileForm += _editText('Jami', 'jamiAddress', jamiAddress)
|
||||||
|
editProfileForm += _editText('Cwtch', 'cwtchAddress', cwtchAddress)
|
||||||
|
editProfileForm += _editText(translate['PGP Fingerprint'],
|
||||||
|
'openpgp', PGPfingerprint)
|
||||||
editProfileForm += \
|
editProfileForm += \
|
||||||
'<label class="labels">SSB</label><br>\n' + \
|
_editTextArea(translate['PGP'], 'pgp', PGPpubKey, 600,
|
||||||
' <input type="text" name="ssbAddress" value="' + \
|
'-----BEGIN PGP PUBLIC KEY BLOCK-----', False)
|
||||||
ssbAddress + '">\n'
|
|
||||||
|
|
||||||
editProfileForm += \
|
editProfileForm += \
|
||||||
'<label class="labels">Tox</label><br>\n' + \
|
|
||||||
' <input type="text" name="toxAddress" value="' + \
|
|
||||||
toxAddress + '">\n'
|
|
||||||
|
|
||||||
editProfileForm += \
|
|
||||||
'<label class="labels">Briar</label><br>\n' + \
|
|
||||||
' <input type="text" name="briarAddress" value="' + \
|
|
||||||
briarAddress + '">\n'
|
|
||||||
|
|
||||||
editProfileForm += \
|
|
||||||
'<label class="labels">Jami</label><br>\n' + \
|
|
||||||
' <input type="text" name="jamiAddress" value="' + \
|
|
||||||
jamiAddress + '">\n'
|
|
||||||
|
|
||||||
editProfileForm += \
|
|
||||||
'<label class="labels">Cwtch</label><br>\n' + \
|
|
||||||
' <input type="text" name="cwtchAddress" value="' + \
|
|
||||||
cwtchAddress + '">\n'
|
|
||||||
|
|
||||||
editProfileForm += \
|
|
||||||
'<label class="labels">' + \
|
|
||||||
translate['PGP Fingerprint'] + '</label><br>\n' + \
|
|
||||||
' <input type="text" name="openpgp" value="' + \
|
|
||||||
PGPfingerprint + '">\n' + \
|
|
||||||
'<label class="labels">' + translate['PGP'] + '</label><br>\n' + \
|
|
||||||
' <textarea id="message" placeholder=' + \
|
|
||||||
'"-----BEGIN PGP PUBLIC KEY BLOCK-----" name="pgp" ' + \
|
|
||||||
'style="height:600px" spellcheck="false">' + \
|
|
||||||
PGPpubKey + '</textarea>\n' + \
|
|
||||||
'<a href="/users/' + nickname + \
|
'<a href="/users/' + nickname + \
|
||||||
'/followingaccounts"><label class="labels">' + \
|
'/followingaccounts"><label class="labels">' + \
|
||||||
translate['Following'] + '</label></a><br>\n' + \
|
translate['Following'] + '</label></a><br>\n'
|
||||||
' </div></details>\n'
|
|
||||||
|
editProfileForm += _endEditSection()
|
||||||
return editProfileForm
|
return editProfileForm
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue