From 8d880a4ea5eb25189fb758364792c23b378bcf7f Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 6 Oct 2025 13:41:12 +0100 Subject: [PATCH] Tidying --- blocking.py | 24 ------------------------ daemon.py | 9 --------- 2 files changed, 33 deletions(-) diff --git a/blocking.py b/blocking.py index 99c746fcb..a296e505c 100644 --- a/blocking.py +++ b/blocking.py @@ -39,7 +39,6 @@ from utils import has_users_path from utils import get_full_domain from utils import remove_id_ending from utils import locate_post -from utils import evil_incarnate from utils import get_domain_from_actor from utils import get_nickname_from_actor from utils import acct_dir @@ -646,29 +645,6 @@ def is_blocked_hashtag(base_dir: str, hashtag: str) -> bool: return False -def get_domain_blocklist(base_dir: str) -> str: - """Returns all globally blocked domains as a string - This can be used for fast matching to mitigate flooding - """ - blocked_str: str = '' - - evil_domains = evil_incarnate() - for evil in evil_domains: - blocked_str += evil + '\n' - - global_blocking_filename = data_dir(base_dir) + '/blocking.txt' - if not os.path.isfile(global_blocking_filename): - return blocked_str - try: - with open(global_blocking_filename, 'r', - encoding='utf-8') as fp_blocked: - blocked_str += fp_blocked.read() - except OSError: - print('EX: get_domain_blocklist unable to read ' + - global_blocking_filename) - return blocked_str - - def update_blocked_cache(base_dir: str, blocked_cache: [], blocked_cache_last_updated: int, diff --git a/daemon.py b/daemon.py index aafda02e8..06f37b65b 100644 --- a/daemon.py +++ b/daemon.py @@ -37,7 +37,6 @@ from blocking import load_blocked_bluesky from blocking import load_blocked_nostr from blocking import update_blocked_cache from blocking import set_broch_mode -from blocking import get_domain_blocklist from webapp_utils import load_buy_sites from webapp_accesskeys import load_access_keys_for_accounts from webapp_media import load_peertube_instances @@ -362,8 +361,6 @@ class EpicyonServer(ThreadingHTTPServer): max_newswire_posts = 0 verify_all_signatures: bool = False blocklistUpdateCtr = 0 - blocklistUpdateInterval = 100 - domainBlocklist = None manual_follower_approval = True onion_domain = None i2p_domain = None @@ -995,12 +992,6 @@ def run_daemon(accounts_data_dir: str, # whether to require that all incoming posts have valid jsonld signatures httpd.verify_all_signatures = verify_all_signatures - # This counter is used to update the list of blocked domains in memory. - # It helps to avoid touching the disk and so improves flooding resistance - httpd.blocklistUpdateCtr = 0 - httpd.blocklistUpdateInterval = 100 - httpd.domainBlocklist = get_domain_blocklist(base_dir) - httpd.manual_follower_approval = manual_follower_approval if domain.endswith('.onion'): onion_domain = domain