block["block_level"] = blocks.alias_block_level(block["block_level"])
logger.debug("block[block_level]='%s' - AFTER!", block["block_level"])
- if processing.block(blocker, block["blocked"], block["reason"], block["block_level"]) and block["block_level"] in ["reject", "suspend"] and config.get("bot_enabled"):
+ if processing.block(blocker, block["blocked"], block["reason"], block["block_level"]) and block["block_level"] in ["rejected", "suspended"] and config.get("bot_enabled"):
logger.debug("Appending block[blocked]'%s',reason='%s' for blocker='%s' ...", block["blocked"], block["block_level"], blocker)
blockdict.append({
"blocked": block["blocked"],
blocklist = {
"silenced": list(),
- "reject": list(),
+ "rejected": list(),
}
logger.debug("Fetching domainblocks from source_domain='%s'", source_domain)
suspended = doc.find("h3", {"id": "suspended_servers"}).find_next("ul").findAll("li")
logger.info("Checking %d suspended entries ...", len(suspended))
- blocklist["reject"] = utils.find_domains(suspended, "div")
+ blocklist["rejected"] = utils.find_domains(suspended, "div")
- blocking = blocklist["silenced"] + blocklist["reject"]
+ blocking = blocklist["silenced"] + blocklist["rejected"]
blocker = "todon.eu"
logger.debug("Invoking instances.set_total_blocks(%s, %d) ...", blocker, len(blocking))
logger.info("Adding new block: blocked='%s',block_level='%s'", blocked, block_level)
- if processing.block(blocker, blocked, None, block_level) and block_level == "reject" and config.get("bot_enabled"):
+ if processing.block(blocker, blocked, None, block_level) and block_level in ["suspended", "rejected"] and config.get("bot_enabled"):
logger.debug("Appending blocked='%s',reason='%s' for blocker='%s' ...", blocked, block_level, blocker)
blockdict.append({
"blocked": blocked,
blocklist = {
"silenced": list(),
- "reject" : list(),
+ "rejected": list(),
}
source_domain = "raw.githubusercontent.com"
blocked = doc.find("h2", {"id": "blocked-instances"}).findNext("table").find("tbody")
logger.debug("blocked[%s]()=%d", type(blocked), len(blocked))
- blocklist["reject"] = federation.find_domains(blocked)
+ blocklist["rejected"] = federation.find_domains(blocked)
- blocking = blocklist["silenced"] + blocklist["reject"]
+ blocking = blocklist["silenced"] + blocklist["rejected"]
blocker = "chaos.social"
logger.debug("Invoking instances.set_total_blocks(%s, %d) ...", blocker, len(blocking))
instances.set_last_blocked(blocker)
instances.set_total_blocks(blocker, blocking)
- logger.debug("blocklist[silenced]()=%d,blocklist[reject]()=%d", len(blocklist["silenced"]), len(blocklist["reject"]))
+ logger.debug("blocklist[silenced]()=%d,blocklist[reject]()=%d", len(blocklist["silenced"]), len(blocklist["rejected"]))
if len(blocking) > 0:
blockdict = list()
for block_level in blocklist:
logger.warning("Exception '%s' during fetching instances (fetch_cs) from row[domain]='%s'", type(exception), row["domain"])
instances.set_last_error(row["domain"], exception)
- if processing.block(blocker, row["domain"], row["reason"], block_level) and block_level == "reject" and config.get("bot_enabled"):
+ if processing.block(blocker, row["domain"], row["reason"], block_level) and block_level in ["suspended", "rejected"] and config.get("bot_enabled"):
logger.debug("Appending blocked='%s',reason='%s' for blocker='%s' ...", row["domain"], block_level, blocker)
blockdict.append({
"blocked": row["domain"],
block["block_level"] = blocks.alias_block_level(block["block_level"])
logger.info("blocked='%s' has been deobfuscated to blocked='%s', adding ...", block["blocked"], blocked)
- if processing.block(row["domain"], blocked, block["reason"], block["block_level"]) and block["block_level"] == "reject" and config.get("bot_enabled"):
+ if processing.block(row["domain"], blocked, block["reason"], block["block_level"]) and block["block_level"] in ["suspended", "rejected"] and config.get("bot_enabled"):
logger.debug("Appending blocked='%s',reason='%s' for blocker='%s' ...", block["blocked"], block["block_level"], row["domain"])
blockdict.append({
"blocked": blocked,
severity = blocks.alias_block_level(row["severity"])
else:
logger.debug("row='%s' does not contain severity column, setting 'reject'", row)
- severity = "reject"
+ severity = "rejected"
if "reason" in row:
reason = tidyup.reason(row["reason"]) if row["reason"] not in [None, ""] else None
raise ValueError(f"Parameter block_level[]='{type(block_level)}' is not of type 'str'")
elif block_level == "":
raise ValueError("Parameter 'block_level' is empty")
- elif block_level in ["accept", "suspend", "silence", "nsfw", "quarantined_instances"]:
+ elif block_level in ["accept", "reject", "suspend", "silence", "nsfw", "quarantined_instances"]:
raise ValueError(f"block_level='{block_level}' is not wanted.")
elif blacklist.is_blacklisted(blocker):
raise Exception(f"blocker='{blocker}' is blacklisted but function invoked")
raise ValueError(f"Parameter block_level[]='{type(block_level)}' is not of type 'str'")
elif block_level == "":
raise ValueError("Parameter 'block_level' is empty")
- elif block_level in ["accept", "suspend", "silence", "nsfw", "quarantined_instances"]:
+ elif block_level in ["accept", "reject", "suspend", "silence", "nsfw", "quarantined_instances"]:
raise ValueError(f"block_level='{block_level}' is not wanted.")
elif blacklist.is_blacklisted(blocker):
raise Exception(f"blocker='{blocker}' is blacklisted but function invoked")
raise ValueError(f"Parameter block_level[]='{type(block_level)}' is not of type 'str'")
elif block_level == "":
raise ValueError("Parameter 'block_level' is empty")
- elif block_level in ["accept", "suspend", "silence", "nsfw", "quarantined_instances"]:
+ elif block_level in ["accept", "reject", "suspend", "silence", "nsfw", "quarantined_instances"]:
raise ValueError(f"blocked='{blocked}' has unwanted block_level='{block_level}'")
elif blacklist.is_blacklisted(blocker):
raise Exception(f"blocker='{blocker}' is blacklisted but function invoked")
raise ValueError(f"Parameter block_level[]='{type(block_level)}' is not of type 'str'")
elif block_level == "":
raise ValueError("Parameter 'block_level' is empty")
- elif block_level in ["accept", "suspend", "silence", "nsfw", "quarantined_instances"]:
+ elif block_level in ["accept", "reject", "suspend", "silence", "nsfw", "quarantined_instances"]:
raise ValueError(f"blocked='{blocked}' has unwanted block_level='{block_level}'")
elif blacklist.is_blacklisted(blocker):
raise Exception(f"blocker='{blocker}' is blacklisted but function invoked")
raise ValueError(f"Parameter block_level[]='{type(block_level)}' is not of type 'str'")
elif block_level == "":
raise ValueError("Parameter 'block_level' is empty")
- elif block_level in ["accept", "suspend", "silence", "nsfw", "quarantined_instances"]:
+ elif block_level in ["accept", "reject", "suspend", "silence", "nsfw", "quarantined_instances"]:
raise ValueError(f"blocked='{blocked}' has unwanted block_level='{block_level}'")
elif blacklist.is_blacklisted(blocker):
raise Exception(f"blocker='{blocker}' is blacklisted but function invoked")
"blocker" : domain,
"blocked" : blocked,
"reason" : reason,
- "block_level": "reject",
+ "block_level": "rejected",
})
logger.debug("blocklist()=%d - EXIT!", len(blocklist))
"blocker" : domain,
"blocked" : blocked,
"reason" : None,
- "block_level": "reject",
+ "block_level": "rejected",
})
logger.debug("blocklist()=%d - EXIT!", len(blocklist))
"blocker" : domain,
"blocked" : blocked,
"reason" : None,
- "block_level": "reject",
+ "block_level": "rejected",
})
else:
logger.warning("Cannot fetch /instances due to error: response.ok='%s',response.status_code=%d,response.details='%s'", response.ok, response.status_code, response.reason)
logger.debug("Returning blocklist for domain='%s' - EXIT!", domain)
return {
- "reject" : blocklist["Suspended servers"],
+ "rejected" : blocklist["Suspended servers"],
"media_removal" : blocklist["Filtered media"],
"followers_only": blocklist["Limited servers"] + blocklist["Silenced servers"],
}
"blocker" : domain,
"blocked" : blocked,
"reason" : None,
- "block_level": "reject",
+ "block_level": "rejected",
})
logger.debug("count=%d", count)
"media_removal" : "media_removal",
"media force-set as sensitive": "media_nsfw",
"nsfw" : "media_nsfw",
- "reject" : "reject",
- "suspended servers": "reject",
+ "reject" : "rejected",
+ "suspended servers": "suspended",
"silenced servers" : "silenced",
"removal from \"the whole known network\" timeline": "federated_timeline_removal",
}
break
blocklist = {
- "reject" : [],
+ "rejected" : [],
+ "suspended" : [],
"filtered_media": [],
"followers_only": [],
"silenced" : [],