diff --git a/account.py b/account.py index 75295ec..5b3dde1 100644 --- a/account.py +++ b/account.py @@ -305,6 +305,12 @@ 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'] diff --git a/main.py b/main.py index 33b36bc..f039e08 100644 --- a/main.py +++ b/main.py @@ -101,9 +101,6 @@ 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, diff --git a/plugins/txcount.py b/plugins/txcount.py new file mode 100644 index 0000000..7a1fcf8 --- /dev/null +++ b/plugins/txcount.py @@ -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)}'} + \ No newline at end of file