use wildchar for domain

This commit is contained in:
Enju Aihara 2022-04-22 04:25:29 +02:00
parent bc803a16a7
commit 5bbe09862d

3
api.py
View file

@ -22,7 +22,8 @@ def info():
def blocked(domain: str):
conn = sqlite3.connect("blocks.db")
c = conn.cursor()
c.execute("select blocker, block_level, reason from blocks where blocked = ?", (domain,))
wildchar = "*." + ".".join(domain.split(".")[-domain.count("."):])
c.execute("select blocker, block_level, reason from blocks where blocked = ? or blocked = ?", (domain, wildchar))
blocks = c.fetchall()
conn.close()