Commit 715b69ba authored by Bob Mottram's avatar Bob Mottram
Browse files

Load the text mode banner

parent f3ce5cb4
......@@ -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
......
......@@ -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', '<br>')
return None
def _setThemeImages(baseDir: str, name: str) -> None:
"""Changes the profile background image
and banner to the defaults
......
......@@ -888,7 +888,7 @@ def htmlKeyboardNavigation(banner: str, links: {},
htmlStr = '<div class="transparent"><ul>'
if banner:
htmlStr += banner.replace('\n', '<br>') + '<br>'
htmlStr += banner + '<br>'
# show new follower approvals
if usersPath and translate and followApprovals:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment