Show type of software used to create post

merge-requests/30/head
Bob Mottram 2025-01-20 17:55:29 +00:00
parent 560d609260
commit a5d5fdf9cf
35 changed files with 621 additions and 253 deletions

View File

@ -65,6 +65,7 @@ from utils import set_config_param
from utils import get_config_param
from utils import load_json
from utils import load_mitm_servers
from utils import load_instance_software
from content import load_auto_cw_cache
from content import load_dogwhistles
from theme import scan_themes_for_scripts
@ -717,6 +718,10 @@ def run_daemon(accounts_data_dir: str,
# servers with man-in-the-middle transport encryption
httpd.mitm_servers = load_mitm_servers(base_dir)
# for each domain name this stores the instance type
# such as mastodon, epicyon, pixelfed, etc
httpd.instance_software = load_instance_software(base_dir)
# default "searchable by" for new posts for each account
httpd.searchable_by_default = load_searchable_by_default(base_dir)

View File

@ -755,7 +755,8 @@ def daemon_http_get(self) -> None:
self.server.block_federated,
self.server.auto_cw_cache,
self.server.default_timeline,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.instance_software):
fitness_performance(getreq_start_time, self.server.fitness,
'_GET', '_show_conversation_thread',
self.server.debug)
@ -1679,7 +1680,8 @@ def daemon_http_get(self) -> None:
self.server.session_i2p,
self.server.http_prefix,
self.server.debug,
self.server.mitm_servers)
self.server.mitm_servers,
self.server.instance_software)
if html_str:
msg = html_str.encode('utf-8')
msglen = len(msg)
@ -3061,7 +3063,8 @@ def daemon_http_get(self) -> None:
self.server.debug,
self.server.buy_sites,
self.server.auto_cw_cache,
self.server.mitm_servers)
self.server.mitm_servers,
self.server.instance_software)
if msg:
msg = msg.encode('utf-8')
msglen = len(msg)
@ -3164,7 +3167,8 @@ def daemon_http_get(self) -> None:
self.server.min_images_for_accounts,
self.server.buy_sites,
self.server.auto_cw_cache,
ua_str, self.server.mitm_servers)
ua_str, self.server.mitm_servers,
self.server.instance_software)
self.server.getreq_busy = False
return
@ -3475,7 +3479,8 @@ def daemon_http_get(self) -> None:
self.server.min_images_for_accounts,
self.server.session_onion,
self.server.session_i2p,
self.server.mitm_servers)
self.server.mitm_servers,
self.server.instance_software)
self.server.getreq_busy = False
return
@ -3578,7 +3583,8 @@ def daemon_http_get(self) -> None:
self.server.session_onion,
self.server.session_i2p,
self.server.session,
self.server.mitm_servers)
self.server.mitm_servers,
self.server.instance_software)
self.server.getreq_busy = False
return
@ -3614,7 +3620,8 @@ def daemon_http_get(self) -> None:
self.server.session,
self.server.session_onion,
self.server.session_i2p,
self.server.mitm_servers)
self.server.mitm_servers,
self.server.instance_software)
self.server.getreq_busy = False
return
@ -3665,7 +3672,8 @@ def daemon_http_get(self) -> None:
self.server.min_images_for_accounts,
self.server.session_onion,
self.server.session_i2p,
self.server.mitm_servers)
self.server.mitm_servers,
self.server.instance_software)
self.server.getreq_busy = False
return
@ -3715,7 +3723,8 @@ def daemon_http_get(self) -> None:
self.server.iconsCache,
self.server.session_onion,
self.server.session_i2p,
self.server.mitm_servers)
self.server.mitm_servers,
self.server.instance_software)
self.server.getreq_busy = False
return
@ -3767,7 +3776,8 @@ def daemon_http_get(self) -> None:
self.server.min_images_for_accounts,
self.server.session_onion,
self.server.session_i2p,
self.server.mitm_servers)
self.server.mitm_servers,
self.server.instance_software)
self.server.getreq_busy = False
return
@ -3818,7 +3828,8 @@ def daemon_http_get(self) -> None:
self.server.min_images_for_accounts,
self.server.session_onion,
self.server.session_i2p,
self.server.mitm_servers)
self.server.mitm_servers,
self.server.instance_software)
self.server.getreq_busy = False
return
@ -3869,7 +3880,8 @@ def daemon_http_get(self) -> None:
self.server.min_images_for_accounts,
self.server.session_onion,
self.server.session_i2p,
self.server.mitm_servers)
self.server.mitm_servers,
self.server.instance_software)
self.server.getreq_busy = False
return
@ -3914,7 +3926,8 @@ def daemon_http_get(self) -> None:
self.server.account_timezone,
self.server.bold_reading,
self.server.fitness,
self.server.mitm_servers)
self.server.mitm_servers,
self.server.instance_software)
self.server.getreq_busy = False
return
@ -3965,7 +3978,8 @@ def daemon_http_get(self) -> None:
self.server.min_images_for_accounts,
self.server.session_onion,
self.server.session_i2p,
self.server.mitm_servers)
self.server.mitm_servers,
self.server.instance_software)
self.server.getreq_busy = False
return
@ -4011,7 +4025,8 @@ def daemon_http_get(self) -> None:
self.server.session_onion,
self.server.session_i2p,
self.server.default_timeline,
self.server.mitm_servers)
self.server.mitm_servers,
self.server.instance_software)
self.server.getreq_busy = False
return
@ -4058,7 +4073,8 @@ def daemon_http_get(self) -> None:
self.server.bold_reading,
self.server.min_images_for_accounts,
self.server.default_timeline,
self.server.mitm_servers)
self.server.mitm_servers,
self.server.instance_software)
self.server.getreq_busy = False
return
@ -4105,7 +4121,8 @@ def daemon_http_get(self) -> None:
self.server.bold_reading,
self.server.min_images_for_accounts,
self.server.default_timeline,
self.server.mitm_servers)
self.server.mitm_servers,
self.server.instance_software)
self.server.getreq_busy = False
return
@ -4456,7 +4473,8 @@ def daemon_http_get(self) -> None:
self.server.buy_sites,
self.server.auto_cw_cache,
self.server.searchable_by_default,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.instance_software):
self.server.getreq_busy = False
return
@ -4503,7 +4521,8 @@ def daemon_http_get(self) -> None:
self.server.onion_domain,
self.server.i2p_domain,
self.server.bold_reading,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.instance_software):
self.server.getreq_busy = False
return
@ -4542,7 +4561,8 @@ def daemon_http_get(self) -> None:
self.server.buy_sites,
self.server.auto_cw_cache,
self.server.fitness,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.instance_software):
self.server.getreq_busy = False
return
@ -4581,7 +4601,8 @@ def daemon_http_get(self) -> None:
self.server.buy_sites,
self.server.auto_cw_cache,
self.server.fitness,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.instance_software):
self.server.getreq_busy = False
return
@ -4630,7 +4651,8 @@ def daemon_http_get(self) -> None:
self.server.fitness,
self.server.onion_domain,
self.server.i2p_domain,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.instance_software):
self.server.getreq_busy = False
return
@ -4687,7 +4709,8 @@ def daemon_http_get(self) -> None:
self.server.fitness,
self.server.onion_domain,
self.server.i2p_domain,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.instance_software):
self.server.getreq_busy = False
return
@ -4745,7 +4768,8 @@ def daemon_http_get(self) -> None:
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.instance_software):
self.server.getreq_busy = False
return
@ -4791,7 +4815,8 @@ def daemon_http_get(self) -> None:
self.server.onion_domain,
self.server.i2p_domain,
self.server.bold_reading,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.instance_software):
self.server.getreq_busy = False
return
@ -4836,7 +4861,8 @@ def daemon_http_get(self) -> None:
self.server.auto_cw_cache,
self.server.onion_domain,
self.server.i2p_domain,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.instance_software):
self.server.getreq_busy = False
return
@ -4899,7 +4925,8 @@ def daemon_http_get(self) -> None:
self.server.onion_domain,
self.server.i2p_domain,
self.server.hide_announces,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.instance_software):
self.server.getreq_busy = False
return
@ -4960,7 +4987,8 @@ def daemon_http_get(self) -> None:
self.server.fitness,
self.server.onion_domain,
self.server.i2p_domain,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.instance_software):
self.server.getreq_busy = False
return
@ -5021,7 +5049,8 @@ def daemon_http_get(self) -> None:
self.server.fitness,
self.server.onion_domain,
self.server.i2p_domain,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.instance_software):
self.server.getreq_busy = False
return
@ -5084,7 +5113,8 @@ def daemon_http_get(self) -> None:
self.server.onion_domain,
self.server.i2p_domain,
self.server.hide_announces,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.instance_software):
self.server.getreq_busy = False
return
@ -5146,7 +5176,8 @@ def daemon_http_get(self) -> None:
self.server.fitness,
self.server.onion_domain,
self.server.i2p_domain,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.instance_software):
self.server.getreq_busy = False
return
@ -5209,7 +5240,8 @@ def daemon_http_get(self) -> None:
self.server.fitness,
self.server.onion_domain,
self.server.i2p_domain,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.instance_software):
self.server.getreq_busy = False
return
@ -5269,7 +5301,8 @@ def daemon_http_get(self) -> None:
self.server.fitness,
self.server.onion_domain,
self.server.i2p_domain,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.instance_software):
self.server.getreq_busy = False
return
@ -5327,7 +5360,8 @@ def daemon_http_get(self) -> None:
self.server.buy_sites,
self.server.auto_cw_cache,
self.server.fitness,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.instance_software):
self.server.getreq_busy = False
return
@ -5381,7 +5415,8 @@ def daemon_http_get(self) -> None:
self.server.buy_sites,
self.server.auto_cw_cache,
self.server.fitness,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.instance_software):
self.server.getreq_busy = False
return
@ -5424,7 +5459,8 @@ def daemon_http_get(self) -> None:
self.server.signing_priv_key_pem,
None,
self.server.block_federated,
self.server.mitm_servers)
self.server.mitm_servers,
self.server.instance_software)
if msg:
msg = msg.encode('utf-8')
msglen = len(msg)
@ -5467,7 +5503,8 @@ def daemon_http_get(self) -> None:
self.server.signing_priv_key_pem,
None,
self.server.block_federated,
self.server.mitm_servers)
self.server.mitm_servers,
self.server.instance_software)
if msg:
msg = msg.encode('utf-8')
msglen = len(msg)
@ -5534,7 +5571,8 @@ def daemon_http_get(self) -> None:
self.server.fitness,
self.server.onion_domain,
self.server.i2p_domain,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.instance_software):
self.server.getreq_busy = False
return
@ -5661,7 +5699,8 @@ def daemon_http_get(self) -> None:
self.server.fitness,
self.server.onion_domain,
self.server.i2p_domain,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.instance_software):
self.server.getreq_busy = False
return

