From 81fcf117b75f295d54c4f43d7a93b343897b77c8 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 10 Oct 2020 16:56:44 +0100 Subject: [PATCH] Check that admin is defined in config --- epicyon.py | 2 +- webinterface.py | 179 ++++++++++++++++++++++++------------------------ 2 files changed, 91 insertions(+), 90 deletions(-) diff --git a/epicyon.py b/epicyon.py index 0b890c1d..35680c59 100644 --- a/epicyon.py +++ b/epicyon.py @@ -1916,7 +1916,7 @@ if minimumvotes: votingtime = getConfigParam(baseDir, 'votingtime') if votingtime: args.votingtime = votingtime - + YTDomain = getConfigParam(baseDir, 'youtubedomain') if YTDomain: if '://' in YTDomain: diff --git a/webinterface.py b/webinterface.py index e5e55d31..def0b025 100644 --- a/webinterface.py +++ b/webinterface.py @@ -1543,104 +1543,105 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str, moderatorsStr = '' themesDropdown = '' adminNickname = getConfigParam(baseDir, 'admin') - if path.startswith('/users/' + adminNickname + '/'): - instanceDescription = \ - getConfigParam(baseDir, 'instanceDescription') - instanceDescriptionShort = \ - getConfigParam(baseDir, 'instanceDescriptionShort') - instanceTitle = \ - getConfigParam(baseDir, 'instanceTitle') - instanceStr = '
' - instanceStr += \ - ' ' - if instanceTitle: + if adminNickname: + if path.startswith('/users/' + adminNickname + '/'): + instanceDescription = \ + getConfigParam(baseDir, 'instanceDescription') + instanceDescriptionShort = \ + getConfigParam(baseDir, 'instanceDescriptionShort') + instanceTitle = \ + getConfigParam(baseDir, 'instanceTitle') + instanceStr = '
' instanceStr += \ - '
' - else: + ' ' + if instanceTitle: + instanceStr += \ + '
' + else: + instanceStr += \ + '
' instanceStr += \ - '
' - instanceStr += \ - ' ' - if instanceDescriptionShort: + ' ' + if instanceDescriptionShort: + instanceStr += \ + '
' + else: + instanceStr += \ + '
' instanceStr += \ - '
' - else: + ' ' + if instanceDescription: + instanceStr += \ + ' ' + else: + instanceStr += \ + ' ' instanceStr += \ - '
' - instanceStr += \ - ' ' - if instanceDescription: + ' ' instanceStr += \ - ' ' - else: - instanceStr += \ - ' ' - instanceStr += \ - ' ' - instanceStr += \ - ' ' - instanceStr += '
' + ' ' + instanceStr += '
' - moderators = '' - moderatorsFile = baseDir + '/accounts/moderators.txt' - if os.path.isfile(moderatorsFile): - with open(moderatorsFile, "r") as f: - moderators = f.read() - moderatorsStr = '
' - moderatorsStr += ' ' + translate['Moderators'] + '
' - moderatorsStr += ' ' + \ - translate['A list of moderator nicknames. One per line.'] - moderatorsStr += \ - ' ' - moderatorsStr += '
' + moderators = '' + moderatorsFile = baseDir + '/accounts/moderators.txt' + if os.path.isfile(moderatorsFile): + with open(moderatorsFile, "r") as f: + moderators = f.read() + moderatorsStr = '
' + moderatorsStr += ' ' + translate['Moderators'] + '
' + moderatorsStr += ' ' + \ + translate['A list of moderator nicknames. One per line.'] + moderatorsStr += \ + ' ' + moderatorsStr += '
' - themes = getThemesList() - themesDropdown = '
' - themesDropdown += ' ' + translate['Theme'] + '
' - grayscaleFilename = \ - baseDir + '/accounts/.grayscale' - grayscale = '' - if os.path.isfile(grayscaleFilename): - grayscale = 'checked' - themesDropdown += \ - ' ' + translate['Grayscale'] + '
' - themesDropdown += '
' - 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'): + themes = getThemesList() + themesDropdown = '
' + themesDropdown += ' ' + translate['Theme'] + '
' + grayscaleFilename = \ + baseDir + '/accounts/.grayscale' + grayscale = '' + if os.path.isfile(grayscaleFilename): + grayscale = 'checked' themesDropdown += \ ' ' + \ - translate['Remove the custom font'] + '
' - themesDropdown += '
' - themeName = getConfigParam(baseDir, 'theme') - themesDropdown = \ - themesDropdown.replace('
' + themeName = getConfigParam(baseDir, 'theme') + themesDropdown = \ + themesDropdown.replace('