mirror of https://gitlab.com/bashrc2/epicyon
Add debug condition
parent
bbb9881b54
commit
ff84b0a0c7
|
|
@ -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,6 +102,7 @@ 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:
|
||||
if debug:
|
||||
print('EX: Failed to read account blocks ' + blocking_filename)
|
||||
return ''
|
||||
|
||||
|
|
@ -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')
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 += \
|
||||
|
|
|
|||
Loading…
Reference in New Issue