Handle it both sides

This commit is contained in:
Mint 2023-02-27 01:08:33 +03:00
parent 03aa6e3560
commit c29326745b

5
api.py
View file

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