]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sat, 25 Nov 2023 23:45:04 +0000 (00:45 +0100)
committerRoland Häder <roland@mxchange.org>
Sat, 25 Nov 2023 23:45:04 +0000 (00:45 +0100)
- improved/added debug lines

fba/networks/misskey.py
fba/networks/pleroma.py

index e318cd60ae0c62be8f430ff51c399f1be31b1af5..ddbfa461ae784621c716a85a5a7a281b71358065 100644 (file)
@@ -141,7 +141,7 @@ def fetch_blocks(domain: str) -> list:
     headers = tuple()
 
     try:
-        logger.debug("Checking CSRF for domain='%s'", domain)
+        logger.debug("Checking CSRF for domain='%s' ...", domain)
         headers = csrf.determine(domain, dict())
     except network.exceptions as exception:
         logger.warning("Exception '%s' during checking CSRF (fetch_blocks,%s)", type(exception), __name__)
@@ -158,6 +158,7 @@ def fetch_blocks(domain: str) -> list:
     # instances page-by-page since it doesn't support sending them all at once
     logger.debug("Fetching misskey blocks from domain='%s'", domain)
     while True:
+        logger.debug("offset=%d", offset)
         try:
             logger.debug("Fetching offset=%d from domain='%s' ...", offset, domain)
             if offset == 0:
@@ -202,6 +203,7 @@ def fetch_blocks(domain: str) -> list:
                 offset = offset + step
 
             count = 0
+            logger.debug("Checking %d row(s) of instances ...", len(rows))
             for instance in rows:
                 # Is it there?
                 logger.debug("instance[]='%s'", type(instance))
@@ -245,6 +247,7 @@ def fetch_blocks(domain: str) -> list:
 
     while True:
         # Fetch blocked (full suspended) instances
+        logger.debug("offset=%d", offset)
         try:
             if offset == 0:
                 logger.debug("Sending JSON API request to domain='%s',step=%d,offset=%d", domain, step, offset)
@@ -288,12 +291,13 @@ def fetch_blocks(domain: str) -> list:
                 offset = offset + step
 
             count = 0
+            logger.debug("Checking %d row(s) of instances ...", len(rows))
             for instance in rows:
                 # Is it there?
                 logger.debug("instance[]='%s'", type(instance))
                 blocked = tidyup.domain(instance["host"])
-
                 logger.debug("blocked='%s'", blocked)
+
                 if blocked is None or blocked == "":
                     logger.warning("instance[host]='%s' is None or empty after tidyup.domain() - SKIPPED!", instance["host"])
                     continue
index e26cabe60144ffb1e4a57ee07dd7e3c4078e7676..41d8500ecdbd7e7f1d0d05a14bc6ca133722036f 100644 (file)
@@ -124,40 +124,40 @@ def fetch_blocks(domain: str) -> list:
             block_level = blocks.alias_block_level(block_level)
 
             logger.debug("Checking %d entries from domain='%s',block_level='%s' ...", len(blocklist), domain, block_level)
-            if len(blocklist) > 0:
-                for blocked in blocklist:
-                    logger.debug("blocked='%s' - BEFORE!", blocked)
-                    blocked = tidyup.domain(blocked) if blocked != "" else None
-                    logger.debug("blocked='%s' - AFTER!", blocked)
-
-                    if blocked is None or blocked == "":
-                        logger.warning("blocked='%s' is empty after tidyup.domain(): domain='%s',block_level='%s' - SKIPPED!", blocked, domain, block_level)
-                        continue
-
-                    logger.debug("Invoking utils.deobfuscate(%s, %s) ...", blocked, domain)
-                    blocked = utils.deobfuscate(blocked, domain)
-
-                    logger.debug("blocked='%s' - DEOBFUSCATED!", blocked)
-                    if blocked is None or blocked == "":
-                        logger.warning("instance[host]='%s' is None or empty after tidyup.domain() - SKIPPED!", instance["host"])
-                        continue
-                    elif not domain_helper.is_wanted(blocked):
-                        logger.debug("blocked='%s' is not wanted - SKIPPED!", blocked)
-                        continue
-
-                    logger.debug("Appending blocker='%s',blocked='%s',block_level='%s' ...", domain, blocked, block_level)
-                    blockdict.append({
-                        "blocker"    : domain,
-                        "blocked"    : blocked,
-                        "reason"     : None,
-                        "block_level": block_level,
-                    })
+            for blocked in blocklist:
+                logger.debug("blocked='%s' - BEFORE!", blocked)
+                blocked = tidyup.domain(blocked) if blocked != "" else None
+                logger.debug("blocked='%s' - AFTER!", blocked)
+
+                if blocked is None or blocked == "":
+                    logger.warning("blocked='%s' is empty after tidyup.domain(): domain='%s',block_level='%s' - SKIPPED!", blocked, domain, block_level)
+                    continue
+
+                logger.debug("Invoking utils.deobfuscate(%s, %s) ...", blocked, domain)
+                blocked = utils.deobfuscate(blocked, domain)
+                logger.debug("blocked='%s' - DEOBFUSCATED!", blocked)
+
+                if blocked is None or blocked == "":
+                    logger.warning("instance[host]='%s' is None or empty after tidyup.domain() - SKIPPED!", instance["host"])
+                    continue
+                elif not domain_helper.is_wanted(blocked):
+                    logger.debug("blocked='%s' is not wanted - SKIPPED!", blocked)
+                    continue
+
+                logger.debug("Appending blocker='%s',blocked='%s',block_level='%s' ...", domain, blocked, block_level)
+                blockdict.append({
+                    "blocker"    : domain,
+                    "blocked"    : blocked,
+                    "reason"     : None,
+                    "block_level": block_level,
+                })
 
     elif "quarantined_instances" in data:
         logger.debug("Found 'quarantined_instances' in JSON response: domain='%s'", domain)
         found = True
         block_level = "quarantined"
 
+        logger.debug("Checking %d quarantined instance(s) ...", len(data["quarantined_instances"]))
         for blocked in data["quarantined_instances"]:
             logger.debug("blocked='%s' - BEFORE!", blocked)
             blocked = tidyup.domain(blocked) if blocked != "" else None
@@ -255,7 +255,7 @@ def fetch_blocks(domain: str) -> list:
                 logger.warning("blocked is empty after tidyup.domain(): domain='%s',block_level='%s'", domain, block_level)
                 continue
 
-            logger.debug("Checking %d blockdict records ...", len(blockdict))
+            logger.debug("Checking %d blockdict record(s) ...", len(blockdict))
             for block in blockdict:
                 logger.debug("block[blocked]='%s',blocked='%s'", block["blocked"], blocked)
                 if block["blocked"] == blocked:
@@ -270,7 +270,7 @@ def fetch_blocks(domain: str) -> list:
 
         logger.debug("blocklist()=%d", len(blocklist))
         if len(blocklist) > 0:
-            logger.info("Checking %d different blocklists ...", len(blocklist))
+            logger.info("Checking %d different blocklist(s) ...", len(blocklist))
             for block_level in blocklist:
                 logger.debug("block_level='%s'", block_level)
                 rows = blocklist[block_level]