main
Bob Mottram 2024-04-12 13:16:35 +01:00
parent 43a3ab1b84
commit 5199dd3db5
2 changed files with 96 additions and 42 deletions

View File

@ -3838,7 +3838,37 @@ def daemon_http_get(self) -> None:
self.server.domain_full, self.server.domain_full,
getreq_start_time, getreq_start_time,
cookie, no_drop_down, conversation_id, cookie, no_drop_down, conversation_id,
curr_session): curr_session,
self.server.default_reply_interval_hrs,
self.server.debug,
self.server.access_keys,
self.server.key_shortcuts,
self.server.system_language,
self.server.default_post_language,
self.server.bold_reading,
self.server.person_cache,
self.server.fitness,
self.server.default_timeline,
self.server.newswire,
self.server.theme_name,
self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.cached_webfingers,
self.server.port,
self.server.project_version,
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.max_like_count,
self.server.signing_priv_key_pem,
self.server.cw_lists,
self.server.lists_enabled,
self.server.dogwhistles,
self.server.min_images_for_accounts,
self.server.buy_sites,
self.server.auto_cw_cache):
self.server.getreq_busy = False self.server.getreq_busy = False
return return

View File

@ -286,7 +286,34 @@ def show_new_post(self, edit_post_params: {},
domain: str, domain_full: str, domain: str, domain_full: str,
getreq_start_time, cookie, getreq_start_time, cookie,
no_drop_down: bool, conversation_id: str, no_drop_down: bool, conversation_id: str,
curr_session) -> bool: curr_session, default_reply_interval_hrs: int,
debug: bool, access_keys: {},
key_shortcuts: {}, system_language: str,
default_post_language: {},
bold_reading_nicknames: {},
person_cache: {},
fitness: {},
default_timeline: str,
newswire: {},
theme_name: str,
recent_posts_cache: {},
max_recent_posts: int,
cached_webfingers: {},
port: int,
project_version: str,
yt_replace_domain: str,
twitter_replacement_domain: str,
show_published_date_only: bool,
peertube_instances: [],
allow_local_network_access: bool,
max_like_count: int,
signing_priv_key_pem: str,
cw_lists: {},
lists_enabled: {},
dogwhistles: {},
min_images_for_accounts: bool,
buy_sites: [],
auto_cw_cache: {}) -> bool:
"""Shows the new post screen """Shows the new post screen
""" """
is_new_post_endpoint = False is_new_post_endpoint = False
@ -319,27 +346,25 @@ def show_new_post(self, edit_post_params: {},
http_404(self, 103) http_404(self, 103)
return True return True
if in_reply_to_url: if in_reply_to_url:
reply_interval_hours = self.server.default_reply_interval_hrs reply_interval_hours = default_reply_interval_hrs
if not can_reply_to(base_dir, nickname, domain, if not can_reply_to(base_dir, nickname, domain,
in_reply_to_url, reply_interval_hours): in_reply_to_url, reply_interval_hours):
print('Reply outside of time window ' + in_reply_to_url + print('Reply outside of time window ' + in_reply_to_url +
' ' + str(reply_interval_hours) + ' hours') ' ' + str(reply_interval_hours) + ' hours')
http_403(self) http_403(self)
return True return True
if self.server.debug: if debug:
print('Reply is within time interval: ' + print('Reply is within time interval: ' +
str(reply_interval_hours) + ' hours') str(reply_interval_hours) + ' hours')
access_keys = self.server.access_keys if key_shortcuts.get(nickname):
if self.server.key_shortcuts.get(nickname): access_keys = key_shortcuts[nickname]
access_keys = self.server.key_shortcuts[nickname]
custom_submit_text = get_config_param(base_dir, 'customSubmitText') custom_submit_text = get_config_param(base_dir, 'customSubmitText')
default_post_language = self.server.system_language default_post_language2 = system_language
if self.server.default_post_language.get(nickname): if default_post_language.get(nickname):
default_post_language = \ default_post_language2 = default_post_language[nickname]
self.server.default_post_language[nickname]
post_json_object = None post_json_object = None
if in_reply_to_url: if in_reply_to_url:
@ -351,10 +376,10 @@ def show_new_post(self, edit_post_params: {},
reply_language = \ reply_language = \
get_reply_language(base_dir, post_json_object) get_reply_language(base_dir, post_json_object)
if reply_language: if reply_language:
default_post_language = reply_language default_post_language2 = reply_language
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
languages_understood = \ languages_understood = \
@ -362,7 +387,7 @@ def show_new_post(self, edit_post_params: {},
http_prefix, http_prefix,
nickname, nickname,
domain_full, domain_full,
self.server.person_cache) person_cache)
default_buy_site = '' default_buy_site = ''
msg = \ msg = \
html_new_post(edit_post_params, media_instance, html_new_post(edit_post_params, media_instance,
@ -376,41 +401,41 @@ def show_new_post(self, edit_post_params: {},
reply_category, reply_category,
nickname, domain, nickname, domain,
domain_full, domain_full,
self.server.default_timeline, default_timeline,
self.server.newswire, newswire,
self.server.theme_name, theme_name,
no_drop_down, access_keys, no_drop_down, access_keys,
custom_submit_text, custom_submit_text,
conversation_id, conversation_id,
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,
self.server.port, port,
post_json_object, post_json_object,
self.server.project_version, project_version,
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.system_language, system_language,
languages_understood, languages_understood,
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,
self.server.default_timeline, default_timeline,
reply_is_chat, reply_is_chat,
bold_reading, bold_reading,
self.server.dogwhistles, dogwhistles,
self.server.min_images_for_accounts, min_images_for_accounts,
new_post_month, new_post_year, new_post_month, new_post_year,
default_post_language, default_post_language2,
self.server.buy_sites, buy_sites,
default_buy_site, default_buy_site,
self.server.auto_cw_cache) auto_cw_cache)
if not msg: if not msg:
print('Error replying to ' + in_reply_to_url) print('Error replying to ' + in_reply_to_url)
http_404(self, 104) http_404(self, 104)
@ -420,10 +445,9 @@ def show_new_post(self, edit_post_params: {},
set_headers(self, 'text/html', msglen, set_headers(self, 'text/html', msglen,
cookie, calling_domain, False) cookie, calling_domain, False)
write2(self, msg) write2(self, msg)
fitness_performance(getreq_start_time, fitness_performance(getreq_start_time, fitness,
self.server.fitness,
'_GET', 'show_new_post', '_GET', 'show_new_post',
self.server.debug) debug)
return True return True
return False return False