mirror of https://gitlab.com/bashrc2/epicyon
Check that admin is defined in config
parent
0154c77b54
commit
81fcf117b7
179
webinterface.py
179
webinterface.py
|
@ -1543,104 +1543,105 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str,
|
||||||
moderatorsStr = ''
|
moderatorsStr = ''
|
||||||
themesDropdown = ''
|
themesDropdown = ''
|
||||||
adminNickname = getConfigParam(baseDir, 'admin')
|
adminNickname = getConfigParam(baseDir, 'admin')
|
||||||
if path.startswith('/users/' + adminNickname + '/'):
|
if adminNickname:
|
||||||
instanceDescription = \
|
if path.startswith('/users/' + adminNickname + '/'):
|
||||||
getConfigParam(baseDir, 'instanceDescription')
|
instanceDescription = \
|
||||||
instanceDescriptionShort = \
|
getConfigParam(baseDir, 'instanceDescription')
|
||||||
getConfigParam(baseDir, 'instanceDescriptionShort')
|
instanceDescriptionShort = \
|
||||||
instanceTitle = \
|
getConfigParam(baseDir, 'instanceDescriptionShort')
|
||||||
getConfigParam(baseDir, 'instanceTitle')
|
instanceTitle = \
|
||||||
instanceStr = '<div class="container">'
|
getConfigParam(baseDir, 'instanceTitle')
|
||||||
instanceStr += \
|
instanceStr = '<div class="container">'
|
||||||
' <label class="labels">' + \
|
|
||||||
translate['Instance Title'] + '</label>'
|
|
||||||
if instanceTitle:
|
|
||||||
instanceStr += \
|
instanceStr += \
|
||||||
' <input type="text" name="instanceTitle" value="' + \
|
' <label class="labels">' + \
|
||||||
instanceTitle + '"><br>'
|
translate['Instance Title'] + '</label>'
|
||||||
else:
|
if instanceTitle:
|
||||||
|
instanceStr += \
|
||||||
|
' <input type="text" name="instanceTitle" value="' + \
|
||||||
|
instanceTitle + '"><br>'
|
||||||
|
else:
|
||||||
|
instanceStr += \
|
||||||
|
' <input type="text" name="instanceTitle" value=""><br>'
|
||||||
instanceStr += \
|
instanceStr += \
|
||||||
' <input type="text" name="instanceTitle" value=""><br>'
|
' <label class="labels">' + \
|
||||||
instanceStr += \
|
translate['Instance Short Description'] + '</label>'
|
||||||
' <label class="labels">' + \
|
if instanceDescriptionShort:
|
||||||
translate['Instance Short Description'] + '</label>'
|
instanceStr += \
|
||||||
if instanceDescriptionShort:
|
' <input type="text" ' + \
|
||||||
|
'name="instanceDescriptionShort" value="' + \
|
||||||
|
instanceDescriptionShort + '"><br>'
|
||||||
|
else:
|
||||||
|
instanceStr += \
|
||||||
|
' <input type="text" ' + \
|
||||||
|
'name="instanceDescriptionShort" value=""><br>'
|
||||||
instanceStr += \
|
instanceStr += \
|
||||||
' <input type="text" ' + \
|
' <label class="labels">' + \
|
||||||
'name="instanceDescriptionShort" value="' + \
|
translate['Instance Description'] + '</label>'
|
||||||
instanceDescriptionShort + '"><br>'
|
if instanceDescription:
|
||||||
else:
|
instanceStr += \
|
||||||
|
' <textarea id="message" name="instanceDescription" ' + \
|
||||||
|
'style="height:200px">' + \
|
||||||
|
instanceDescription + '</textarea>'
|
||||||
|
else:
|
||||||
|
instanceStr += \
|
||||||
|
' <textarea id="message" name="instanceDescription" ' + \
|
||||||
|
'style="height:200px"></textarea>'
|
||||||
instanceStr += \
|
instanceStr += \
|
||||||
' <input type="text" ' + \
|
' <label class="labels">' + \
|
||||||
'name="instanceDescriptionShort" value=""><br>'
|
translate['Instance Logo'] + '</label>'
|
||||||
instanceStr += \
|
|
||||||
' <label class="labels">' + \
|
|
||||||
translate['Instance Description'] + '</label>'
|
|
||||||
if instanceDescription:
|
|
||||||
instanceStr += \
|
instanceStr += \
|
||||||
' <textarea id="message" name="instanceDescription" ' + \
|
' <input type="file" id="instanceLogo" name="instanceLogo"'
|
||||||
'style="height:200px">' + \
|
instanceStr += ' accept="' + imageFormats + '">'
|
||||||
instanceDescription + '</textarea>'
|
instanceStr += '</div>'
|
||||||
else:
|
|
||||||
instanceStr += \
|
|
||||||
' <textarea id="message" name="instanceDescription" ' + \
|
|
||||||
'style="height:200px"></textarea>'
|
|
||||||
instanceStr += \
|
|
||||||
' <label class="labels">' + \
|
|
||||||
translate['Instance Logo'] + '</label>'
|
|
||||||
instanceStr += \
|
|
||||||
' <input type="file" id="instanceLogo" name="instanceLogo"'
|
|
||||||
instanceStr += ' accept="' + imageFormats + '">'
|
|
||||||
instanceStr += '</div>'
|
|
||||||
|
|
||||||
moderators = ''
|
moderators = ''
|
||||||
moderatorsFile = baseDir + '/accounts/moderators.txt'
|
moderatorsFile = baseDir + '/accounts/moderators.txt'
|
||||||
if os.path.isfile(moderatorsFile):
|
if os.path.isfile(moderatorsFile):
|
||||||
with open(moderatorsFile, "r") as f:
|
with open(moderatorsFile, "r") as f:
|
||||||
moderators = f.read()
|
moderators = f.read()
|
||||||
moderatorsStr = '<div class="container">'
|
moderatorsStr = '<div class="container">'
|
||||||
moderatorsStr += ' <b>' + translate['Moderators'] + '</b><br>'
|
moderatorsStr += ' <b>' + translate['Moderators'] + '</b><br>'
|
||||||
moderatorsStr += ' ' + \
|
moderatorsStr += ' ' + \
|
||||||
translate['A list of moderator nicknames. One per line.']
|
translate['A list of moderator nicknames. One per line.']
|
||||||
moderatorsStr += \
|
moderatorsStr += \
|
||||||
' <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">' + moderators + '</textarea>'
|
'..." style="height:200px">' + moderators + '</textarea>'
|
||||||
moderatorsStr += '</div>'
|
moderatorsStr += '</div>'
|
||||||
|
|
||||||
themes = getThemesList()
|
themes = getThemesList()
|
||||||
themesDropdown = '<div class="container">'
|
themesDropdown = '<div class="container">'
|
||||||
themesDropdown += ' <b>' + translate['Theme'] + '</b><br>'
|
themesDropdown += ' <b>' + translate['Theme'] + '</b><br>'
|
||||||
grayscaleFilename = \
|
grayscaleFilename = \
|
||||||
baseDir + '/accounts/.grayscale'
|
baseDir + '/accounts/.grayscale'
|
||||||
grayscale = ''
|
grayscale = ''
|
||||||
if os.path.isfile(grayscaleFilename):
|
if os.path.isfile(grayscaleFilename):
|
||||||
grayscale = 'checked'
|
grayscale = 'checked'
|
||||||
themesDropdown += \
|
|
||||||
' <input type="checkbox" class="profilecheckbox" ' + \
|
|
||||||
'name="grayscale" ' + grayscale + \
|
|
||||||
'> ' + translate['Grayscale'] + '<br>'
|
|
||||||
themesDropdown += ' <select id="themeDropdown" ' + \
|
|
||||||
'name="themeDropdown" class="theme">'
|
|
||||||
for themeName in themes:
|
|
||||||
themesDropdown += ' <option value="' + \
|
|
||||||
themeName.lower() + '">' + \
|
|
||||||
translate[themeName] + '</option>'
|
|
||||||
themesDropdown += ' </select><br>'
|
|
||||||
if os.path.isfile(baseDir + '/fonts/custom.woff') or \
|
|
||||||
os.path.isfile(baseDir + '/fonts/custom.woff2') or \
|
|
||||||
os.path.isfile(baseDir + '/fonts/custom.otf') or \
|
|
||||||
os.path.isfile(baseDir + '/fonts/custom.ttf'):
|
|
||||||
themesDropdown += \
|
themesDropdown += \
|
||||||
' <input type="checkbox" class="profilecheckbox" ' + \
|
' <input type="checkbox" class="profilecheckbox" ' + \
|
||||||
'name="removeCustomFont"> ' + \
|
'name="grayscale" ' + grayscale + \
|
||||||
translate['Remove the custom font'] + '<br>'
|
'> ' + translate['Grayscale'] + '<br>'
|
||||||
themesDropdown += '</div>'
|
themesDropdown += ' <select id="themeDropdown" ' + \
|
||||||
themeName = getConfigParam(baseDir, 'theme')
|
'name="themeDropdown" class="theme">'
|
||||||
themesDropdown = \
|
for themeName in themes:
|
||||||
themesDropdown.replace('<option value="' + themeName + '">',
|
themesDropdown += ' <option value="' + \
|
||||||
'<option value="' + themeName +
|
themeName.lower() + '">' + \
|
||||||
'" selected>')
|
translate[themeName] + '</option>'
|
||||||
|
themesDropdown += ' </select><br>'
|
||||||
|
if os.path.isfile(baseDir + '/fonts/custom.woff') or \
|
||||||
|
os.path.isfile(baseDir + '/fonts/custom.woff2') or \
|
||||||
|
os.path.isfile(baseDir + '/fonts/custom.otf') or \
|
||||||
|
os.path.isfile(baseDir + '/fonts/custom.ttf'):
|
||||||
|
themesDropdown += \
|
||||||
|
' <input type="checkbox" class="profilecheckbox" ' + \
|
||||||
|
'name="removeCustomFont"> ' + \
|
||||||
|
translate['Remove the custom font'] + '<br>'
|
||||||
|
themesDropdown += '</div>'
|
||||||
|
themeName = getConfigParam(baseDir, 'theme')
|
||||||
|
themesDropdown = \
|
||||||
|
themesDropdown.replace('<option value="' + themeName + '">',
|
||||||
|
'<option value="' + themeName +
|
||||||
|
'" selected>')
|
||||||
|
|
||||||
editProfileForm = htmlHeader(cssFilename, editProfileCSS)
|
editProfileForm = htmlHeader(cssFilename, editProfileCSS)
|
||||||
editProfileForm += \
|
editProfileForm += \
|
||||||
|
|
Loading…
Reference in New Issue