diff --git a/blocking.py b/blocking.py index 71a8a2204..9eef37478 100644 --- a/blocking.py +++ b/blocking.py @@ -82,7 +82,8 @@ def get_global_block_reason(search_text: str, def get_account_blocks(base_dir: str, - nickname: str, domain: str) -> str: + nickname: str, domain: str, + debug: bool) -> str: """Return the text for the textarea for "blocked accounts" when editing profile """ @@ -101,7 +102,8 @@ def get_account_blocks(base_dir: str, with open(blocking_filename, 'r', encoding='utf-8') as fp_block: blocking_file_text = fp_block.read() except OSError: - print('EX: Failed to read account blocks ' + blocking_filename) + if debug: + print('EX: Failed to read account blocks ' + blocking_filename) return '' blocklist = blocking_file_text.split('\n') @@ -123,12 +125,13 @@ def get_account_blocks(base_dir: str, def blocked_timeline_json(actor: str, page_number: int, items_per_page: int, base_dir: str, - nickname: str, domain: str) -> {}: + nickname: str, domain: str, + debug: bool) -> {}: """Returns blocked collection for an account https://codeberg.org/fediverse/fep/src/branch/main/fep/c648/fep-c648.md """ blocked_accounts_textarea = \ - get_account_blocks(base_dir, nickname, domain) + get_account_blocks(base_dir, nickname, domain, debug) blocked_list: list[str] = [] if blocked_accounts_textarea: blocked_list = blocked_accounts_textarea.split('\n') diff --git a/daemon_get.py b/daemon_get.py index 82173613a..7a21d4bdc 100644 --- a/daemon_get.py +++ b/daemon_get.py @@ -1073,7 +1073,8 @@ def daemon_http_get(self) -> None: blocked_json = \ blocked_timeline_json(actor, page_number, blocked_items_per_page, base_dir, - nickname, self.server.domain) + nickname, self.server.domain, + self.server.debug) msg_str = json.dumps(blocked_json, ensure_ascii=False) msg_str = convert_domains(calling_domain, @@ -4542,7 +4543,8 @@ def daemon_http_get(self) -> None: self.server.block_government, self.server.block_bluesky, self.server.block_nostr, - self.server.block_federated_endpoints): + self.server.block_federated_endpoints, + self.server.debug): self.server.getreq_busy = False return diff --git a/daemon_get_profile.py b/daemon_get_profile.py index 981b59b9b..d6b163301 100644 --- a/daemon_get_profile.py +++ b/daemon_get_profile.py @@ -578,7 +578,8 @@ def edit_profile2(self, calling_domain: str, path: str, block_government: {}, block_bluesky: {}, block_nostr: {}, - block_federated_endpoints: []) -> bool: + block_federated_endpoints: [], + debug: bool) -> bool: """Show the edit profile screen """ if '/users/' in path and path.endswith('/editprofile'): @@ -609,7 +610,8 @@ def edit_profile2(self, calling_domain: str, path: str, block_government, block_bluesky, block_nostr, - block_federated_endpoints) + block_federated_endpoints, + debug) if msg: msg = msg.encode('utf-8') msglen = len(msg) diff --git a/webapp_profile.py b/webapp_profile.py index daf78c6d8..8962f0002 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -2648,7 +2648,8 @@ def _html_edit_profile_filtering(base_dir: str, nickname: str, domain: str, block_government: {}, block_bluesky: {}, block_nostr: {}, - block_federated_endpoints: []) -> str: + block_federated_endpoints: [], + debug: bool) -> str: """Filtering and blocking section of edit profile screen """ filter_str = '' @@ -2707,7 +2708,7 @@ def _html_edit_profile_filtering(base_dir: str, nickname: str, domain: str, print('EX: _html_edit_profile_filtering unable to read ' + auto_cw_filename) - blocked_str = get_account_blocks(base_dir, nickname, domain) + blocked_str = get_account_blocks(base_dir, nickname, domain, debug) dm_allowed_instances_str = '' dm_allowed_instances_filename = \ @@ -3553,7 +3554,8 @@ def html_edit_profile(server, translate: {}, block_government: {}, block_bluesky: {}, block_nostr: {}, - block_federated_endpoints: []) -> str: + block_federated_endpoints: [], + debug: bool) -> str: """Shows the edit profile screen """ replacements = { @@ -3895,7 +3897,8 @@ def html_edit_profile(server, translate: {}, cw_lists, lists_enabled, buy_sites, block_military, block_government, block_bluesky, block_nostr, - block_federated_endpoints) + block_federated_endpoints, + debug) # git projects section edit_profile_form += \