From 5673a3fcfa8cbfb7eb065f8b5a7a37a6aab8729f Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Mon, 6 Nov 2023 12:38:12 +1100 Subject: [PATCH] feat: Convert punycode domains to unicode --- server.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server.py b/server.py index 446c578..3c4d06d 100644 --- a/server.py +++ b/server.py @@ -23,10 +23,13 @@ def index(): tld = 'freeconcept' https_redirect = "" + # Count sales sales = requests.get('https://reg.woodburn.au/api?action=getMyStaked', headers={'Authorization': 'Bearer ' + os.getenv('reg_auth')}) sales = sales.json() if 'data' not in sales: + if tld.startswith('xn--'): + tld = tld.encode('ascii').decode('idna') return render_template('index.html', tld=tld, https_redirect=https_redirect, sales=0) tld_sales = 0 @@ -35,6 +38,10 @@ def index(): if sale['tld'] == tld: print(sale) tld_sales = sale['slds'] + + if tld.startswith('xn--'): + tld = tld.encode('ascii').decode('idna') + return render_template('index.html', tld=tld, https_redirect=https_redirect, sales=tld_sales) # 404 catch all