Multiple and themed CSS for About and ToS

alt-html-css
Admin 2020-12-03 09:45:41 +00:00
parent 81743813f7
commit 0d36569a27
2 changed files with 36 additions and 12 deletions

View File

@ -9,7 +9,7 @@ __status__ = "Production"
import os
from shutil import copyfile
from utils import getConfigParam
from webapp_utils import htmlHeaderWithExternalStyle
from webapp_utils import htmlHeaderWithExternalStyles
from webapp_utils import htmlFooter
@ -32,12 +32,24 @@ def htmlAbout(cssCache: {}, baseDir: str, httpPrefix: str,
with open(baseDir + '/accounts/about.txt', 'r') as aboutFile:
aboutText = aboutFile.read()
aboutForm = ''
cssFilename = baseDir + '/epicyon-profile.css'
if os.path.isfile(baseDir + '/epicyon.css'):
cssFilename = baseDir + '/epicyon.css'
cssFiles = []
aboutForm = htmlHeaderWithExternalStyle(cssFilename)
aboutForm = ''
cssFiles.append(baseDir + '/epicyon-profile.css')
if os.path.isfile(baseDir + '/epicyon.css'):
cssFiles[0] = baseDir + '/epicyon.css'
# TODO: Clean up and remove this override
cssFiles[0] = 'base.css'
# Get theme-specific css if exists - must be named '<theme-name>.css'
themeName = getConfigParam(baseDir, 'theme')
themePath = f'{baseDir}/theme/{themeName}.css'
if os.path.isfile(themePath):
cssFiles.append('theme/' + themeName + '.css')
aboutForm = htmlHeaderWithExternalStyles(cssFiles)
aboutForm += '<div class="container">' + aboutText + '</div>'
if onionDomain:
aboutForm += \

View File

@ -9,7 +9,7 @@ __status__ = "Production"
import os
from shutil import copyfile
from utils import getConfigParam
from webapp_utils import htmlHeaderWithExternalStyle
from webapp_utils import htmlHeaderWithExternalStyles
from webapp_utils import htmlFooter
@ -32,12 +32,24 @@ def htmlTermsOfService(cssCache: {}, baseDir: str,
with open(baseDir + '/accounts/tos.txt', 'r') as file:
TOSText = file.read()
TOSForm = ''
cssFilename = baseDir + '/epicyon-profile.css'
if os.path.isfile(baseDir + '/epicyon.css'):
cssFilename = baseDir + '/epicyon.css'
cssFiles = []
TOSForm = htmlHeaderWithExternalStyle(cssFilename)
TOSForm = ''
cssFiles.append(baseDir + '/epicyon-profile.css')
if os.path.isfile(baseDir + '/epicyon.css'):
cssFiles[0] = baseDir + '/epicyon.css'
# TODO: Clean up and remove this override
cssFiles[0] = 'base.css'
# Get theme-specific css if exists - must be named '<theme-name>.css'
themeName = getConfigParam(baseDir, 'theme')
themePath = f'{baseDir}/theme/{themeName}.css'
if os.path.isfile(themePath):
cssFiles.append('theme/' + themeName + '.css')
TOSForm = htmlHeaderWithExternalStyles(cssFiles)
TOSForm += '<div class="container">' + TOSText + '</div>\n'
if adminNickname:
adminActor = httpPrefix + '://' + domainFull + \