mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
cd2590d5ab
commit
da4a288eae
|
@ -137,6 +137,21 @@ from session import get_json
|
|||
MAX_DISPLAY_NAME_LENGTH = 42
|
||||
|
||||
|
||||
def _get_instalce_software_html(title_str: str, software_name: str) -> str:
|
||||
"""Returns the html displaying the type of software
|
||||
such as mastodon, epicyon or pixelfed
|
||||
"""
|
||||
if not software_name:
|
||||
return ''
|
||||
if software_name in title_str:
|
||||
return ''
|
||||
title_str += \
|
||||
'<br><label class="instanceSoftware">' + \
|
||||
'<span itemprop="software">' + \
|
||||
software_name + '</span></label>\n'
|
||||
return title_str
|
||||
|
||||
|
||||
def _get_instance_software(base_dir: str, session,
|
||||
instance_http_prefix: str,
|
||||
instance_domain: str,
|
||||
|
@ -1551,12 +1566,7 @@ def _get_post_title_announce_html(base_dir: str,
|
|||
if mitm or announce_domain in mitm_servers:
|
||||
title_str += mitm_warning_html(translate)
|
||||
|
||||
if software_name:
|
||||
if '[' + software_name + ']' not in title_str:
|
||||
title_str += \
|
||||
'<br><label class="instanceSoftware">' + \
|
||||
'<span itemprop="software">[' + \
|
||||
software_name + ']</span></label>\n'
|
||||
title_str += _get_instalce_software_html(title_str, software_name)
|
||||
|
||||
# show avatar of person replied to
|
||||
announce_actor = attributed_to
|
||||
|
@ -1603,12 +1613,7 @@ def _reply_to_yourself_html(translate: {}, software_name: str) -> str:
|
|||
'" src="/icons' + \
|
||||
'/reply.png" class="announceOrReply"/>\n'
|
||||
|
||||
if software_name:
|
||||
if '[' + software_name + ']' not in title_str:
|
||||
title_str += \
|
||||
'<br><label class="instanceSoftware">' + \
|
||||
'<span itemprop="software">[' + \
|
||||
software_name + ']</span></label>\n'
|
||||
title_str += _get_instalce_software_html(title_str, software_name)
|
||||
return title_str
|
||||
|
||||
|
||||
|
@ -1647,13 +1652,7 @@ def _reply_to_unknown_html(translate: {},
|
|||
post_link + \
|
||||
'" class="announceOrReply" tabindex="10">@unknown</a>\n'
|
||||
|
||||
if software_name:
|
||||
if '[' + software_name + ']' not in title_str:
|
||||
title_str += \
|
||||
'<br><label class="instanceSoftware">' + \
|
||||
'<span itemprop="software">[' + \
|
||||
software_name + ']</span></label>\n'
|
||||
|
||||
title_str += _get_instalce_software_html(title_str, software_name)
|
||||
return title_str
|
||||
|
||||
|
||||
|
@ -1684,13 +1683,7 @@ def _reply_with_unknown_path_html(translate: {},
|
|||
'" class="announceOrReply" tabindex="10">' + \
|
||||
post_domain + mitm_str + '</a>\n'
|
||||
|
||||
if software_name:
|
||||
if '[' + software_name + ']' not in title_str:
|
||||
title_str += \
|
||||
'<br><label class="instanceSoftware">' + \
|
||||
'<span itemprop="software">[' + \
|
||||
software_name + ']</span></label>\n'
|
||||
|
||||
title_str += _get_instalce_software_html(title_str, software_name)
|
||||
return title_str
|
||||
|
||||
|
||||
|
@ -1718,13 +1711,7 @@ def _get_reply_html(translate: {},
|
|||
reply_handle + '">' + '<span itemprop="audience">' + \
|
||||
reply_display_name + '</span></a>\n'
|
||||
|
||||
if software_name:
|
||||
if '[' + software_name + ']' not in title_str:
|
||||
title_str += \
|
||||
'<br><label class="instanceSoftware">' + \
|
||||
'<span itemprop="software">[' + \
|
||||
software_name + ']</span></label>\n'
|
||||
|
||||
title_str += _get_instalce_software_html(title_str, software_name)
|
||||
return title_str
|
||||
|
||||
|
||||
|
@ -1757,13 +1744,7 @@ def _get_post_title_reply_html(base_dir: str,
|
|||
# not a reply
|
||||
reply_id = get_reply_to(obj_json)
|
||||
if not reply_id:
|
||||
if software_name:
|
||||
if software_name:
|
||||
if '[' + software_name + ']' not in title_str:
|
||||
title_str += \
|
||||
'<br><label class="instanceSoftware">' + \
|
||||
'<span itemprop="software">[' + \
|
||||
software_name + ']</span></label>\n'
|
||||
title_str += _get_instalce_software_html(title_str, software_name)
|
||||
return (title_str, reply_avatar_image_in_post,
|
||||
container_class_icons, container_class)
|
||||
|
||||
|
@ -1887,12 +1868,7 @@ def _get_post_title_reply_html(base_dir: str,
|
|||
if mitm or reply_domain in mitm_servers:
|
||||
title_str += mitm_warning_html(translate)
|
||||
|
||||
if software_name:
|
||||
if '[' + software_name + ']' not in title_str:
|
||||
title_str += \
|
||||
'<br><label class="instanceSoftware">' + \
|
||||
'<span itemprop="software">[' + \
|
||||
software_name + ']</span></label>\n'
|
||||
title_str += _get_instalce_software_html(title_str, software_name)
|
||||
|
||||
_log_post_timing(enable_timing_log, post_start_time, '13.7')
|
||||
|
||||
|
|
Loading…
Reference in New Issue