diff --git a/FireWalletBrowser.bsdesign b/FireWalletBrowser.bsdesign
index fca0fa5..5eed954 100644
Binary files a/FireWalletBrowser.bsdesign and b/FireWalletBrowser.bsdesign differ
diff --git a/account.py b/account.py
index d8e36b1..ed6e0ac 100644
--- a/account.py
+++ b/account.py
@@ -317,7 +317,11 @@ def setDNS(account,domain,records):
TXTRecords = []
for record in records:
if record['type'] == 'TXT':
- TXTRecords.append(record['value'])
+ if 'txt' not in record:
+ TXTRecords.append(record['value'])
+ else:
+ for txt in record['txt']:
+ TXTRecords.append(txt)
elif record['type'] == 'NS':
newRecords.append({
'type': 'NS',
@@ -663,6 +667,42 @@ def getxPub(account):
}
+def signMessage(account,domain,message):
+ account_name = check_account(account)
+ password = ":".join(account.split(":")[1:])
+
+ if account_name == False:
+ return {
+ "error": {
+ "message": "Invalid account"
+ }
+ }
+
+
+ try:
+ response = hsw.rpc_selectWallet(account_name)
+ if response['error'] is not None:
+ return {
+ "error": {
+ "message": response['error']['message']
+ }
+ }
+ response = hsw.rpc_walletPassphrase(password,10)
+ if response['error'] is not None:
+ return {
+ "error": {
+ "message": response['error']['message']
+ }
+ }
+ response = hsw.rpc_signMessageWithName(domain,message)
+ return response
+ except Exception as e:
+ return {
+ "error": {
+ "message": str(e)
+ }
+ }
+
#endregion
def generateReport(account,format="{name},{expiry},{value},{maxBid}"):
diff --git a/main.py b/main.py
index 4d6c8f0..aefbeba 100644
--- a/main.py
+++ b/main.py
@@ -90,6 +90,7 @@ def index():
domain_count = len(domains)
+ domainsMobile = render.domains(domains,True)
domains = render.domains(domains)
plugins = ""
@@ -102,7 +103,8 @@ def index():
return render_template("index.html", account=account, available=available,
- total=total, pending=pending, domains=domains, plugins=plugins,
+ total=total, pending=pending, domains=domains,
+ domainsMobile=domainsMobile, plugins=plugins,
domain_count=domain_count, sync=account_module.getNodeSync(),
sort_price=sort_price,sort_expiry=sort_expiry,
sort_domain=sort_domain,sort_price_next=sort_price_next,
@@ -273,6 +275,9 @@ def search():
search_term = request.args.get("q")
search_term = search_term.lower().strip()
+
+ # Replace spaces with hyphens
+ search_term = search_term.replace(" ","-")
# Convert emoji to punycode
search_term = domainLookup.emoji_to_punycode(search_term)
@@ -281,14 +286,23 @@ def search():
domain = account_module.getDomain(search_term)
+ plugins = "
"
+ # Execute domain plugins
+ searchFunctions = plugins_module.getSearchFunctions()
+ for function in searchFunctions:
+ functionOutput = plugins_module.runPluginFunction(function["plugin"],function["function"],{"domain":search_term},account_module.check_account(request.cookies.get("account")))
+ plugins += render.plugin_output(functionOutput,plugins_module.getPluginFunctionReturns(function["plugin"],function["function"]))
+
+ plugins += "
"
+
if 'error' in domain:
return render_template("search.html", account=account,sync=account_module.getNodeSync(),
- search_term=search_term, domain=domain['error'])
+ search_term=search_term, domain=domain['error'],plugins=plugins)
if domain['info'] is None:
return render_template("search.html", account=account, sync=account_module.getNodeSync(),
search_term=search_term,domain=search_term,
- state="AVAILABLE", next="Available Now")
+ state="AVAILABLE", next="Available Now",plugins=plugins)
state = domain['info']['state']
if state == 'CLOSED':
@@ -329,15 +343,6 @@ def search():
dns = render.dns(dns)
txs = render.txs(txs)
- plugins = ""
- # Execute domain plugins
- searchFunctions = plugins_module.getSearchFunctions()
- for function in searchFunctions:
- functionOutput = plugins_module.runPluginFunction(function["plugin"],function["function"],{"domain":search_term},account_module.check_account(request.cookies.get("account")))
- plugins += render.plugin_output(functionOutput,plugins_module.getPluginFunctionReturns(function["plugin"],function["function"]))
-
- plugins += "
"
-
return render_template("search.html", account=account, sync=account_module.getNodeSync(),
search_term=search_term,domain=domain['info']['name'],
raw=domain,state=state, next=next, owner=owner,
@@ -636,6 +641,47 @@ def transfer(domain):
sync=account_module.getNodeSync(),action=action,
content=content,cancel=cancel,confirm=confirm)
+@app.route('/manage//sign')
+def signMessage(domain):
+ if request.cookies.get("account") is None:
+ return redirect("/login")
+
+ account = account_module.check_account(request.cookies.get("account"))
+ if not account:
+ return redirect("/logout")
+
+ # Get the address and amount
+ message = request.args.get("message")
+
+ if message is None:
+ return redirect("/manage/" + domain + "?error=Invalid message")
+
+
+ content = "Message to sign:
" + message + "
"
+ signedMessage = account_module.signMessage(request.cookies.get("account"),domain,message)
+ if signedMessage["error"] != None:
+ return redirect("/manage/" + domain + "?error=" + signedMessage["error"])
+ content += "Signature:
" + signedMessage["result"] + "
"
+
+ data = {
+ "domain": domain,
+ "message": message,
+ "signature": signedMessage["result"]
+ }
+
+ content += "Full information:
" + json.dumps(data,indent=4).replace('\n',"
") + "
"
+
+ content += ""
+
+ copyScript = ""
+ content += "" + copyScript
+
+
+
+ return render_template("message.html", account=account,sync=account_module.getNodeSync(),
+ title="Sign Message",content=content)
+
+
@app.route('/manage//transfer/confirm')
def transferConfirm(domain):
if request.cookies.get("account") is None:
@@ -770,18 +816,21 @@ def bid(domain):
if blind == "":
blind = 0
+ bid = float(bid)
+ blind = float(blind)
+
if bid+blind == 0:
return redirect("/auction/" + domain+ "?message=Invalid bid amount")
# Show confirm page
- total = float(bid) + float(blind)
+ total = bid + blind
action = f"Bid on {domain}/"
content = f"Are you sure you want to bid on {domain}/?"
content += "You are about to bid with the following details:
"
- content += f"Bid: {request.args.get('bid')} HNS
"
- content += f"Blind: {request.args.get('blind')} HNS
"
+ content += f"Bid: {str(bid)} HNS
"
+ content += f"Blind: {str(blind)} HNS
"
content += f"Total: {total} HNS (excluding fees)
"
cancel = f"/auction/{domain}"
@@ -804,11 +853,22 @@ def bid_confirm(domain):
return redirect("/logout")
domain = domain.lower()
+ bid = request.args.get("bid")
+ blind = request.args.get("blind")
+
+ if bid == "":
+ bid = 0
+ if blind == "":
+ blind = 0
+
+ bid = float(bid)
+ blind = float(blind)
+
# Send the bid
response = account_module.bid(request.cookies.get("account"),domain,
- float(request.args.get('bid')),
- float(request.args.get('blind')))
+ float(bid),
+ float(blind))
print(response)
if 'error' in response:
return redirect("/auction/" + domain + "?message=" + response['error']['message'])
@@ -900,7 +960,8 @@ def settings_action(action):
return redirect("/settings?success=Zapped transactions")
elif action == "xpub":
return render_template("message.html", account=account,sync=account_module.getNodeSync(),
- title="xPub Key",content=account_module.getxPub(request.cookies.get("account")))
+ title="xPub Key",
+ content=""+account_module.getxPub(request.cookies.get("account"))+"
")
return redirect("/settings?error=Invalid action")
diff --git a/plugins/example.py b/plugins/example.py
index ccfdc1b..f9d7c31 100644
--- a/plugins/example.py
+++ b/plugins/example.py
@@ -138,7 +138,7 @@ def check(params, authentication):
return {"domains": domains}
def search(params, authentication):
- search = params["search"]
+ search = params["search"].lower()
wallet = authentication.split(":")[0]
owned = account.getDomains(wallet)
# Only keep owned domains ["name"]
@@ -159,9 +159,12 @@ def dns(params,authentication):
def niami(params, authentication):
domain = params["domain"]
- print(domain)
response = requests.get(f"https://api.handshake.niami.io/domain/{domain}")
print(response.text)
+ if response.status_code != 200:
+ return {"rating":"Error fetching rating from Niami.io"}
+ if response.json()["success"] == False:
+ return {"rating":"Error fetching rating from Niami.io"}
data = response.json()["data"]
rating = str(data["rating"]["score"]) + " (" + data["rating"]["rarity"] + ")"
return {"rating":rating}
diff --git a/render.py b/render.py
index d430c76..dde304a 100644
--- a/render.py
+++ b/render.py
@@ -3,7 +3,7 @@ import json
import urllib.parse
from flask import render_template
-def domains(domains):
+def domains(domains, mobile=False):
html = ''
for domain in domains:
owner = domain['owner']
@@ -17,8 +17,10 @@ def domains(domains):
paid = paid / 1000000
-
- html += f'{domain["name"]} | {expires} days | {paid} HNS | Manage |
'
+ if not mobile:
+ html += f'{domain["name"]} | {expires} days | {paid} HNS | Manage |
'
+ else:
+ html += f'{domain["name"]} | {expires} days |
'
return html
diff --git a/templates/404.html b/templates/404.html
index e3729a8..5e4362a 100644
--- a/templates/404.html
+++ b/templates/404.html
@@ -19,7 +19,7 @@
-