diff --git a/account.py b/account.py index 5b3dde1..7a37793 100644 --- a/account.py +++ b/account.py @@ -15,6 +15,9 @@ ip = os.getenv("hsd_ip") if ip is None: ip = "localhost" +show_expired = os.getenv("show_expired") +if show_expired is None: + show_expired = False hsd = api.hsd(APIKEY,ip) hsw = api.hsw(APIKEY,ip) @@ -179,7 +182,21 @@ def getDomains(account,own=True): else: response = requests.get(f"http://x:{APIKEY}@{ip}:12039/wallet/{account}/name") info = response.json() - return info + + if show_expired: + 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): # Get the transactions diff --git a/example.env b/example.env index 4b8ae7a..96a6a46 100644 --- a/example.env +++ b/example.env @@ -1,3 +1,4 @@ hsd_api=123480615465636893475aCwyaae6s45 hsd_ip=localhost -theme=black \ No newline at end of file +theme=black +show_expired=false \ No newline at end of file