feat: Convert punycode domains to unicode
All checks were successful
Build Docker / Build Image (push) Successful in 27s

This commit is contained in:
Nathan Woodburn 2023-11-06 12:38:12 +11:00
parent 20638a1c09
commit 5673a3fcfa
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -23,10 +23,13 @@ def index():
tld = 'freeconcept' tld = 'freeconcept'
https_redirect = "<script>console.log('https.js not loaded on localhost')</script>" https_redirect = "<script>console.log('https.js not loaded on localhost')</script>"
# Count sales # Count sales
sales = requests.get('https://reg.woodburn.au/api?action=getMyStaked', headers={'Authorization': 'Bearer ' + os.getenv('reg_auth')}) sales = requests.get('https://reg.woodburn.au/api?action=getMyStaked', headers={'Authorization': 'Bearer ' + os.getenv('reg_auth')})
sales = sales.json() sales = sales.json()
if 'data' not in sales: 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) return render_template('index.html', tld=tld, https_redirect=https_redirect, sales=0)
tld_sales = 0 tld_sales = 0
@ -35,6 +38,10 @@ def index():
if sale['tld'] == tld: if sale['tld'] == tld:
print(sale) print(sale)
tld_sales = sale['slds'] 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) return render_template('index.html', tld=tld, https_redirect=https_redirect, sales=tld_sales)
# 404 catch all # 404 catch all