From 6c6618fa3baf3359d382add3b7c32007d19e949b Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 25 Feb 2021 22:25:01 +0000 Subject: [PATCH] Substitute instance title within welcome screens --- defaultwelcome/welcome_en.md | 4 ++-- webapp_welcome.py | 12 +++++++++--- webapp_welcome_final.py | 12 +++++++++--- webapp_welcome_profile.py | 12 +++++++++--- 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/defaultwelcome/welcome_en.md b/defaultwelcome/welcome_en.md index 2a90b3a52..c069ae1c6 100644 --- a/defaultwelcome/welcome_en.md +++ b/defaultwelcome/welcome_en.md @@ -1,5 +1,5 @@ -# Welcome -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. +# Welcome to INSTANCE +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. diff --git a/webapp_welcome.py b/webapp_welcome.py index d5530a681..77c868707 100644 --- a/webapp_welcome.py +++ b/webapp_welcome.py @@ -59,17 +59,23 @@ def htmlWelcomeScreen(baseDir: str, nickname: str, defaultFilename = \ baseDir + '/defaultwelcome/' + currScreen + '_en.md' copyfile(defaultFilename, welcomeFilename) + + instanceTitle = \ + getConfigParam(baseDir, 'instanceTitle') + if not instanceTitle: + instanceTitle = 'Epicyon' + if os.path.isfile(welcomeFilename): with open(welcomeFilename, 'r') as welcomeFile: - welcomeText = markdownToHtml(removeHtml(welcomeFile.read())) + welcomeText = welcomeFile.read() + welcomeText = welcomeText.replace('INSTANCE', instanceTitle) + welcomeText = markdownToHtml(removeHtml(welcomeText)) welcomeForm = '' cssFilename = baseDir + '/epicyon-welcome.css' if os.path.isfile(baseDir + '/welcome.css'): cssFilename = baseDir + '/welcome.css' - instanceTitle = \ - getConfigParam(baseDir, 'instanceTitle') welcomeForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle) welcomeForm += \ '
\n' diff --git a/webapp_welcome_profile.py b/webapp_welcome_profile.py index 5f1d4b9ca..341ad5b55 100644 --- a/webapp_welcome_profile.py +++ b/webapp_welcome_profile.py @@ -37,17 +37,23 @@ def htmlWelcomeProfile(baseDir: str, nickname: str, domain: str, if not os.path.isfile(defaultFilename): defaultFilename = baseDir + '/defaultwelcome/profile_en.md' copyfile(defaultFilename, profileFilename) + + instanceTitle = \ + getConfigParam(baseDir, 'instanceTitle') + if not instanceTitle: + instanceTitle = 'Epicyon' + if os.path.isfile(profileFilename): with open(profileFilename, 'r') as profileFile: - profileText = markdownToHtml(removeHtml(profileFile.read())) + profileText = profileFile.read() + profileText = profileText.replace('INSTANCE', instanceTitle) + profileText = markdownToHtml(removeHtml(profileText)) profileForm = '' cssFilename = baseDir + '/epicyon-welcome.css' if os.path.isfile(baseDir + '/welcome.css'): cssFilename = baseDir + '/welcome.css' - instanceTitle = \ - getConfigParam(baseDir, 'instanceTitle') profileForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle) # get the url of the avatar