Compare commits
29 Commits
a877b5bf9e
...
v1.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
a56ffef656
|
|||
|
f1828d39a7
|
|||
|
2e743528d4
|
|||
|
3db0ba46d0
|
|||
|
80a4628d77
|
|||
|
47f210e51b
|
|||
|
2d574c0d46
|
|||
|
01d820368a
|
|||
|
71e59a9a95
|
|||
|
7a4300066f
|
|||
|
b5c3075fba
|
|||
|
3844acdaf8
|
|||
|
a1d1a6337e
|
|||
|
9507bc17a8
|
|||
|
c236cb964d
|
|||
|
08e6d5834d
|
|||
|
c568668b39
|
|||
|
4b15a1aa0c
|
|||
|
fb9cb50a90
|
|||
|
209c3794fc
|
|||
|
8099320673
|
|||
|
aa92220756
|
|||
|
2595503dc0
|
|||
|
d516e91592
|
|||
|
b24a3147dd
|
|||
|
f8e03aca73
|
|||
|
38f08c069c
|
|||
|
16ac6c7d2b
|
|||
|
b0c7fcf779
|
@@ -10,7 +10,7 @@ COPY . /app
|
|||||||
|
|
||||||
# Add mount point for data volume
|
# Add mount point for data volume
|
||||||
# VOLUME /data
|
# VOLUME /data
|
||||||
RUN apk add git
|
RUN apk add git openssl
|
||||||
|
|
||||||
ENTRYPOINT ["python3"]
|
ENTRYPOINT ["python3"]
|
||||||
CMD ["server.py"]
|
CMD ["server.py"]
|
||||||
|
|||||||
Binary file not shown.
@@ -1,6 +1,8 @@
|
|||||||
# FireWalletBrowser
|
# FireWalletBrowser
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
See [here](https://firewallet.au/setup) for instructions on how to setup a FireWallet
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/Nathanwoodburn/firewalletbrowser.git
|
git clone https://github.com/Nathanwoodburn/firewalletbrowser.git
|
||||||
cd firewalletbrowser
|
cd firewalletbrowser
|
||||||
@@ -119,7 +121,9 @@ HSD_API: HSD API key
|
|||||||
HSD_IP: HSD IP address
|
HSD_IP: HSD IP address
|
||||||
THEME: Theme to use (dark-purple, black)
|
THEME: Theme to use (dark-purple, black)
|
||||||
SHOW_EXPIRED: Show expired domains (true/false)
|
SHOW_EXPIRED: Show expired domains (true/false)
|
||||||
EXCLUDE: Comma separated list of wallets to exclude from the wallet list
|
EXCLUDE: Comma separated list of wallets to exclude from the wallet list (default primary)
|
||||||
|
EXPLORER_TX: URL for exploring transactions (default https://niami.io/tx/)
|
||||||
|
HSD_NETWORK: Network to connect to (main, regtest, simnet)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
34
account.py
34
account.py
@@ -388,7 +388,7 @@ def check_hip2(domain: str):
|
|||||||
domain = domain.lower()
|
domain = domain.lower()
|
||||||
|
|
||||||
if re.match(r'^[a-zA-Z0-9\-\.]{1,63}$', domain) is None:
|
if re.match(r'^[a-zA-Z0-9\-\.]{1,63}$', domain) is None:
|
||||||
return 'Invalid address'
|
return 'Invalid domain'
|
||||||
|
|
||||||
address = domainLookup.hip2(domain)
|
address = domainLookup.hip2(domain)
|
||||||
if address.startswith("Hip2: "):
|
if address.startswith("Hip2: "):
|
||||||
@@ -571,6 +571,10 @@ def getBids(account, domain="NONE"):
|
|||||||
for bid in response:
|
for bid in response:
|
||||||
if 'value' not in bid:
|
if 'value' not in bid:
|
||||||
bid['value'] = -1000000
|
bid['value'] = -1000000
|
||||||
|
|
||||||
|
# Backup for older HSD versions
|
||||||
|
if 'height' not in bid:
|
||||||
|
bid['height'] = 0
|
||||||
bids.append(bid)
|
bids.append(bid)
|
||||||
return bids
|
return bids
|
||||||
|
|
||||||
@@ -596,11 +600,31 @@ def getPendingReveals(account):
|
|||||||
pending.append(bid)
|
pending.append(bid)
|
||||||
return pending
|
return pending
|
||||||
|
|
||||||
#! TODO
|
|
||||||
def getPendingRedeems(account):
|
def getPendingRedeems(account,password):
|
||||||
bids = getBids(account)
|
hsw.rpc_selectWallet(account)
|
||||||
domains = getDomains(account,False)
|
hsw.rpc_walletPassphrase(password,10)
|
||||||
|
tx = hsw.rpc_createREDEEM('','default')
|
||||||
|
if tx['error']:
|
||||||
|
return []
|
||||||
|
|
||||||
pending = []
|
pending = []
|
||||||
|
try:
|
||||||
|
for output in tx['result']['outputs']:
|
||||||
|
if output['covenant']['type'] != 5:
|
||||||
|
continue
|
||||||
|
if output['covenant']['action'] != "REDEEM":
|
||||||
|
continue
|
||||||
|
nameHash = output['covenant']['items'][0]
|
||||||
|
# Try to get the name from hash
|
||||||
|
name = hsd.rpc_getNameByHash(nameHash)
|
||||||
|
if name['error']:
|
||||||
|
pending.append(nameHash)
|
||||||
|
else:
|
||||||
|
pending.append(name['result'])
|
||||||
|
except:
|
||||||
|
print("Failed to parse redeems")
|
||||||
|
|
||||||
return pending
|
return pending
|
||||||
|
|
||||||
def getPendingRegisters(account):
|
def getPendingRegisters(account):
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ import dns.asyncresolver
|
|||||||
import httpx
|
import httpx
|
||||||
from requests_doh import DNSOverHTTPSSession, add_dns_provider
|
from requests_doh import DNSOverHTTPSSession, add_dns_provider
|
||||||
import requests
|
import requests
|
||||||
|
import urllib3
|
||||||
|
|
||||||
|
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) # Disable insecure request warnings (since we are manually verifying the certificate)
|
||||||
|
|
||||||
def hip2(domain: str):
|
def hip2(domain: str):
|
||||||
domain_check = False
|
domain_check = False
|
||||||
@@ -75,9 +78,9 @@ def hip2(domain: str):
|
|||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
expiry_date = cert_obj.not_valid_after
|
expiry_date = cert_obj.not_valid_after_utc
|
||||||
# Check if expiry date is past
|
# Check if expiry date is past
|
||||||
if expiry_date < datetime.datetime.now():
|
if expiry_date < datetime.datetime.now(datetime.timezone.utc):
|
||||||
return "Hip2: Certificate is expired"
|
return "Hip2: Certificate is expired"
|
||||||
|
|
||||||
|
|
||||||
@@ -114,6 +117,7 @@ def hip2(domain: str):
|
|||||||
|
|
||||||
# Catch all exceptions
|
# Catch all exceptions
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
print(f"Hip2: Lookup failed with error: {e}",flush=True)
|
||||||
return "Hip2: Lookup failed."
|
return "Hip2: Lookup failed."
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
93
main.py
93
main.py
@@ -38,48 +38,6 @@ def index():
|
|||||||
if not account:
|
if not account:
|
||||||
return redirect("/logout")
|
return redirect("/logout")
|
||||||
|
|
||||||
domains = account_module.getDomains(account)
|
|
||||||
|
|
||||||
# Sort
|
|
||||||
sort = request.args.get("sort")
|
|
||||||
if sort == None:
|
|
||||||
sort = "domain"
|
|
||||||
sort = sort.lower()
|
|
||||||
sort_price = ""
|
|
||||||
sort_price_next = "⬇"
|
|
||||||
sort_expiry = ""
|
|
||||||
sort_expiry_next = "⬇"
|
|
||||||
sort_domain = ""
|
|
||||||
sort_domain_next = "⬇"
|
|
||||||
reverse = False
|
|
||||||
|
|
||||||
direction = request.args.get("direction")
|
|
||||||
if direction == None:
|
|
||||||
direction = "⬇"
|
|
||||||
|
|
||||||
if direction == "⬆":
|
|
||||||
reverse = True
|
|
||||||
|
|
||||||
if sort == "expiry":
|
|
||||||
# Sort by next expiry
|
|
||||||
domains = sorted(domains, key=lambda k: k['renewal'],reverse=reverse)
|
|
||||||
sort_expiry = direction
|
|
||||||
sort_expiry_next = reverseDirection(direction)
|
|
||||||
|
|
||||||
|
|
||||||
elif sort == "price":
|
|
||||||
# Sort by price
|
|
||||||
domains = sorted(domains, key=lambda k: k['value'],reverse=reverse)
|
|
||||||
sort_price = direction
|
|
||||||
sort_price_next = reverseDirection(direction)
|
|
||||||
else:
|
|
||||||
# Sort by domain
|
|
||||||
domains = sorted(domains, key=lambda k: k['name'],reverse=reverse)
|
|
||||||
sort_domain = direction
|
|
||||||
sort_domain_next = reverseDirection(direction)
|
|
||||||
|
|
||||||
domainsMobile = render.domains(domains,True)
|
|
||||||
domains = render.domains(domains)
|
|
||||||
|
|
||||||
plugins = ""
|
plugins = ""
|
||||||
dashFunctions = plugins_module.getDashboardFunctions()
|
dashFunctions = plugins_module.getDashboardFunctions()
|
||||||
@@ -87,11 +45,7 @@ def index():
|
|||||||
functionOutput = plugins_module.runPluginFunction(function["plugin"],function["function"],{},request.cookies.get("account"))
|
functionOutput = plugins_module.runPluginFunction(function["plugin"],function["function"],{},request.cookies.get("account"))
|
||||||
plugins += render.plugin_output_dash(functionOutput,plugins_module.getPluginFunctionReturns(function["plugin"],function["function"]))
|
plugins += render.plugin_output_dash(functionOutput,plugins_module.getPluginFunctionReturns(function["plugin"],function["function"]))
|
||||||
|
|
||||||
return render_template("index.html", account=account,domains=domains,
|
return render_template("index.html", account=account, plugins=plugins)
|
||||||
domainsMobile=domainsMobile, plugins=plugins,
|
|
||||||
sort_price=sort_price,sort_expiry=sort_expiry,
|
|
||||||
sort_domain=sort_domain,sort_price_next=sort_price_next,
|
|
||||||
sort_expiry_next=sort_expiry_next,sort_domain_next=sort_domain_next)
|
|
||||||
|
|
||||||
def reverseDirection(direction: str):
|
def reverseDirection(direction: str):
|
||||||
if direction == "⬆":
|
if direction == "⬆":
|
||||||
@@ -170,7 +124,7 @@ def send():
|
|||||||
if address is None or amount is None:
|
if address is None or amount is None:
|
||||||
return redirect("/send?message=Invalid address or amount&address=" + address + "&amount=" + amount)
|
return redirect("/send?message=Invalid address or amount&address=" + address + "&amount=" + amount)
|
||||||
|
|
||||||
address_check = account_module.check_address(address,True,True)
|
address_check = account_module.check_address(address.strip(),True,True)
|
||||||
if not address_check:
|
if not address_check:
|
||||||
return redirect("/send?message=Invalid address&address=" + address + "&amount=" + amount)
|
return redirect("/send?message=Invalid address&address=" + address + "&amount=" + amount)
|
||||||
|
|
||||||
@@ -254,7 +208,7 @@ def check_address():
|
|||||||
if address is None:
|
if address is None:
|
||||||
return jsonify({"result": "Invalid address"})
|
return jsonify({"result": "Invalid address"})
|
||||||
|
|
||||||
return jsonify({"result": account_module.check_address(address)})
|
return jsonify({"result": account_module.check_address(address.strip())})
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Domains
|
#region Domains
|
||||||
@@ -297,6 +251,8 @@ def auctions():
|
|||||||
if direction == "⬆":
|
if direction == "⬆":
|
||||||
reverse = True
|
reverse = True
|
||||||
|
|
||||||
|
sortbyDomain = False
|
||||||
|
|
||||||
if sort == "price":
|
if sort == "price":
|
||||||
# Sort by price
|
# Sort by price
|
||||||
bids = sorted(bids, key=lambda k: k['value'],reverse=reverse)
|
bids = sorted(bids, key=lambda k: k['value'],reverse=reverse)
|
||||||
@@ -306,26 +262,25 @@ def auctions():
|
|||||||
sort_state = direction
|
sort_state = direction
|
||||||
sort_state_next = reverseDirection(direction)
|
sort_state_next = reverseDirection(direction)
|
||||||
domains = sorted(domains, key=lambda k: k['state'],reverse=reverse)
|
domains = sorted(domains, key=lambda k: k['state'],reverse=reverse)
|
||||||
|
sortbyDomain = True
|
||||||
elif sort == "time":
|
elif sort == "time":
|
||||||
sort_time = direction
|
sort_time = direction
|
||||||
sort_time_next = reverseDirection(direction)
|
sort_time_next = reverseDirection(direction)
|
||||||
bids = sorted(bids, key=lambda k: k['height'],reverse=reverse)
|
|
||||||
|
# If older HSD version sort by domain height
|
||||||
|
if bids[0]['height'] == 0:
|
||||||
|
domains = sorted(domains, key=lambda k: k['height'],reverse=reverse)
|
||||||
|
sortbyDomain = True
|
||||||
|
else:
|
||||||
|
bids = sorted(bids, key=lambda k: k['height'],reverse=reverse)
|
||||||
else:
|
else:
|
||||||
# Sort by domain
|
# Sort by domain
|
||||||
bids = sorted(bids, key=lambda k: k['name'],reverse=reverse)
|
bids = sorted(bids, key=lambda k: k['name'],reverse=reverse)
|
||||||
sort_domain = direction
|
sort_domain = direction
|
||||||
sort_domain_next = reverseDirection(direction)
|
sort_domain_next = reverseDirection(direction)
|
||||||
|
|
||||||
if sort == "state":
|
bidsHtml = render.bidDomains(bids,domains,sortbyDomain)
|
||||||
bidsHtml = render.bidDomains(bids,domains,True)
|
|
||||||
else:
|
|
||||||
bidsHtml = render.bidDomains(bids,domains)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
plugins = ""
|
plugins = ""
|
||||||
|
|
||||||
message = ''
|
message = ''
|
||||||
if 'message' in request.args:
|
if 'message' in request.args:
|
||||||
message = request.args.get("message")
|
message = request.args.get("message")
|
||||||
@@ -765,7 +720,7 @@ def transfer(domain):
|
|||||||
|
|
||||||
address_check = account_module.check_address(address,True,True)
|
address_check = account_module.check_address(address,True,True)
|
||||||
if not address_check:
|
if not address_check:
|
||||||
return redirect("/send?message=Invalid address&address=" + address)
|
return redirect("/manage/" + domain + "?error=Invalid address")
|
||||||
|
|
||||||
address = address_check
|
address = address_check
|
||||||
|
|
||||||
@@ -874,9 +829,9 @@ def auction(domain):
|
|||||||
error=error)
|
error=error)
|
||||||
|
|
||||||
if domainInfo['info'] is None:
|
if domainInfo['info'] is None:
|
||||||
if domainInfo['registered'] == False and domainInfo['expired'] == False:
|
if 'registered' in domainInfo and domainInfo['registered'] == False and 'expired' in domainInfo and domainInfo['expired'] == False:
|
||||||
# Needs to be registered
|
# Needs to be registered
|
||||||
next_action = f'ERROR GETTING NEXT STATE'
|
next_action = f'ERROR GETTING NEXT STATE'
|
||||||
else:
|
else:
|
||||||
next_action = f'<a href="/auction/{domain}/open">Open Auction</a>'
|
next_action = f'<a href="/auction/{domain}/open">Open Auction</a>'
|
||||||
return render_template("auction.html", account=account,
|
return render_template("auction.html", account=account,
|
||||||
@@ -1488,6 +1443,7 @@ def api_wallet(function):
|
|||||||
return jsonify({"error": "Not logged in"})
|
return jsonify({"error": "Not logged in"})
|
||||||
|
|
||||||
account = account_module.check_account(request.cookies.get("account"))
|
account = account_module.check_account(request.cookies.get("account"))
|
||||||
|
password = request.cookies.get("account").split(":")[1]
|
||||||
if not account:
|
if not account:
|
||||||
return jsonify({"error": "Invalid account"})
|
return jsonify({"error": "Invalid account"})
|
||||||
|
|
||||||
@@ -1514,7 +1470,18 @@ def api_wallet(function):
|
|||||||
if function == "pendingRegister":
|
if function == "pendingRegister":
|
||||||
return jsonify({"result": len(account_module.getPendingRegisters(account))})
|
return jsonify({"result": len(account_module.getPendingRegisters(account))})
|
||||||
if function == "pendingRedeem":
|
if function == "pendingRedeem":
|
||||||
return jsonify({"result": len(account_module.getPendingRedeems(account))})
|
return jsonify({"result": len(account_module.getPendingRedeems(account,password))})
|
||||||
|
|
||||||
|
|
||||||
|
if function == "domains":
|
||||||
|
domains = account_module.getDomains(account)
|
||||||
|
if 'error' in domains:
|
||||||
|
return jsonify({"result": [], "error": domains['error']})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return jsonify({"result": domains})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return jsonify({"error": "Invalid function", "result": "Invalid function"}), 400
|
return jsonify({"error": "Invalid function", "result": "Invalid function"}), 400
|
||||||
|
|||||||
@@ -1,175 +0,0 @@
|
|||||||
import json
|
|
||||||
import account
|
|
||||||
import requests
|
|
||||||
|
|
||||||
|
|
||||||
# Plugin Data
|
|
||||||
info = {
|
|
||||||
"name": "Example Plugin",
|
|
||||||
"description": "This is a plugin to be used as an example",
|
|
||||||
"version": "1.0",
|
|
||||||
"author": "Nathan.Woodburn/"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Functions
|
|
||||||
functions = {
|
|
||||||
"search":{
|
|
||||||
"name": "Search Owned",
|
|
||||||
"type": "default",
|
|
||||||
"description": "Search for owned domains containing a string",
|
|
||||||
"params": {
|
|
||||||
"search": {
|
|
||||||
"name":"Search string",
|
|
||||||
"type":"text"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"returns": {
|
|
||||||
"domains":
|
|
||||||
{
|
|
||||||
"name": "List of owned domains",
|
|
||||||
"type": "list"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"transfer":{
|
|
||||||
"name": "Bulk Transfer Domains",
|
|
||||||
"type": "default",
|
|
||||||
"description": "Transfer domains to another wallet",
|
|
||||||
"params": {
|
|
||||||
"address": {
|
|
||||||
"name":"Address to transfer to",
|
|
||||||
"type":"address"
|
|
||||||
},
|
|
||||||
"domains": {
|
|
||||||
"name":"List of domains to transfer",
|
|
||||||
"type":"longText"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"returns": {
|
|
||||||
"hash": {
|
|
||||||
"name": "Hash of the transaction",
|
|
||||||
"type": "tx"
|
|
||||||
},
|
|
||||||
"address":{
|
|
||||||
"name": "Address of the new owner",
|
|
||||||
"type": "text"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dns":{
|
|
||||||
"name": "Set DNS for Domains",
|
|
||||||
"type": "default",
|
|
||||||
"description": "Set DNS for domains",
|
|
||||||
"params": {
|
|
||||||
"domains": {
|
|
||||||
"name":"List of domains to set DNS for",
|
|
||||||
"type":"longText"
|
|
||||||
},
|
|
||||||
"dns": {
|
|
||||||
"name":"DNS",
|
|
||||||
"type":"dns"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"returns": {
|
|
||||||
"hash": {
|
|
||||||
"name": "Hash of the transaction",
|
|
||||||
"type": "tx"
|
|
||||||
},
|
|
||||||
"dns":{
|
|
||||||
"name": "DNS",
|
|
||||||
"type": "dns"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"niami": {
|
|
||||||
"name": "Niami info",
|
|
||||||
"type": "domain",
|
|
||||||
"description": "Check the domains niami rating",
|
|
||||||
"params": {},
|
|
||||||
"returns": {
|
|
||||||
"rating":
|
|
||||||
{
|
|
||||||
"name": "Niami Rating",
|
|
||||||
"type": "text"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"niamiSearch": {
|
|
||||||
"name": "Niami info",
|
|
||||||
"type": "search",
|
|
||||||
"description": "Check the domains niami rating",
|
|
||||||
"params": {},
|
|
||||||
"returns": {
|
|
||||||
"rating":
|
|
||||||
{
|
|
||||||
"name": "Niami Rating",
|
|
||||||
"type": "text"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"connections":{
|
|
||||||
"name": "HSD Connections",
|
|
||||||
"type": "dashboard",
|
|
||||||
"description": "Show the number of connections the HSD node is connected to",
|
|
||||||
"params": {},
|
|
||||||
"returns": {
|
|
||||||
"connections":
|
|
||||||
{
|
|
||||||
"name": "HSD Connections",
|
|
||||||
"type": "text"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def check(params, authentication):
|
|
||||||
domains = params["domains"]
|
|
||||||
domains = domains.splitlines()
|
|
||||||
|
|
||||||
wallet = authentication.split(":")[0]
|
|
||||||
owned = account.getDomains(wallet)
|
|
||||||
# Only keep owned domains ["name"]
|
|
||||||
ownedNames = [domain["name"] for domain in owned]
|
|
||||||
|
|
||||||
domains = [domain for domain in domains if domain in ownedNames]
|
|
||||||
|
|
||||||
|
|
||||||
return {"domains": domains}
|
|
||||||
|
|
||||||
def search(params, authentication):
|
|
||||||
search = params["search"].lower()
|
|
||||||
wallet = authentication.split(":")[0]
|
|
||||||
owned = account.getDomains(wallet)
|
|
||||||
# Only keep owned domains ["name"]
|
|
||||||
ownedNames = [domain["name"] for domain in owned]
|
|
||||||
|
|
||||||
domains = [domain for domain in ownedNames if search in domain]
|
|
||||||
|
|
||||||
return {"domains": domains}
|
|
||||||
|
|
||||||
|
|
||||||
def transfer(params, authentication):
|
|
||||||
address = params["address"]
|
|
||||||
return {"hash":"f921ffe1bb01884bf515a8079073ee9381cb93a56b486694eda2cce0719f27c0","address":address}
|
|
||||||
|
|
||||||
def dns(params,authentication):
|
|
||||||
dns = params["dns"]
|
|
||||||
return {"hash":"f921ffe1bb01884bf515a8079073ee9381cb93a56b486694eda2cce0719f27c0","dns":dns}
|
|
||||||
|
|
||||||
def niami(params, authentication):
|
|
||||||
domain = params["domain"]
|
|
||||||
response = requests.get(f"https://api.handshake.niami.io/domain/{domain}")
|
|
||||||
data = response.json()["data"]
|
|
||||||
if 'rating' not in data:
|
|
||||||
return {"rating":"No rating found."}
|
|
||||||
rating = str(data["rating"]["score"]) + " (" + data["rating"]["rarity"] + ")"
|
|
||||||
return {"rating":rating}
|
|
||||||
|
|
||||||
def niamiSearch(params, authentication):
|
|
||||||
return niami(params, authentication)
|
|
||||||
|
|
||||||
|
|
||||||
def connections(params,authentication):
|
|
||||||
outbound = account.hsd.getInfo()['pool']['outbound']
|
|
||||||
return {"connections": outbound}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
import json
|
|
||||||
import account
|
|
||||||
import requests
|
|
||||||
|
|
||||||
# Plugin Data
|
|
||||||
info = {
|
|
||||||
"name": "Plugin Template",
|
|
||||||
"description": "Plugin Description",
|
|
||||||
"version": "1.0",
|
|
||||||
"author": "Nathan.Woodburn/"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Functions
|
|
||||||
functions = {
|
|
||||||
"main":{
|
|
||||||
"name": "Function name",
|
|
||||||
"type": "dashboard",
|
|
||||||
"description": "Description",
|
|
||||||
"params": {},
|
|
||||||
"returns": {
|
|
||||||
"status":
|
|
||||||
{
|
|
||||||
"name": "Status of the function",
|
|
||||||
"type": "text"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def main(params, authentication):
|
|
||||||
return {"status": "Success"}
|
|
||||||
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
import json
|
|
||||||
import account
|
|
||||||
import requests
|
|
||||||
|
|
||||||
# Plugin Data
|
|
||||||
info = {
|
|
||||||
"name": "TX Count",
|
|
||||||
"description": "Plugin for checking how many txs are in a wallet",
|
|
||||||
"version": "1.0",
|
|
||||||
"author": "Nathan.Woodburn/"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Functions
|
|
||||||
functions = {
|
|
||||||
"main":{
|
|
||||||
"name": "List TXs",
|
|
||||||
"type": "default",
|
|
||||||
"description": "Get TXs",
|
|
||||||
"params": {},
|
|
||||||
"returns": {
|
|
||||||
"txs":
|
|
||||||
{
|
|
||||||
"name": "Transactions",
|
|
||||||
"type": "text"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def main(params, authentication):
|
|
||||||
wallet = authentication.split(":")[0]
|
|
||||||
txCount = 0
|
|
||||||
page = 1
|
|
||||||
while True:
|
|
||||||
txs = account.getTransactions(wallet,page)
|
|
||||||
if len(txs) == 0:
|
|
||||||
break
|
|
||||||
txCount += len(txs)
|
|
||||||
page += 1
|
|
||||||
|
|
||||||
return {"txs": f'Total TXs: {txCount}'}
|
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ def dns(data, edit=False):
|
|||||||
|
|
||||||
|
|
||||||
elif entry['type'] == 'DS':
|
elif entry['type'] == 'DS':
|
||||||
ds = f'{entry['keyTag']} {entry['algorithm']} {entry['digestType']} {entry['digest']}'
|
ds = f"{entry['keyTag']} {entry['algorithm']} {entry['digestType']} {entry['digest']}"
|
||||||
html_output += f"<td>{ds}</td>\n"
|
html_output += f"<td>{ds}</td>\n"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@@ -183,9 +183,10 @@ def bids(bids,reveals):
|
|||||||
return html
|
return html
|
||||||
|
|
||||||
|
|
||||||
def bidDomains(bids,domains, sortState=False):
|
def bidDomains(bids,domains, sortbyDomains=False):
|
||||||
html = ''
|
html = ''
|
||||||
if not sortState:
|
|
||||||
|
if not sortbyDomains:
|
||||||
for bid in bids:
|
for bid in bids:
|
||||||
for domain in domains:
|
for domain in domains:
|
||||||
if bid['name'] == domain['name']:
|
if bid['name'] == domain['name']:
|
||||||
@@ -201,7 +202,7 @@ def bidDomains(bids,domains, sortState=False):
|
|||||||
html += f"<td><a class='text-decoration-none' style='color: var(--bs-table-color-state, var(--bs-table-color-type, var(--bs-table-color)));' href='/auction/{domain['name']}'>{domain['name']}</a></td>"
|
html += f"<td><a class='text-decoration-none' style='color: var(--bs-table-color-state, var(--bs-table-color-type, var(--bs-table-color)));' href='/auction/{domain['name']}'>{domain['name']}</a></td>"
|
||||||
html += f"<td>{domain['state']}</td>"
|
html += f"<td>{domain['state']}</td>"
|
||||||
html += f"<td>{bidDisplay}</td>"
|
html += f"<td>{bidDisplay}</td>"
|
||||||
html += f"<td>{bid['height']:,}</td>"
|
html += f"<td>{domain['height']:,}</td>"
|
||||||
html += "</tr>"
|
html += "</tr>"
|
||||||
else:
|
else:
|
||||||
for domain in domains:
|
for domain in domains:
|
||||||
|
|||||||
2
templates/assets/js/script.min.js
vendored
2
templates/assets/js/script.min.js
vendored
@@ -1 +1 @@
|
|||||||
async function request(e){try{const t=await fetch(`/api/v1/${e}`);if(!t.ok)throw new Error(`HTTP error! Status: ${t.status}`);const l=await t.json();return void 0!==l.error?`Error: ${l.error}`:l.result}catch(e){return console.error("Request failed:",e),"Error"}}window.addEventListener("load",(async()=>{const e=["hsd-sync","hsd-version","hsd-height","wallet-sync","wallet-available","wallet-total","wallet-locked","wallet-pending","wallet-domainCount","wallet-bidCount","wallet-pendingReveal","wallet-pendingRegister","wallet-pendingRedeem"],t=["wallet-available","wallet-total","wallet-locked","wallet-pending"];for(const l of e){const e=document.getElementById(l);if(e){const o=l.replace(/-/g,"/");let n=await request(o);t.includes(l)&&(n=Number(n).toFixed(2),n=n.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")),e.innerHTML=n}}})),function(){"use strict";var e=document.querySelector(".sidebar"),t=document.querySelectorAll("#sidebarToggle, #sidebarToggleTop");if(e){e.querySelector(".collapse");var l=[].slice.call(document.querySelectorAll(".sidebar .collapse")).map((function(e){return new bootstrap.Collapse(e,{toggle:!1})}));for(var o of t)o.addEventListener("click",(function(t){if(document.body.classList.toggle("sidebar-toggled"),e.classList.toggle("toggled"),e.classList.contains("toggled"))for(var o of l)o.hide()}));window.addEventListener("resize",(function(){if(Math.max(document.documentElement.clientWidth||0,window.innerWidth||0)<768)for(var e of l)e.hide()}))}var n=document.querySelector("body.fixed-nav .sidebar");n&&n.on("mousewheel DOMMouseScroll wheel",(function(e){if(Math.max(document.documentElement.clientWidth||0,window.innerWidth||0)>768){var t=e.originalEvent,l=t.wheelDelta||-t.detail;this.scrollTop+=30*(l<0?1:-1),e.preventDefault()}}));var r=document.querySelector(".scroll-to-top");r&&window.addEventListener("scroll",(function(){var e=window.pageYOffset;r.style.display=e>100?"block":"none"}))}();
|
async function request(e){try{const t=await fetch(`/api/v1/${e}`);if(!t.ok)throw new Error(`HTTP error! Status: ${t.status}`);const n=await t.json();return void 0!==n.error?`Error: ${n.error}`:n.result}catch(e){return console.error("Request failed:",e),"Error"}}function sortTable(e,t=!1){const n=document.getElementById("data-table"),a=n.querySelector("tbody"),o=Array.from(a.querySelectorAll("tr")),r=n.querySelectorAll("th");let l=n.getAttribute("data-sort-order")||"asc",c=n.getAttribute("data-sort-column")||"-1";l=t||c!=e?"asc":"asc"===l?"desc":"asc",n.setAttribute("data-sort-order",l),n.setAttribute("data-sort-column",e),o.sort(((t,n)=>{let a=t.cells[e].innerText.trim(),o=n.cells[e].innerText.trim(),r=parseFloat(a.replace(/[^0-9.,]/g,"").replace(/,/g,"")),c=parseFloat(o.replace(/[^0-9.,]/g,"").replace(/,/g,""));return isNaN(r)||isNaN(c)?"asc"===l?a.localeCompare(o):o.localeCompare(a):"asc"===l?r-c:c-r})),a.innerHTML="",o.forEach((e=>a.appendChild(e))),updateSortIndicators(r,e,l)}function updateSortIndicators(e,t,n){e.forEach(((e,a)=>{let o=e.querySelector(".sort-indicator");o.innerHTML=a===t?"asc"===n?" ▲":" ▼":""}))}window.addEventListener("load",(async()=>{const e=["hsd-sync","hsd-version","hsd-height","wallet-sync","wallet-available","wallet-total","wallet-locked","wallet-pending","wallet-domainCount","wallet-bidCount","wallet-pendingReveal","wallet-pendingRegister","wallet-pendingRedeem"],t=["wallet-available","wallet-total","wallet-locked"];for(const n of e){const e=document.getElementById(n);if(e){const a=n.replace(/-/g,"/");let o=await request(a);t.includes(n)&&(o=Number(o).toFixed(2)),o=o.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),e.innerHTML=o}}})),document.addEventListener("DOMContentLoaded",(function(){fetch("/api/v1/wallet/domains").then((e=>e.json())).then((e=>{const t=document.querySelector("#data-table tbody");t.innerHTML="",e.result.forEach((e=>{const n=document.createElement("tr"),a=document.createElement("td");a.textContent=e.name,n.appendChild(a);var o="Unknown";"stats"in e&&"daysUntilExpire"in e.stats&&(o=e.stats.daysUntilExpire);const r=document.createElement("td");r.textContent=`${o} days`,n.appendChild(r);const l=document.createElement("td");l.textContent=`${(e.value/1e6).toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g,",")} HNS`,n.appendChild(l);const c=document.createElement("td");c.innerHTML=e.registered?"<a href='/manage/"+e.name+"'>Manage</a>":"<a href='/auction/"+e.name+"/register'>Register</a>",n.appendChild(c),t.appendChild(n)})),sortTable(0,!0)})).catch((e=>console.error("Error fetching data:",e)))})),setInterval((async function(){const e=["hsd-sync","hsd-height","wallet-sync","wallet-pending","wallet-available","wallet-total"];for(const t of e){const e=document.getElementById(t);if(e){const n=t.replace(/-/g,"/");let a=await request(n);["wallet-available","wallet-total"].includes(t)&&(a=Number(a).toFixed(2)),a=a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),e.innerHTML=a}}}),2e4),function(){"use strict";var e=document.querySelector(".sidebar"),t=document.querySelectorAll("#sidebarToggle, #sidebarToggleTop");if(e){e.querySelector(".collapse");var n=[].slice.call(document.querySelectorAll(".sidebar .collapse")).map((function(e){return new bootstrap.Collapse(e,{toggle:!1})}));for(var a of t)a.addEventListener("click",(function(t){if(document.body.classList.toggle("sidebar-toggled"),e.classList.toggle("toggled"),e.classList.contains("toggled"))for(var a of n)a.hide()}));window.addEventListener("resize",(function(){if(Math.max(document.documentElement.clientWidth||0,window.innerWidth||0)<768)for(var e of n)e.hide()}))}var o=document.querySelector("body.fixed-nav .sidebar");o&&o.on("mousewheel DOMMouseScroll wheel",(function(e){if(Math.max(document.documentElement.clientWidth||0,window.innerWidth||0)>768){var t=e.originalEvent,n=t.wheelDelta||-t.detail;this.scrollTop+=30*(n<0?1:-1),e.preventDefault()}}));var r=document.querySelector(".scroll-to-top");r&&window.addEventListener("scroll",(function(){var e=window.pageYOffset;r.style.display=e>100?"block":"none"}))}();
|
||||||
@@ -155,7 +155,7 @@
|
|||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th><a href="/auctions?direction={{sort_domain_next}}">Domain{{sort_domain}}</a></th>
|
<th><a href="/auctions?sort=domain&direction={{sort_domain_next}}">Domain{{sort_domain}}</a></th>
|
||||||
<th><a href="/auctions?sort=state&direction={{sort_state_next}}">State{{sort_state}}</a></th>
|
<th><a href="/auctions?sort=state&direction={{sort_state_next}}">State{{sort_state}}</a></th>
|
||||||
<th><a href="/auctions?sort=price&direction={{sort_price_next}}">Bid{{sort_price}}</a></th>
|
<th><a href="/auctions?sort=price&direction={{sort_price_next}}">Bid{{sort_price}}</a></th>
|
||||||
<th><a href="/auctions?sort=time&direction={{sort_time_next}}">Block{{sort_time}}</a></th>
|
<th><a href="/auctions?sort=time&direction={{sort_time_next}}">Block{{sort_time}}</a></th>
|
||||||
|
|||||||
@@ -130,13 +130,30 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>{{plugins|safe}}
|
</div>{{plugins|safe}}
|
||||||
</div>
|
</div>
|
||||||
<div class="row d-none d-sm-none d-md-block">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="card shadow mb-4">
|
<div class="card shadow mb-4">
|
||||||
<div class="card-header d-flex justify-content-between align-items-center">
|
<div class="card-header d-flex justify-content-between align-items-center">
|
||||||
<h6 class="text-primary fw-bold m-0">Domains</h6>
|
<h6 class="text-primary fw-bold m-0">Domains</h6>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body"><div class="table-responsive">
|
<div class="card-body"><div class="table-responsive">
|
||||||
|
<table class="table" id="data-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th onclick="sortTable(0)">Domain <span class="sort-indicator"></span></th>
|
||||||
|
<th onclick="sortTable(1)">Expires <span class="sort-indicator"></span></th>
|
||||||
|
<th onclick="sortTable(2)">Price Paid <span class="sort-indicator"></span></th>
|
||||||
|
<th><span class="sort-indicator"></span></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<!-- {{domains | safe}} -->
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <div class="table-responsive">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -150,29 +167,7 @@
|
|||||||
{{domains | safe}}
|
{{domains | safe}}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div></div>
|
</div> --></div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row d-block d-sm-block d-md-none">
|
|
||||||
<div class="col">
|
|
||||||
<div class="card shadow mb-4">
|
|
||||||
<div class="card-header d-flex justify-content-between align-items-center">
|
|
||||||
<h6 class="text-primary fw-bold m-0">Domains</h6>
|
|
||||||
</div>
|
|
||||||
<div class="card-body"><div class="table-responsive">
|
|
||||||
<table class="table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th><a href="/?direction={{sort_domain_next}}">Domain{{sort_domain}}</a></th>
|
|
||||||
<th><a href="/?sort=expiry&direction={{sort_expiry_next}}">Expires{{sort_expiry}}</a></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{{domainsMobile | safe}}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div></div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card" style="max-width: 500px;margin: auto;margin-top: 50px;">
|
<div class="card" style="max-width: 500px;margin: auto;margin-top: 50px;">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h4 class="card-title">Your transaction has been sent and will be mined soon.</h4><span style="display: block;font-size: 12px;">TX: {{tx}}</span><span style="display: block;">Check your transaction on a block explorer</span><a class="card-link" href="https://niami.io/tx/{{tx}}" target="_blank">Niami</a><a class="card-link" href="https://3xpl.com/handshake/transaction/{{tx}}" target="_blank">3xpl</a>
|
<h4 class="card-title">Your transaction has been sent and will be mined soon.</h4><span style="display: block;font-size: 12px;">TX: {{tx}}</span><span style="display: block;">Check your transaction on a block explorer</span><a class="card-link" href="https://niami.io/tx/{{tx}}" target="_blank">Niami</a><a class="card-link" href="https://3xpl.com/handshake/transaction/{{tx}}" target="_blank">3xpl</a><a class="card-link" href="https://hns.cymon.de/tx/{{tx}}" target="_blank">HNS.Cymon.de</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user