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