Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
171e891555 | |||
5e21074b24 | |||
703f1ed5c1 |
@ -168,4 +168,10 @@ def emoji_to_punycode(emoji):
|
|||||||
try:
|
try:
|
||||||
return emoji.encode("idna").decode("ascii")
|
return emoji.encode("idna").decode("ascii")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return ""
|
return emoji
|
||||||
|
|
||||||
|
def punycode_to_emoji(punycode):
|
||||||
|
try:
|
||||||
|
return punycode.encode("ascii").decode("idna")
|
||||||
|
except Exception as e:
|
||||||
|
return punycode
|
2
main.py
2
main.py
@ -1047,6 +1047,8 @@ def settings():
|
|||||||
branch = info['refs']
|
branch = info['refs']
|
||||||
if branch != "main":
|
if branch != "main":
|
||||||
branch = f"({branch})"
|
branch = f"({branch})"
|
||||||
|
else:
|
||||||
|
branch = ""
|
||||||
last_commit = info['author_date']
|
last_commit = info['author_date']
|
||||||
# import to time from format "2024-02-13 11:24:03"
|
# import to time from format "2024-02-13 11:24:03"
|
||||||
last_commit = datetime.datetime.strptime(last_commit, "%Y-%m-%d %H:%M:%S")
|
last_commit = datetime.datetime.strptime(last_commit, "%Y-%m-%d %H:%M:%S")
|
||||||
|
14
render.py
14
render.py
@ -2,14 +2,11 @@ import datetime
|
|||||||
import json
|
import json
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
|
from domainLookup import punycode_to_emoji
|
||||||
|
|
||||||
def domains(domains, mobile=False):
|
def domains(domains, mobile=False):
|
||||||
html = ''
|
html = ''
|
||||||
for domain in domains:
|
for domain in domains:
|
||||||
owner = domain['owner']
|
|
||||||
if 'index' in owner:
|
|
||||||
if owner['index'] == 0:
|
|
||||||
continue
|
|
||||||
expires = domain['stats']
|
expires = domain['stats']
|
||||||
if 'daysUntilExpire' in expires:
|
if 'daysUntilExpire' in expires:
|
||||||
expires = expires['daysUntilExpire']
|
expires = expires['daysUntilExpire']
|
||||||
@ -18,11 +15,16 @@ def domains(domains, mobile=False):
|
|||||||
paid = domain['value']
|
paid = domain['value']
|
||||||
paid = paid / 1000000
|
paid = paid / 1000000
|
||||||
|
|
||||||
|
# Handle punycodes
|
||||||
|
name = domain['name']
|
||||||
|
emoji = punycode_to_emoji(name)
|
||||||
|
if emoji != name:
|
||||||
|
name = f'{emoji} ({name})'
|
||||||
|
|
||||||
if not mobile:
|
if not mobile:
|
||||||
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>'
|
html += f'<tr><td>{name}</td><td>{expires} days</td><td>{paid} HNS</td><td><a href="/manage/{domain["name"]}">Manage</a></td></tr>'
|
||||||
else:
|
else:
|
||||||
html += f'<tr><td><a href="/manage/{domain["name"]}">{domain["name"]}</a></td><td>{expires} days</td></tr>'
|
html += f'<tr><td><a href="/manage/{domain["name"]}">{name}</a></td><td>{expires} days</td></tr>'
|
||||||
|
|
||||||
return html
|
return html
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user