Handle wildcards in mutual block endpoint

This commit is contained in:
Mint 2023-02-27 01:06:11 +03:00
parent e4caf63d48
commit 03aa6e3560

3
api.py
View file

@ -136,11 +136,12 @@ def mutual(domains: list[str] = Query()):
c = conn.cursor()
c.execute(
"SELECT block_level FROM blocks " \
"WHERE ((blocker = :a OR blocker = :b) AND (blocked = :b OR blocked = :a)) " \
"WHERE ((blocker = :a OR blocker = :b) AND (blocked = :b OR blocked = :a OR blocked = :w)) " \
"AND block_level = 'reject' " \
"LIMIT 1",
{
"a": domains[0],
"w": "*." + domains[0],
"b": domains[1],
},
)