Compare commits

..

No commits in common. "f695d53f8d045eaec8353e3213c3ee37ff83d789" and "171e89155573c8e31588d579f7bf51d234953c2e" have entirely different histories.

8 changed files with 37 additions and 81 deletions

2
.gitignore vendored
View File

@ -8,5 +8,3 @@ templates/assets/css/styles.min.css
ignore/
plugins/signatures.json
.venv/

Binary file not shown.

View File

@ -138,8 +138,6 @@ def getBalance(account: str):
if domain['state'] == "CLOSED":
domainValue += domain['value']
total = total - (domainValue/1000000)
locked = locked - (domainValue/1000000)
# Only keep 2 decimal places
total = round(total, 2)
@ -305,12 +303,6 @@ def getDNS(domain: str):
return {
"error": response['error']['message']
}
if 'result' not in response:
return {
"error": "No DNS records"
}
if 'records' not in response['result']:
return []
return response['result']['records']

View File

@ -101,6 +101,9 @@ def index():
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"]))
return render_template("index.html", account=account, available=available,
total=total, pending=pending, domains=domains,
domainsMobile=domainsMobile, plugins=plugins,

View File

@ -3,7 +3,7 @@ import account
import requests
import threading
import os
import time
import datetime
APIKEY = os.environ.get("hsd_api")
ip = os.getenv("hsd_ip")
@ -37,47 +37,45 @@ functions = {
}
}
started = False
started = 0
# Main entry point only lets the main function run every 5 mins
def automation(params, authentication):
global started
if started:
return {"Status": "Auto Renews running"}
started = True
now = datetime.datetime.now().timestamp()
# Add 5 mins
now = now - 300
if now < started:
return {"Status": "Waiting before checking for new actions"}
started = datetime.datetime.now().timestamp()
threading.Thread(target=automations_background, args=(authentication,)).start()
return {"Status": "Started Auto Renews"}
return {"Status": "Checking for actions"}
# Background function to run the automations
def automations_background(authentication):
while True:
print("Running automations")
# Get account details
account_name = account.check_account(authentication)
password = ":".join(authentication.split(":")[1:])
print("Running automations")
# Get account details
account_name = account.check_account(authentication)
password = ":".join(authentication.split(":")[1:])
if account_name == False:
return {
"error": {
"message": "Invalid account"
}
if account_name == False:
return {
"error": {
"message": "Invalid account"
}
}
try:
# Try to select and login to the wallet
response = account.hsw.rpc_selectWallet(account_name)
if response['error'] is not None:
return
response = account.hsw.rpc_walletPassphrase(password,10)
if response['error'] is not None:
return
# Try to send the batch of all renew, reveal and redeem actions
requests.post(f"http://x:{APIKEY}@{ip}:12039",json={"method": "sendbatch","params": [[["RENEW"]]]})
requests.post(f"http://x:{APIKEY}@{ip}:12039",json={"method": "sendbatch","params": [[["REVEAL"]]]})
requests.post(f"http://x:{APIKEY}@{ip}:12039",json={"method": "sendbatch","params": [[["REDEEM"]]]})
except Exception as e:
print(e)
# Sleep for 5 mins before running again
time.sleep(300)
try:
# Try to select and login to the wallet
response = account.hsw.rpc_selectWallet(account_name)
if response['error'] is not None:
return
response = account.hsw.rpc_walletPassphrase(password,10)
if response['error'] is not None:
return
# Try to send the batch of all renew, reveal and redeem actions
requests.post(f"http://x:{APIKEY}@{ip}:12039",json={"method": "sendbatch","params": [[["RENEW"]]]})
requests.post(f"http://x:{APIKEY}@{ip}:12039",json={"method": "sendbatch","params": [[["REVEAL"]]]})
requests.post(f"http://x:{APIKEY}@{ip}:12039",json={"method": "sendbatch","params": [[["REDEEM"]]]})
except Exception as e:
print(e)

View File

@ -1,35 +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]
txs = account.getTransactions(wallet)
return {"txs": f'Total TXs: {len(txs)}'}

View File

@ -17,7 +17,7 @@ functions = {
"status":{
"name": "Check connection",
"type": "dashboard",
"description": "You need to set varo_instance to the ICANN domain of the chosen Varo instance and varo_api to your varo API key before you can connect",
"description": "You need tp set varo_instance to the ICANN domain of the chosen Varo instance and varo_api to your varo API key before you can connect",
"params": {},
"returns": {
"status":

View File

@ -4,7 +4,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<title>Auctions - FireWallet</title>
<title>Dashboard - FireWallet</title>
<link rel="icon" type="image/png" sizes="900x768" href="/assets/img/favicon.png">
<link rel="icon" type="image/png" sizes="900x768" href="/assets/img/favicon.png">
<link rel="icon" type="image/png" sizes="900x768" href="/assets/img/favicon.png">