- # DEBUG: print(f"DEBUG: blocked='{blocked}' de-obscured to '{row[0]}'")
- blocked = row[0]
- origin = row[1]
- nodeinfo_url = row[2]
- elif blocked.count("?") > 0:
- # Obscured domain name with no hash
- row = instances.deobscure("?", blocked)
-
- # DEBUG: print(f"DEBUG: row[]='{type(row)}'")
- if row is None:
- print(f"WARNING: Cannot deobsfucate blocked='{blocked}',domain='{domain}',origin='{origin}' - SKIPPED!")
- continue
-
- # DEBUG: print(f"DEBUG: blocked='{blocked}' de-obscured to '{row[0]}'")
- blocked = row[0]
- origin = row[1]
- nodeinfo_url = row[2]
-
- # DEBUG: print(f"DEBUG: blocked='{blocked}'")
- if not validators.domain(blocked):
- print(f"WARNING: blocked='{blocked}',software='pleroma' is not a valid domain name - SKIPPED!")
- continue
- elif blocked.endswith(".arpa"):
- print(f"WARNING: blocked='{blocked}' is a reversed .arpa domain and should not be used generally.")
- continue
- elif blocked.endswith(".tld"):
- print(f"WARNING: blocked='{blocked}' is a fake domain, please don't crawl them!")
- continue
- elif blacklist.is_blacklisted(blocked):
- # DEBUG: print(f"DEBUG: blocked='{blocked}' is blacklisted - SKIPPED!")
- continue
- elif not instances.is_registered(blocked):
- # DEBUG: print(f"DEBUG: Domain blocked='{blocked}' wasn't found, adding ..., domain='{domain}',origin='{origin}',nodeinfo_url='{nodeinfo_url}'")
- instances.add(blocked, domain, inspect.currentframe().f_code.co_name, nodeinfo_url)
-
- # DEBUG: print(f"DEBUG: Updating block reason: reason='{reason}',domain='{domain}',blocked='{blocked}',block_level='{block_level}'")
- blocks.update_reason(reason, domain, blocked, block_level)
-
- # DEBUG: print(f"DEBUG: blockdict()={len(blockdict)}")
- for entry in blockdict:
- if entry["blocked"] == blocked:
- # DEBUG: print(f"DEBUG: Updating entry reason: blocked='{blocked}',reason='{reason}'")
- entry["reason"] = reason
+ logger.debug("Checking %d blockdict records ...", len(blockdict))
+ for block in blockdict:
+ logger.debug("block[blocked]='%s',blocked='%s'", block["blocked"], blocked)
+ if block["blocked"] == blocked:
+ logger.debug("Updating reason='%s' for blocker='%s'", reason, block["blocked"])
+ block["reason"] = reason