mirror of https://gitlab.com/bashrc2/epicyon
Merge branch 'main' of gitlab.com:bashrc2/epicyon
commit
b3018ac972
46
daemon.py
46
daemon.py
|
@ -2173,7 +2173,24 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
for fieldStr in fieldsList:
|
||||
if '=' not in fieldStr:
|
||||
continue
|
||||
fields[fieldStr.split('=')[0]] = fieldStr.split('=')[1].strip()
|
||||
fieldValue = fieldStr.split('=')[1].strip()
|
||||
if not fieldValue:
|
||||
continue
|
||||
if fieldValue == 'on':
|
||||
fieldValue = 'True'
|
||||
fields[fieldStr.split('=')[0]] = fieldValue
|
||||
|
||||
# Check for boolean values which are False.
|
||||
# These don't come through via themeParams,
|
||||
# so need to be checked separately
|
||||
themeFilename = baseDir + '/theme/' + themeName + '/theme.json'
|
||||
themeJson = loadJson(themeFilename)
|
||||
if themeJson:
|
||||
for variableName, value in themeJson.items():
|
||||
variableName = 'themeSetting_' + variableName
|
||||
if value.lower() == 'false' or value.lower() == 'true':
|
||||
if variableName not in fields:
|
||||
fields[variableName] = 'False'
|
||||
|
||||
# get the parameters from the theme designer screen
|
||||
themeDesignerParams = {}
|
||||
|
@ -2187,6 +2204,33 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
allowLocalNetworkAccess,
|
||||
systemLanguage)
|
||||
|
||||
if 'rss-icon-at-top' in themeDesignerParams:
|
||||
if themeDesignerParams['rss-icon-at-top'].lower() == 'true':
|
||||
self.server.rssIconAtTop = True
|
||||
else:
|
||||
self.server.rssIconAtTop = False
|
||||
if 'publish-button-at-top' in themeDesignerParams:
|
||||
if themeDesignerParams['publish-button-at-top'].lower() == 'true':
|
||||
self.server.publishButtonAtTop = True
|
||||
else:
|
||||
self.server.publishButtonAtTop = False
|
||||
if 'newswire-publish-icon' in themeDesignerParams:
|
||||
if themeDesignerParams['newswire-publish-icon'].lower() == 'true':
|
||||
self.server.showPublishAsIcon = True
|
||||
else:
|
||||
self.server.showPublishAsIcon = False
|
||||
if 'icons-as-buttons' in themeDesignerParams:
|
||||
if themeDesignerParams['icons-as-buttons'].lower() == 'true':
|
||||
self.server.iconsAsButtons = True
|
||||
else:
|
||||
self.server.iconsAsButtons = False
|
||||
if 'full-width-timeline-buttons' in themeDesignerParams:
|
||||
themeValue = themeDesignerParams['full-width-timeline-buttons']
|
||||
if themeValue.lower() == 'true':
|
||||
self.server.fullWidthTimelineButtonHeader = True
|
||||
else:
|
||||
self.server.fullWidthTimelineButtonHeader = False
|
||||
|
||||
# redirect back from theme designer screen
|
||||
if callingDomain.endswith('.onion') and onionDomain:
|
||||
originPathStr = \
|
||||
|
|
|
@ -223,39 +223,85 @@ def htmlThemeDesigner(cssCache: {}, baseDir: str,
|
|||
'name="submitThemeDesigner" accesskey="' + submitKey + '">' + \
|
||||
translate['Submit'] + '</button>\n </center>\n'
|
||||
|
||||
themeForm += ' <table class="accesskeys">\n'
|
||||
themeForm += ' <colgroup>\n'
|
||||
themeForm += ' <col span="1" class="accesskeys-left">\n'
|
||||
themeForm += ' <col span="1" class="accesskeys-center">\n'
|
||||
themeForm += ' </colgroup>\n'
|
||||
themeForm += ' <tbody>\n'
|
||||
tableStr = ' <table class="accesskeys">\n'
|
||||
tableStr += ' <colgroup>\n'
|
||||
tableStr += ' <col span="1" class="accesskeys-left">\n'
|
||||
tableStr += ' <col span="1" class="accesskeys-center">\n'
|
||||
tableStr += ' </colgroup>\n'
|
||||
tableStr += ' <tbody>\n'
|
||||
|
||||
fontStr = ' <div class="container">\n' + tableStr
|
||||
colorStr = ' <div class="container">\n' + tableStr
|
||||
dimensionStr = ' <div class="container">\n' + tableStr
|
||||
switchStr = ' <div class="container">\n' + tableStr
|
||||
for variableName, value in themeJson.items():
|
||||
# only use colors defined as hex
|
||||
if not value.startswith('#'):
|
||||
if color_to_hex.get(value):
|
||||
value = color_to_hex[value]
|
||||
else:
|
||||
continue
|
||||
if variableName.endswith('-color') or \
|
||||
variableName.endswith('-text'):
|
||||
if 'font-size' in variableName:
|
||||
variableNameStr = variableName.replace('-', ' ')
|
||||
if variableNameStr.endswith(' color'):
|
||||
variableNameStr = variableNameStr.replace(' color', '')
|
||||
if variableNameStr.endswith(' bg'):
|
||||
variableNameStr = variableNameStr.replace(' bg', ' background')
|
||||
elif variableNameStr.endswith(' fg'):
|
||||
variableNameStr = variableNameStr.replace(' fg', ' foreground')
|
||||
variableNameStr = variableNameStr.title()
|
||||
themeForm += \
|
||||
fontStr += \
|
||||
' <tr><td><label class="labels">' + \
|
||||
variableNameStr + '</label></td>'
|
||||
themeForm += \
|
||||
fontStr += \
|
||||
'<td><input type="text" name="themeSetting_' + \
|
||||
variableName + '" value="' + str(value) + \
|
||||
'" title="' + variableNameStr + '"></td></tr>\n'
|
||||
elif ('-color' in variableName or
|
||||
'-background' in variableName or
|
||||
variableName.endswith('-text')):
|
||||
# only use colors defined as hex
|
||||
if not value.startswith('#'):
|
||||
if color_to_hex.get(value):
|
||||
value = color_to_hex[value]
|
||||
else:
|
||||
continue
|
||||
variableNameStr = variableName.replace('-', ' ')
|
||||
if ' color' in variableNameStr:
|
||||
variableNameStr = variableNameStr.replace(' color', '')
|
||||
if ' bg' in variableNameStr:
|
||||
variableNameStr = variableNameStr.replace(' bg', ' background')
|
||||
elif ' fg' in variableNameStr:
|
||||
variableNameStr = variableNameStr.replace(' fg', ' foreground')
|
||||
if variableNameStr == 'cw':
|
||||
variableNameStr = 'content warning'
|
||||
variableNameStr = variableNameStr.title()
|
||||
colorStr += \
|
||||
' <tr><td><label class="labels">' + \
|
||||
variableNameStr + '</label></td>'
|
||||
colorStr += \
|
||||
'<td><input type="color" name="themeSetting_' + \
|
||||
variableName + '" value="' + str(value) + \
|
||||
'" title="' + variableNameStr + '"></p></td></tr>\n'
|
||||
'" title="' + variableNameStr + '"></td></tr>\n'
|
||||
elif (('-width' in variableName or
|
||||
'-height' in variableName) and
|
||||
(value.lower() != 'true' and value.lower() != 'false')):
|
||||
variableNameStr = variableName.replace('-', ' ')
|
||||
variableNameStr = variableNameStr.title()
|
||||
dimensionStr += \
|
||||
' <tr><td><label class="labels">' + \
|
||||
variableNameStr + '</label></td>'
|
||||
dimensionStr += \
|
||||
'<td><input type="text" name="themeSetting_' + \
|
||||
variableName + '" value="' + str(value) + \
|
||||
'" title="' + variableNameStr + '"></td></tr>\n'
|
||||
elif value.title() == 'True' or value.title() == 'False':
|
||||
variableNameStr = variableName.replace('-', ' ')
|
||||
variableNameStr = variableNameStr.title()
|
||||
switchStr += \
|
||||
' <tr><td><label class="labels">' + \
|
||||
variableNameStr + '</label></td>'
|
||||
checkedStr = ''
|
||||
if value.title() == 'True':
|
||||
checkedStr = ' checked'
|
||||
switchStr += \
|
||||
'<td><input type="checkbox" class="profilecheckbox" ' + \
|
||||
'name="themeSetting_' + variableName + '"' + \
|
||||
checkedStr + '></td></tr>\n'
|
||||
|
||||
themeForm += ' </table>\n'
|
||||
colorStr += ' </table>\n </div>\n'
|
||||
fontStr += ' </table>\n </div>\n'
|
||||
dimensionStr += ' </table>\n </div>\n'
|
||||
switchStr += ' </table>\n </div>\n'
|
||||
themeForm += colorStr + fontStr + dimensionStr + switchStr
|
||||
themeForm += ' </form>\n'
|
||||
themeForm += '</div>\n'
|
||||
themeForm += htmlFooter()
|
||||
|
|
Loading…
Reference in New Issue