forked from nathanwoodburn/firewalletbrowser
Compare commits
6 Commits
v1.2
...
feat/insta
| Author | SHA1 | Date | |
|---|---|---|---|
|
0fc95d0eb1
|
|||
|
65eedff61c
|
|||
|
9aa061691d
|
|||
|
ce8c773db3
|
|||
|
461e2cdbe9
|
|||
|
12884fe696
|
2
.gitignore
vendored
2
.gitignore
vendored
@@ -14,3 +14,5 @@ plugins/signatures.json
|
|||||||
user_data/
|
user_data/
|
||||||
customPlugins/
|
customPlugins/
|
||||||
cache/
|
cache/
|
||||||
|
dist/
|
||||||
|
build/
|
||||||
10
main.py
10
main.py
@@ -1,6 +1,7 @@
|
|||||||
import io
|
import io
|
||||||
import json
|
import json
|
||||||
import random
|
import random
|
||||||
|
import sys
|
||||||
from flask import Flask, make_response, redirect, request, jsonify, render_template, send_from_directory,send_file
|
from flask import Flask, make_response, redirect, request, jsonify, render_template, send_from_directory,send_file
|
||||||
import os
|
import os
|
||||||
import dotenv
|
import dotenv
|
||||||
@@ -55,7 +56,7 @@ def index():
|
|||||||
commit = info['commit']
|
commit = info['commit']
|
||||||
if commit != latestVersion(branch):
|
if commit != latestVersion(branch):
|
||||||
print("New version available",flush=True)
|
print("New version available",flush=True)
|
||||||
plugins += render_template('components/dashboard-plugin.html', name='Update', output='New version available')
|
plugins += render_template('components/dashboard-alert.html', name='Update', output='A new version of FireWallet is available')
|
||||||
|
|
||||||
return render_template("index.html", account=account, plugins=plugins)
|
return render_template("index.html", account=account, plugins=plugins)
|
||||||
|
|
||||||
@@ -1474,7 +1475,6 @@ def plugin_function(ptype,plugin,function):
|
|||||||
return render_template("plugin-output.html", account=account,name=data['name'],
|
return render_template("plugin-output.html", account=account,name=data['name'],
|
||||||
description=data['description'],output=response)
|
description=data['description'],output=response)
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return jsonify({"error": "Function not found"})
|
return jsonify({"error": "Function not found"})
|
||||||
|
|
||||||
@@ -1609,4 +1609,8 @@ def page_not_found(e):
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(debug=True,host='0.0.0.0')
|
# Check to see if --debug is in the command line arguments
|
||||||
|
if "--debug" in sys.argv:
|
||||||
|
app.run(debug=True,host='0.0.0.0')
|
||||||
|
else:
|
||||||
|
app.run(host='0.0.0.0',threaded=True)
|
||||||
63
main.spec
Normal file
63
main.spec
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
# -*- mode: python ; coding: utf-8 -*-
|
||||||
|
|
||||||
|
import compileall
|
||||||
|
from PyInstaller.utils.hooks import collect_data_files
|
||||||
|
import os
|
||||||
|
|
||||||
|
compileall.compile_dir('.', force=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
datas = [
|
||||||
|
('templates', 'templates'),
|
||||||
|
('assets', 'assets'),
|
||||||
|
('themes', 'themes'),
|
||||||
|
('plugins', 'plugins')
|
||||||
|
]
|
||||||
|
hiddenimports = [
|
||||||
|
'plugins.automations',
|
||||||
|
'plugins.batching',
|
||||||
|
'plugins.customPlugins',
|
||||||
|
'plugins.renewal',
|
||||||
|
'plugins.varo'
|
||||||
|
]
|
||||||
|
|
||||||
|
# Copy the plugins folder to the dist folder
|
||||||
|
os.system(f'cp -r plugins dist/')
|
||||||
|
|
||||||
|
a = Analysis(
|
||||||
|
['main.py'],
|
||||||
|
pathex=[],
|
||||||
|
binaries=[],
|
||||||
|
datas=datas,
|
||||||
|
hiddenimports=hiddenimports,
|
||||||
|
hookspath=[],
|
||||||
|
hooksconfig={},
|
||||||
|
runtime_hooks=[],
|
||||||
|
excludes=[],
|
||||||
|
noarchive=False,
|
||||||
|
optimize=0,
|
||||||
|
)
|
||||||
|
pyz = PYZ(a.pure)
|
||||||
|
|
||||||
|
exe = EXE(
|
||||||
|
pyz,
|
||||||
|
a.scripts,
|
||||||
|
a.binaries,
|
||||||
|
a.datas,
|
||||||
|
[],
|
||||||
|
name='FireWallet',
|
||||||
|
debug=False,
|
||||||
|
bootloader_ignore_signals=False,
|
||||||
|
strip=False,
|
||||||
|
upx=True,
|
||||||
|
upx_exclude=[],
|
||||||
|
runtime_tmpdir=None,
|
||||||
|
console=False,
|
||||||
|
disable_windowed_traceback=False,
|
||||||
|
argv_emulation=False,
|
||||||
|
target_arch=None,
|
||||||
|
codesign_identity=None,
|
||||||
|
entitlements_file=None,
|
||||||
|
onefile=False,
|
||||||
|
)
|
||||||
21
plugin.py
21
plugin.py
@@ -6,12 +6,19 @@ import hashlib
|
|||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
def import_module(module_name):
|
||||||
|
if module_name in sys.modules:
|
||||||
|
return importlib.reload(sys.modules[module_name])
|
||||||
|
else:
|
||||||
|
return importlib.import_module(module_name)
|
||||||
|
|
||||||
|
|
||||||
def listPlugins(update=False):
|
def listPlugins(update=False):
|
||||||
plugins = []
|
plugins = []
|
||||||
for file in os.listdir("plugins"):
|
for file in os.listdir("plugins"):
|
||||||
if file.endswith(".py"):
|
if file.endswith(".py"):
|
||||||
if file != "main.py":
|
if file != "main.py":
|
||||||
plugin = importlib.import_module("plugins."+file[:-3])
|
plugin = import_module("plugins."+file[:-3])
|
||||||
if "info" not in dir(plugin):
|
if "info" not in dir(plugin):
|
||||||
continue
|
continue
|
||||||
details = plugin.info
|
details = plugin.info
|
||||||
@@ -42,7 +49,7 @@ def listPlugins(update=False):
|
|||||||
for file in os.listdir(f"customPlugins/{importPath}"):
|
for file in os.listdir(f"customPlugins/{importPath}"):
|
||||||
if file.endswith(".py"):
|
if file.endswith(".py"):
|
||||||
if file != "main.py":
|
if file != "main.py":
|
||||||
plugin = importlib.import_module(f"customPlugins.{importPath}."+file[:-3])
|
plugin = import_module(f"customPlugins.{importPath}."+file[:-3])
|
||||||
if "info" not in dir(plugin):
|
if "info" not in dir(plugin):
|
||||||
continue
|
continue
|
||||||
details = plugin.info
|
details = plugin.info
|
||||||
@@ -106,7 +113,7 @@ def hashPlugin(plugin: str):
|
|||||||
|
|
||||||
|
|
||||||
def getPluginData(pluginStr: str):
|
def getPluginData(pluginStr: str):
|
||||||
plugin = importlib.import_module(pluginStr.replace("/","."))
|
plugin = import_module(pluginStr.replace("/","."))
|
||||||
|
|
||||||
# Check if the plugin is verified
|
# Check if the plugin is verified
|
||||||
signatures = []
|
signatures = []
|
||||||
@@ -141,12 +148,12 @@ def getPluginData(pluginStr: str):
|
|||||||
|
|
||||||
|
|
||||||
def getPluginFunctions(plugin: str):
|
def getPluginFunctions(plugin: str):
|
||||||
plugin = importlib.import_module(plugin.replace("/","."))
|
plugin = import_module(plugin.replace("/","."))
|
||||||
return plugin.functions
|
return plugin.functions
|
||||||
|
|
||||||
|
|
||||||
def runPluginFunction(plugin: str, function: str, params: dict, authentication: str):
|
def runPluginFunction(plugin: str, function: str, params: dict, authentication: str):
|
||||||
plugin_module = importlib.import_module(plugin.replace("/","."))
|
plugin_module = import_module(plugin.replace("/","."))
|
||||||
if function not in plugin_module.functions:
|
if function not in plugin_module.functions:
|
||||||
return {"error": "Function not found"}
|
return {"error": "Function not found"}
|
||||||
|
|
||||||
@@ -182,12 +189,12 @@ def runPluginFunction(plugin: str, function: str, params: dict, authentication:
|
|||||||
|
|
||||||
|
|
||||||
def getPluginFunctionInputs(plugin: str, function: str):
|
def getPluginFunctionInputs(plugin: str, function: str):
|
||||||
plugin = importlib.import_module(plugin.replace("/","."))
|
plugin = import_module(plugin.replace("/","."))
|
||||||
return plugin.functions[function]["params"]
|
return plugin.functions[function]["params"]
|
||||||
|
|
||||||
|
|
||||||
def getPluginFunctionReturns(plugin: str, function: str):
|
def getPluginFunctionReturns(plugin: str, function: str):
|
||||||
plugin = importlib.import_module(plugin.replace("/","."))
|
plugin = import_module(plugin.replace("/","."))
|
||||||
return plugin.functions[function]["returns"]
|
return plugin.functions[function]["returns"]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
8
templates/components/dashboard-alert.html
Normal file
8
templates/components/dashboard-alert.html
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<div class="col-md-6 col-xl-3 mb-4">
|
||||||
|
<div class="card shadow border-start-warning py-2">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="text-uppercase fw-bold text-xs mb-1"><span style="color: var(--bs-dark);">{{name}}</span></div>
|
||||||
|
<div class="text-dark fw-bold h5 mb-0"><span>{{output | safe}}</span></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user