import datetime import json import urllib.parse from flask import render_template from domainLookup import punycode_to_emoji import os # Get Explorer URL TX_EXPLORER_URL = os.getenv("EXPLORER_TX") if TX_EXPLORER_URL is None: TX_EXPLORER_URL = "https://niami.io/tx/" def domains(domains, mobile=False): html = '' for domain in domains: expires = domain['stats'] if 'daysUntilExpire' in expires: expires = expires['daysUntilExpire'] else: 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})' link = f'/manage/{domain["name"]}' link_action = "Manage" if domain['registered'] == False: link_action = "Register" link = f'/auction/{domain["name"]}/register' if not mobile: html += f'
Returns: {returns}
' html += f'Returns: {returns}
' html += f'' html += f'' return html def plugin_output(outputs, returns): html = '' for returnOutput in returns: if returnOutput not in outputs: continue html += f'{output}
' elif returns[returnOutput]["type"] == "tx": html += render_template('components/tx.html', tx=output) elif returns[returnOutput]["type"] == "dns": output = json.loads(output) html += render_template('components/dns-output.html', dns=dns(output)) html += f'