fix: Hide expired domains
All checks were successful
Build Docker / Build Image (push) Successful in 43s

This commit is contained in:
Nathan Woodburn 2024-11-21 15:40:02 +11:00
parent f695d53f8d
commit da9354cb23
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
2 changed files with 20 additions and 2 deletions

View File

@ -15,6 +15,9 @@ ip = os.getenv("hsd_ip")
if ip is None: if ip is None:
ip = "localhost" ip = "localhost"
show_expired = os.getenv("show_expired")
if show_expired is None:
show_expired = False
hsd = api.hsd(APIKEY,ip) hsd = api.hsd(APIKEY,ip)
hsw = api.hsw(APIKEY,ip) hsw = api.hsw(APIKEY,ip)
@ -179,8 +182,22 @@ def getDomains(account,own=True):
else: else:
response = requests.get(f"http://x:{APIKEY}@{ip}:12039/wallet/{account}/name") response = requests.get(f"http://x:{APIKEY}@{ip}:12039/wallet/{account}/name")
info = response.json() info = response.json()
if show_expired:
return info return info
# Remove any expired domains
domains = []
for domain in info:
if 'stats' in domain:
if 'daysUntilExpire' in domain['stats']:
if domain['stats']['daysUntilExpire'] < 0:
continue
domains.append(domain)
return domains
def getTransactions(account): def getTransactions(account):
# Get the transactions # Get the transactions
info = hsw.getWalletTxHistory(account) info = hsw.getWalletTxHistory(account)

View File

@ -1,3 +1,4 @@
hsd_api=123480615465636893475aCwyaae6s45 hsd_api=123480615465636893475aCwyaae6s45
hsd_ip=localhost hsd_ip=localhost
theme=black theme=black
show_expired=false