View File

@ -221,7 +221,8 @@ def delete_button(self, calling_domain: str, path: str,
session_onion,
session_i2p,
default_timeline: str,
mitm_servers: []) -> None:
mitm_servers: [],
instance_software: {}) -> None:
"""Delete button is pressed on a post
"""
if not cookie:
@ -316,7 +317,8 @@ def delete_button(self, calling_domain: str, path: str,
min_images_for_accounts,
buy_sites,
auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
if delete_str:
delete_str_len = len(delete_str)
set_headers(self, 'text/html', delete_str_len,

View File

@ -70,7 +70,8 @@ def announce_button(self, calling_domain: str, path: str,
bold_reading_nicknames: {},
min_images_for_accounts: int,
session_onion, session_i2p,
mitm_servers: []) -> None:
mitm_servers: [],
instance_software: {}) -> None:
"""The announce/repeat button was pressed on a post
"""
page_number = 1
@ -261,7 +262,8 @@ def announce_button(self, calling_domain: str, path: str,
minimize_all_images, None,
buy_sites,
auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
actor_absolute = \
get_instance_url(calling_domain,

View File

@ -65,7 +65,8 @@ def bookmark_button(self, calling_domain: str, path: str,
min_images_for_accounts: [],
session_onion,
session_i2p,
mitm_servers: []) -> None:
mitm_servers: [],
instance_software: {}) -> None:
"""Bookmark button was pressed
"""
page_number = 1
@ -216,7 +217,8 @@ def bookmark_button(self, calling_domain: str, path: str,
minimize_all_images, None,
buy_sites,
auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
else:
print('WARN: Bookmarked post not found: ' + bookmark_filename)
actor_absolute = \
@ -275,7 +277,8 @@ def bookmark_button_undo(self, calling_domain: str, path: str,
min_images_for_accounts: [],
session_onion,
session_i2p,
mitm_servers: []) -> None:
mitm_servers: [],
instance_software: {}) -> None:
"""Button pressed to undo a bookmark
"""
page_number = 1
@ -425,7 +428,8 @@ def bookmark_button_undo(self, calling_domain: str, path: str,
minimize_all_images, None,
buy_sites,
auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
else:
print('WARN: Unbookmarked post not found: ' +
bookmark_filename)

View File

@ -67,7 +67,8 @@ def like_button(self, calling_domain: str, path: str,
min_images_for_accounts: [],
session_onion,
session_i2p,
mitm_servers: []) -> None:
mitm_servers: [],
instance_software: {}) -> None:
"""Press the like button
"""
page_number = 1
@ -263,7 +264,8 @@ def like_button(self, calling_domain: str, path: str,
minimize_all_images, None,
buy_sites,
auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
else:
print('WARN: Liked post not found: ' + liked_post_filename)
# clear the icon from the cache so that it gets updated
@ -329,7 +331,8 @@ def like_button_undo(self, calling_domain: str, path: str,
icons_cache: {},
session_onion,
session_i2p,
mitm_servers: []) -> None:
mitm_servers: [],
instance_software: {}) -> None:
"""A button is pressed to undo
"""
page_number = 1
@ -516,7 +519,8 @@ def like_button_undo(self, calling_domain: str, path: str,
minimize_all_images, None,
buy_sites,
auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
else:
print('WARN: Unliked post not found: ' + liked_post_filename)
# clear the icon from the cache so that it gets updated

View File

@ -57,7 +57,8 @@ def mute_button(self, calling_domain: str, path: str,
bold_reading_nicknames: {},
min_images_for_accounts: [],
default_timeline: str,
mitm_servers: []) -> None:
mitm_servers: [],
instance_software: {}) -> None:
"""Mute button is pressed
"""
mute_url = path.split('?mute=')[1]
@ -179,7 +180,8 @@ def mute_button(self, calling_domain: str, path: str,
minimize_all_images, None,
buy_sites,
auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
else:
print('WARN: Muted post not found: ' + mute_filename)
@ -233,7 +235,8 @@ def mute_button_undo(self, calling_domain: str, path: str,
bold_reading_nicknames: {},
min_images_for_accounts: [],
default_timeline: str,
mitm_servers: []) -> None:
mitm_servers: [],
instance_software: {}) -> None:
"""Undo mute button is pressed
"""
mute_url = path.split('?unmute=')[1]
@ -355,7 +358,8 @@ def mute_button_undo(self, calling_domain: str, path: str,
minimize_all_images, None,
buy_sites,
auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
else:
print('WARN: Unmuted post not found: ' + mute_filename)
if calling_domain.endswith('.onion') and onion_domain:

View File

@ -66,7 +66,8 @@ def reaction_button(self, calling_domain: str, path: str,
bold_reading_nicknames: {},
min_images_for_accounts: [],
session_onion, session_i2p,
mitm_servers: []) -> None:
mitm_servers: [],
instance_software: {}) -> None:
"""Press an emoji reaction button
Note that this is not the emoji reaction selection icon at the
bottom of the post
@ -292,7 +293,8 @@ def reaction_button(self, calling_domain: str, path: str,
minimize_all_images, None,
buy_sites,
auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
else:
print('WARN: Emoji reaction post not found: ' +
reaction_post_filename)
@ -355,7 +357,8 @@ def reaction_button_undo(self, calling_domain: str, path: str,
min_images_for_accounts: [],
session_onion,
session_i2p,
mitm_servers: []) -> None:
mitm_servers: [],
instance_software: {}) -> None:
"""A button is pressed to undo emoji reaction
"""
page_number = 1
@ -567,7 +570,8 @@ def reaction_button_undo(self, calling_domain: str, path: str,
minimize_all_images, None,
buy_sites,
auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
else:
print('WARN: Unreaction post not found: ' +
reaction_post_filename)

View File

@ -129,6 +129,8 @@ def show_shares_feed(self, authorized: bool,
bold_reading = True
known_epicyon_instances = \
self.server.known_epicyon_instances
instance_software = \
self.server.instance_software
msg = \
html_profile(signing_priv_key_pem,
rss_icon_at_top,
@ -171,7 +173,8 @@ def show_shares_feed(self, authorized: bool,
no_of_books,
auto_cw_cache,
known_epicyon_instances,
mitm_servers)
mitm_servers,
instance_software)
msg = msg.encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,
@ -318,6 +321,8 @@ def show_following_feed(self, authorized: bool,
following = {}
known_epicyon_instances = \
self.server.known_epicyon_instances
instance_software = \
self.server.instance_software
msg = \
html_profile(signing_priv_key_pem,
@ -362,7 +367,8 @@ def show_following_feed(self, authorized: bool,
no_of_books,
auto_cw_cache,
known_epicyon_instances,
mitm_servers).encode('utf-8')
mitm_servers,
instance_software).encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html',
msglen, cookie, calling_domain, False)
@ -510,6 +516,8 @@ def show_moved_feed(self, authorized: bool,
known_epicyon_instances = \
self.server.known_epicyon_instances
instance_software = \
self.server.instance_software
msg = \
html_profile(signing_priv_key_pem,
@ -554,7 +562,8 @@ def show_moved_feed(self, authorized: bool,
no_of_books,
auto_cw_cache,
known_epicyon_instances,
mitm_servers).encode('utf-8')
mitm_servers,
instance_software).encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html',
msglen, cookie, calling_domain, False)
@ -696,6 +705,8 @@ def show_inactive_feed(self, authorized: bool,
bold_reading = True
known_epicyon_instances = \
self.server.known_epicyon_instances
instance_software = \
self.server.instance_software
msg = \
html_profile(signing_priv_key_pem,
rss_icon_at_top,
@ -739,7 +750,8 @@ def show_inactive_feed(self, authorized: bool,
no_of_books,
auto_cw_cache,
known_epicyon_instances,
mitm_servers).encode('utf-8')
mitm_servers,
instance_software).encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html',
msglen, cookie, calling_domain, False)
@ -883,6 +895,8 @@ def show_followers_feed(self, authorized: bool,
bold_reading = True
known_epicyon_instances = \
self.server.known_epicyon_instances
instance_software = \
self.server.instance_software
msg = \
html_profile(signing_priv_key_pem,
rss_icon_at_top,
@ -927,7 +941,8 @@ def show_followers_feed(self, authorized: bool,
no_of_books,
auto_cw_cache,
known_epicyon_instances,
mitm_servers).encode('utf-8')
mitm_servers,
instance_software).encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,
cookie, calling_domain, False)

View File

@ -170,7 +170,8 @@ def hashtag_search2(self, calling_domain: str,
buy_sites: [],
auto_cw_cache: {},
ua_str: str,
mitm_servers: []) -> None:
mitm_servers: [],
instance_software: {}) -> None:
"""Return the result of a hashtag search
"""
page_number = 1
@ -238,7 +239,8 @@ def hashtag_search2(self, calling_domain: str,
min_images_for_accounts,
buy_sites,
auto_cw_cache, ua_str,
mitm_servers)
mitm_servers,
instance_software)
if hashtag_str:
msg = hashtag_str.encode('utf-8')
msglen = len(msg)

View File

@ -85,7 +85,8 @@ def _show_post_from_file(self, post_filename: str, liked_by: str,
fitness: {}, path: str,
onion_domain: str,
i2p_domain: str,
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""Shows an individual post from its filename
"""
if not os.path.isfile(post_filename):
@ -164,7 +165,8 @@ def _show_post_from_file(self, post_filename: str, liked_by: str,
min_images_for_accounts,
buy_sites,
auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
msg = msg.encode('utf-8')
msglen = len(msg)
set_html_post_headers(self, msglen,
@ -244,7 +246,8 @@ def show_individual_post(self, ssml_getreq: bool, authorized: bool,
auto_cw_cache: {},
onion_domain: str,
i2p_domain: str,
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""Shows an individual post
"""
liked_by = None
@ -350,7 +353,8 @@ def show_individual_post(self, ssml_getreq: bool, authorized: bool,
fitness, path,
onion_domain,
i2p_domain,
mitm_servers)
mitm_servers,
instance_software)
fitness_performance(getreq_start_time, fitness,
'_GET', 'show_individual_post',
@ -399,7 +403,8 @@ def show_new_post(self, edit_post_params: {},
buy_sites: [],
auto_cw_cache: {},
searchable_by_default_dict: [],
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""Shows the new post screen
"""
searchable_by_default = 'yourself'
@ -526,7 +531,8 @@ def show_new_post(self, edit_post_params: {},
default_buy_site,
auto_cw_cache,
searchable_by_default,
mitm_servers)
mitm_servers,
instance_software)
if not msg:
print('Error replying to ' + in_reply_to_url)
http_404(self, 104)
@ -577,7 +583,8 @@ def show_individual_at_post(self, ssml_getreq: bool, authorized: bool,
onion_domain: str,
i2p_domain: str,
bold_reading_nicknames: {},
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""get an individual post from the path /@nickname/statusnumber
"""
if '/@' not in path:
@ -689,7 +696,8 @@ def show_individual_at_post(self, ssml_getreq: bool, authorized: bool,
fitness, path,
onion_domain,
i2p_domain,
mitm_servers)
mitm_servers,
instance_software)
fitness_performance(getreq_start_time, fitness,
'_GET', 'show_individual_at_post',
@ -728,7 +736,8 @@ def show_likers_of_post(self, authorized: bool,
buy_sites: [],
auto_cw_cache: {},
fitness: {},
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""Show the likers of a post
"""
if not authorized:
@ -777,7 +786,8 @@ def show_likers_of_post(self, authorized: bool,
min_images_for_accounts,
buy_sites,
auto_cw_cache, 'likes',
mitm_servers)
mitm_servers,
instance_software)
if not msg:
http_404(self, 69)
return True
@ -823,7 +833,8 @@ def show_announcers_of_post(self, authorized: bool,
buy_sites: [],
auto_cw_cache: {},
fitness: {},
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""Show the announcers of a post
"""
if not authorized:
@ -872,7 +883,8 @@ def show_announcers_of_post(self, authorized: bool,
min_images_for_accounts,
buy_sites,
auto_cw_cache,
'shares', mitm_servers)
'shares', mitm_servers,
instance_software)
if not msg:
http_404(self, 70)
return True
@ -920,7 +932,8 @@ def show_replies_to_post(self, authorized: bool,
fitness: {},
onion_domain: str,
i2p_domain: str,
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""Shows the replies to a post
"""
if not ('/statuses/' in path and '/users/' in path):
@ -1021,7 +1034,8 @@ def show_replies_to_post(self, authorized: bool,
min_images_for_accounts,
buy_sites,
auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
msg = msg.encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,
@ -1134,7 +1148,8 @@ def show_replies_to_post(self, authorized: bool,
min_images_for_accounts,
buy_sites,
auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
msg = msg.encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,
@ -1202,7 +1217,8 @@ def show_notify_post(self, authorized: bool,
onion_domain: str,
i2p_domain: str,
bold_reading_nicknames: {},
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""Shows an individual post from an account which you are following
and where you have the notify checkbox set on person options
"""
@ -1261,7 +1277,8 @@ def show_notify_post(self, authorized: bool,
fitness, path,
onion_domain,
i2p_domain,
mitm_servers)
mitm_servers,
instance_software)
fitness_performance(getreq_start_time, fitness,
'_GET', 'show_notify_post',
debug)
@ -1304,7 +1321,8 @@ def show_conversation_thread(self, authorized: bool,
block_federated: {},
auto_cw_cache: {},
default_timeline: str,
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""get conversation thread from the date link on a post
"""
if not path.startswith('/users/'):
@ -1387,7 +1405,8 @@ def show_conversation_thread(self, authorized: bool,
auto_cw_cache,
ua_str,
default_timeline,
mitm_servers)
mitm_servers,
instance_software)
if conv_str:
msg = conv_str.encode('utf-8')
msglen = len(msg)

View File

@ -113,6 +113,8 @@ def show_person_profile(self, authorized: bool,
bold_reading = True
known_epicyon_instances = \
self.server.known_epicyon_instances
instance_software = \
self.server.instance_software
msg = \
html_profile(signing_priv_key_pem,
rss_icon_at_top,
@ -152,7 +154,8 @@ def show_person_profile(self, authorized: bool,
no_of_books,
auto_cw_cache,
known_epicyon_instances,
mitm_servers).encode('utf-8')
mitm_servers,
instance_software).encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,
cookie, calling_domain, False)
@ -273,6 +276,8 @@ def show_roles(self, calling_domain: str, referer_domain: str,
bold_reading = True
known_epicyon_instances = \
self.server.known_epicyon_instances
instance_software = \
self.server.instance_software
msg = \
html_profile(signing_priv_key_pem,
rss_icon_at_top,
@ -312,7 +317,8 @@ def show_roles(self, calling_domain: str, referer_domain: str,
no_of_books,
auto_cw_cache,
known_epicyon_instances,
mitm_servers)
mitm_servers,
instance_software)
msg = msg.encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,
@ -425,6 +431,8 @@ def show_skills(self, calling_domain: str, referer_domain: str,
bold_reading = True
known_epicyon_instances = \
self.server.known_epicyon_instances
instance_software = \
self.server.instance_software
msg = \
html_profile(signing_priv_key_pem,
rss_icon_at_top,
@ -466,7 +474,8 @@ def show_skills(self, calling_domain: str, referer_domain: str,
no_of_books,
auto_cw_cache,
known_epicyon_instances,
mitm_servers)
mitm_servers,
instance_software)
msg = msg.encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,

View File

@ -48,7 +48,8 @@ def reaction_picker2(self, calling_domain: str, path: str,
account_timezone: {},
bold_reading_nicknames: {},
fitness: {},
mitm_servers: []) -> None:
mitm_servers: [],
instance_software: {}) -> None:
"""Press the emoji reaction picker icon at the bottom of the post
"""
page_number = 1
@ -151,7 +152,8 @@ def reaction_picker2(self, calling_domain: str, path: str,
min_images_for_accounts,
buy_sites,
auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
msg = msg.encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,

View File

@ -157,6 +157,7 @@ def show_media_timeline(self, authorized: bool,
show_announces = False
known_epicyon_instances = \
self.server.known_epicyon_instances
instance_software = self.server.instance_software
msg = \
html_inbox_media(default_timeline,
recent_posts_cache,
@ -205,7 +206,8 @@ def show_media_timeline(self, authorized: bool,
auto_cw_cache,
show_announces,
known_epicyon_instances,
mitm_servers)
mitm_servers,
instance_software)
msg = msg.encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,
@ -369,6 +371,8 @@ def show_blogs_timeline(self, authorized: bool,
last_post_id = last_post_id.split(';')[0]
known_epicyon_instances = \
self.server.known_epicyon_instances
instance_software = \
self.server.instance_software
msg = \
html_inbox_blogs(default_timeline,
recent_posts_cache,
@ -416,7 +420,8 @@ def show_blogs_timeline(self, authorized: bool,
buy_sites,
auto_cw_cache,
known_epicyon_instances,
mitm_servers)
mitm_servers,
instance_software)
msg = msg.encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,
@ -584,6 +589,8 @@ def show_news_timeline(self, authorized: bool,
reverse_sequence = True
known_epicyon_instances = \
self.server.known_epicyon_instances
instance_software = \
self.server.instance_software
msg = \
html_inbox_news(default_timeline,
recent_posts_cache,
@ -632,7 +639,8 @@ def show_news_timeline(self, authorized: bool,
buy_sites,
auto_cw_cache,
known_epicyon_instances,
mitm_servers)
mitm_servers,
instance_software)
msg = msg.encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,
@ -795,6 +803,7 @@ def show_features_timeline(self, authorized: bool,
reverse_sequence = True
known_epicyon_instances = \
self.server.known_epicyon_instances
instance_software = self.server.instance_software
msg = \
html_inbox_features(default_timeline,
recent_posts_cache,
@ -843,7 +852,8 @@ def show_features_timeline(self, authorized: bool,
buy_sites,
auto_cw_cache,
known_epicyon_instances,
mitm_servers)
mitm_servers,
instance_software)
msg = msg.encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,
@ -970,6 +980,7 @@ def show_shares_timeline(self, authorized: bool,
reverse_sequence = True
known_epicyon_instances = \
self.server.known_epicyon_instances
instance_software = self.server.instance_software
msg = \
html_shares(default_timeline,
recent_posts_cache,
@ -1014,7 +1025,8 @@ def show_shares_timeline(self, authorized: bool,
buy_sites,
auto_cw_cache,
known_epicyon_instances,
mitm_servers)
mitm_servers,
instance_software)
msg = msg.encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,
@ -1117,6 +1129,7 @@ def show_wanted_timeline(self, authorized: bool,
reverse_sequence = True
known_epicyon_instances = \
self.server.known_epicyon_instances
instance_software = self.server.instance_software
msg = \
html_wanted(default_timeline,
recent_posts_cache,
@ -1161,7 +1174,8 @@ def show_wanted_timeline(self, authorized: bool,
buy_sites,
auto_cw_cache,
known_epicyon_instances,
mitm_servers)
mitm_servers,
instance_software)
msg = msg.encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,
@ -1297,6 +1311,7 @@ def show_bookmarks_timeline(self, authorized: bool,
reverse_sequence = True
known_epicyon_instances = \
self.server.known_epicyon_instances
instance_software = self.server.instance_software
msg = \
html_bookmarks(default_timeline,
recent_posts_cache,
@ -1344,7 +1359,8 @@ def show_bookmarks_timeline(self, authorized: bool,
buy_sites,
auto_cw_cache,
known_epicyon_instances,
mitm_servers)
mitm_servers,
instance_software)
msg = msg.encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,
@ -1509,6 +1525,7 @@ def show_outbox_timeline(self, authorized: bool,
show_announces = False
known_epicyon_instances = \
self.server.known_epicyon_instances
instance_software = self.server.instance_software
msg = \
html_outbox(default_timeline,
recent_posts_cache,
@ -1555,7 +1572,8 @@ def show_outbox_timeline(self, authorized: bool,
auto_cw_cache,
show_announces,
known_epicyon_instances,
mitm_servers)
mitm_servers,
instance_software)
msg = msg.encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,
@ -1701,6 +1719,7 @@ def show_mod_timeline(self, authorized: bool,
reverse_sequence = True
known_epicyon_instances = \
self.server.known_epicyon_instances
instance_software = self.server.instance_software
msg = \
html_moderation(default_timeline,
recent_posts_cache,
@ -1748,7 +1767,8 @@ def show_mod_timeline(self, authorized: bool,
buy_sites,
auto_cw_cache,
known_epicyon_instances,
mitm_servers)
mitm_servers,
instance_software)
msg = msg.encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,
@ -1909,6 +1929,7 @@ def show_dms(self, authorized: bool,
last_post_id = last_post_id.split(';')[0]
known_epicyon_instances = \
self.server.known_epicyon_instances
instance_software = self.server.instance_software
msg = \
html_inbox_dms(default_timeline,
recent_posts_cache,
@ -1955,7 +1976,8 @@ def show_dms(self, authorized: bool,
buy_sites,
auto_cw_cache,
known_epicyon_instances,
mitm_servers)
mitm_servers,
instance_software)
msg = msg.encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,
@ -2119,6 +2141,7 @@ def show_replies(self, authorized: bool,
last_post_id = last_post_id.split(';')[0]
known_epicyon_instances = \
self.server.known_epicyon_instances
instance_software = self.server.instance_software
msg = \
html_inbox_replies(default_timeline,
recent_posts_cache,
@ -2166,7 +2189,8 @@ def show_replies(self, authorized: bool,
buy_sites,
auto_cw_cache,
known_epicyon_instances,
mitm_servers)
mitm_servers,
instance_software)
msg = msg.encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,
@ -2341,6 +2365,7 @@ def show_inbox(self, authorized: bool,
show_announces = False
known_epicyon_instances = \
self.server.known_epicyon_instances
instance_software = self.server.instance_software
msg = \
html_inbox(default_timeline,
recent_posts_cache,
@ -2390,7 +2415,8 @@ def show_inbox(self, authorized: bool,
auto_cw_cache,
show_announces,
known_epicyon_instances,
mitm_servers)
mitm_servers,
instance_software)
if getreq_start_time:
fitness_performance(getreq_start_time, fitness,
'_GET', '_show_inbox3',

View File

@ -478,7 +478,8 @@ def daemon_http_post(self) -> None:
self.server.max_shares_on_profile,
self.server.no_of_books,
self.server.shared_items_federated_domains,
ua_str, self.server.mitm_servers)
ua_str, self.server.mitm_servers,
self.server.instance_software)
self.server.postreq_busy = False
return
@ -740,7 +741,8 @@ def daemon_http_post(self) -> None:
self.server.newswire,
self.server.block_federated,
self.server.mitm_servers,
ua_str)
ua_str,
self.server.instance_software)
self.server.postreq_busy = False
return
@ -911,7 +913,8 @@ def daemon_http_post(self) -> None:
self.server.watermark_width_percent,
self.server.watermark_position,
self.server.watermark_opacity,
self.server.mitm_servers)
self.server.mitm_servers,
self.server.instance_software)
if page_number:
print(curr_post_type + ' post received')
nickname = self.path.split('/users/')[1]

View File

@ -248,7 +248,8 @@ def _person_options_view(self, options_confirm_params: str,
calling_domain: str,
curr_session, access_keys: {},
mitm_servers: [],
ua_str: str) -> bool:
ua_str: str,
instance_software: {}) -> bool:
"""Person options screen, view button
See html_person_options
"""
@ -330,7 +331,8 @@ def _person_options_view(self, options_confirm_params: str,
no_of_books,
auto_cw_cache,
mitm_servers,
ua_str)
ua_str,
instance_software)
if profile_str:
msg = profile_str.encode('utf-8')
msglen = len(msg)
@ -919,7 +921,8 @@ def _person_options_dm(self, options_confirm_params: str,
auto_cw_cache: {},
cookie: str, calling_domain: str,
access_keys: {},
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""Person options screen, DM button
See html_person_options
"""
@ -1001,7 +1004,8 @@ def _person_options_dm(self, options_confirm_params: str,
default_buy_site,
auto_cw_cache,
searchable_by_default,
mitm_servers)
mitm_servers,
instance_software)
if msg:
msg = msg.encode('utf-8')
msglen = len(msg)
@ -1158,7 +1162,8 @@ def _person_options_report(self, options_confirm_params: str,
auto_cw_cache: {},
cookie: str, calling_domain: str,
access_keys: {},
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""Person options screen, report button
See html_person_options
"""
@ -1240,7 +1245,8 @@ def _person_options_report(self, options_confirm_params: str,
default_buy_site,
auto_cw_cache,
searchable_by_default,
mitm_servers)
mitm_servers,
instance_software)
if msg:
msg = msg.encode('utf-8')
msglen = len(msg)
@ -1292,7 +1298,8 @@ def person_options2(self, path: str,
newswire: {},
block_federated: [],
mitm_servers: [],
ua_str: str) -> None:
ua_str: str,
instance_software: {}) -> None:
"""Receive POST from person options screen
"""
page_number = 1
@ -1422,7 +1429,8 @@ def person_options2(self, path: str,
calling_domain,
curr_session, access_keys,
mitm_servers,
ua_str):
ua_str,
instance_software):
return
if _person_option_receive_petname(self, options_confirm_params,
@ -1632,7 +1640,8 @@ def person_options2(self, path: str,
auto_cw_cache,
cookie, calling_domain,
access_keys,
mitm_servers):
mitm_servers,
instance_software):
return
if _person_options_info(self, options_confirm_params,
@ -1701,7 +1710,8 @@ def person_options2(self, path: str,
auto_cw_cache,
cookie, calling_domain,
access_keys,
mitm_servers):
mitm_servers,
instance_software):
return
# redirect back from person options screen

View File

@ -112,7 +112,8 @@ def _receive_new_post_process_newpost(self, fields: {},
max_replies: int,
onion_domain: str,
i2p_domain: str,
mitm_servers: []) -> int:
mitm_servers: [],
instance_software: {}) -> int:
""" A new post has been received from the New Post screen and
is then sent to the outbox
"""
@ -220,7 +221,8 @@ def _receive_new_post_process_newpost(self, fields: {},
buy_sites,
auto_cw_cache,
onion_domain, i2p_domain,
mitm_servers)
mitm_servers,
instance_software)
print('DEBUG: sending edited public post ' +
str(message_json))
if fields['schedulePost']:
@ -527,7 +529,8 @@ def _receive_new_post_process_newunlisted(self, fields: {},
max_replies: int,
onion_domain: str,
i2p_domain: str,
mitm_servers: []) -> int:
mitm_servers: [],
instance_software: {}) -> int:
"""Unlisted post has been received from New Post screen
and is then sent to the outbox
"""
@ -621,7 +624,8 @@ def _receive_new_post_process_newunlisted(self, fields: {},
buy_sites,
auto_cw_cache,
onion_domain, i2p_domain,
mitm_servers)
mitm_servers,
instance_software)
print('DEBUG: sending edited unlisted post ' +
str(message_json))
@ -683,7 +687,8 @@ def _receive_new_post_process_newfollowers(self, fields: {},
max_replies: int,
onion_domain: str,
i2p_domain: str,
mitm_servers: []) -> int:
mitm_servers: [],
instance_software: {}) -> int:
"""Followers only post has been received from New Post screen
and is then sent to the outbox
"""
@ -787,7 +792,8 @@ def _receive_new_post_process_newfollowers(self, fields: {},
buy_sites,
auto_cw_cache,
onion_domain, i2p_domain,
mitm_servers)
mitm_servers,
instance_software)
print('DEBUG: sending edited followers post ' +
str(message_json))
@ -850,7 +856,8 @@ def _receive_new_post_process_newdm(self, fields: {},
max_replies: int,
onion_domain: str,
i2p_domain: str,
mitm_servers: []) -> int:
mitm_servers: [],
instance_software: {}) -> int:
"""Direct message post has been received from New Post screen
and is then sent to the outbox
"""
@ -961,7 +968,8 @@ def _receive_new_post_process_newdm(self, fields: {},
buy_sites,
auto_cw_cache,
onion_domain, i2p_domain,
mitm_servers)
mitm_servers,
instance_software)
print('DEBUG: sending edited dm post ' +
str(message_json))
@ -1023,7 +1031,8 @@ def _receive_new_post_process_newreminder(self, fields: {}, nickname: str,
proxy_type: str,
onion_domain: str,
i2p_domain: str,
mitm_servers: []) -> int:
mitm_servers: [],
instance_software: {}) -> int:
"""Reminder post has been received from New Post screen
and is then sent to the outbox
"""
@ -1119,7 +1128,8 @@ def _receive_new_post_process_newreminder(self, fields: {}, nickname: str,
buy_sites,
auto_cw_cache,
onion_domain, i2p_domain,
mitm_servers)
mitm_servers,
instance_software)
print('DEBUG: sending edited reminder post ' +
str(message_json))
if post_to_outbox(self, message_json,
@ -1325,7 +1335,8 @@ def _receive_new_post_process_newreading(self, fields: {},
max_replies: int,
onion_domain: str,
i2p_domain: str,
mitm_servers: []) -> int:
mitm_servers: [],
instance_software: {}) -> int:
"""Reading status post has been received from New Post screen
and is then sent to the outbox
"""
@ -1439,7 +1450,8 @@ def _receive_new_post_process_newreading(self, fields: {},
buy_sites,
auto_cw_cache,
onion_domain, i2p_domain,
mitm_servers)
mitm_servers,
instance_software)
print('DEBUG: sending edited reading status post ' +
str(message_json))
if fields['schedulePost']:
@ -1648,7 +1660,8 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
watermark_width_percent: int,
watermark_position: str,
watermark_opacity: int,
mitm_servers: []) -> int:
mitm_servers: [],
instance_software: {}) -> int:
# Note: this needs to happen synchronously
# 0=this is not a new post
# 1=new post success
@ -1908,7 +1921,8 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
max_replies,
onion_domain,
i2p_domain,
mitm_servers)
mitm_servers,
instance_software)
if post_type == 'newblog':
return _receive_new_post_process_newblog(
self, fields,
@ -2261,7 +2275,8 @@ def receive_new_post(self, post_type, path: str,
watermark_width_percent: int,
watermark_position: str,
watermark_opacity: int,
mitm_servers: []) -> int:
mitm_servers: [],
instance_software: {}) -> int:
"""A new post has been created
This creates a thread to send the new post
"""
@ -2403,7 +2418,8 @@ def receive_new_post(self, post_type, path: str,
watermark_width_percent,
watermark_position,
watermark_opacity,
mitm_servers)
mitm_servers,
instance_software)
if debug:
print('DEBUG: _receive_new_post_process returned ' +
str(retval))

