Compare commits
No commits in common. "d516e915922e706bb61b200c7494c22233e1d28b" and "b24a3147dd479bf081a36316171aa62f3dd72075" have entirely different histories.
d516e91592
...
b24a3147dd
2
.gitignore
vendored
2
.gitignore
vendored
@ -8,5 +8,3 @@ templates/assets/css/styles.min.css
|
|||||||
ignore/
|
ignore/
|
||||||
|
|
||||||
plugins/signatures.json
|
plugins/signatures.json
|
||||||
|
|
||||||
.venv/
|
|
||||||
|
Binary file not shown.
@ -138,8 +138,6 @@ def getBalance(account: str):
|
|||||||
if domain['state'] == "CLOSED":
|
if domain['state'] == "CLOSED":
|
||||||
domainValue += domain['value']
|
domainValue += domain['value']
|
||||||
total = total - (domainValue/1000000)
|
total = total - (domainValue/1000000)
|
||||||
locked = locked - (domainValue/1000000)
|
|
||||||
|
|
||||||
|
|
||||||
# Only keep 2 decimal places
|
# Only keep 2 decimal places
|
||||||
total = round(total, 2)
|
total = round(total, 2)
|
||||||
@ -305,12 +303,6 @@ def getDNS(domain: str):
|
|||||||
return {
|
return {
|
||||||
"error": response['error']['message']
|
"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']
|
return response['result']['records']
|
||||||
|
|
||||||
|
|
||||||
|
@ -168,10 +168,4 @@ def emoji_to_punycode(emoji):
|
|||||||
try:
|
try:
|
||||||
return emoji.encode("idna").decode("ascii")
|
return emoji.encode("idna").decode("ascii")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return emoji
|
return ""
|
||||||
|
|
||||||
def punycode_to_emoji(punycode):
|
|
||||||
try:
|
|
||||||
return punycode.encode("ascii").decode("idna")
|
|
||||||
except Exception as e:
|
|
||||||
return punycode
|
|
5
main.py
5
main.py
@ -101,6 +101,9 @@ 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, available=available,
|
return render_template("index.html", account=account, available=available,
|
||||||
total=total, pending=pending, domains=domains,
|
total=total, pending=pending, domains=domains,
|
||||||
domainsMobile=domainsMobile, plugins=plugins,
|
domainsMobile=domainsMobile, plugins=plugins,
|
||||||
@ -1044,8 +1047,6 @@ def settings():
|
|||||||
branch = info['refs']
|
branch = info['refs']
|
||||||
if branch != "main":
|
if branch != "main":
|
||||||
branch = f"({branch})"
|
branch = f"({branch})"
|
||||||
else:
|
|
||||||
branch = ""
|
|
||||||
last_commit = info['author_date']
|
last_commit = info['author_date']
|
||||||
# import to time from format "2024-02-13 11:24:03"
|
# import to time from format "2024-02-13 11:24:03"
|
||||||
last_commit = datetime.datetime.strptime(last_commit, "%Y-%m-%d %H:%M:%S")
|
last_commit = datetime.datetime.strptime(last_commit, "%Y-%m-%d %H:%M:%S")
|
||||||
|
@ -3,7 +3,7 @@ import account
|
|||||||
import requests
|
import requests
|
||||||
import threading
|
import threading
|
||||||
import os
|
import os
|
||||||
import time
|
import datetime
|
||||||
|
|
||||||
APIKEY = os.environ.get("hsd_api")
|
APIKEY = os.environ.get("hsd_api")
|
||||||
ip = os.getenv("hsd_ip")
|
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
|
# Main entry point only lets the main function run every 5 mins
|
||||||
def automation(params, authentication):
|
def automation(params, authentication):
|
||||||
global started
|
global started
|
||||||
|
now = datetime.datetime.now().timestamp()
|
||||||
if started:
|
# Add 5 mins
|
||||||
return {"Status": "Auto Renews running"}
|
now = now - 300
|
||||||
started = True
|
if now < started:
|
||||||
|
return {"Status": "Waiting before checking for new actions"}
|
||||||
|
started = datetime.datetime.now().timestamp()
|
||||||
threading.Thread(target=automations_background, args=(authentication,)).start()
|
threading.Thread(target=automations_background, args=(authentication,)).start()
|
||||||
return {"Status": "Started Auto Renews"}
|
return {"Status": "Checking for actions"}
|
||||||
|
|
||||||
# Background function to run the automations
|
# Background function to run the automations
|
||||||
def automations_background(authentication):
|
def automations_background(authentication):
|
||||||
while True:
|
print("Running automations")
|
||||||
print("Running automations")
|
# Get account details
|
||||||
# Get account details
|
account_name = account.check_account(authentication)
|
||||||
account_name = account.check_account(authentication)
|
password = ":".join(authentication.split(":")[1:])
|
||||||
password = ":".join(authentication.split(":")[1:])
|
|
||||||
|
|
||||||
if account_name == False:
|
if account_name == False:
|
||||||
return {
|
return {
|
||||||
"error": {
|
"error": {
|
||||||
"message": "Invalid account"
|
"message": "Invalid account"
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Try to select and login to the wallet
|
# Try to select and login to the wallet
|
||||||
response = account.hsw.rpc_selectWallet(account_name)
|
response = account.hsw.rpc_selectWallet(account_name)
|
||||||
if response['error'] is not None:
|
if response['error'] is not None:
|
||||||
return
|
return
|
||||||
response = account.hsw.rpc_walletPassphrase(password,10)
|
response = account.hsw.rpc_walletPassphrase(password,10)
|
||||||
if response['error'] is not None:
|
if response['error'] is not None:
|
||||||
return
|
return
|
||||||
# Try to send the batch of all renew, reveal and redeem actions
|
# 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": [[["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": [[["REVEAL"]]]})
|
||||||
requests.post(f"http://x:{APIKEY}@{ip}:12039",json={"method": "sendbatch","params": [[["REDEEM"]]]})
|
requests.post(f"http://x:{APIKEY}@{ip}:12039",json={"method": "sendbatch","params": [[["REDEEM"]]]})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|
||||||
# Sleep for 5 mins before running again
|
|
||||||
time.sleep(300)
|
|
@ -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)}'}
|
|
||||||
|
|
@ -17,7 +17,7 @@ functions = {
|
|||||||
"status":{
|
"status":{
|
||||||
"name": "Check connection",
|
"name": "Check connection",
|
||||||
"type": "dashboard",
|
"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": {},
|
"params": {},
|
||||||
"returns": {
|
"returns": {
|
||||||
"status":
|
"status":
|
||||||
|
14
render.py
14
render.py
@ -2,11 +2,14 @@ import datetime
|
|||||||
import json
|
import json
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
from domainLookup import punycode_to_emoji
|
|
||||||
|
|
||||||
def domains(domains, mobile=False):
|
def domains(domains, mobile=False):
|
||||||
html = ''
|
html = ''
|
||||||
for domain in domains:
|
for domain in domains:
|
||||||
|
owner = domain['owner']
|
||||||
|
if 'index' in owner:
|
||||||
|
if owner['index'] == 0:
|
||||||
|
continue
|
||||||
expires = domain['stats']
|
expires = domain['stats']
|
||||||
if 'daysUntilExpire' in expires:
|
if 'daysUntilExpire' in expires:
|
||||||
expires = expires['daysUntilExpire']
|
expires = expires['daysUntilExpire']
|
||||||
@ -15,16 +18,11 @@ def domains(domains, mobile=False):
|
|||||||
paid = domain['value']
|
paid = domain['value']
|
||||||
paid = paid / 1000000
|
paid = paid / 1000000
|
||||||
|
|
||||||
# Handle punycodes
|
|
||||||
name = domain['name']
|
|
||||||
emoji = punycode_to_emoji(name)
|
|
||||||
if emoji != name:
|
|
||||||
name = f'{emoji} ({name})'
|
|
||||||
|
|
||||||
if not mobile:
|
if not mobile:
|
||||||
html += f'<tr><td>{name}</td><td>{expires} days</td><td>{paid} HNS</td><td><a href="/manage/{domain["name"]}">Manage</a></td></tr>'
|
html += f'<tr><td>{domain["name"]}</td><td>{expires} days</td><td>{paid} HNS</td><td><a href="/manage/{domain["name"]}">Manage</a></td></tr>'
|
||||||
else:
|
else:
|
||||||
html += f'<tr><td><a href="/manage/{domain["name"]}">{name}</a></td><td>{expires} days</td></tr>'
|
html += f'<tr><td><a href="/manage/{domain["name"]}">{domain["name"]}</a></td><td>{expires} days</td></tr>'
|
||||||
|
|
||||||
return html
|
return html
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
<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">
|
<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">
|
||||||
|
Loading…
Reference in New Issue
Block a user