mirror of
https://git.kiwifarms.net/mint/fedi-block-api.git
synced 2024-10-23 01:29:05 +00:00
Handle IDNs in API
This commit is contained in:
parent
8c8fd9c597
commit
2305220bc9
1 changed files with 2 additions and 1 deletions
3
api.py
3
api.py
|
@ -38,7 +38,8 @@ def blocked(domain: str = None, reason: str = None):
|
|||
c = conn.cursor()
|
||||
if domain != None:
|
||||
wildchar = "*." + ".".join(domain.split(".")[-domain.count("."):])
|
||||
c.execute("select blocker, block_level, reason from blocks where blocked = ? or blocked = ? or blocked = ? or blocked = ?", (domain, "*." + domain, wildchar, get_hash(domain)))
|
||||
c.execute("select blocker, block_level, reason from blocks where blocked = ? or blocked = ? or blocked = ? or blocked = ? or blocked = ? or blocked = ?",
|
||||
(domain, "*." + domain, wildchar, get_hash(domain), domain.encode('idna'), "*." + domain.encode('idna')))
|
||||
else:
|
||||
c.execute("select * from blocks where reason like ? and reason != ''", ("%"+reason+"%",))
|
||||
blocks = c.fetchall()
|
||||
|
|
Loading…
Reference in a new issue