View File

@ -86,7 +86,8 @@ def _receive_search_hashtag(self, actor_str: str,
auto_cw_cache: {},
calling_domain: str,
ua_str: str,
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""Receive a search for a hashtag from the search screen
"""
nickname = get_nickname_from_actor(actor_str)
@ -135,7 +136,8 @@ def _receive_search_hashtag(self, actor_str: str,
min_images_for_accounts,
buy_sites,
auto_cw_cache, ua_str,
mitm_servers)
mitm_servers,
instance_software)
if hashtag_str:
msg = hashtag_str.encode('utf-8')
msglen = len(msg)
@ -218,7 +220,8 @@ def _receive_search_my_posts(self, search_str: str,
buy_sites: [],
auto_cw_cache: {},
calling_domain: str,
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""Receive a search for your own posts from the search screen
"""
# your post history search
@ -285,7 +288,8 @@ def _receive_search_my_posts(self, search_str: str,
min_images_for_accounts,
buy_sites,
auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
if history_str:
msg = history_str.encode('utf-8')
msglen = len(msg)
@ -331,7 +335,8 @@ def _receive_search_bookmarks(self, search_str: str,
buy_sites: [],
auto_cw_cache: {},
calling_domain: str,
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""Receive a search for bookmarked posts from the search screen
"""
# bookmark search
@ -398,7 +403,8 @@ def _receive_search_bookmarks(self, search_str: str,
min_images_for_accounts,
buy_sites,
auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
if bookmarks_str:
msg = bookmarks_str.encode('utf-8')
msglen = len(msg)
@ -446,7 +452,8 @@ def _receive_search_handle(self, search_str: str,
actor_str: str,
curr_session, access_keys: {},
mitm_servers: [],
ua_str: str) -> bool:
ua_str: str,
instance_software: {}) -> bool:
"""Receive a search for a fediverse handle or url from the search screen
"""
remote_only = False
@ -603,7 +610,8 @@ def _receive_search_handle(self, search_str: str,
no_of_books,
auto_cw_cache,
mitm_servers,
ua_str)
ua_str,
instance_software)
if profile_str:
msg = profile_str.encode('utf-8')
msglen = len(msg)
@ -766,7 +774,8 @@ def receive_search_query(self, calling_domain: str, cookie: str,
no_of_books: int,
shared_items_federated_domains: [],
ua_str: str,
mitm_servers: []) -> None:
mitm_servers: [],
instance_software: {}) -> None:
"""Receive a search query
"""
# get the page number
@ -873,7 +882,8 @@ def receive_search_query(self, calling_domain: str, cookie: str,
auto_cw_cache,
calling_domain,
ua_str,
mitm_servers):
mitm_servers,
instance_software):
return
elif (search_str.startswith('*') or
search_str.endswith(' skill')):
@ -922,7 +932,8 @@ def receive_search_query(self, calling_domain: str, cookie: str,
buy_sites,
auto_cw_cache,
calling_domain,
mitm_servers):
mitm_servers,
instance_software):
return
elif (search_str.startswith('-') or
string_ends_with(search_str, bookmark_endings)):
@ -960,7 +971,8 @@ def receive_search_query(self, calling_domain: str, cookie: str,
buy_sites,
auto_cw_cache,
calling_domain,
mitm_servers):
mitm_servers,
instance_software):
return
elif ('@' in search_str or
('://' in search_str and
@ -1000,7 +1012,8 @@ def receive_search_query(self, calling_domain: str, cookie: str,
auto_cw_cache, actor_str,
curr_session, access_keys,
mitm_servers,
ua_str):
ua_str,
instance_software):
return
elif (search_str.startswith(':') or
search_str.endswith(' emoji')):

View File

@ -143,7 +143,8 @@ def post_to_outbox(self, message_json: {}, version: str,
self.server.max_cached_readers,
self.server.auto_cw_cache,
self.server.block_federated,
self.server.mitm_servers)
self.server.mitm_servers,
self.server.instance_software)
def _get_outbox_thread_index(self, nickname: str,

View File

@ -191,7 +191,8 @@ def _inbox_store_post_to_html_cache(recent_posts_cache: {},
min_images_for_accounts: [],
buy_sites: {},
auto_cw_cache: {},
mitm_servers: []) -> None:
mitm_servers: [],
instance_software: {}) -> None:
"""Converts the json post into html and stores it in a cache
This enables the post to be quickly displayed later
"""
@ -222,7 +223,7 @@ def _inbox_store_post_to_html_cache(recent_posts_cache: {},
cw_lists, lists_enabled, timezone, mitm,
bold_reading, dogwhistles, minimize_all_images,
None, buy_sites, auto_cw_cache,
mitm_servers)
mitm_servers, instance_software)
def valid_inbox(base_dir: str, nickname: str, domain: str) -> bool:
@ -805,7 +806,8 @@ def update_edited_post(base_dir: str,
auto_cw_cache: {},
onion_domain: str,
i2p_domain: str,
mitm_servers: []) -> None:
mitm_servers: [],
instance_software: {}) -> None:
""" When an edited post is created this assigns
a published and updated date to it, and uses
the previous id
@ -856,7 +858,8 @@ def update_edited_post(base_dir: str,
max_hashtags, buy_sites,
auto_cw_cache,
onion_domain, i2p_domain,
mitm_servers)
mitm_servers,
instance_software)
# update the index
id_str = edited_postid.split('/')[-1]
@ -1800,7 +1803,8 @@ def _inbox_after_initial(server, inbox_start_time,
dogwhistles: {},
max_hashtags: int, buy_sites: {},
sites_unavailable: [],
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
""" Anything which needs to be done after initial checks have passed
"""
# if this is a clearnet instance then replace any onion/i2p
@ -1865,7 +1869,7 @@ def _inbox_after_initial(server, inbox_start_time,
bold_reading, dogwhistles,
server.min_images_for_accounts,
buy_sites, server.auto_cw_cache,
mitm_servers):
mitm_servers, instance_software):
if debug:
print('DEBUG: Like accepted from ' + actor)
fitness_performance(inbox_start_time, server.fitness,
@ -1893,7 +1897,7 @@ def _inbox_after_initial(server, inbox_start_time,
bold_reading, dogwhistles,
server.min_images_for_accounts,
buy_sites, server.auto_cw_cache,
mitm_servers):
mitm_servers, instance_software):
if debug:
print('DEBUG: Undo like accepted from ' + actor)
fitness_performance(inbox_start_time, server.fitness,
@ -1922,7 +1926,7 @@ def _inbox_after_initial(server, inbox_start_time,
bold_reading, dogwhistles,
server.min_images_for_accounts,
buy_sites, server.auto_cw_cache,
mitm_servers):
mitm_servers, instance_software):
if debug:
print('DEBUG: Reaction accepted from ' + actor)
fitness_performance(inbox_start_time, server.fitness,
@ -1951,7 +1955,7 @@ def _inbox_after_initial(server, inbox_start_time,
bold_reading, dogwhistles,
server.min_images_for_accounts,
buy_sites, server.auto_cw_cache,
mitm_servers):
mitm_servers, instance_software):
if debug:
print('DEBUG: Zot reaction accepted from ' + actor)
fitness_performance(inbox_start_time, server.fitness,
@ -1979,7 +1983,7 @@ def _inbox_after_initial(server, inbox_start_time,
bold_reading, dogwhistles,
server.min_images_for_accounts,
buy_sites, server.auto_cw_cache,
mitm_servers):
mitm_servers, instance_software):
if debug:
print('DEBUG: Undo reaction accepted from ' + actor)
fitness_performance(inbox_start_time, server.fitness,
@ -2008,7 +2012,7 @@ def _inbox_after_initial(server, inbox_start_time,
server.min_images_for_accounts,
server.buy_sites,
server.auto_cw_cache,
mitm_servers):
mitm_servers, instance_software):
if debug:
print('DEBUG: Bookmark accepted from ' + actor)
fitness_performance(inbox_start_time, server.fitness,
@ -2037,7 +2041,7 @@ def _inbox_after_initial(server, inbox_start_time,
server.min_images_for_accounts,
server.buy_sites,
server.auto_cw_cache,
mitm_servers):
mitm_servers, instance_software):
if debug:
print('DEBUG: Undo bookmark accepted from ' + actor)
fitness_performance(inbox_start_time, server.fitness,
@ -2086,7 +2090,7 @@ def _inbox_after_initial(server, inbox_start_time,
languages_understood,
server.auto_cw_cache,
server.block_federated,
mitm_servers):
mitm_servers, instance_software):
if debug:
print('DEBUG: Announce accepted from ' + actor)
fitness_performance(inbox_start_time, server.fitness,
@ -2156,7 +2160,7 @@ def _inbox_after_initial(server, inbox_start_time,
server.buy_sites,
server.sites_unavailable,
server.auto_cw_cache,
mitm_servers)
mitm_servers, instance_software)
fitness_performance(inbox_start_time, server.fitness,
'INBOX', '_receive_question_vote',
debug)
@ -2487,6 +2491,7 @@ def _inbox_after_initial(server, inbox_start_time,
inbox_start_time = time.time()
min_img_for_accounts = \
server.min_images_for_accounts
instance_software = server.instance_software
_inbox_store_post_to_html_cache(recent_posts_cache,
max_recent_posts,
translate, base_dir,
@ -2514,7 +2519,8 @@ def _inbox_after_initial(server, inbox_start_time,
min_img_for_accounts,
buy_sites,
server.auto_cw_cache,
server.mitm_servers)
server.mitm_servers,
instance_software)
fitness_performance(inbox_start_time,
server.fitness,
'INBOX',
@ -3686,7 +3692,8 @@ def run_inbox_queue(server,
max_hashtags, server.buy_sites,
server.auto_cw_cache,
onion_domain,
i2p_domain, server.mitm_servers):
i2p_domain, server.mitm_servers,
server.instance_software):
if debug:
print('Queue: Update accepted from ' + key_id)
if os.path.isfile(queue_filename):
@ -3817,7 +3824,8 @@ def run_inbox_queue(server,
bold_reading, dogwhistles,
max_hashtags, server.buy_sites,
server.sites_unavailable,
server.mitm_servers)
server.mitm_servers,
server.instance_software)
fitness_performance(inbox_start_time, server.fitness,
'INBOX', 'handle_after_initial',
debug)

View File

@ -375,7 +375,8 @@ def receive_edit_to_post(recent_posts_cache: {}, message_json: {},
auto_cw_cache: {},
onion_domain: str,
i2p_domain: str,
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""A post was edited
"""
if not has_object_dict(message_json):
@ -517,7 +518,7 @@ def receive_edit_to_post(recent_posts_cache: {}, message_json: {},
bold_reading, dogwhistles,
minimize_all_images, None,
buy_sites, auto_cw_cache,
mitm_servers)
mitm_servers, instance_software)
return True
@ -654,7 +655,8 @@ def receive_update_activity(recent_posts_cache: {}, session, base_dir: str,
auto_cw_cache: {},
onion_domain: str,
i2p_domain: str,
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""Receives an Update activity within the POST section of HTTPServer
"""
if message_json['type'] != 'Update':
@ -701,7 +703,8 @@ def receive_update_activity(recent_posts_cache: {}, session, base_dir: str,
max_hashtags, buy_sites,
auto_cw_cache,
onion_domain, i2p_domain,
mitm_servers):
mitm_servers,
instance_software):
print('EDITPOST: received ' + message_json['object']['id'])
return True
else:
@ -958,7 +961,8 @@ def receive_like(recent_posts_cache: {},
min_images_for_accounts: [],
buy_sites: {},
auto_cw_cache: {},
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""Receives a Like activity within the POST section of HTTPServer
"""
if message_json['type'] != 'Like':
@ -1074,7 +1078,8 @@ def receive_like(recent_posts_cache: {},
lists_enabled, timezone, mitm,
bold_reading, dogwhistles,
minimize_all_images, None, buy_sites,
auto_cw_cache, mitm_servers)
auto_cw_cache, mitm_servers,
instance_software)
return True
@ -1099,7 +1104,8 @@ def receive_reaction(recent_posts_cache: {},
min_images_for_accounts: [],
buy_sites: {},
auto_cw_cache: {},
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""Receives an emoji reaction within the POST section of HTTPServer
"""
if message_json['type'] != 'EmojiReact':
@ -1236,7 +1242,8 @@ def receive_reaction(recent_posts_cache: {},
lists_enabled, timezone, mitm,
bold_reading, dogwhistles,
minimize_all_images, None, buy_sites,
auto_cw_cache, mitm_servers)
auto_cw_cache, mitm_servers,
instance_software)
return True
@ -1261,7 +1268,8 @@ def receive_zot_reaction(recent_posts_cache: {},
min_images_for_accounts: [],
buy_sites: {},
auto_cw_cache: {},
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""Receives an zot-style emoji reaction within the POST section of
HTTPServer A zot style emoji reaction is an ordinary reply Note whose
content is exactly one emoji
@ -1424,7 +1432,8 @@ def receive_zot_reaction(recent_posts_cache: {},
bold_reading, dogwhistles,
minimize_all_images, None,
buy_sites, auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
return True
@ -1447,7 +1456,8 @@ def receive_bookmark(recent_posts_cache: {},
min_images_for_accounts: [],
buy_sites: {},
auto_cw_cache: {},
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""Receives a bookmark activity within the POST section of HTTPServer
"""
if not message_json.get('type'):
@ -1552,7 +1562,8 @@ def receive_bookmark(recent_posts_cache: {},
bold_reading, dogwhistles,
minimize_all_images, None,
buy_sites, auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
return True
@ -1656,7 +1667,8 @@ def receive_announce(recent_posts_cache: {},
languages_understood: [],
auto_cw_cache: {},
block_federated: [],
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""Receives an announce activity within the POST section of HTTPServer
"""
if message_json['type'] != 'Announce':
@ -1825,7 +1837,8 @@ def receive_announce(recent_posts_cache: {},
bold_reading, dogwhistles,
minimize_all_images, None,
buy_sites, auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
if not announce_html:
print('WARN: Unable to generate html for announce ' +
str(message_json))
@ -1981,7 +1994,8 @@ def receive_question_vote(server, base_dir: str, nickname: str, domain: str,
buy_sites: {},
sites_unavailable: [],
auto_cw_cache: {},
mitm_servers: []) -> None:
mitm_servers: [],
instance_software: {}) -> None:
"""Updates the votes on a Question/poll
"""
# if this is a reply to a question then update the votes
@ -2041,7 +2055,8 @@ def receive_question_vote(server, base_dir: str, nickname: str, domain: str,
bold_reading, dogwhistles,
minimize_all_images, None,
buy_sites, auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
# add id to inbox index
inbox_update_index('inbox', base_dir, handle,

View File

@ -176,7 +176,8 @@ def receive_undo_like(recent_posts_cache: {},
min_images_for_accounts: [],
buy_sites: {},
auto_cw_cache: {},
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""Receives an undo like activity within the POST section of HTTPServer
"""
if message_json['type'] != 'Undo':
@ -280,7 +281,8 @@ def receive_undo_like(recent_posts_cache: {},
bold_reading, dogwhistles,
minimize_all_images, None,
buy_sites, auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
return True
@ -304,7 +306,8 @@ def receive_undo_reaction(recent_posts_cache: {},
min_images_for_accounts: [],
buy_sites: {},
auto_cw_cache: {},
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""Receives an undo emoji reaction within the POST section of HTTPServer
"""
if message_json['type'] != 'Undo':
@ -426,7 +429,8 @@ def receive_undo_reaction(recent_posts_cache: {},
bold_reading, dogwhistles,
minimize_all_images, None,
buy_sites, auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
return True
@ -449,7 +453,8 @@ def receive_undo_bookmark(recent_posts_cache: {},
min_images_for_accounts: [],
buy_sites: {},
auto_cw_cache: {},
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""Receives an undo bookmark activity within the POST section of HTTPServer
"""
if not message_json.get('type'):
@ -555,7 +560,7 @@ def receive_undo_bookmark(recent_posts_cache: {},
timezone, mitm, bold_reading,
dogwhistles, minimize_all_images, None,
buy_sites, auto_cw_cache,
mitm_servers)
mitm_servers, instance_software)
return True

View File

@ -300,7 +300,8 @@ def post_message_to_outbox(session, translate: {},
max_cached_readers: int,
auto_cw_cache: {},
block_federated: [],
mitm_servers: []) -> bool:
mitm_servers: [],
instance_software: {}) -> bool:
"""post is received by the outbox
Client to server message post
https://www.w3.org/TR/activitypub/#client-to-server-outbox-delivery
@ -682,7 +683,8 @@ def post_message_to_outbox(session, translate: {},
bold_reading, dogwhistles,
minimize_all_images, None,
buy_sites, auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
if is_edited_post:
message_json['type'] = 'Update'

View File

@ -165,7 +165,8 @@ def _update_post_schedule(base_dir: str, handle: str, httpd,
httpd.max_cached_readers,
httpd.auto_cw_cache,
httpd.block_federated,
httpd.mitm_servers):
httpd.mitm_servers,
httpd.instance_software):
index_lines.remove(line)
try:
os.remove(post_filename)

View File

@ -5375,6 +5375,18 @@ def load_mitm_servers(base_dir: str) -> []:
return mitm_servers
def load_instance_software(base_dir: str) -> []:
"""For each domain encountered this stores the instance type
such as mastodon, epicyon, pixelfed, etc
"""
instance_software_filename = data_dir(base_dir) + '/instance_software.json'
if os.path.isfile(instance_software_filename):
instance_software_json = load_json(instance_software_filename)
if instance_software_json:
return instance_software_json
return {}
def save_mitm_servers(base_dir: str, mitm_servers: []) -> None:
"""Saves a list of servers implementing insecure transport security
"""

View File

@ -45,7 +45,8 @@ def html_confirm_delete(server,
min_images_for_accounts: [],
buy_sites: {},
auto_cw_cache: {},
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Shows a screen asking to confirm the deletion of a post
"""
if '/statuses/' not in message_id:
@ -106,7 +107,8 @@ def html_confirm_delete(server,
cw_lists, lists_enabled, timezone, mitm,
bold_reading, dogwhistles,
minimize_all_images, None, buy_sites,
auto_cw_cache, mitm_servers)
auto_cw_cache, mitm_servers,
instance_software)
delete_post_str += '<center>'
delete_post_str += \
' <p class="followText">' + \

View File

@ -57,7 +57,8 @@ def html_conversation_view(authorized: bool, post_id: str,
auto_cw_cache: {},
ua_str: str,
default_timeline: str,
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Show a page containing a conversation thread
"""
conv_posts = \
@ -157,7 +158,8 @@ def html_conversation_view(authorized: bool, post_id: str,
dogwhistles,
minimize_all_images, None,
buy_sites, auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
if post_str:
conv_str += \
current_reading_str + text_mode_separator + \

View File

@ -274,7 +274,8 @@ def html_new_post(edit_post_params: {},
default_buy_site: str,
auto_cw_cache: {},
searchable_by_default: str,
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""New post screen
"""
# get the json if this is an edited post
@ -457,7 +458,8 @@ def html_new_post(edit_post_params: {},
bold_reading, dogwhistles,
minimize_all_images, None,
buy_sites, auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
new_post_text += \
open_content_warning(replied_to_post, translate)
# about the author

View File

@ -43,7 +43,8 @@ def _html_front_screen_posts(recent_posts_cache: {}, max_recent_posts: int,
min_images_for_accounts: [],
buy_sites: {},
auto_cw_cache: {},
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Shows posts on the front screen of a news instance
These should only be public blog posts from the features timeline
which is the blog timeline of the news actor
@ -101,7 +102,8 @@ def _html_front_screen_posts(recent_posts_cache: {}, max_recent_posts: int,
bold_reading, dogwhistles,
minimize_all_images, None,
buy_sites, auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
if post_str:
profile_str += post_str + separator_str
ctr += 1
@ -135,7 +137,8 @@ def html_front_screen(signing_priv_key_pem: str,
buy_sites: {},
auto_cw_cache: {},
known_epicyon_instances: [],
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Show the news instance front screen
"""
bold_reading = False
@ -215,7 +218,8 @@ def html_front_screen(signing_priv_key_pem: str,
min_images_for_accounts,
buy_sites,
auto_cw_cache,
mitm_servers) + license_str
mitm_servers,
instance_software) + license_str
# Footer which is only used for system accounts
profile_footer_str = ' </td>\n'

View File

@ -46,7 +46,8 @@ def html_likers_of_post(base_dir: str, nickname: str,
min_images_for_accounts: [],
buy_sites: {}, auto_cw_cache: {},
dict_name: str,
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Returns html for a screen showing who liked a post
"""
css_filename = base_dir + '/epicyon-profile.css'
@ -120,7 +121,8 @@ def html_likers_of_post(base_dir: str, nickname: str,
dogwhistles,
minimize_all_images, None,
buy_sites, auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
# show likers beneath the post
obj = post_json_object

View File

@ -68,7 +68,8 @@ def html_moderation(default_timeline: str,
buy_sites: {},
auto_cw_cache: {},
known_epicyon_instances: [],
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Show the moderation feed as html
This is what you see when selecting the "mod" timeline
"""
@ -98,7 +99,8 @@ def html_moderation(default_timeline: str,
timezone, bold_reading, dogwhistles, ua_str,
min_images_for_accounts, reverse_sequence, None,
buy_sites, auto_cw_cache, show_announces,
known_epicyon_instances, mitm_servers)
known_epicyon_instances, mitm_servers,
instance_software)
def html_account_info(translate: {},

View File

@ -35,6 +35,7 @@ from flags import is_news_post
from flags import is_recent_post
from flags import is_chat_message
from flags import is_pgp_encrypted
from utils import save_json
from utils import text_mode_removals
from utils import remove_header_tags
from utils import get_actor_from_post_id
@ -136,6 +137,68 @@ from session import get_json
MAX_DISPLAY_NAME_LENGTH = 42
def _get_instance_software(base_dir: str, session,
instance_http_prefix: str,
instance_domain: str,
instance_software: {},
signing_priv_key_pem: str,
debug: bool,
http_prefix: str, domain: str,
mitm_servers: []) -> str:
"""returns the type of instance software for the given
instance domain eg. mastodon, epicyon, pixelfed
"""
if instance_software.get(instance_domain):
return instance_software[instance_domain]
# get the initial nodeinfo url
nodeinfo1_url = \
instance_http_prefix + '://' + instance_domain + \
'/.well-known/nodeinfo'
profile_str = 'https://www.w3.org/ns/activitystreams'
headers = {
'Accept': 'application/ld+json; profile="' + profile_str + '"'
}
nodeinfo1_json = \
get_json(signing_priv_key_pem,
session, nodeinfo1_url,
headers, None, debug, mitm_servers,
__version__, http_prefix, domain)
if not get_json_valid(nodeinfo1_json):
return ''
# get the nodeinfo data
nodeinfo_url = None
if nodeinfo1_json.get('links'):
if isinstance(nodeinfo1_json['links'], list):
if len(nodeinfo1_json['links']) > 0:
if nodeinfo1_json['links'][0].get('href'):
href = nodeinfo1_json['links'][0]['href']
if isinstance(href, str):
nodeinfo_url = href
if not nodeinfo_url:
return ''
nodeinfo_json = \
get_json(signing_priv_key_pem,
session, nodeinfo_url,
headers, None, debug, mitm_servers,
__version__, http_prefix, domain)
if not get_json_valid(nodeinfo_json):
return ''
if not nodeinfo_json.get('software'):
return ''
if not isinstance(nodeinfo_json['software'], dict):
return ''
if not nodeinfo_json['software'].get('name'):
return ''
software_name = nodeinfo_json['software']['name']
if not isinstance(software_name, str):
return ''
software_name = remove_html(software_name)
instance_software[instance_domain] = software_name
instance_software_filename = data_dir(base_dir) + '/instance_software.json'
save_json(instance_software, instance_software_filename)
return software_name
def _enforce_max_display_name_length(display_name: str) -> str:
"""Ensures that the display name does not get too long
"""
@ -1408,7 +1471,8 @@ def _get_post_title_announce_html(base_dir: str,
container_class_icons: str,
container_class: str,
mitm: bool,
mitm_servers: []) -> (str, str, str, str):
mitm_servers: [],
software_name: str) -> (str, str, str, str):
"""Returns the announce title of a post containing names of participants
x announces y
"""
@ -1480,6 +1544,11 @@ 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:
title_str += \
' <span itemprop="software"><mark>[' + \
software_name.title() + ']</mark></span>'
# show avatar of person replied to
announce_actor = attributed_to
announce_avatar_url = \
@ -1627,7 +1696,8 @@ def _get_post_title_reply_html(base_dir: str,
mitm: bool,
signing_priv_key_pem: str,
session, debug: bool,
mitm_servers: []) -> (str, str, str, str):
mitm_servers: [],
software_name: str) -> (str, str, str, str):
"""Returns the reply title of a post containing names of participants
x replies to y
"""
@ -1757,6 +1827,11 @@ 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:
title_str += \
' <span itemprop="software"><mark>[' + \
software_name.title() + ']</mark></span>'
_log_post_timing(enable_timing_log, post_start_time, '13.7')
# show avatar of person replied to
@ -1805,7 +1880,8 @@ def _get_post_title_html(base_dir: str,
signing_priv_key_pem: str,
session,
debug: bool,
mitm_servers: []) -> (str, str, str, str):
mitm_servers: [],
software_name: str) -> (str, str, str, str):
"""Returns the title of a post containing names of participants
x replies to y, x announces y, etc
"""
@ -1832,7 +1908,8 @@ def _get_post_title_html(base_dir: str,
message_id_str,
container_class_icons,
container_class, mitm,
mitm_servers)
mitm_servers,
software_name)
return _get_post_title_reply_html(base_dir,
http_prefix,
@ -1850,7 +1927,8 @@ def _get_post_title_html(base_dir: str,
container_class, mitm,
signing_priv_key_pem,
session, debug,
mitm_servers)
mitm_servers,
software_name)
def _get_footer_with_icons(show_icons: bool,
@ -2143,7 +2221,8 @@ def individual_post_as_html(signing_priv_key_pem: str,
first_post_id: str,
buy_sites: {},
auto_cw_cache: {},
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
""" Shows a single post as html
"""
if not post_json_object:
@ -2659,6 +2738,20 @@ def individual_post_as_html(signing_priv_key_pem: str,
_log_post_timing(enable_timing_log, post_start_time, '13.1')
# get the software instance type, such as "mastodon"
instance_http_prefix = http_prefix
if '://' in post_actor:
instance_http_prefix = post_actor.split('://')[0]
software_name = \
_get_instance_software(base_dir, session,
instance_http_prefix,
post_actor,
instance_software,
signing_priv_key_pem,
False,
http_prefix, domain,
mitm_servers)
# get the title: x replies to y, x announces y, etc
(title_str2,
reply_avatar_image_in_post,
@ -2681,7 +2774,8 @@ def individual_post_as_html(signing_priv_key_pem: str,
container_class, mitm,
signing_priv_key_pem,
session, False,
mitm_servers)
mitm_servers,
software_name)
title_str += title_str2
_log_post_timing(enable_timing_log, post_start_time, '14')
@ -3124,7 +3218,8 @@ def html_individual_post(recent_posts_cache: {}, max_recent_posts: int,
bold_reading: bool, dogwhistles: {},
min_images_for_accounts: [],
buy_sites: {},
auto_cw_cache: {}, mitm_servers: []) -> str:
auto_cw_cache: {}, mitm_servers: [],
instance_software: {}) -> str:
"""Show an individual post as html
"""
original_post_json = post_json_object
@ -3211,7 +3306,8 @@ def html_individual_post(recent_posts_cache: {}, max_recent_posts: int,
cw_lists, lists_enabled, timezone, mitm,
bold_reading, dogwhistles,
minimize_all_images, None, buy_sites,
auto_cw_cache, mitm_servers)
auto_cw_cache, mitm_servers,
instance_software)
message_id = remove_id_ending(post_json_object['id'])
# show the previous posts
@ -3264,7 +3360,8 @@ def html_individual_post(recent_posts_cache: {}, max_recent_posts: int,
minimize_all_images,
None, buy_sites,
auto_cw_cache,
mitm_servers) + post_str
mitm_servers,
instance_software) + post_str
# show the following posts
post_filename = locate_post(base_dir, nickname, domain, message_id)
@ -3306,7 +3403,7 @@ def html_individual_post(recent_posts_cache: {}, max_recent_posts: int,
bold_reading, dogwhistles,
minimize_all_images, None,
buy_sites, auto_cw_cache,
mitm_servers)
mitm_servers, instance_software)
css_filename = base_dir + '/epicyon-profile.css'
if os.path.isfile(base_dir + '/epicyon.css'):
css_filename = base_dir + '/epicyon.css'
@ -3359,7 +3456,8 @@ def html_post_replies(recent_posts_cache: {}, max_recent_posts: int,
min_images_for_accounts: [],
buy_sites: {},
auto_cw_cache: {},
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Show the replies to an individual post as html
"""
replies_str = ''
@ -3392,7 +3490,8 @@ def html_post_replies(recent_posts_cache: {}, max_recent_posts: int,
bold_reading, dogwhistles,
minimize_all_images, None,
buy_sites, auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
css_filename = base_dir + '/epicyon-profile.css'
if os.path.isfile(base_dir + '/epicyon.css'):
@ -3428,7 +3527,8 @@ def html_emoji_reaction_picker(recent_posts_cache: {}, max_recent_posts: int,
min_images_for_accounts: [],
buy_sites: {},
auto_cw_cache: {},
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Returns the emoji picker screen
"""
minimize_all_images = False
@ -3457,7 +3557,8 @@ def html_emoji_reaction_picker(recent_posts_cache: {}, max_recent_posts: int,
cw_lists, lists_enabled, timezone, False,
bold_reading, dogwhistles,
minimize_all_images, None, buy_sites,
auto_cw_cache, mitm_servers)
auto_cw_cache, mitm_servers,
instance_software)
reactions_filename = base_dir + '/emoji/reactions.json'
if not os.path.isfile(reactions_filename):

View File

@ -253,7 +253,8 @@ def html_profile_after_search(authorized: bool,
no_of_books: int,
auto_cw_cache: {},
mitm_servers: [],
ua_str: str) -> str:
ua_str: str,
instance_software: {}) -> str:
"""Show a profile page after a search for a fediverse address
"""
http = False
@ -618,7 +619,8 @@ def html_profile_after_search(authorized: bool,
bold_reading, dogwhistles,
minimize_all_images, None,
buy_sites, auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
if not profile_post_html:
if debug:
print('DEBUG: no html produced for profile post: ' +
@ -1045,7 +1047,8 @@ def html_profile(signing_priv_key_pem: str,
no_of_books: int,
auto_cw_cache: {},
known_epicyon_instances: [],
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Show the profile page as html
"""
show_moved_accounts = False
@ -1079,7 +1082,7 @@ def html_profile(signing_priv_key_pem: str,
min_images_for_accounts, buy_sites,
auto_cw_cache,
known_epicyon_instances,
mitm_servers)
mitm_servers, instance_software)
domain, port = get_domain_from_actor(profile_json['id'])
if not domain:
@ -1654,7 +1657,8 @@ def html_profile(signing_priv_key_pem: str,
max_profile_posts,
buy_sites,
auto_cw_cache,
mitm_servers) + license_str
mitm_servers,
instance_software) + license_str
if not is_group:
if selected == 'following':
profile_str += \
@ -1765,7 +1769,8 @@ def _html_profile_posts(recent_posts_cache: {}, max_recent_posts: int,
max_profile_posts: int,
buy_sites: {},
auto_cw_cache: {},
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Shows posts on the profile screen
These should only be public posts
"""
@ -1825,7 +1830,8 @@ def _html_profile_posts(recent_posts_cache: {}, max_recent_posts: int,
bold_reading, dogwhistles,
minimize_all_images, None,
buy_sites, auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
if post_str and item_id not in shown_items:
profile_str += post_str + separator_str
shown_items.append(item_id)

View File

@ -735,7 +735,8 @@ def html_history_search(translate: {}, base_dir: str,
min_images_for_accounts: [],
buy_sites: {},
auto_cw_cache: {},
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Show a page containing search results for your post history
"""
if historysearch.startswith("'"):
@ -853,7 +854,8 @@ def html_history_search(translate: {}, base_dir: str,
dogwhistles,
minimize_all_images, None,
buy_sites, auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
if post_str:
history_search_form += separator_str + post_str
index += 1
@ -884,7 +886,8 @@ def html_hashtag_search(nickname: str, domain: str, port: int,
min_images_for_accounts: [],
buy_sites: {}, auto_cw_cache: {},
ua_str: str,
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Show a page containing search results for a hashtag
or after selecting a hashtag from the swarm
"""
@ -1084,7 +1087,8 @@ def html_hashtag_search(nickname: str, domain: str, port: int,
bold_reading, dogwhistles,
minimize_all_images, None,
buy_sites, auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
if post_str:
hashtag_search_form += \
text_mode_separator + separator_str + post_str
@ -1129,7 +1133,8 @@ def html_hashtag_search_remote(nickname: str, domain: str, port: int,
min_images_for_accounts: [],
debug: bool, buy_sites: {},
auto_cw_cache: {},
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Show a page containing search results for a remote hashtag
"""
hashtag = urllib.parse.unquote(hashtag_url.split('/')[-1])
@ -1293,7 +1298,8 @@ def html_hashtag_search_remote(nickname: str, domain: str, port: int,
bold_reading, dogwhistles,
minimize_all_images, None,
buy_sites, auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
if post_str:
hashtag_search_form += \
text_mode_separator + separator_str + post_str

View File

@ -525,7 +525,8 @@ def html_timeline(default_timeline: str,
auto_cw_cache: {},
show_announces: bool,
known_epicyon_instances: [],
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Show the timeline as html
"""
enable_timing_log = False
@ -1141,7 +1142,8 @@ def html_timeline(default_timeline: str,
minimize_all_images,
first_post_id, buy_sites,
auto_cw_cache,
mitm_servers)
mitm_servers,
instance_software)
_log_timeline_timing(enable_timing_log,
timeline_start_time, box_name, '12')
@ -1426,7 +1428,8 @@ def html_shares(default_timeline: str,
buy_sites: {},
auto_cw_cache: {},
known_epicyon_instances: [],
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Show the shares timeline as html
"""
manually_approve_followers = \
@ -1463,7 +1466,7 @@ def html_shares(default_timeline: str,
reverse_sequence, None, buy_sites,
auto_cw_cache, show_announces,
known_epicyon_instances,
mitm_servers)
mitm_servers, instance_software)
def html_wanted(default_timeline: str,
@ -1499,7 +1502,8 @@ def html_wanted(default_timeline: str,
buy_sites: {},
auto_cw_cache: {},
known_epicyon_instances: [],
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Show the wanted timeline as html
"""
manually_approve_followers = \
@ -1536,7 +1540,7 @@ def html_wanted(default_timeline: str,
reverse_sequence, None, buy_sites,
auto_cw_cache, show_announces,
known_epicyon_instances,
mitm_servers)
mitm_servers, instance_software)
def html_inbox(default_timeline: str,
@ -1575,7 +1579,8 @@ def html_inbox(default_timeline: str,
auto_cw_cache: {},
show_announces: bool,
known_epicyon_instances: [],
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Show the inbox as html
"""
manually_approve_followers = \
@ -1611,7 +1616,7 @@ def html_inbox(default_timeline: str,
reverse_sequence, last_post_id,
buy_sites, auto_cw_cache, show_announces,
known_epicyon_instances,
mitm_servers)
mitm_servers, instance_software)
def html_bookmarks(default_timeline: str,
@ -1648,7 +1653,8 @@ def html_bookmarks(default_timeline: str,
buy_sites: {},
auto_cw_cache: {},
known_epicyon_instances: [],
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Show the bookmarks as html
"""
manually_approve_followers = \
@ -1684,7 +1690,7 @@ def html_bookmarks(default_timeline: str,
reverse_sequence, None, buy_sites,
auto_cw_cache, show_announces,
known_epicyon_instances,
mitm_servers)
mitm_servers, instance_software)
def html_inbox_dms(default_timeline: str,
@ -1722,7 +1728,8 @@ def html_inbox_dms(default_timeline: str,
buy_sites: {},
auto_cw_cache: {},
known_epicyon_instances: [],
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Show the DM timeline as html
"""
artist = is_artist(base_dir, nickname)
@ -1754,7 +1761,7 @@ def html_inbox_dms(default_timeline: str,
reverse_sequence, last_post_id,
buy_sites, auto_cw_cache, show_announces,
known_epicyon_instances,
mitm_servers)
mitm_servers, instance_software)
def html_inbox_replies(default_timeline: str,
@ -1792,7 +1799,8 @@ def html_inbox_replies(default_timeline: str,
buy_sites: {},
auto_cw_cache: {},
known_epicyon_instances: [],
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Show the replies timeline as html
"""
artist = is_artist(base_dir, nickname)
@ -1821,7 +1829,8 @@ def html_inbox_replies(default_timeline: str,
dogwhistles, ua_str, min_images_for_accounts,
reverse_sequence, last_post_id, buy_sites,
auto_cw_cache, show_announces,
known_epicyon_instances, mitm_servers)
known_epicyon_instances, mitm_servers,
instance_software)
def html_inbox_media(default_timeline: str,
@ -1860,7 +1869,8 @@ def html_inbox_media(default_timeline: str,
auto_cw_cache: {},
show_announces: bool,
known_epicyon_instances: [],
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Show the media timeline as html
"""
artist = is_artist(base_dir, nickname)
@ -1888,7 +1898,8 @@ def html_inbox_media(default_timeline: str,
dogwhistles, ua_str, min_images_for_accounts,
reverse_sequence, last_post_id, buy_sites,
auto_cw_cache, show_announces,
known_epicyon_instances, mitm_servers)
known_epicyon_instances, mitm_servers,
instance_software)
def html_inbox_blogs(default_timeline: str,
@ -1926,7 +1937,8 @@ def html_inbox_blogs(default_timeline: str,
buy_sites: {},
auto_cw_cache: {},
known_epicyon_instances: [],
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Show the blogs timeline as html
"""
artist = is_artist(base_dir, nickname)
@ -1955,7 +1967,8 @@ def html_inbox_blogs(default_timeline: str,
dogwhistles, ua_str, min_images_for_accounts,
reverse_sequence, last_post_id, buy_sites,
auto_cw_cache, show_announces,
known_epicyon_instances, mitm_servers)
known_epicyon_instances, mitm_servers,
instance_software)
def html_inbox_features(default_timeline: str,
@ -1993,7 +2006,8 @@ def html_inbox_features(default_timeline: str,
buy_sites: {},
auto_cw_cache: {},
known_epicyon_instances: [],
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Show the features timeline as html
"""
show_announces = True
@ -2021,7 +2035,8 @@ def html_inbox_features(default_timeline: str,
dogwhistles, ua_str, min_images_for_accounts,
reverse_sequence, None, buy_sites,
auto_cw_cache, show_announces,
known_epicyon_instances, mitm_servers)
known_epicyon_instances, mitm_servers,
instance_software)
def html_inbox_news(default_timeline: str,
@ -2058,7 +2073,8 @@ def html_inbox_news(default_timeline: str,
buy_sites: {},
auto_cw_cache: {},
known_epicyon_instances: [],
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Show the news timeline as html
"""
show_announces = True
@ -2086,7 +2102,8 @@ def html_inbox_news(default_timeline: str,
dogwhistles, ua_str, min_images_for_accounts,
reverse_sequence, None, buy_sites,
auto_cw_cache, show_announces,
known_epicyon_instances, mitm_servers)
known_epicyon_instances, mitm_servers,
instance_software)
def html_outbox(default_timeline: str,
@ -2124,7 +2141,8 @@ def html_outbox(default_timeline: str,
auto_cw_cache: {},
show_announces: bool,
known_epicyon_instances: [],
mitm_servers: []) -> str:
mitm_servers: [],
instance_software: {}) -> str:
"""Show the Outbox as html
"""
manually_approve_followers = \
@ -2154,4 +2172,4 @@ def html_outbox(default_timeline: str,
dogwhistles, ua_str, min_images_for_accounts,
reverse_sequence, None, buy_sites, auto_cw_cache,
show_announces, known_epicyon_instances,
mitm_servers)
mitm_servers, instance_software)