More dynamic app improvements; Move app icons
|
@ -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")
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -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):
|
||||
|
@ -421,3 +427,65 @@ def reset_custom_app_version_data():
|
|||
os.system("rm -f /mnt/hdd/mynode/settings/mynode_app_versions_custom.sh")
|
||||
os.system("sync")
|
||||
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")
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 9.0 KiB |
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 12 KiB |
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="136px" height="183px" viewBox="0 0 136 183" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 52.6 (67491) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>Group 2</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<g id="Page-2" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="Group-2" transform="translate(56.301537, 101.210101) rotate(70.000000) translate(-56.301537, -101.210101) translate(-37.698463, 21.710101)">
|
||||
<path d="M119.379895,40.6029336 C114.608986,25.846267 101.692623,15.2696003 86.5071681,15.2696003 C67.2489863,15.2696003 51.5980772,32.306267 51.5980772,53.2696003 C51.5980772,74.2329336 67.2489863,91.2696003 86.5071681,91.2696003 C101.692623,91.2696003 114.608986,80.6929336 119.379895,65.936267 L144.688986,65.936267 L144.688986,91.2696003 L167.961714,91.2696003 L167.961714,65.936267 L179.598077,65.936267 L179.598077,40.6029336 L119.379895,40.6029336 Z M86.5071681,65.936267 C80.1071681,65.936267 74.8708045,60.236267 74.8708045,53.2696003 C74.8708045,46.3029336 80.1071681,40.6029336 86.5071681,40.6029336 C92.9071681,40.6029336 98.1435318,46.3029336 98.1435318,53.2696003 C98.1435318,60.236267 92.9071681,65.936267 86.5071681,65.936267 Z" id="Shape" fill-opacity="0.53" fill="#FFFFFF" fill-rule="nonzero" transform="translate(115.598077, 53.269600) rotate(-15.000000) translate(-115.598077, -53.269600) "></path>
|
||||
<path d="M109.318138,82.5452222 C104.547229,67.7885555 91.6308655,57.2118888 76.445411,57.2118888 C57.1872292,57.2118888 41.5363201,74.2485555 41.5363201,95.2118888 C41.5363201,116.175222 57.1872292,133.211889 76.445411,133.211889 C91.6308655,133.211889 104.547229,122.635222 109.318138,107.878555 L134.627229,107.878555 L134.627229,133.211889 L157.899956,133.211889 L157.899956,107.878555 L169.53632,107.878555 L169.53632,82.5452222 L109.318138,82.5452222 Z M76.445411,107.878555 C70.045411,107.878555 64.8090473,102.178555 64.8090473,95.2118888 C64.8090473,88.2452222 70.045411,82.5452222 76.445411,82.5452222 C82.845411,82.5452222 88.0817746,88.2452222 88.0817746,95.2118888 C88.0817746,102.178555 82.845411,107.878555 76.445411,107.878555 Z" id="Shape" fill="#FFFFFF" fill-rule="nonzero" transform="translate(105.536320, 95.211889) rotate(28.000000) translate(-105.536320, -95.211889) "></path>
|
||||
<circle id="Oval" stroke="#FFFFFF" stroke-width="10" cx="42" cy="64" r="42"></circle>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 2.5 KiB |
|
@ -103,7 +103,7 @@
|
|||
<div class="app_tile_row">
|
||||
<div class="app_tile_short">
|
||||
<div class="app_status_icon"></div>
|
||||
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/electrs.png")}}"/></div>
|
||||
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/app_icons/electrs.png")}}"/></div>
|
||||
<div class="app_title">Local<br/>PC Wallet</div>
|
||||
<div class="app_status"></div>
|
||||
<div class="app_contents">
|
||||
|
@ -113,7 +113,7 @@
|
|||
|
||||
<div class="app_tile_short">
|
||||
<div class="app_status_icon"></div>
|
||||
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/electrs.png")}}"/></div>
|
||||
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/app_icons/electrs.png")}}"/></div>
|
||||
<div class="app_title">Local<br/>Mobile Wallets</div>
|
||||
<div class="app_status"></div>
|
||||
<div class="app_contents">
|
||||
|
@ -123,7 +123,7 @@
|
|||
|
||||
<div class="app_tile_short">
|
||||
<div class="app_status_icon"></div>
|
||||
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/tor.png")}}"/></div>
|
||||
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/app_icons/tor.png")}}"/></div>
|
||||
<div class="app_title">Remote<br/>PC Wallet</div>
|
||||
<div class="app_status"></div>
|
||||
<div class="app_contents">
|
||||
|
@ -133,7 +133,7 @@
|
|||
|
||||
<div class="app_tile_short">
|
||||
<div class="app_status_icon"></div>
|
||||
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/tor.png")}}"/></div>
|
||||
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/app_icons/tor.png")}}"/></div>
|
||||
<div class="app_title">Remote<br/>Mobile Wallet</div>
|
||||
<div class="app_status"></div>
|
||||
<div class="app_contents">
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div class="app_tile_wide">
|
||||
<div style="width: 130px; float: left;">
|
||||
<div class="app_status_icon {{ bitcoin_status_color }}" id="bitcoin_status_icon"></div>
|
||||
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/bitcoin.png")}}"/></div>
|
||||
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/app_icons/bitcoin.png")}}"/></div>
|
||||
<div class="app_title">Bitcoin</div>
|
||||
<div class="app_status" id="bitcoin_status">{{ bitcoin_status }}</div>
|
||||
{% if is_testnet_enabled %}
|
||||
|
@ -43,7 +43,7 @@
|
|||
<div class="app_tile_wide">
|
||||
<div style="width: 130px; float: left;">
|
||||
<div class="app_status_icon {{ lnd_status_color }}" id="lnd_status_icon"></div>
|
||||
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/lightning.png")}}"/></div>
|
||||
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/app_icons/lightning.png")}}"/></div>
|
||||
<div class="app_title">Lightning</div>
|
||||
<div class="app_status" id="lnd_status">{{ lnd_status }}</div>
|
||||
{% if is_testnet_enabled %}
|
||||
|
|
|
@ -559,7 +559,7 @@
|
|||
<div class="app_tile_row">
|
||||
<div class="app_tile_short">
|
||||
<div class="app_status_icon"></div>
|
||||
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/rtl.png")}}"/></div>
|
||||
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/app_icons/rtl.png")}}"/></div>
|
||||
<div class="app_title">RTL</div>
|
||||
<div class="app_status"></div>
|
||||
<div class="app_contents">
|
||||
|
@ -570,7 +570,7 @@
|
|||
|
||||
<div class="app_tile_short">
|
||||
<div class="app_status_icon"></div>
|
||||
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/thunderhub.png")}}"/></div>
|
||||
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/app_icons/thunderhub.png")}}"/></div>
|
||||
<div class="app_title">Thunderhub</div>
|
||||
<div class="app_status"></div>
|
||||
<div class="app_contents">
|
||||
|
@ -584,7 +584,7 @@
|
|||
|
||||
<div class="app_tile_short">
|
||||
<div class="app_status_icon"></div>
|
||||
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/zap.png")}}"/></div>
|
||||
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/app_icons/zap.png")}}"/></div>
|
||||
<div class="app_title">Zap</div>
|
||||
<div class="app_status"></div>
|
||||
<div class="app_contents">
|
||||
|
@ -594,7 +594,7 @@
|
|||
|
||||
<div class="app_tile_short">
|
||||
<div class="app_status_icon"></div>
|
||||
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/bluewallet.png")}}"/></div>
|
||||
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/app_icons/bluewallet.png")}}"/></div>
|
||||
<div class="app_title">BlueWallet</div>
|
||||
<div class="app_status"></div>
|
||||
<div class="app_contents">
|
||||
|
|
|
@ -132,7 +132,7 @@
|
|||
<div class="app_tile_row">
|
||||
<div class="app_tile_short">
|
||||
<div class="app_status_icon"></div>
|
||||
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/fully_noded_logo.png")}}"/></div>
|
||||
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/app_icons/fully_noded.png")}}"/></div>
|
||||
<div class="app_title">Fully Noded</div>
|
||||
<div class="app_status"></div>
|
||||
<div class="app_contents">
|
||||
|
|