Compare commits

..

No commits in common. "171e89155573c8e31588d579f7bf51d234953c2e" and "703f1ed5c19c56602060c3b85080fdbfee4e5f5b" have entirely different histories.

2 changed files with 8 additions and 16 deletions

View File

@ -168,10 +168,4 @@ def emoji_to_punycode(emoji):
try:
return emoji.encode("idna").decode("ascii")
except Exception as e:
return emoji
def punycode_to_emoji(punycode):
try:
return punycode.encode("ascii").decode("idna")
except Exception as e:
return punycode
return ""

View File

@ -2,11 +2,14 @@ import datetime
import json
import urllib.parse
from flask import render_template
from domainLookup import punycode_to_emoji
def domains(domains, mobile=False):
html = ''
for domain in domains:
owner = domain['owner']
if 'index' in owner:
if owner['index'] == 0:
continue
expires = domain['stats']
if 'daysUntilExpire' in expires:
expires = expires['daysUntilExpire']
@ -14,17 +17,12 @@ def domains(domains, mobile=False):
expires = "No expiration date"
paid = domain['value']
paid = paid / 1000000
# Handle punycodes
name = domain['name']
emoji = punycode_to_emoji(name)
if emoji != name:
name = f'{emoji} ({name})'
if not mobile:
html += f'<tr><td>{name}</td><td>{expires} days</td><td>{paid} HNS</td><td><a href="/manage/{domain["name"]}">Manage</a></td></tr>'
html += f'<tr><td>{domain["name"]}</td><td>{expires} days</td><td>{paid} HNS</td><td><a href="/manage/{domain["name"]}">Manage</a></td></tr>'
else:
html += f'<tr><td><a href="/manage/{domain["name"]}">{name}</a></td><td>{expires} days</td></tr>'
html += f'<tr><td><a href="/manage/{domain["name"]}">{domain["name"]}</a></td><td>{expires} days</td></tr>'
return html