Fix (?) for yet more duplicate uppercase entries

This commit is contained in:
Mint 2022-08-07 14:17:12 +03:00
parent b3fa2f5b4a
commit 5727c24375
2 changed files with 3 additions and 2 deletions

2
api.py
View file

@ -38,7 +38,7 @@ def blocked(domain: str = None, reason: str = None):
c = conn.cursor()
if domain != None:
wildchar = "*." + ".".join(domain.split(".")[-domain.count("."):])
c.execute("select blocker, block_level, reason from blocks where blocked = ? or blocked = ? or blocked = ? or blocked = ?", (domain, "*."+domain, wildchar, get_hash(domain)))
c.execute("select blocker, block_level, reason from blocks where blocked = ? or blocked = ? or blocked = ? or blocked = ?", (domain, "*." + domain, wildchar, get_hash(domain)))
else:
c.execute("select * from blocks where reason like ? and reason != ''", ("%"+reason+"%",))
blocks = c.fetchall()

View file

@ -44,7 +44,7 @@ def get_mastodon_blocks(domain: str) -> dict:
if header_text in blocks:
blocks[header_text].append(
{
"domain": line.find("span").text.lower(),
"domain": line.find("span").text,
"hash": line.find("span")["title"][9:],
"reason": line.find_all("td")[1].text.strip(),
}
@ -145,6 +145,7 @@ for blocker, software in c.fetchall():
json = get_mastodon_blocks(blocker)
for block_level, blocks in json.items():
for instance in blocks:
blocked == blocked.lower()
blocked, blocked_hash, reason = instance.values()
if blocked.count("*") <= 1:
c.execute(