Substitute instance title within welcome screens

main
Bob Mottram 2021-02-25 22:25:01 +00:00
parent 864bd5a8c2
commit 6c6618fa3b
4 changed files with 29 additions and 11 deletions

View File

@ -1,5 +1,5 @@
# Welcome # Welcome to INSTANCE
Epicyon is an ActivityPub server designed for easy self-hosting of a few people on low power systems, such as single board computers or old laptops. This is an ActivityPub server designed for easy self-hosting of a few people on low power systems, such as single board computers or old laptops.
Run your own social network presence the way you want to, and say goodbye to Big Tech. Run your own social network presence the way you want to, and say goodbye to Big Tech.

View File

@ -59,17 +59,23 @@ def htmlWelcomeScreen(baseDir: str, nickname: str,
defaultFilename = \ defaultFilename = \
baseDir + '/defaultwelcome/' + currScreen + '_en.md' baseDir + '/defaultwelcome/' + currScreen + '_en.md'
copyfile(defaultFilename, welcomeFilename) copyfile(defaultFilename, welcomeFilename)
instanceTitle = \
getConfigParam(baseDir, 'instanceTitle')
if not instanceTitle:
instanceTitle = 'Epicyon'
if os.path.isfile(welcomeFilename): if os.path.isfile(welcomeFilename):
with open(welcomeFilename, 'r') as welcomeFile: with open(welcomeFilename, 'r') as welcomeFile:
welcomeText = markdownToHtml(removeHtml(welcomeFile.read())) welcomeText = welcomeFile.read()
welcomeText = welcomeText.replace('INSTANCE', instanceTitle)
welcomeText = markdownToHtml(removeHtml(welcomeText))
welcomeForm = '' welcomeForm = ''
cssFilename = baseDir + '/epicyon-welcome.css' cssFilename = baseDir + '/epicyon-welcome.css'
if os.path.isfile(baseDir + '/welcome.css'): if os.path.isfile(baseDir + '/welcome.css'):
cssFilename = baseDir + '/welcome.css' cssFilename = baseDir + '/welcome.css'
instanceTitle = \
getConfigParam(baseDir, 'instanceTitle')
welcomeForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle) welcomeForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
welcomeForm += \ welcomeForm += \
'<form enctype="multipart/form-data" method="POST" ' + \ '<form enctype="multipart/form-data" method="POST" ' + \

View File

@ -34,17 +34,23 @@ def htmlWelcomeFinal(baseDir: str, nickname: str, domain: str,
if not os.path.isfile(defaultFilename): if not os.path.isfile(defaultFilename):
defaultFilename = baseDir + '/defaultwelcome/final_en.md' defaultFilename = baseDir + '/defaultwelcome/final_en.md'
copyfile(defaultFilename, finalFilename) copyfile(defaultFilename, finalFilename)
instanceTitle = \
getConfigParam(baseDir, 'instanceTitle')
if not instanceTitle:
instanceTitle = 'Epicyon'
if os.path.isfile(finalFilename): if os.path.isfile(finalFilename):
with open(finalFilename, 'r') as finalFile: with open(finalFilename, 'r') as finalFile:
finalText = markdownToHtml(removeHtml(finalFile.read())) finalText = finalFile.read()
finalText = finalText.replace('INSTANCE', instanceTitle)
finalText = markdownToHtml(removeHtml(finalText))
finalForm = '' finalForm = ''
cssFilename = baseDir + '/epicyon-welcome.css' cssFilename = baseDir + '/epicyon-welcome.css'
if os.path.isfile(baseDir + '/welcome.css'): if os.path.isfile(baseDir + '/welcome.css'):
cssFilename = baseDir + '/welcome.css' cssFilename = baseDir + '/welcome.css'
instanceTitle = \
getConfigParam(baseDir, 'instanceTitle')
finalForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle) finalForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
finalForm += '<div class="container">' + finalText + '</div>\n' finalForm += '<div class="container">' + finalText + '</div>\n'

View File

@ -37,17 +37,23 @@ def htmlWelcomeProfile(baseDir: str, nickname: str, domain: str,
if not os.path.isfile(defaultFilename): if not os.path.isfile(defaultFilename):
defaultFilename = baseDir + '/defaultwelcome/profile_en.md' defaultFilename = baseDir + '/defaultwelcome/profile_en.md'
copyfile(defaultFilename, profileFilename) copyfile(defaultFilename, profileFilename)
instanceTitle = \
getConfigParam(baseDir, 'instanceTitle')
if not instanceTitle:
instanceTitle = 'Epicyon'
if os.path.isfile(profileFilename): if os.path.isfile(profileFilename):
with open(profileFilename, 'r') as profileFile: with open(profileFilename, 'r') as profileFile:
profileText = markdownToHtml(removeHtml(profileFile.read())) profileText = profileFile.read()
profileText = profileText.replace('INSTANCE', instanceTitle)
profileText = markdownToHtml(removeHtml(profileText))
profileForm = '' profileForm = ''
cssFilename = baseDir + '/epicyon-welcome.css' cssFilename = baseDir + '/epicyon-welcome.css'
if os.path.isfile(baseDir + '/welcome.css'): if os.path.isfile(baseDir + '/welcome.css'):
cssFilename = baseDir + '/welcome.css' cssFilename = baseDir + '/welcome.css'
instanceTitle = \
getConfigParam(baseDir, 'instanceTitle')
profileForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle) profileForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
# get the url of the avatar # get the url of the avatar