mirror of https://gitlab.com/bashrc2/epicyon
Show mitm warning icons on display names
parent
7b0c824006
commit
6ec69bf756
|
@ -751,7 +751,8 @@ def show_person_options(self, calling_domain: str, path: str,
|
|||
self.server.sites_unavailable,
|
||||
youtube, peertube, pixelfed,
|
||||
discord, music_site_url,
|
||||
art_site_url)
|
||||
art_site_url,
|
||||
self.server.mitm_servers)
|
||||
if msg:
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
|
|
|
@ -30,6 +30,7 @@ from follow import is_following_actor
|
|||
from followingCalendar import receiving_calendar_events
|
||||
from notifyOnPost import notify_when_person_posts
|
||||
from person import get_person_notes
|
||||
from webapp_utils import mitm_warning_html
|
||||
from webapp_utils import html_header_with_external_style
|
||||
from webapp_utils import html_footer
|
||||
from webapp_utils import get_broken_link_substitute
|
||||
|
@ -175,7 +176,8 @@ def html_person_options(default_timeline: str,
|
|||
pixelfed: str,
|
||||
discord: str,
|
||||
music_site_url: str,
|
||||
art_site_url: str) -> str:
|
||||
art_site_url: str,
|
||||
mitm_servers: []) -> str:
|
||||
"""Show options for a person: view/follow/block/report
|
||||
"""
|
||||
options_link_str = ''
|
||||
|
@ -313,9 +315,12 @@ def html_person_options(default_timeline: str,
|
|||
handle_shown += ' 💤'
|
||||
if offline:
|
||||
handle_shown += ' [' + translate['offline'].upper() + ']'
|
||||
mitm_str = ''
|
||||
if options_domain in mitm_servers:
|
||||
mitm_str = ' ' + mitm_warning_html(translate)
|
||||
options_str += \
|
||||
' <p class="optionsText">' + translate['Options for'] + \
|
||||
' @' + handle_shown + '</p>\n'
|
||||
' @' + handle_shown + mitm_str + '</p>\n'
|
||||
|
||||
# is sending posts to this account blocked?
|
||||
send_block_filename = \
|
||||
|
|
|
@ -100,6 +100,7 @@ from content import switch_words
|
|||
from content import add_auto_cw
|
||||
from person import is_person_snoozed
|
||||
from person import get_person_avatar_url
|
||||
from webapp_utils import mitm_warning_html
|
||||
from webapp_utils import text_mode_browser
|
||||
from webapp_utils import get_buy_links
|
||||
from webapp_utils import get_banner_file
|
||||
|
@ -1467,7 +1468,7 @@ def _get_post_title_announce_html(base_dir: str,
|
|||
nickname, announce_handle)
|
||||
|
||||
if mitm or announce_domain in mitm_servers:
|
||||
title_str += _mitm_warning_html(translate)
|
||||
title_str += mitm_warning_html(translate)
|
||||
|
||||
# show avatar of person replied to
|
||||
announce_actor = attributed_to
|
||||
|
@ -1550,16 +1551,6 @@ def _reply_to_unknown_html(translate: {},
|
|||
'" class="announceOrReply" tabindex="10">@unknown</a>\n'
|
||||
|
||||
|
||||
def _mitm_warning_html(translate: {}) -> str:
|
||||
"""Returns the html title for a reply to an unknown handle
|
||||
"""
|
||||
mitm_warning_str = translate['mitm']
|
||||
return ' <img loading="lazy" decoding="async" title="' + \
|
||||
mitm_warning_str + '" alt="' + \
|
||||
mitm_warning_str + '" src="/icons' + \
|
||||
'/mitm.png" class="announceOrReply"/>\n'
|
||||
|
||||
|
||||
def _reply_with_unknown_path_html(translate: {},
|
||||
post_json_object: {},
|
||||
post_domain: str,
|
||||
|
@ -1746,7 +1737,7 @@ def _get_post_title_reply_html(base_dir: str,
|
|||
nickname, post_json_object, reply_handle)
|
||||
|
||||
if mitm or reply_domain in mitm_servers:
|
||||
title_str += _mitm_warning_html(translate)
|
||||
title_str += mitm_warning_html(translate)
|
||||
|
||||
_log_post_timing(enable_timing_log, post_start_time, '13.7')
|
||||
|
||||
|
@ -2456,6 +2447,12 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
|||
display_name_is_emoji(display_name):
|
||||
display_name = None
|
||||
actor_handle = actor_nickname + '@' + actor_domain
|
||||
|
||||
# MITM warning icon
|
||||
mitm_str = ''
|
||||
if mitm or actor_domain in mitm_servers:
|
||||
mitm_str = ' ' + mitm_warning_html(translate)
|
||||
|
||||
if display_name:
|
||||
display_name = _enforce_max_display_name_length(display_name)
|
||||
# add emojis
|
||||
|
@ -2469,8 +2466,8 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
|||
nickname + '?options=' + post_actor + \
|
||||
';' + str(page_number) + ';' + avatar_url + message_id_str + \
|
||||
'" tabindex="10" title="' + actor_handle + '">' + \
|
||||
'<span itemprop="author">' + display_name + '</span>' + \
|
||||
'</a>\n'
|
||||
'<span itemprop="author">' + display_name + \
|
||||
mitm_str + '</span></a>\n'
|
||||
else:
|
||||
if not message_id:
|
||||
# pprint(post_json_object)
|
||||
|
@ -2486,7 +2483,8 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
|||
nickname + '?options=' + post_actor + \
|
||||
';' + str(page_number) + ';' + avatar_url + message_id_str + \
|
||||
'" tabindex="10">' + \
|
||||
'@<span itemprop="author">' + actor_handle + '</span></a>\n'
|
||||
'@<span itemprop="author">' + actor_handle + \
|
||||
mitm_str + '</span></a>\n'
|
||||
|
||||
# benchmark 9
|
||||
_log_post_timing(enable_timing_log, post_start_time, '9')
|
||||
|
|
|
@ -2475,3 +2475,13 @@ def html_known_epicyon_instances(base_dir: str, http_prefix: str,
|
|||
'<div class="container">' + instances_text + '</div>\n'
|
||||
html_str += html_footer()
|
||||
return html_str
|
||||
|
||||
|
||||
def mitm_warning_html(translate: {}) -> str:
|
||||
"""Returns html for a MITM warning icon
|
||||
"""
|
||||
mitm_warning_str = translate['mitm']
|
||||
return ' <img loading="lazy" decoding="async" title="' + \
|
||||
mitm_warning_str + '" alt="' + \
|
||||
mitm_warning_str + '" src="/icons' + \
|
||||
'/mitm.png" class="announceOrReply"/>\n'
|
||||
|
|
Loading…
Reference in New Issue