diff --git a/account.py b/account.py index 3079b4a..0392fd6 100644 --- a/account.py +++ b/account.py @@ -13,14 +13,11 @@ dotenv.load_dotenv() HSD_API = os.getenv("HSD_API","") HSD_IP = os.getenv("HSD_IP","localhost") -HSD_NETWORK = os.getenv("HSD_NETWORK") +HSD_NETWORK = os.getenv("HSD_NETWORK", "main") HSD_WALLET_PORT = 12039 HSD_NODE_PORT = 12037 -if not HSD_NETWORK: - HSD_NETWORK = "main" -else: - HSD_NETWORK = HSD_NETWORK.lower() +HSD_NETWORK = HSD_NETWORK.lower() if HSD_NETWORK == "simnet": HSD_WALLET_PORT = 15039 @@ -32,6 +29,12 @@ elif HSD_NETWORK == "regtest": HSD_WALLET_PORT = 14039 HSD_NODE_PORT = 14037 +INTERNAL_NODE = os.getenv("INTERNAL_HSD","false").lower() in ["1","true","yes"] +if INTERNAL_NODE: + if HSD_API == "": + # Use a random API KEY + HSD_API = "firewallet-" + str(int(time.time())) + SHOW_EXPIRED = os.getenv("SHOW_EXPIRED") if SHOW_EXPIRED is None: diff --git a/main.py b/main.py index 5741698..4b2300b 100644 --- a/main.py +++ b/main.py @@ -56,10 +56,6 @@ def blocks_to_time(blocks: int) -> str: if hours == 0: return f"{days} days" return f"{days} days {hours} hrs" - - - - @app.route('/') def index(): @@ -82,6 +78,8 @@ def index(): return render_template("index.html", account=account, plugins=plugins) info = gitinfo.get_git_info() + if info is None: + return render_template("index.html", account=account, plugins=plugins) branch = info['refs'] commit = info['commit'] if commit != latestVersion(branch): diff --git a/render.py b/render.py index 847b3be..e48ec3f 100644 --- a/render.py +++ b/render.py @@ -6,7 +6,7 @@ from domainLookup import punycode_to_emoji import os from handywrapper import api import threading -import account +import requests # Get Explorer URL TX_EXPLORER_URL = os.getenv("EXPLORER_TX") @@ -535,8 +535,10 @@ def renderDomainAsync(namehash: str) -> None: if namehash in cache: return - # Fetch the name outside the lock (network call) - name = account.hsd.rpc_getNameByHash(namehash) + # Fetch the name outside the lock (network call) using hsd.hns.au + # name = account.hsd.rpc_getNameByHash(namehash) + name = requests.get(f"https://hsd.hns.au/api/v1/namehash/{namehash}").json() + if name["error"] is None: name = name["result"] rendered = renderDomain(name)