mirror of https://gitlab.com/bashrc2/epicyon
Try other fields to obtain block strings
parent
ca0ffdbd6b
commit
0e82d56cd0
31
blocking.py
31
blocking.py
|
@ -1933,26 +1933,31 @@ def _update_federated_blocks(session, base_dir: str,
|
||||||
# a simple list of strings containing handles
|
# a simple list of strings containing handles
|
||||||
# or domains
|
# or domains
|
||||||
handle = block_dict
|
handle = block_dict
|
||||||
|
if handle.startswith('@'):
|
||||||
|
handle = handle[1:]
|
||||||
if _valid_blocklist_entry(handle):
|
if _valid_blocklist_entry(handle):
|
||||||
new_block_api_str += handle + '\n'
|
if handle not in new_block_api_str:
|
||||||
|
new_block_api_str += handle + '\n'
|
||||||
if handle not in block_federated:
|
if handle not in block_federated:
|
||||||
block_federated.append(handle)
|
block_federated.append(handle)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not isinstance(block_dict, dict):
|
if not isinstance(block_dict, dict):
|
||||||
continue
|
continue
|
||||||
if not block_dict.get('username'):
|
for block_fieldname in ('username', 'domain'):
|
||||||
continue
|
if not block_dict.get(block_fieldname):
|
||||||
if not isinstance(block_dict['username'], str):
|
continue
|
||||||
continue
|
if not isinstance(block_dict[block_fieldname], str):
|
||||||
handle = block_dict['username']
|
continue
|
||||||
if handle.startswith('@'):
|
handle = block_dict[block_fieldname]
|
||||||
handle = handle[1:]
|
if handle.startswith('@'):
|
||||||
if not _valid_blocklist_entry(handle):
|
handle = handle[1:]
|
||||||
continue
|
if not _valid_blocklist_entry(handle):
|
||||||
new_block_api_str += handle + '\n'
|
continue
|
||||||
if handle not in block_federated:
|
if handle not in new_block_api_str:
|
||||||
block_federated.append(handle)
|
new_block_api_str += handle + '\n'
|
||||||
|
if handle not in block_federated:
|
||||||
|
block_federated.append(handle)
|
||||||
|
|
||||||
block_api_filename = \
|
block_api_filename = \
|
||||||
base_dir + '/accounts/block_api.txt'
|
base_dir + '/accounts/block_api.txt'
|
||||||
|
|
Loading…
Reference in New Issue