Variable for text mode banner

merge-requests/16/head
Bob Mottram 2021-02-05 19:14:27 +00:00
parent 17a334bd29
commit f5babf0d01
5 changed files with 81 additions and 43 deletions

View File

@ -7025,6 +7025,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.dormantMonths,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess,
self.server.textModeBanner,
actorJson['roles'],
None, None)
msg = msg.encode('utf-8')
@ -7112,6 +7113,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.dormantMonths,
self.server.peertubeInstances,
allowLocalNetworkAccess,
self.server.textModeBanner,
actorJson['skills'],
None, None)
msg = msg.encode('utf-8')
@ -7503,7 +7505,8 @@ class PubServer(BaseHTTPRequestHandler):
authorized,
self.server.themeName,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess)
self.server.allowLocalNetworkAccess,
self.server.textModeBanner)
if GETstartTime:
self._benchmarkGETtimings(GETstartTime, GETtimings,
'show status done',
@ -7631,7 +7634,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.publishButtonAtTop,
authorized, self.server.themeName,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess)
self.server.allowLocalNetworkAccess,
self.server.textModeBanner)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -7752,7 +7756,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.publishButtonAtTop,
authorized, self.server.themeName,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess)
self.server.allowLocalNetworkAccess,
self.server.textModeBanner)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -7874,7 +7879,8 @@ class PubServer(BaseHTTPRequestHandler):
authorized,
self.server.themeName,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess)
self.server.allowLocalNetworkAccess,
self.server.textModeBanner)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -7996,7 +8002,8 @@ class PubServer(BaseHTTPRequestHandler):
authorized,
self.server.themeName,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess)
self.server.allowLocalNetworkAccess,
self.server.textModeBanner)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -8127,7 +8134,8 @@ class PubServer(BaseHTTPRequestHandler):
authorized,
self.server.themeName,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess)
self.server.allowLocalNetworkAccess,
self.server.textModeBanner)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -8254,7 +8262,8 @@ class PubServer(BaseHTTPRequestHandler):
authorized,
self.server.themeName,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess)
self.server.allowLocalNetworkAccess,
self.server.textModeBanner)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -8342,7 +8351,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.publishButtonAtTop,
authorized, self.server.themeName,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess)
self.server.allowLocalNetworkAccess,
self.server.textModeBanner)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -8447,7 +8457,8 @@ class PubServer(BaseHTTPRequestHandler):
authorized,
self.server.themeName,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess)
self.server.allowLocalNetworkAccess,
self.server.textModeBanner)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -8572,7 +8583,8 @@ class PubServer(BaseHTTPRequestHandler):
authorized,
self.server.themeName,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess)
self.server.allowLocalNetworkAccess,
self.server.textModeBanner)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -8689,7 +8701,8 @@ class PubServer(BaseHTTPRequestHandler):
authorized,
self.server.themeName,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess)
self.server.allowLocalNetworkAccess,
self.server.textModeBanner)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -8796,7 +8809,8 @@ class PubServer(BaseHTTPRequestHandler):
authorized, moderationActionStr,
self.server.themeName,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess)
self.server.allowLocalNetworkAccess,
self.server.textModeBanner)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -8897,6 +8911,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.dormantMonths,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess,
self.server.textModeBanner,
shares,
pageNumber, sharesPerPage)
msg = msg.encode('utf-8')
@ -8994,6 +9009,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.dormantMonths,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess,
self.server.textModeBanner,
following,
pageNumber,
followsPerPage).encode('utf-8')
@ -9091,6 +9107,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.dormantMonths,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess,
self.server.textModeBanner,
followers,
pageNumber,
followsPerPage).encode('utf-8')
@ -9211,6 +9228,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.dormantMonths,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess,
self.server.textModeBanner,
None, None).encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -9777,7 +9795,8 @@ class PubServer(BaseHTTPRequestHandler):
httpPrefix,
self.server.defaultTimeline,
self.server.themeName,
peertubeInstances).encode('utf-8')
peertubeInstances,
self.server.textModeBanner).encode('utf-8')
if msg:
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -13860,6 +13879,9 @@ def runDaemon(verifyAllSignatures: bool,
print('ERROR: HTTP server failed to start. ' + str(e))
return False
# ASCII/ANSI text banner used in shell browsers, such as Lynx
httpd.textModeBanner = None
httpd.unitTest = unitTest
httpd.allowLocalNetworkAccess = allowLocalNetworkAccess
if unitTest:

View File

@ -43,7 +43,8 @@ def htmlModeration(cssCache: {}, defaultTimeline: str,
publishButtonAtTop: bool,
authorized: bool, moderationActionStr: str,
theme: str, peertubeInstances: [],
allowLocalNetworkAccess: bool) -> str:
allowLocalNetworkAccess: bool,
textModeBanner: str) -> str:
"""Show the moderation feed as html
This is what you see when selecting the "mod" timeline
"""
@ -58,7 +59,8 @@ def htmlModeration(cssCache: {}, defaultTimeline: str,
showPublishAsIcon, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, moderationActionStr, theme,
peertubeInstances, allowLocalNetworkAccess)
peertubeInstances, allowLocalNetworkAccess,
textModeBanner)
def htmlAccountInfo(cssCache: {}, translate: {},

View File

@ -473,6 +473,7 @@ def htmlProfile(rssIconAtTop: bool,
newswire: {}, theme: str, dormantMonths: int,
peertubeInstances: [],
allowLocalNetworkAccess: bool,
textModeBanner: str,
extraJson=None, pageNumber=None,
maxItemsPerPage=None) -> str:
"""Show the profile page as html
@ -721,7 +722,7 @@ def htmlProfile(rssIconAtTop: bool,
translate['Shares']: userPathStr + '/shares#timeline',
translate['Logout']: '/logout'
}
profileStr = htmlKeyboardNavigation(navLinks)
profileStr = htmlKeyboardNavigation(textModeBanner, navLinks)
profileStr += profileHeaderStr + donateSection
profileStr += '<div class="container" id="buttonheader">\n'
@ -995,7 +996,8 @@ def _htmlProfileShares(actor: str, translate: {},
def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str,
domain: str, port: int, httpPrefix: str,
defaultTimeline: str, theme: str,
peertubeInstances: []) -> str:
peertubeInstances: [],
textModeBanner: str) -> str:
"""Shows the edit profile screen
"""
imageFormats = getImageFormats()
@ -1349,7 +1351,7 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str,
translate['Switch to profile view']: userPathStr,
translate['Switch to timeline view']: userTimalineStr
}
editProfileForm += htmlKeyboardNavigation(navLinks)
editProfileForm += htmlKeyboardNavigation(textModeBanner, navLinks)
# top banner
editProfileForm += \

View File

@ -65,7 +65,8 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
moderationActionStr: str,
theme: str,
peertubeInstances: [],
allowLocalNetworkAccess: bool) -> str:
allowLocalNetworkAccess: bool,
textModeBanner: str) -> str:
"""Show the timeline as html
"""
enableTimingLog = False
@ -392,7 +393,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
}
if moderator:
navLinks[translate['Mod']] = usersPath + '/moderation'
tlStr += htmlKeyboardNavigation(navLinks,
tlStr += htmlKeyboardNavigation(textModeBanner, navLinks,
usersPath, translate, followApprovals)
# banner and row of buttons
@ -766,7 +767,8 @@ def htmlShares(cssCache: {}, defaultTimeline: str,
publishButtonAtTop: bool,
authorized: bool, theme: str,
peertubeInstances: [],
allowLocalNetworkAccess: bool) -> str:
allowLocalNetworkAccess: bool,
textModeBanner: str) -> str:
"""Show the shares timeline as html
"""
manuallyApproveFollowers = \
@ -787,7 +789,7 @@ def htmlShares(cssCache: {}, defaultTimeline: str,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess)
allowLocalNetworkAccess, textModeBanner)
def htmlInbox(cssCache: {}, defaultTimeline: str,
@ -808,7 +810,8 @@ def htmlInbox(cssCache: {}, defaultTimeline: str,
publishButtonAtTop: bool,
authorized: bool, theme: str,
peertubeInstances: [],
allowLocalNetworkAccess: bool) -> str:
allowLocalNetworkAccess: bool,
textModeBanner: str) -> str:
"""Show the inbox as html
"""
manuallyApproveFollowers = \
@ -829,7 +832,7 @@ def htmlInbox(cssCache: {}, defaultTimeline: str,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess)
allowLocalNetworkAccess, textModeBanner)
def htmlBookmarks(cssCache: {}, defaultTimeline: str,
@ -850,7 +853,8 @@ def htmlBookmarks(cssCache: {}, defaultTimeline: str,
publishButtonAtTop: bool,
authorized: bool, theme: str,
peertubeInstances: [],
allowLocalNetworkAccess: bool) -> str:
allowLocalNetworkAccess: bool,
textModeBanner: str) -> str:
"""Show the bookmarks as html
"""
manuallyApproveFollowers = \
@ -871,7 +875,7 @@ def htmlBookmarks(cssCache: {}, defaultTimeline: str,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess)
allowLocalNetworkAccess, textModeBanner)
def htmlEvents(cssCache: {}, defaultTimeline: str,
@ -892,7 +896,8 @@ def htmlEvents(cssCache: {}, defaultTimeline: str,
publishButtonAtTop: bool,
authorized: bool, theme: str,
peertubeInstances: [],
allowLocalNetworkAccess: bool) -> str:
allowLocalNetworkAccess: bool,
textModeBanner: str) -> str:
"""Show the events as html
"""
manuallyApproveFollowers = \
@ -913,7 +918,7 @@ def htmlEvents(cssCache: {}, defaultTimeline: str,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess)
allowLocalNetworkAccess, textModeBanner)
def htmlInboxDMs(cssCache: {}, defaultTimeline: str,
@ -934,7 +939,8 @@ def htmlInboxDMs(cssCache: {}, defaultTimeline: str,
publishButtonAtTop: bool,
authorized: bool, theme: str,
peertubeInstances: [],
allowLocalNetworkAccess: bool) -> str:
allowLocalNetworkAccess: bool,
textModeBanner: str) -> str:
"""Show the DM timeline as html
"""
return htmlTimeline(cssCache, defaultTimeline,
@ -950,7 +956,7 @@ def htmlInboxDMs(cssCache: {}, defaultTimeline: str,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess)
allowLocalNetworkAccess, textModeBanner)
def htmlInboxReplies(cssCache: {}, defaultTimeline: str,
@ -971,7 +977,8 @@ def htmlInboxReplies(cssCache: {}, defaultTimeline: str,
publishButtonAtTop: bool,
authorized: bool, theme: str,
peertubeInstances: [],
allowLocalNetworkAccess: bool) -> str:
allowLocalNetworkAccess: bool,
textModeBanner: str) -> str:
"""Show the replies timeline as html
"""
return htmlTimeline(cssCache, defaultTimeline,
@ -988,7 +995,7 @@ def htmlInboxReplies(cssCache: {}, defaultTimeline: str,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess)
allowLocalNetworkAccess, textModeBanner)
def htmlInboxMedia(cssCache: {}, defaultTimeline: str,
@ -1009,7 +1016,8 @@ def htmlInboxMedia(cssCache: {}, defaultTimeline: str,
publishButtonAtTop: bool,
authorized: bool, theme: str,
peertubeInstances: [],
allowLocalNetworkAccess: bool) -> str:
allowLocalNetworkAccess: bool,
textModeBanner: str) -> str:
"""Show the media timeline as html
"""
return htmlTimeline(cssCache, defaultTimeline,
@ -1026,7 +1034,7 @@ def htmlInboxMedia(cssCache: {}, defaultTimeline: str,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess)
allowLocalNetworkAccess, textModeBanner)
def htmlInboxBlogs(cssCache: {}, defaultTimeline: str,
@ -1047,7 +1055,8 @@ def htmlInboxBlogs(cssCache: {}, defaultTimeline: str,
publishButtonAtTop: bool,
authorized: bool, theme: str,
peertubeInstances: [],
allowLocalNetworkAccess: bool) -> str:
allowLocalNetworkAccess: bool,
textModeBanner: str) -> str:
"""Show the blogs timeline as html
"""
return htmlTimeline(cssCache, defaultTimeline,
@ -1064,7 +1073,7 @@ def htmlInboxBlogs(cssCache: {}, defaultTimeline: str,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess)
allowLocalNetworkAccess, textModeBanner)
def htmlInboxFeatures(cssCache: {}, defaultTimeline: str,
@ -1086,7 +1095,8 @@ def htmlInboxFeatures(cssCache: {}, defaultTimeline: str,
authorized: bool,
theme: str,
peertubeInstances: [],
allowLocalNetworkAccess: bool) -> str:
allowLocalNetworkAccess: bool,
textModeBanner: str) -> str:
"""Show the features timeline as html
"""
return htmlTimeline(cssCache, defaultTimeline,
@ -1103,7 +1113,7 @@ def htmlInboxFeatures(cssCache: {}, defaultTimeline: str,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess)
allowLocalNetworkAccess, textModeBanner)
def htmlInboxNews(cssCache: {}, defaultTimeline: str,
@ -1124,7 +1134,8 @@ def htmlInboxNews(cssCache: {}, defaultTimeline: str,
publishButtonAtTop: bool,
authorized: bool, theme: str,
peertubeInstances: [],
allowLocalNetworkAccess: bool) -> str:
allowLocalNetworkAccess: bool,
textModeBanner: str) -> str:
"""Show the news timeline as html
"""
return htmlTimeline(cssCache, defaultTimeline,
@ -1141,7 +1152,7 @@ def htmlInboxNews(cssCache: {}, defaultTimeline: str,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess)
allowLocalNetworkAccess, textModeBanner)
def htmlOutbox(cssCache: {}, defaultTimeline: str,
@ -1162,7 +1173,8 @@ def htmlOutbox(cssCache: {}, defaultTimeline: str,
publishButtonAtTop: bool,
authorized: bool, theme: str,
peertubeInstances: [],
allowLocalNetworkAccess: bool) -> str:
allowLocalNetworkAccess: bool,
textModeBanner: str) -> str:
"""Show the Outbox as html
"""
manuallyApproveFollowers = \
@ -1180,4 +1192,4 @@ def htmlOutbox(cssCache: {}, defaultTimeline: str,
showPublishAsIcon, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess)
allowLocalNetworkAccess, textModeBanner)

View File

@ -880,7 +880,7 @@ def getAvatarImageUrl(session,
return avatarUrl
def htmlKeyboardNavigation(links: {},
def htmlKeyboardNavigation(banner: str, links: {},
usersPath=None, translate=None,
followApprovals=False) -> str:
"""Given a set of links return the html for keyboard navigation