From 5620e4be5b6d83f80e97b516468698390032b219 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 11 Jun 2023 19:59:08 +0200 Subject: [PATCH] Continued: - also cut off trailing double-dot (some people cannot format their data in tables properly) - a wildcat might be at the start of the string, so start checking there for it --- fba/helpers/tidyup.py | 3 ++- fba/networks/pleroma.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/fba/helpers/tidyup.py b/fba/helpers/tidyup.py index e5f8eab..b784eeb 100644 --- a/fba/helpers/tidyup.py +++ b/fba/helpers/tidyup.py @@ -46,8 +46,9 @@ def domain(string: str) -> str: # No trailing slash string = re.sub("\/$", "", string) - # No @ sign + # No @ or : sign string = re.sub("^\@", "", string) + string = string.split(":")[0] # No individual users in block lists string = re.sub("(.+)\@", "", string) diff --git a/fba/networks/pleroma.py b/fba/networks/pleroma.py index 8c16f88..186c8d4 100644 --- a/fba/networks/pleroma.py +++ b/fba/networks/pleroma.py @@ -98,7 +98,7 @@ def fetch_blocks(domain: str, origin: str, nodeinfo_url: str): elif blacklist.is_blacklisted(blocked): # DEBUG: print(f"DEBUG: blocked='{blocked}' is blacklisted - skipping!") continue - elif blocked.count("*") > 1: + elif blocked.count("*") > 0: # Obsured domain name with no hash # DEBUG: print(f"DEBUG: Trying to de-obscure blocked='{blocked}' ...") fba.cursor.execute( @@ -185,7 +185,7 @@ def fetch_blocks(domain: str, origin: str, nodeinfo_url: str): elif blacklist.is_blacklisted(blocked): # DEBUG: print(f"DEBUG: blocked='{blocked}' is blacklisted - skipping!") continue - elif blocked.count("*") > 1: + elif blocked.count("*") > 0: # Obsured domain with no hash # DEBUG: print(f"DEBUG: Trying to de-obscure blocked='{blocked}' ...") fba.cursor.execute( -- 2.39.5