mirror of https://gitlab.com/bashrc2/epicyon
Extra newlines on text mode login screen
parent
bb371b2f6f
commit
7b8515396b
|
@ -177,6 +177,7 @@ from webapp_utils import csv_following_list
|
|||
from webapp_utils import set_blog_address
|
||||
from webapp_utils import html_show_share
|
||||
from webapp_utils import get_pwa_theme_colors
|
||||
from webapp_utils import text_mode_browser
|
||||
from webapp_calendar import html_calendar_delete_confirm
|
||||
from webapp_calendar import html_calendar
|
||||
from webapp_about import html_about
|
||||
|
@ -190,7 +191,6 @@ from webapp_confirm import html_confirm_unblock
|
|||
from webapp_person_options import person_minimize_images
|
||||
from webapp_person_options import person_undo_minimize_images
|
||||
from webapp_person_options import html_person_options
|
||||
from webapp_timeline import text_mode_browser
|
||||
from webapp_timeline import html_shares
|
||||
from webapp_timeline import html_wanted
|
||||
from webapp_timeline import html_inbox
|
||||
|
@ -15287,7 +15287,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.http_prefix,
|
||||
self.server.domain_full,
|
||||
self.server.system_language,
|
||||
False).encode('utf-8')
|
||||
False, ua_str).encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._logout_headers('text/html', msglen, calling_domain)
|
||||
self._write(msg)
|
||||
|
@ -16995,7 +16995,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.http_prefix,
|
||||
self.server.domain_full,
|
||||
self.server.system_language,
|
||||
True).encode('utf-8')
|
||||
True, ua_str).encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._login_headers('text/html', msglen, calling_domain)
|
||||
self._write(msg)
|
||||
|
|
|
@ -17,6 +17,7 @@ from webapp_utils import set_custom_background
|
|||
from webapp_utils import html_header_with_website_markup
|
||||
from webapp_utils import html_footer
|
||||
from webapp_utils import html_keyboard_navigation
|
||||
from webapp_utils import text_mode_browser
|
||||
from theme import get_text_mode_logo
|
||||
|
||||
|
||||
|
@ -58,7 +59,8 @@ def html_login(translate: {},
|
|||
base_dir: str,
|
||||
http_prefix: str, domain: str,
|
||||
system_language: str,
|
||||
autocomplete: bool) -> str:
|
||||
autocomplete: bool,
|
||||
ua_str: str) -> str:
|
||||
"""Shows the login screen
|
||||
"""
|
||||
accounts = no_of_accounts(base_dir)
|
||||
|
@ -178,14 +180,21 @@ def html_login(translate: {},
|
|||
' <input type="text" ' + autocomplete_nickname_str + \
|
||||
' placeholder="' + translate['Enter Nickname'] + '" ' + \
|
||||
'pattern="' + nickname_pattern + '" name="username" tabindex="1" ' + \
|
||||
'required autofocus>\n' + \
|
||||
'\n' + \
|
||||
'required autofocus>'
|
||||
in_text_mode = text_mode_browser(ua_str)
|
||||
if in_text_mode:
|
||||
login_form += '<br>'
|
||||
login_form += \
|
||||
'\n\n' + \
|
||||
' <label for="password"><b>' + \
|
||||
translate['Password'] + '</b></label>\n' + \
|
||||
' <input type="password" ' + autocomplete_password_str + \
|
||||
' placeholder="' + translate['Enter Password'] + '" ' + \
|
||||
'pattern="{8,256}" name="password" tabindex="1" required>\n' + \
|
||||
login_button_str + register_button_str + '\n' + \
|
||||
'pattern="{8,256}" name="password" tabindex="1" required>'
|
||||
if in_text_mode:
|
||||
login_form += '<br>'
|
||||
login_form += \
|
||||
'\n' + login_button_str + register_button_str + '\n' + \
|
||||
' </div>\n' + \
|
||||
'</form>\n' + \
|
||||
'<a href="https://gitlab.com/bashrc2/epicyon" tabindex="2">' + \
|
||||
|
|
|
@ -23,6 +23,7 @@ from utils import remove_eol
|
|||
from follow import follower_approval_active
|
||||
from person import is_person_snoozed
|
||||
from markdown import markdown_to_html
|
||||
from webapp_utils import text_mode_browser
|
||||
from webapp_utils import html_keyboard_navigation
|
||||
from webapp_utils import html_hide_from_screen_reader
|
||||
from webapp_utils import html_post_separator
|
||||
|
@ -382,16 +383,6 @@ def _html_timeline_keyboard(moderator: bool, text_mode_banner: str,
|
|||
follow_approvals)
|
||||
|
||||
|
||||
def text_mode_browser(ua_str: str) -> bool:
|
||||
"""Does the user agent indicate a text mode browser?
|
||||
"""
|
||||
text_mode_agents = ('Lynx/', 'w3m/', 'Links (', 'Emacs/', 'ELinks')
|
||||
for agent in text_mode_agents:
|
||||
if agent in ua_str:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def _html_timeline_end(base_dir: str, nickname: str, domain_full: str,
|
||||
http_prefix: str, translate: {},
|
||||
moderator: bool, editor: bool,
|
||||
|
|
|
@ -1887,3 +1887,13 @@ def html_common_emoji(base_dir: str, no_of_emoji: int) -> str:
|
|||
ctr += 1
|
||||
line_ctr += 1
|
||||
return html_str
|
||||
|
||||
|
||||
def text_mode_browser(ua_str: str) -> bool:
|
||||
"""Does the user agent indicate a text mode browser?
|
||||
"""
|
||||
text_mode_agents = ('Lynx/', 'w3m/', 'Links (', 'Emacs/', 'ELinks')
|
||||
for agent in text_mode_agents:
|
||||
if agent in ua_str:
|
||||
return True
|
||||
return False
|
||||
|
|
Loading…
Reference in New Issue