"federated_timeline_removal": blocks["Limited servers"] + blocks["Silenced servers"],
}
+def get_hash(domain: str) -> str:
+ return sha256(domain.encode("utf-8")).hexdigest()
def get_type(domain: str) -> str:
try:
continue
c.execute("select domain from instances where domain = ?", (blocked,))
if c.fetchone() == None:
- c.execute("insert into instances select ?, ?, ?", (blocked, sha256(bytes(blocked, "utf-8")).hexdigest(), get_type(blocked)))
+ c.execute("insert into instances select ?, ?, ?", (blocked, get_hash(blocked), get_type(blocked)))
c.execute("insert into blocks select ?, ?, '', ?", (blocker, blocked, mrf))
# Quarantined Instances
if "quarantined_instances" in json["metadata"]["federation"]:
continue
c.execute("select domain from instances where domain = ?", (blocked,))
if c.fetchone() == None:
- c.execute("insert into instances select ?, ?, ?", (blocked, sha256(bytes(blocked, "utf-8")).hexdigest(), get_type(blocked)))
+ c.execute("insert into instances select ?, ?, ?", (blocked, get_hash(blocked), get_type(blocked)))
c.execute("insert into blocks select ?, ?, '', 'quarantined_instances'", (blocker, blocked))
conn.commit()
# Reasons
c.execute("select domain from instances where domain = ?", (blocked["domain"],))
if c.fetchone() == None:
# if instance not known, add it
- c.execute("insert into instances select ?, ?, ?", (blocked["domain"], sha256(bytes(blocked["domain"], "utf-8")).hexdigest(), get_type(blocked["domain"])))
+ c.execute("insert into instances select ?, ?, ?", (blocked["domain"], get_hash(blocked["domain"]), get_type(blocked["domain"])))
c.execute("insert into blocks select ?, ?, ?, ?", (blocker, blocked["domain"], blocked["reason"], block_level))
conn.commit()
except Exception as e: