Update fediverse.py

This commit is contained in:
Namhyeon Go 2024-10-09 03:33:21 +09:00 committed by GitHub
parent 447b152f85
commit bd2e017598
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -40,9 +40,6 @@ try:
except Exception as e: except Exception as e:
logger.error("[*] Invalid configuration", exc_info=e) logger.error("[*] Invalid configuration", exc_info=e)
# bad reputation domains
bad_domains = bad_domains.split(",")
class Fediverse(Extension): class Fediverse(Extension):
def __init__(self): def __init__(self):
self.type = "filter" # this is a filter self.type = "filter" # this is a filter
@ -75,7 +72,7 @@ class Fediverse(Extension):
return False return False
# check if the text contains any of the bad domains # check if the text contains any of the bad domains
if len(bad_domains) > 0 and bool(re.search(r"https://(" + "|".join(re.escape(domain) for domain in bad_domains) + ")", text)): if bool(re.search(r"https?://(" + "|".join(re.escape(domain) for domain in bad_domains.split(",")) + ")", text)):
logger.warning("[*] Found a bad reputation domain.") logger.warning("[*] Found a bad reputation domain.")
logger.warning("[*] BLOCKED MESSAGE: %s" % (text)) logger.warning("[*] BLOCKED MESSAGE: %s" % (text))
return True return True