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__)
# 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:
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))
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)
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
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
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:
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]