forked from nathanwoodburn/firewalletbrowser
fix: Remove circular depends
This commit is contained in:
20
render.py
20
render.py
@@ -3,7 +3,6 @@ import json
|
|||||||
import urllib.parse
|
import urllib.parse
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
from domainLookup import punycode_to_emoji
|
from domainLookup import punycode_to_emoji
|
||||||
from main import renderDomain
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
# Get Explorer URL
|
# Get Explorer URL
|
||||||
@@ -349,4 +348,21 @@ def plugin_output_dash(outputs, returns):
|
|||||||
if outputs[returnOutput] == None:
|
if outputs[returnOutput] == None:
|
||||||
continue
|
continue
|
||||||
html += render_template('components/dashboard-plugin.html', name=returns[returnOutput]["name"], output=outputs[returnOutput])
|
html += render_template('components/dashboard-plugin.html', name=returns[returnOutput]["name"], output=outputs[returnOutput])
|
||||||
return html
|
return html
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def renderDomain(name: str) -> str:
|
||||||
|
"""
|
||||||
|
Render a domain name with emojis and other special characters.
|
||||||
|
"""
|
||||||
|
# Convert emoji to punycode
|
||||||
|
try:
|
||||||
|
rendered = name.encode("ascii").decode("idna")
|
||||||
|
if rendered == name:
|
||||||
|
return f"{name}/"
|
||||||
|
return f"{rendered}/ ({name})"
|
||||||
|
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
return f"{name}/"
|
||||||
|
|||||||
Reference in New Issue
Block a user