mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
095f3eba10
commit
cf27367719
|
@ -412,8 +412,7 @@ def send_undo_announce_via_server(base_dir: str, session,
|
||||||
|
|
||||||
|
|
||||||
def outbox_undo_announce(recent_posts_cache: {},
|
def outbox_undo_announce(recent_posts_cache: {},
|
||||||
base_dir: str, http_prefix: str,
|
base_dir: str, nickname: str, domain: str,
|
||||||
nickname: str, domain: str, port: int,
|
|
||||||
message_json: {}, debug: bool) -> None:
|
message_json: {}, debug: bool) -> None:
|
||||||
""" When an undo announce is received by the outbox from c2s
|
""" When an undo announce is received by the outbox from c2s
|
||||||
"""
|
"""
|
||||||
|
|
14
blocking.py
14
blocking.py
|
@ -119,7 +119,8 @@ def add_block(base_dir: str, nickname: str, domain: str,
|
||||||
followers_filename = \
|
followers_filename = \
|
||||||
acct_dir(base_dir, nickname, domain) + '/followers.txt'
|
acct_dir(base_dir, nickname, domain) + '/followers.txt'
|
||||||
if os.path.isfile(followers_filename):
|
if os.path.isfile(followers_filename):
|
||||||
if block_handle + '\n' in open(followers_filename).read():
|
if block_handle + '\n' in open(followers_filename,
|
||||||
|
encoding='utf-8').read():
|
||||||
followers_str = ''
|
followers_str = ''
|
||||||
try:
|
try:
|
||||||
with open(followers_filename, 'r',
|
with open(followers_filename, 'r',
|
||||||
|
@ -186,7 +187,8 @@ def remove_global_block(base_dir: str,
|
||||||
else:
|
else:
|
||||||
unblock_hashtag = unblock_nickname
|
unblock_hashtag = unblock_nickname
|
||||||
if os.path.isfile(unblocking_filename):
|
if os.path.isfile(unblocking_filename):
|
||||||
if unblock_hashtag + '\n' in open(unblocking_filename).read():
|
if unblock_hashtag + '\n' in open(unblocking_filename,
|
||||||
|
encoding='utf-8').read():
|
||||||
try:
|
try:
|
||||||
with open(unblocking_filename, 'r',
|
with open(unblocking_filename, 'r',
|
||||||
encoding='utf-8') as fp_unblock:
|
encoding='utf-8') as fp_unblock:
|
||||||
|
@ -356,7 +358,8 @@ def is_blocked_domain(base_dir: str, domain: str,
|
||||||
global_blocking_filename = base_dir + '/accounts/blocking.txt'
|
global_blocking_filename = base_dir + '/accounts/blocking.txt'
|
||||||
if os.path.isfile(global_blocking_filename):
|
if os.path.isfile(global_blocking_filename):
|
||||||
try:
|
try:
|
||||||
with open(global_blocking_filename, 'r') as fp_blocked:
|
with open(global_blocking_filename, 'r',
|
||||||
|
encoding='utf-8') as fp_blocked:
|
||||||
blocked_str = fp_blocked.read()
|
blocked_str = fp_blocked.read()
|
||||||
if '*@' + domain + '\n' in blocked_str:
|
if '*@' + domain + '\n' in blocked_str:
|
||||||
return True
|
return True
|
||||||
|
@ -370,10 +373,11 @@ def is_blocked_domain(base_dir: str, domain: str,
|
||||||
allow_filename = base_dir + '/accounts/allowedinstances.txt'
|
allow_filename = base_dir + '/accounts/allowedinstances.txt'
|
||||||
# instance allow list
|
# instance allow list
|
||||||
if not short_domain:
|
if not short_domain:
|
||||||
if domain not in open(allow_filename).read():
|
if domain not in open(allow_filename, encoding='utf-8').read():
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
if short_domain not in open(allow_filename).read():
|
if short_domain not in open(allow_filename,
|
||||||
|
encoding='utf-8').read():
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -601,8 +601,7 @@ def post_message_to_outbox(session, translate: {},
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: handle any undo announce requests')
|
print('DEBUG: handle any undo announce requests')
|
||||||
outbox_undo_announce(recent_posts_cache,
|
outbox_undo_announce(recent_posts_cache,
|
||||||
base_dir, http_prefix,
|
base_dir, post_to_nickname, domain,
|
||||||
post_to_nickname, domain, port,
|
|
||||||
message_json, debug)
|
message_json, debug)
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
|
|
Loading…
Reference in New Issue