From a51effb663e7556a28e10651c9ef280063ab196c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 12 Jan 2024 10:00:40 +0100 Subject: [PATCH] Continued: - changed string "true/false" to boolean - please update your configuration file (all occurances!) --- config.defaults.json | 4 ++-- fba/commands.py | 4 ++-- fba/helpers/domain.py | 4 ++-- fba/helpers/processing.py | 2 +- fba/models/error_log.py | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/config.defaults.json b/config.defaults.json index 8b72846..a616c72 100644 --- a/config.defaults.json +++ b/config.defaults.json @@ -22,11 +22,11 @@ "source_last_access" : 86400, "misskey_limit" : 100, "error_log_cleanup" : 604800, - "write_error_log" : "true", + "write_error_log" : true, "rss_limit" : 50, "api_limit" : 500, "theme" : "light", - "allow_i2p_domain" : "false", + "allow_i2p_domain" : false, "instances_social_api_key": "", "max_crawl_depth" : 2000, "min_peers_length" : 1000 diff --git a/fba/commands.py b/fba/commands.py index ce6623e..ef9d746 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -373,7 +373,7 @@ def fetch_blocks(args: argparse.Namespace) -> int: elif block["blocked"].endswith(".onion"): logger.debug("blocked='%s' is a TOR .onion domain - SKIPPED", block["blocked"]) continue - elif block["blocked"].endswith(".i2p") and not config.get("allow_i2p_domain") == "true": + elif block["blocked"].endswith(".i2p") and not config.get("allow_i2p_domain"): logger.debug("blocked='%s' is an I2P .onion domain - SKIPPED", block["blocked"]) continue elif block["blocked"].endswith(".arpa"): @@ -1342,7 +1342,7 @@ def recheck_obfuscation(args: argparse.Namespace) -> int: elif block["blocked"].endswith(".onion"): logger.debug("blocked='%s' is a TOR onion domain name - SKIPPED!", block["blocked"]) continue - elif block["blocked"].endswith(".i2p") and not config.get("allow_i2p_domain") == "true": + elif block["blocked"].endswith(".i2p") and not config.get("allow_i2p_domain"): logger.debug("blocked='%s' is an I2P onion domain name - SKIPPED!", block["blocked"]) continue elif block["blocked"].endswith(".arpa"): diff --git a/fba/helpers/domain.py b/fba/helpers/domain.py index 8614892..df4c703 100644 --- a/fba/helpers/domain.py +++ b/fba/helpers/domain.py @@ -42,7 +42,7 @@ def raise_on(domain: str): raise ValueError(f"domain='{domain}' is not a valid domain") elif domain.endswith(".onion"): raise ValueError(f"domain='{domain}' is a TOR, please don't crawl them!") - elif domain.endswith(".i2p") and not config.get("allow_i2p_domain") == "true": + elif domain.endswith(".i2p") and not config.get("allow_i2p_domain"): raise ValueError(f"domain='{domain}' is an I2P, please don't crawl them!") elif domain.endswith(".arpa"): raise ValueError(f"domain='{domain}' is a domain for reversed IP addresses, please don't crawl them!") @@ -97,7 +97,7 @@ def is_wanted(domain: str) -> bool: elif domain.endswith(".onion"): logger.debug("domain='%s' is a TOR .onion domain - setting False ...", domain) wanted = False - elif domain.endswith(".i2p") and not config.get("allow_i2p_domain") == "true": + elif domain.endswith(".i2p") and not config.get("allow_i2p_domain"): logger.debug("domain='%s' is an I2P domain - setting False ...", domain) wanted = False elif domain.endswith(".tld"): diff --git a/fba/helpers/processing.py b/fba/helpers/processing.py index 5a96ac9..847f9fc 100644 --- a/fba/helpers/processing.py +++ b/fba/helpers/processing.py @@ -205,7 +205,7 @@ def csv_block(blocker: str, url: str, command: str): elif domain.endswith(".onion"): logger.debug("domain='%s' is a TOR .onion domain - SKIPPED", domain) continue - elif domain.endswith(".i2p") and not config.get("allow_i2p_domain") == "true": + elif domain.endswith(".i2p") and not config.get("allow_i2p_domain"): logger.debug("domain='%s' is an I2P .onion domain - SKIPPED", domain) continue elif domain.endswith(".arpa"): diff --git a/fba/models/error_log.py b/fba/models/error_log.py index 35e0933..672c775 100644 --- a/fba/models/error_log.py +++ b/fba/models/error_log.py @@ -32,7 +32,7 @@ def add(domain: str, error: dict): if blacklist.is_blacklisted(domain): raise ValueError(f"domain='{domain}' is blacklisted but function was invoked") - elif config.get("write_error_log").lower() != "true": + elif not config.get("write_error_log"): logger.debug("Writing to error_log is disabled in configuruation file - EXIT!") return -- 2.39.5