fix: Use hsd.hns.au to get name from namehash in order to only import account once

This commit is contained in:
2025-08-26 15:26:19 +10:00
parent 49e378803d
commit 4c84bc2bbe
3 changed files with 15 additions and 12 deletions

View File

@@ -13,14 +13,11 @@ dotenv.load_dotenv()
HSD_API = os.getenv("HSD_API","") HSD_API = os.getenv("HSD_API","")
HSD_IP = os.getenv("HSD_IP","localhost") 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_WALLET_PORT = 12039
HSD_NODE_PORT = 12037 HSD_NODE_PORT = 12037
if not HSD_NETWORK: HSD_NETWORK = HSD_NETWORK.lower()
HSD_NETWORK = "main"
else:
HSD_NETWORK = HSD_NETWORK.lower()
if HSD_NETWORK == "simnet": if HSD_NETWORK == "simnet":
HSD_WALLET_PORT = 15039 HSD_WALLET_PORT = 15039
@@ -32,6 +29,12 @@ elif HSD_NETWORK == "regtest":
HSD_WALLET_PORT = 14039 HSD_WALLET_PORT = 14039
HSD_NODE_PORT = 14037 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") SHOW_EXPIRED = os.getenv("SHOW_EXPIRED")
if SHOW_EXPIRED is None: if SHOW_EXPIRED is None:

View File

@@ -57,10 +57,6 @@ def blocks_to_time(blocks: int) -> str:
return f"{days} days" return f"{days} days"
return f"{days} days {hours} hrs" return f"{days} days {hours} hrs"
@app.route('/') @app.route('/')
def index(): def index():
# Check if the user is logged in # Check if the user is logged in
@@ -82,6 +78,8 @@ def index():
return render_template("index.html", account=account, plugins=plugins) return render_template("index.html", account=account, plugins=plugins)
info = gitinfo.get_git_info() info = gitinfo.get_git_info()
if info is None:
return render_template("index.html", account=account, plugins=plugins)
branch = info['refs'] branch = info['refs']
commit = info['commit'] commit = info['commit']
if commit != latestVersion(branch): if commit != latestVersion(branch):

View File

@@ -6,7 +6,7 @@ from domainLookup import punycode_to_emoji
import os import os
from handywrapper import api from handywrapper import api
import threading import threading
import account import requests
# Get Explorer URL # Get Explorer URL
TX_EXPLORER_URL = os.getenv("EXPLORER_TX") TX_EXPLORER_URL = os.getenv("EXPLORER_TX")
@@ -535,8 +535,10 @@ def renderDomainAsync(namehash: str) -> None:
if namehash in cache: if namehash in cache:
return return
# Fetch the name outside the lock (network call) # Fetch the name outside the lock (network call) using hsd.hns.au
name = account.hsd.rpc_getNameByHash(namehash) # name = account.hsd.rpc_getNameByHash(namehash)
name = requests.get(f"https://hsd.hns.au/api/v1/namehash/{namehash}").json()
if name["error"] is None: if name["error"] is None:
name = name["result"] name = name["result"]
rendered = renderDomain(name) rendered = renderDomain(name)