From 071e768c53cd3d6641fb3d46da153e5e372ddd47 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Wed, 9 Oct 2024 03:50:52 +0900 Subject: [PATCH] Update fediverse.py --- plugins/fediverse.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/fediverse.py b/plugins/fediverse.py index 5f19b8c..eaef005 100644 --- a/plugins/fediverse.py +++ b/plugins/fediverse.py @@ -36,7 +36,7 @@ try: librey_apiurl = config( "LIBREY_APIURL", default="https://serp.catswords.net" ) # https://github.com/Ahwxorg/librey - bad_domains = config("BAD_DOMAINS", default="") + bad_domain = config("BAD_DOMAIN", default="") except Exception as e: logger.error("[*] Invalid configuration", exc_info=e) @@ -72,7 +72,8 @@ class Fediverse(Extension): return False # check if the text contains any of the bad domains - if bool(re.search(r"https?://(" + "|".join(re.escape(domain) for domain in bad_domains.split(",")) + ")", text)): + bad_domains = list(filter(None, map(str.strip, bad_domain))) + if bool(re.search(r"https?://(" + "|".join(re.escape(domain) for domain in bad_domains) + ")", text)): logger.warning("[*] Found a bad reputation domain.") logger.warning("[*] BLOCKED MESSAGE: %s" % (text)) return True