merge-requests/30/head
Bob Mottram 2024-04-12 20:44:15 +01:00
parent 8ae8753735
commit c5aa3270a5
2 changed files with 96 additions and 37 deletions

View File

@ -587,7 +587,36 @@ def daemon_http_get(self) -> None:
self.server.port, self.server.port,
self.server.debug, self.server.debug,
self.server.session, self.server.session,
cookie, ua_str): cookie, ua_str,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain,
self.server.account_timezone,
self.server.bold_reading,
self.server.translate,
self.server.project_version,
self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.cached_webfingers,
self.server.person_cache,
self.server.yt_replace_domain,
self.server.twitter_replacement_domain,
self.server.show_published_date_only,
self.server.peertube_instances,
self.server.allow_local_network_access,
self.server.theme_name,
self.server.system_language,
self.server.max_like_count,
self.server.signing_priv_key_pem,
self.server.cw_lists,
self.server.lists_enabled,
self.server.dogwhistles,
self.server.access_keys,
self.server.min_images_for_accounts,
self.server.buy_sites,
self.server.blocked_cache,
self.server.block_federated,
self.server.auto_cw_cache):
fitness_performance(getreq_start_time, self.server.fitness, fitness_performance(getreq_start_time, self.server.fitness,
'_GET', '_show_conversation_thread', '_GET', '_show_conversation_thread',
self.server.debug) self.server.debug)
@ -4147,7 +4176,8 @@ def daemon_http_get(self) -> None:
cookie, self.server.debug, cookie, self.server.debug,
curr_session, curr_session,
self.server.translate, self.server.translate,
self.server.account_timezone): self.server.account_timezone,
self.server.fitness):
self.server.getreq_busy = False self.server.getreq_busy = False
return return

View File

@ -1029,7 +1029,8 @@ def show_notify_post(self, authorized: bool,
proxy_type: str, cookie: str, proxy_type: str, cookie: str,
debug: str, debug: str,
curr_session, translate: {}, curr_session, translate: {},
account_timezone: {}) -> bool: account_timezone: {},
fitness: {}) -> bool:
"""Shows an individual post from an account which you are following """Shows an individual post from an account which you are following
and where you have the notify checkbox set on person options and where you have the notify checkbox set on person options
""" """
@ -1064,7 +1065,7 @@ def show_notify_post(self, authorized: bool,
include_create_wrapper, include_create_wrapper,
curr_session, translate, curr_session, translate,
account_timezone) account_timezone)
fitness_performance(getreq_start_time, self.server.fitness, fitness_performance(getreq_start_time, fitness,
'_GET', 'show_notify_post', '_GET', 'show_notify_post',
debug) debug)
return result return result
@ -1075,7 +1076,36 @@ def show_conversation_thread(self, authorized: bool,
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
domain: str, port: int, domain: str, port: int,
debug: str, curr_session, debug: str, curr_session,
cookie: str, ua_str: str) -> bool: cookie: str, ua_str: str,
domain_full: str,
onion_domain: str,
i2p_domain: str,
account_timezone: {},
bold_reading_nicknames: {},
translate: {},
project_version: str,
recent_posts_cache: {},
max_recent_posts: int,
cached_webfingers: {},
person_cache: {},
yt_replace_domain: str,
twitter_replacement_domain: str,
show_published_date_only: bool,
peertube_instances: [],
allow_local_network_access: bool,
theme_name: str,
system_language: str,
max_like_count: int,
signing_priv_key_pem: str,
cw_lists: {},
lists_enabled: {},
dogwhistles: {},
access_keys: {},
min_images_for_accounts: bool,
buy_sites: [],
blocked_cache: {},
block_federated: {},
auto_cw_cache: {}) -> bool:
"""get conversation thread from the date link on a post """get conversation thread from the date link on a post
""" """
if not path.startswith('/users/'): if not path.startswith('/users/'):
@ -1087,9 +1117,9 @@ def show_conversation_thread(self, authorized: bool,
if post_id.startswith('/users/'): if post_id.startswith('/users/'):
instance_url = get_instance_url(calling_domain, instance_url = get_instance_url(calling_domain,
http_prefix, http_prefix,
self.server.domain_full, domain_full,
self.server.onion_domain, onion_domain,
self.server.i2p_domain) i2p_domain)
post_id = instance_url + post_id post_id = instance_url + post_id
nickname = path.split('/users/')[1] nickname = path.split('/users/')[1]
if '?convthread=' in nickname: if '?convthread=' in nickname:
@ -1097,46 +1127,45 @@ def show_conversation_thread(self, authorized: bool,
if '/' in nickname: if '/' in nickname:
nickname = nickname.split('/')[0] nickname = nickname.split('/')[0]
timezone = None timezone = None
if self.server.account_timezone.get(nickname): if account_timezone.get(nickname):
timezone = \ timezone = account_timezone.get(nickname)
self.server.account_timezone.get(nickname)
bold_reading = False bold_reading = False
if self.server.bold_reading.get(nickname): if bold_reading_nicknames.get(nickname):
bold_reading = True bold_reading = True
conv_str = \ conv_str = \
html_conversation_view(authorized, html_conversation_view(authorized,
post_id, self.server.translate, post_id, translate,
base_dir, base_dir,
http_prefix, http_prefix,
nickname, nickname,
domain, domain,
self.server.project_version, project_version,
self.server.recent_posts_cache, recent_posts_cache,
self.server.max_recent_posts, max_recent_posts,
curr_session, curr_session,
self.server.cached_webfingers, cached_webfingers,
self.server.person_cache, person_cache,
port, port,
self.server.yt_replace_domain, yt_replace_domain,
self.server.twitter_replacement_domain, twitter_replacement_domain,
self.server.show_published_date_only, show_published_date_only,
self.server.peertube_instances, peertube_instances,
self.server.allow_local_network_access, allow_local_network_access,
self.server.theme_name, theme_name,
self.server.system_language, system_language,
self.server.max_like_count, max_like_count,
self.server.signing_priv_key_pem, signing_priv_key_pem,
self.server.cw_lists, cw_lists,
self.server.lists_enabled, lists_enabled,
timezone, bold_reading, timezone, bold_reading,
self.server.dogwhistles, dogwhistles,
self.server.access_keys, access_keys,
self.server.min_images_for_accounts, min_images_for_accounts,
debug, debug,
self.server.buy_sites, buy_sites,
self.server.blocked_cache, blocked_cache,
self.server.block_federated, block_federated,
self.server.auto_cw_cache, auto_cw_cache,
ua_str) ua_str)
if conv_str: if conv_str:
msg = conv_str.encode('utf-8') msg = conv_str.encode('utf-8')
@ -1146,7 +1175,7 @@ def show_conversation_thread(self, authorized: bool,
self.server.getreq_busy = False self.server.getreq_busy = False
return True return True
# redirect to the original site if there are no results # redirect to the original site if there are no results
if '://' + self.server.domain_full + '/' in post_id: if '://' + domain_full + '/' in post_id:
redirect_headers(self, post_id, cookie, calling_domain) redirect_headers(self, post_id, cookie, calling_domain)
else: else:
redirect_headers(self, post_id, None, calling_domain) redirect_headers(self, post_id, None, calling_domain)