From 92f94e0ffbe71b709a775c861ee10daa39fbfec5 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 26 Jan 2023 18:26:04 +0000 Subject: [PATCH 1/6] Replace double quotes --- webapp_question.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp_question.py b/webapp_question.py index 93bdcf3e9..c98f0bc19 100644 --- a/webapp_question.py +++ b/webapp_question.py @@ -54,7 +54,7 @@ def insert_question(base_dir: str, translate: {}, continue content += \ ' ' + \ + choice['name'].replace('"', '\"') + '" tabindex="10"> ' + \ choice['name'] + '

\n' content += \ ' ' + \ + choice['name'].replace('"', '\\"') + '" tabindex="10"> ' + \ choice['name'] + '

\n' content += \ ' ' + \ + quoted_name + '" tabindex="10"> ' + \ choice['name'] + '

\n' content += \ '
\n' + text_modoe_separator = '

\n' minimize_all_images = False if nickname in min_images_for_accounts: minimize_all_images = True for post_json_object in conv_posts: - show_individual_post_icons = False + show_individual_post_icons = True allow_deletion = False post_str = \ individual_post_as_html(signing_priv_key_pem, From 8da545cb72dec63ebc2faf32d3828706c1f6633e Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 30 Jan 2023 20:16:45 +0000 Subject: [PATCH 5/6] typo --- webapp_conversation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp_conversation.py b/webapp_conversation.py index 4cd77137c..e27fb8536 100644 --- a/webapp_conversation.py +++ b/webapp_conversation.py @@ -63,7 +63,7 @@ def html_conversation_view(post_id: str, html_header_with_external_style(css_filename, instance_title, None) separator_str = html_post_separator(base_dir, None) - text_modoe_separator = '

\n' + text_mode_separator = '

\n' minimize_all_images = False if nickname in min_images_for_accounts: From d88f16f089e9823b933671bfae17794604d70733 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 30 Jan 2023 20:56:47 +0000 Subject: [PATCH 6/6] don't show icons on posts from blocked accounts/instances --- daemon.py | 3 ++- webapp_conversation.py | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/daemon.py b/daemon.py index 0f5b65e4a..28f715512 100644 --- a/daemon.py +++ b/daemon.py @@ -12282,7 +12282,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.access_keys, self.server.min_images_for_accounts, self.server.debug, - self.server.buy_sites) + self.server.buy_sites, + self.server.blocked_cache) if conv_str: msg = conv_str.encode('utf-8') msglen = len(msg) diff --git a/webapp_conversation.py b/webapp_conversation.py index e27fb8536..411e8e25f 100644 --- a/webapp_conversation.py +++ b/webapp_conversation.py @@ -11,6 +11,9 @@ __module_group__ = "Timeline" import os from conversation import download_conversation_posts from utils import get_config_param +from utils import get_nickname_from_actor +from utils import get_domain_from_actor +from blocking import is_blocked from webapp_utils import html_header_with_external_style from webapp_utils import html_post_separator from webapp_utils import html_footer @@ -42,7 +45,8 @@ def html_conversation_view(post_id: str, timezone: str, bold_reading: bool, dogwhistles: {}, access_keys: {}, min_images_for_accounts: [], - debug: bool, buy_sites: {}) -> str: + debug: bool, buy_sites: {}, + blocked_cache: []) -> str: """Show a page containing a conversation thread """ conv_posts = \ @@ -70,6 +74,15 @@ def html_conversation_view(post_id: str, minimize_all_images = True for post_json_object in conv_posts: show_individual_post_icons = True + from_actor = post_json_object['object']['attributedTo'] + from_nickname = get_nickname_from_actor(from_actor) + from_domain, _ = get_domain_from_actor(from_actor) + # don't show icons on posts from blocked accounts/instances + if from_nickname and from_domain: + if is_blocked(base_dir, nickname, domain, + from_nickname, from_domain, + blocked_cache): + show_individual_post_icons = False allow_deletion = False post_str = \ individual_post_as_html(signing_priv_key_pem,