From 5bbe09862ded1142a2d98427baff8933b045a04a Mon Sep 17 00:00:00 2001 From: Enju Aihara <9839590-EnjuAihara@users.noreply.gitlab.com> Date: Fri, 22 Apr 2022 04:25:29 +0200 Subject: [PATCH] use wildchar for domain --- api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api.py b/api.py index 0b01a25..ffdb03e 100644 --- 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() -- 2.39.5