]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sat, 1 Jul 2023 01:18:39 +0000 (03:18 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 1 Jul 2023 01:20:55 +0000 (03:20 +0200)
- skip empty domains after tidyup.domain()

fba/networks/lemmy.py
fba/networks/pleroma.py

index 946d0eb1ebc9a7f8dc45b6265fe601926fcb018b..88e18e0acd56b78dcf319b8319d39f732d7005a4 100644 (file)
@@ -174,11 +174,14 @@ def fetch_blocks(domain: str, nodeinfo_url: str) -> list:
                 blocked = tidyup.domain(tag.contents[0])
                 logger.debug("blocked='%s'", blocked)
 
-                if not utils.is_domain_wanted(blocked):
+                if blocked == "":
+                    logger.warning("blocked='%s' is empty after tidyup.domain() - SKIPPED!", tag.contents[0])
+                    continue
+                elif not utils.is_domain_wanted(blocked):
                     logger.debug("blocked='%s' is not wanted - SKIPPED!", blocked)
                     continue
 
-                logger.debug("Appending blocker='%s',blocked='%s',block_level='reject'", domain, blocked)
+                logger.debug("Appending blocker='%s',blocked='%s',block_level='reject' ...", domain, blocked)
                 blocklist.append({
                     "blocker"    : domain,
                     "blocked"    : blocked,
index 49ec65bea9daf265e3c37bde762a48ed6d5fefd3..a701fdc186b684b8e18ac6dccfa2d85f14457ec3 100644 (file)
@@ -103,7 +103,7 @@ def fetch_blocks(domain: str, nodeinfo_url: str) -> list:
                     logger.debug("blocked='%s' - AFTER!", blocked)
 
                     if blocked == "":
-                        logger.warning("blocked is empty after tidyup.domain(): domain='%s',block_level='%s'", domain, block_level)
+                        logger.warning("blocked is empty after tidyup.domain(): domain='%s',block_level='%s' - SKIPPED!", domain, block_level)
                         continue
                     elif not utils.is_domain_wanted(blocked):
                         logger.debug("blocked='%s' is not wanted - SKIPPED!", blocked)
@@ -238,7 +238,7 @@ def fetch_blocks(domain: str, nodeinfo_url: str) -> list:
                 logger.warning("Cannot find blocked='%s' in rows()=%d,domain='%s' - BREAK!", blocked, len(rows), domain)
                 break
 
-            reason = rows[blocked]["reason"]
+            reason = tidyup.reason(rows[blocked]["reason"])
             logger.debug("reason='%s'", reason)
 
             if blocked == "":
@@ -283,16 +283,17 @@ def fetch_blocks(domain: str, nodeinfo_url: str) -> list:
                     reason  = tidyup.reason(record["reason"])
                     logger.debug("blocked='%s',reason='%s' - AFTER!", blocked, reason)
 
-                    if blocked == "":
-                        logger.warning("blocked is empty after tidyup.domain(): domain='%s',block_level='%s'", domain, block_level)
-                        continue
-                    elif not utils.is_domain_wanted(blocked):
+                    if not utils.is_domain_wanted(blocked):
                         logger.warning("blocked='%s' is not wanted - SKIPPED!", blocked)
                         continue
 
                     logger.debug("Invoking utils.deobfuscate_domain(%s, %s) ...", blocked, domain)
                     blocked = utils.deobfuscate_domain(blocked, domain)
+
                     logger.debug("blocked='%s' - DEOBFUSCATED!", blocked)
+                    if not utils.is_domain_wanted(blocked):
+                        logger.debug("blocked='%s' is not wanted - SKIPPED!", blocked)
+                        continue
 
                     logger.debug("Appending blocker='%s',blocked='%s',reason='%s',block_level='%s' ...",domain, blocked, reason, block_level)
                     blockdict.append({