]> git.mxchange.org Git - fba.git/commitdiff
use wildchar for domain
authorEnju Aihara <9839590-EnjuAihara@users.noreply.gitlab.com>
Fri, 22 Apr 2022 02:25:29 +0000 (04:25 +0200)
committerEnju Aihara <9839590-EnjuAihara@users.noreply.gitlab.com>
Fri, 22 Apr 2022 02:25:29 +0000 (04:25 +0200)
api.py

diff --git a/api.py b/api.py
index 0b01a2517aaa78650865ef9f5d3c8bc831e563d2..ffdb03e6e1f7bed77fad686bf9280f7a5b6d5a98 100644 (file)
--- a/api.py
+++ b/api.py
@@ -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()