Merge branch 'dev' for v1.3
All checks were successful
Build Docker / Build Image (push) Successful in 45s
All checks were successful
Build Docker / Build Image (push) Successful in 45s
This commit is contained in:
commit
65eedff61c
2
main.py
2
main.py
@ -56,7 +56,7 @@ def index():
|
||||
commit = info['commit']
|
||||
if commit != latestVersion(branch):
|
||||
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)
|
||||
|
||||
|
21
plugin.py
21
plugin.py
@ -6,12 +6,19 @@ import hashlib
|
||||
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):
|
||||
plugins = []
|
||||
for file in os.listdir("plugins"):
|
||||
if file.endswith(".py"):
|
||||
if file != "main.py":
|
||||
plugin = importlib.import_module("plugins."+file[:-3])
|
||||
plugin = import_module("plugins."+file[:-3])
|
||||
if "info" not in dir(plugin):
|
||||
continue
|
||||
details = plugin.info
|
||||
@ -42,7 +49,7 @@ def listPlugins(update=False):
|
||||
for file in os.listdir(f"customPlugins/{importPath}"):
|
||||
if file.endswith(".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):
|
||||
continue
|
||||
details = plugin.info
|
||||
@ -106,7 +113,7 @@ def hashPlugin(plugin: str):
|
||||
|
||||
|
||||
def getPluginData(pluginStr: str):
|
||||
plugin = importlib.import_module(pluginStr.replace("/","."))
|
||||
plugin = import_module(pluginStr.replace("/","."))
|
||||
|
||||
# Check if the plugin is verified
|
||||
signatures = []
|
||||
@ -141,12 +148,12 @@ def getPluginData(pluginStr: str):
|
||||
|
||||
|
||||
def getPluginFunctions(plugin: str):
|
||||
plugin = importlib.import_module(plugin.replace("/","."))
|
||||
plugin = import_module(plugin.replace("/","."))
|
||||
return plugin.functions
|
||||
|
||||
|
||||
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:
|
||||
return {"error": "Function not found"}
|
||||
|
||||
@ -182,12 +189,12 @@ def runPluginFunction(plugin: str, function: str, params: dict, authentication:
|
||||
|
||||
|
||||
def getPluginFunctionInputs(plugin: str, function: str):
|
||||
plugin = importlib.import_module(plugin.replace("/","."))
|
||||
plugin = import_module(plugin.replace("/","."))
|
||||
return plugin.functions[function]["params"]
|
||||
|
||||
|
||||
def getPluginFunctionReturns(plugin: str, function: str):
|
||||
plugin = importlib.import_module(plugin.replace("/","."))
|
||||
plugin = import_module(plugin.replace("/","."))
|
||||
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>
|
Loading…
Reference in New Issue
Block a user