From 0a88d7d1d82b858f049c8d1a995e6ef63b214304 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 3 Aug 2023 21:33:05 +0200 Subject: [PATCH] Continued: - update last_blocked timestamp when a blocklist has been fetched/generated for an instance aka. "blocker" --- fba/commands.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fba/commands.py b/fba/commands.py index bd2dd22..f35c096 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -605,6 +605,7 @@ def fetch_todon_wiki(args: argparse.Namespace) -> int: blocker = "todon.eu" logger.debug("Invoking instances.set_total_blocks(%s, %d) ...", blocker, len(blocking)) + instances.set_last_blocked(blocker) instances.set_total_blocks(blocker, blocking) blockdict = list() @@ -713,6 +714,7 @@ def fetch_cs(args: argparse.Namespace): blocker = "chaos.social" logger.debug("Invoking instances.set_total_blocks(%s, %d) ...", blocker, len(blocking)) + instances.set_last_blocked(blocker) instances.set_total_blocks(blocker, blocking) logger.debug("blocklist[silenced]()=%d,blocklist[reject]()=%d", len(blocklist["silenced"]), len(blocklist["reject"])) @@ -1041,6 +1043,8 @@ def fetch_oliphant(args: argparse.Namespace) -> int: logger.debug("args.domain='%s' already handled - SKIPPED!", args.domain) continue + instances.set_last_blocked(block["blocker"]) + # Fetch this URL logger.info("Fetching csv_url='%s' for blocker='%s' ...", block["csv_url"], block["blocker"]) response = utils.fetch_url(f"{base_url}/{block['csv_url']}", network.web_headers, (config.get("connection_timeout"), config.get("read_timeout"))) @@ -1502,6 +1506,7 @@ def fetch_joinfediverse(args: argparse.Namespace) -> int: for blocker in domains: blocker = blocker[0] logger.debug("blocker[%s]='%s'", type(blocker), blocker) + instances.set_last_blocked(blocker) for block in blocking: logger.debug("block[blocked]='%s',block[block reason(s)]='%s' - BEFORE!", block["blocked"], block["block reason(s)"] if "block reason(s)" in block else None) @@ -1582,6 +1587,7 @@ def recheck_obfuscation(args: argparse.Namespace) -> int: # chaos.social requires special care ... if row["domain"] != "chaos.social": logger.debug("Invoking instances.set_total_blocks(%s, %d) ...", row["domain"], len(blocking)) + instances.set_last_blocked(row["domain"]) instances.set_total_blocks(row["domain"], blocking) obfuscated = 0 -- 2.39.5