diff --git a/rootfs/standard/usr/bin/mynode-manage-apps b/rootfs/standard/usr/bin/mynode-manage-apps index 40c90561..b84afd09 100755 --- a/rootfs/standard/usr/bin/mynode-manage-apps +++ b/rootfs/standard/usr/bin/mynode-manage-apps @@ -1,57 +1,10 @@ #!/usr/local/bin/python3 from argparse import ArgumentParser +from application_info import * +import json import os -APPLICATIONS_FOLDER = "/usr/share/mynode_apps" - -def init_application(app_info): - app_name = app_info["short_name"] - app_dir = APPLICATIONS_FOLDER + "/" + app_name - print(" Loading " + app_name + "...") - os.system("cp -f {} {}".format(app_dir+"/app.service", "/etc/systemd/system/"+app_name+".service")) - os.system("cp -f {} {}".format(app_dir+"/"+app_name+".png", "/var/www/mynode/static/images/app_icons/"+app_name+".png")) - if (os.path.isfile(app_dir+"/scripts/pre_"+app_name+".sh")): - os.system("cp -f {} {}".format(app_dir+"/scripts/pre_"+app_name+".sh", "/usr/bin/service_post/pre_"+app_name+".sh")) - if (os.path.isfile(app_dir+"/scripts/post_"+app_name+".sh")): - os.system("cp -f {} {}".format(app_dir+"/scripts/post_"+app_name+".sh", "/usr/bin/service_pre/post_"+app_name+".sh")) - if (os.path.isfile(app_dir+"/scripts/install"+app_name+".sh")): - os.system("cp -f {} {}".format(app_dir+"/scripts/install_"+app_name+".sh", "/usr/bin/service_install/install_"+app_name+".sh")) - if (os.path.isfile(app_dir+"/scripts/uninstall"+app_name+".sh")): - os.system("cp -f {} {}".format(app_dir+"/scripts/uninstall"+app_name+".sh", "/usr/bin/service_uninstall/uninstall_"+app_name+".sh")) - - print(" TODO: Install data files") - - # For "node" type apps - print(" TODO: Need node special files???") - - # For "python" type apps - print(" TODO: Need python special files???") - - # For "docker" type apps - print(" TODO: Build dockerfile???") - print(" TODO: Install dockerfile???") - - print(" Done.") - - -def init_applications(): - # Loop over each app - for app_folder_name in os.listdir(APPLICATIONS_FOLDER): - print("Found Application: {}".format(app_folder_name)) - app_dir = APPLICATIONS_FOLDER + "/" + app_folder_name - try: - app_json_path = app_dir + "/app.json" - with open(app_json_path, 'r') as fp: - app_info = json.load(fp) - init_application(app_info) - - except Exception as e: - print(" ERROR: Error loading app.json file") - - os.system("systemctl daemon-reload") - - def main(): parser = ArgumentParser(prog='mynode-manage-apps') action_choices = ( @@ -64,7 +17,7 @@ def main(): if args.action == "createbasefolders": print("createbasefolders - not needed?") elif args.action == "init": - init_applications() + init_dynamic_apps() else: print("UNKNOWN BASE ACTION") diff --git a/rootfs/standard/usr/share/mynode_apps/lndg/app.json b/rootfs/standard/usr/share/mynode_apps/lndg/app.json index e69de29b..bf8aa6a0 100644 --- a/rootfs/standard/usr/share/mynode_apps/lndg/app.json +++ b/rootfs/standard/usr/share/mynode_apps/lndg/app.json @@ -0,0 +1,13 @@ +{ + "name": "LNDg", + "short_name": "lndg", + "requires_lightning": true, + "hide_status_icon": false, + "app_tile_default_status_text": "Lightning Tool", + "app_tile_button_href": "/lndg", + "app_tile_button_text": "Info", + "can_uninstall": true, + "can_enable_disable": false, + "show_on_homepage": true, + "homepage_order": 99 +} \ No newline at end of file diff --git a/rootfs/standard/var/pynode/application_info.py b/rootfs/standard/var/pynode/application_info.py index 23578202..dd42a064 100644 --- a/rootfs/standard/var/pynode/application_info.py +++ b/rootfs/standard/var/pynode/application_info.py @@ -11,6 +11,9 @@ import subprocess import re import os +# Globals +DYNAMIC_APPLICATIONS_FOLDER = "/usr/share/mynode_apps" + # Cached data JSON_APPLICATION_CACHE_FILE = "/tmp/app_cache.json" mynode_applications = None @@ -157,6 +160,9 @@ def initialize_applications(): apps[index] = initialize_application_defaults(app) mynode_applications = copy.deepcopy(apps) + + # TODO: Load all app-specific JSON files + # ... return def update_applications(include_status=False): @@ -420,4 +426,66 @@ def reset_custom_app_version_data(): os.system("rm -f /usr/share/mynode/mynode_app_versions_custom.sh") os.system("rm -f /mnt/hdd/mynode/settings/mynode_app_versions_custom.sh") os.system("sync") - trigger_application_refresh() \ No newline at end of file + trigger_application_refresh() + +###################################################################################### +## Dynamic Apps +###################################################################################### +def get_dynamic_app_dir(): + global DYNAMIC_APPLICATIONS_FOLDER + return DYNAMIC_APPLICATIONS_FOLDER + +def get_dynamic_app_names(): + app_dir = get_dynamic_app_dir() + app_names = [] + for app_folder_name in os.listdir( app_dir ): + if os.path.isdir(app_dir + "/" +app_folder_name): + app_names.append(app_folder_name) + return app_names + +def init_dynamic_app(app_info): + app_name = app_info["short_name"] + app_dir = DYNAMIC_APPLICATIONS_FOLDER + "/" + app_name + log_message(" Loading " + app_name + "...") + os.system("cp -f {} {}".format(app_dir+"/app.service", "/etc/systemd/system/"+app_name+".service")) + os.system("cp -f {} {}".format(app_dir+"/"+app_name+".png", "/var/www/mynode/static/images/app_icons/"+app_name+".png")) + if (os.path.isfile(app_dir+"/scripts/pre_"+app_name+".sh")): + os.system("cp -f {} {}".format(app_dir+"/scripts/pre_"+app_name+".sh", "/usr/bin/service_post/pre_"+app_name+".sh")) + if (os.path.isfile(app_dir+"/scripts/post_"+app_name+".sh")): + os.system("cp -f {} {}".format(app_dir+"/scripts/post_"+app_name+".sh", "/usr/bin/service_pre/post_"+app_name+".sh")) + if (os.path.isfile(app_dir+"/scripts/install"+app_name+".sh")): + os.system("cp -f {} {}".format(app_dir+"/scripts/install_"+app_name+".sh", "/usr/bin/service_install/install_"+app_name+".sh")) + if (os.path.isfile(app_dir+"/scripts/uninstall"+app_name+".sh")): + os.system("cp -f {} {}".format(app_dir+"/scripts/uninstall"+app_name+".sh", "/usr/bin/service_uninstall/uninstall_"+app_name+".sh")) + + log_message(" TODO: Install data files") + + # For "node" type apps + log_message(" TODO: Need node special files???") + + # For "python" type apps + log_message(" TODO: Need python special files???") + + # For "docker" type apps + log_message(" TODO: Build dockerfile???") + log_message(" TODO: Install dockerfile???") + + log_message(" Done.") + +def init_dynamic_apps(): + # Loop over each app + root_app_dir = get_dynamic_app_dir() + app_names = get_dynamic_app_names() + for app_name in app_names: + log_message("Found Application: {}".format(app_name)) + app_dir = root_app_dir + "/" + app_name + try: + app_json_path = app_dir + "/app.json" + with open(app_json_path, 'r') as fp: + app_info = json.load(fp) + init_dynamic_app(app_info) + + except Exception as e: + log_message(" ERROR: Error loading app.json file ({})".format(str(e))) + + os.system("systemctl daemon-reload") \ No newline at end of file diff --git a/rootfs/standard/var/www/mynode/static/images/bitcoin.png b/rootfs/standard/var/www/mynode/static/images/app_icons/bitcoin.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/bitcoin.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/bitcoin.png diff --git a/rootfs/standard/var/www/mynode/static/images/bluewallet.png b/rootfs/standard/var/www/mynode/static/images/app_icons/bluewallet.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/bluewallet.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/bluewallet.png diff --git a/rootfs/standard/var/www/mynode/static/images/bos.png b/rootfs/standard/var/www/mynode/static/images/app_icons/bos.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/bos.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/bos.png diff --git a/rootfs/standard/var/www/mynode/static/images/btcpayserver.png b/rootfs/standard/var/www/mynode/static/images/app_icons/btcpayserver.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/btcpayserver.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/btcpayserver.png diff --git a/rootfs/standard/var/www/mynode/static/images/btcrpcexplorer.png b/rootfs/standard/var/www/mynode/static/images/app_icons/btcrpcexplorer.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/btcrpcexplorer.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/btcrpcexplorer.png diff --git a/rootfs/standard/var/www/mynode/static/images/caravan.png b/rootfs/standard/var/www/mynode/static/images/app_icons/caravan.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/caravan.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/caravan.png diff --git a/rootfs/standard/var/www/mynode/static/images/ckbunker.png b/rootfs/standard/var/www/mynode/static/images/app_icons/ckbunker.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/ckbunker.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/ckbunker.png diff --git a/rootfs/standard/var/www/mynode/static/images/dojo.png b/rootfs/standard/var/www/mynode/static/images/app_icons/dojo.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/dojo.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/dojo.png diff --git a/rootfs/standard/var/www/mynode/static/images/electrs.png b/rootfs/standard/var/www/mynode/static/images/app_icons/electrs.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/electrs.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/electrs.png diff --git a/rootfs/standard/var/www/mynode/static/images/fully_noded_logo.png b/rootfs/standard/var/www/mynode/static/images/app_icons/fully_noded.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/fully_noded_logo.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/fully_noded.png diff --git a/rootfs/standard/var/www/mynode/static/images/joininbox.png b/rootfs/standard/var/www/mynode/static/images/app_icons/joininbox.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/joininbox.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/joininbox.png diff --git a/rootfs/standard/var/www/mynode/static/images/lightning.png b/rootfs/standard/var/www/mynode/static/images/app_icons/lightning.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/lightning.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/lightning.png diff --git a/rootfs/standard/var/www/mynode/static/images/lit.png b/rootfs/standard/var/www/mynode/static/images/app_icons/lit.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/lit.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/lit.png diff --git a/rootfs/standard/var/www/mynode/static/images/lnbits.png b/rootfs/standard/var/www/mynode/static/images/app_icons/lnbits.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/lnbits.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/lnbits.png diff --git a/rootfs/standard/var/www/mynode/static/images/lnd.png b/rootfs/standard/var/www/mynode/static/images/app_icons/lnd.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/lnd.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/lnd.png diff --git a/rootfs/standard/var/www/mynode/static/images/lndconnect.png b/rootfs/standard/var/www/mynode/static/images/app_icons/lndconnect.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/lndconnect.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/lndconnect.png diff --git a/rootfs/standard/var/www/mynode/static/images/lndhub.png b/rootfs/standard/var/www/mynode/static/images/app_icons/lndhub.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/lndhub.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/lndhub.png diff --git a/rootfs/standard/var/www/mynode/static/images/lndmanage.png b/rootfs/standard/var/www/mynode/static/images/app_icons/lndmanage.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/lndmanage.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/lndmanage.png diff --git a/rootfs/standard/var/www/mynode/static/images/loop.png b/rootfs/standard/var/www/mynode/static/images/app_icons/loop.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/loop.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/loop.png diff --git a/rootfs/standard/var/www/mynode/static/images/mempool.png b/rootfs/standard/var/www/mynode/static/images/app_icons/mempool.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/mempool.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/mempool.png diff --git a/rootfs/standard/var/www/mynode/static/images/netdata.png b/rootfs/standard/var/www/mynode/static/images/app_icons/netdata.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/netdata.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/netdata.png diff --git a/rootfs/standard/var/www/mynode/static/images/pool.png b/rootfs/standard/var/www/mynode/static/images/app_icons/pool.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/pool.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/pool.png diff --git a/rootfs/standard/var/www/mynode/static/images/pyblock.png b/rootfs/standard/var/www/mynode/static/images/app_icons/pyblock.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/pyblock.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/pyblock.png diff --git a/rootfs/standard/var/www/mynode/static/images/rtl.png b/rootfs/standard/var/www/mynode/static/images/app_icons/rtl.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/rtl.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/rtl.png diff --git a/rootfs/standard/var/www/mynode/static/images/specter.png b/rootfs/standard/var/www/mynode/static/images/app_icons/specter.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/specter.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/specter.png diff --git a/rootfs/standard/var/www/mynode/static/images/sphinxrelay.png b/rootfs/standard/var/www/mynode/static/images/app_icons/sphinxrelay.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/sphinxrelay.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/sphinxrelay.png diff --git a/rootfs/standard/var/www/mynode/static/images/thunderhub.png b/rootfs/standard/var/www/mynode/static/images/app_icons/thunderhub.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/thunderhub.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/thunderhub.png diff --git a/rootfs/standard/var/www/mynode/static/images/tor.png b/rootfs/standard/var/www/mynode/static/images/app_icons/tor.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/tor.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/tor.png diff --git a/rootfs/standard/var/www/mynode/static/images/vpn.png b/rootfs/standard/var/www/mynode/static/images/app_icons/vpn.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/vpn.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/vpn.png diff --git a/rootfs/standard/var/www/mynode/static/images/warden.png b/rootfs/standard/var/www/mynode/static/images/app_icons/warden.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/warden.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/warden.png diff --git a/rootfs/standard/var/www/mynode/static/images/wardenterminal.png b/rootfs/standard/var/www/mynode/static/images/app_icons/wardenterminal.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/wardenterminal.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/wardenterminal.png diff --git a/rootfs/standard/var/www/mynode/static/images/webssh2.png b/rootfs/standard/var/www/mynode/static/images/app_icons/webssh2.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/webssh2.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/webssh2.png diff --git a/rootfs/standard/var/www/mynode/static/images/whirlpool.png b/rootfs/standard/var/www/mynode/static/images/app_icons/whirlpool.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/whirlpool.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/whirlpool.png diff --git a/rootfs/standard/var/www/mynode/static/images/zap.png b/rootfs/standard/var/www/mynode/static/images/app_icons/zap.png similarity index 100% rename from rootfs/standard/var/www/mynode/static/images/zap.png rename to rootfs/standard/var/www/mynode/static/images/app_icons/zap.png diff --git a/rootfs/standard/var/www/mynode/static/images/lndhub.svg b/rootfs/standard/var/www/mynode/static/images/lndhub.svg deleted file mode 100644 index 9e06155b..00000000 --- a/rootfs/standard/var/www/mynode/static/images/lndhub.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - lndhub - Created with Sketch. - - - - - - - - - - - \ No newline at end of file diff --git a/rootfs/standard/var/www/mynode/static/images/lndhub_old.png b/rootfs/standard/var/www/mynode/static/images/lndhub_old.png deleted file mode 100644 index af55aead..00000000 Binary files a/rootfs/standard/var/www/mynode/static/images/lndhub_old.png and /dev/null differ diff --git a/rootfs/standard/var/www/mynode/static/images/specter.svg b/rootfs/standard/var/www/mynode/static/images/specter.svg deleted file mode 100644 index 59f7fbb8..00000000 --- a/rootfs/standard/var/www/mynode/static/images/specter.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - Group 2 - Created with Sketch. - - - - - - - - \ No newline at end of file diff --git a/rootfs/standard/var/www/mynode/templates/electrum_server.html b/rootfs/standard/var/www/mynode/templates/electrum_server.html index c8a98944..676ba1fb 100644 --- a/rootfs/standard/var/www/mynode/templates/electrum_server.html +++ b/rootfs/standard/var/www/mynode/templates/electrum_server.html @@ -103,7 +103,7 @@
- +
Local
PC Wallet
@@ -113,7 +113,7 @@
- +
Local
Mobile Wallets
@@ -123,7 +123,7 @@
- +
Remote
PC Wallet
@@ -133,7 +133,7 @@
- +
Remote
Mobile Wallet
diff --git a/rootfs/standard/var/www/mynode/templates/includes/services.html b/rootfs/standard/var/www/mynode/templates/includes/services.html index 0e5d4d9e..0000ccf7 100644 --- a/rootfs/standard/var/www/mynode/templates/includes/services.html +++ b/rootfs/standard/var/www/mynode/templates/includes/services.html @@ -3,7 +3,7 @@
- +
Bitcoin
{{ bitcoin_status }}
{% if is_testnet_enabled %} @@ -43,7 +43,7 @@
- +
Lightning
{{ lnd_status }}
{% if is_testnet_enabled %} diff --git a/rootfs/standard/var/www/mynode/templates/lnd.html b/rootfs/standard/var/www/mynode/templates/lnd.html index 0c031d3b..f44fbaf2 100644 --- a/rootfs/standard/var/www/mynode/templates/lnd.html +++ b/rootfs/standard/var/www/mynode/templates/lnd.html @@ -559,7 +559,7 @@
- +
RTL
@@ -570,7 +570,7 @@
- +
Thunderhub
@@ -584,7 +584,7 @@
- +
Zap
@@ -594,7 +594,7 @@
- +
BlueWallet
diff --git a/rootfs/standard/var/www/mynode/templates/tor.html b/rootfs/standard/var/www/mynode/templates/tor.html index 6b15df32..c92be258 100644 --- a/rootfs/standard/var/www/mynode/templates/tor.html +++ b/rootfs/standard/var/www/mynode/templates/tor.html @@ -132,7 +132,7 @@
- +
Fully Noded