feat: Add tx count plugin and fixed dns error

This commit is contained in:
Nathan Woodburn 2024-04-08 11:44:50 +10:00
parent 40b4c42492
commit 45fdaa2de4
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
3 changed files with 41 additions and 3 deletions

View File

@ -305,6 +305,12 @@ 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']

View File

@ -101,9 +101,6 @@ 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,

35
plugins/txcount.py Normal file
View File

@ -0,0 +1,35 @@
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)}'}