diff --git a/daemon.py b/daemon.py index b05dfe6a2..275a65ddf 100644 --- a/daemon.py +++ b/daemon.py @@ -230,6 +230,7 @@ from media import removeMetaData from cache import storePersonInCache from cache import getPersonFromCache from httpsig import verifyPostHeaders +from theme import getTextModeBanner from theme import setNewsAvatar from theme import setTheme from theme import getTheme @@ -4171,6 +4172,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.themeName = fields['themeDropdown'] setTheme(baseDir, self.server.themeName, domain, allowLocalNetworkAccess) + self.server.textModeBanner = \ + getTextModeBanner(self.server.baseDir) self.server.iconsCache = {} self.server.fontsCache = {} self.server.showPublishAsIcon = \ @@ -4620,6 +4623,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.themeName = currTheme setTheme(baseDir, currTheme, domain, self.server.allowLocalNetworkAccess) + self.server.textModeBanner = \ + getTextModeBanner(self.server.baseDir) self.server.iconsCache = {} self.server.fontsCache = {} self.server.showPublishAsIcon = \ @@ -13880,7 +13885,7 @@ def runDaemon(verifyAllSignatures: bool, return False # ASCII/ANSI text banner used in shell browsers, such as Lynx - httpd.textModeBanner = None + httpd.textModeBanner = getTextModeBanner(baseDir) httpd.unitTest = unitTest httpd.allowLocalNetworkAccess = allowLocalNetworkAccess diff --git a/theme.py b/theme.py index e5e7aa583..031a68de7 100644 --- a/theme.py +++ b/theme.py @@ -422,6 +422,18 @@ def _setThemeFonts(baseDir: str, themeName: str) -> None: break +def getTextModeBanner(baseDir: str) -> str: + """Returns the banner used for shell browsers, like Lynx + """ + textModeBannerFilename = baseDir + '/accounts/banner.txt' + if os.path.isfile(textModeBannerFilename): + with open(textModeBannerFilename, 'r') as fp: + bannerStr = fp.read() + if bannerStr: + return bannerStr.replace('\n', '
') + return None + + def _setThemeImages(baseDir: str, name: str) -> None: """Changes the profile background image and banner to the defaults diff --git a/webapp_utils.py b/webapp_utils.py index 840f555d1..c5eef5454 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -888,7 +888,7 @@ def htmlKeyboardNavigation(banner: str, links: {}, htmlStr = '