From eabd2df2dfbd173bb6dc56ea8ca26bb00bdb087b Mon Sep 17 00:00:00 2001 From: Taylor Helsper Date: Tue, 8 Sep 2020 21:20:29 -0500 Subject: [PATCH] Add upgrade and reinstall buttons to app page --- .../standard/usr/bin/mynode_post_upgrade.sh | 4 +-- .../standard/usr/bin/mynode_reinstall_app.sh | 4 +-- rootfs/standard/var/www/mynode/device_info.py | 30 +++++++++++++++---- .../var/www/mynode/templates/manage_apps.html | 30 +++++++++++++++++-- .../var/www/mynode/templates/settings.html | 6 ++-- 5 files changed, 59 insertions(+), 15 deletions(-) diff --git a/rootfs/standard/usr/bin/mynode_post_upgrade.sh b/rootfs/standard/usr/bin/mynode_post_upgrade.sh index 1237fe9b..c50c0552 100755 --- a/rootfs/standard/usr/bin/mynode_post_upgrade.sh +++ b/rootfs/standard/usr/bin/mynode_post_upgrade.sh @@ -456,7 +456,7 @@ CURRENT="" if [ -f $BTCRPCEXPLORER_VERSION_FILE ]; then CURRENT=$(cat $BTCRPCEXPLORER_VERSION_FILE) fi -if [ "$CURRENT" != "$BTCRPCEXPLORER_UPGRADE_URL" ]; then +if [ "$CURRENT" != "$BTCRPCEXPLORER_VERSION" ]; then cd /opt/mynode rm -rf btc-rpc-explorer sudo -u bitcoin wget $BTCRPCEXPLORER_UPGRADE_URL -O btc-rpc-explorer.tar.gz @@ -468,7 +468,7 @@ if [ "$CURRENT" != "$BTCRPCEXPLORER_UPGRADE_URL" ]; then mkdir -p /home/bitcoin/.mynode/ chown -R bitcoin:bitcoin /home/bitcoin/.mynode/ - echo $BTCRPCEXPLORER_UPGRADE_URL > $BTCRPCEXPLORER_VERSION_FILE + echo $BTCRPCEXPLORER_VERSION > $BTCRPCEXPLORER_VERSION_FILE fi diff --git a/rootfs/standard/usr/bin/mynode_reinstall_app.sh b/rootfs/standard/usr/bin/mynode_reinstall_app.sh index 2cedaa94..ccc0216a 100755 --- a/rootfs/standard/usr/bin/mynode_reinstall_app.sh +++ b/rootfs/standard/usr/bin/mynode_reinstall_app.sh @@ -24,7 +24,7 @@ elif [ "$APP" = "lnd" ]; then elif [ "$APP" = "loopd" ]; then rm -f $LOOP_VERSION_FILE elif [ "$APP" = "btcrpcexplorer" ]; then - rm -f /home/bitcoin/.mynode/.btcrpcexplorer_url # NEEDS UPDATE TO VERSION FILE + rm -f $BTCRPCEXPLORER_VERSION_FILE elif [ "$APP" = "caravan" ]; then rm -f $CARAVAN_VERSION_FILE elif [ "$APP" = "corsproxy" ]; then @@ -32,7 +32,7 @@ elif [ "$APP" = "corsproxy" ]; then elif [ "$APP" = "joinmarket" ]; then rm -f $JOINMARKET_VERSION_FILE elif [ "$APP" = "lnbits" ]; then - rm -f /home/bitcoin/.mynode/.lnbits_url # NEEDS UPDATE TO VERSION FILE + rm -f $LNBITS_VERSION_FILE elif [ "$APP" = "lndconnect" ]; then rm -f $LNDCONNECT_VERSION_FILE elif [ "$APP" = "lndhub" ]; then diff --git a/rootfs/standard/var/www/mynode/device_info.py b/rootfs/standard/var/www/mynode/device_info.py index 5d8240c2..f1df7b1b 100644 --- a/rootfs/standard/var/www/mynode/device_info.py +++ b/rootfs/standard/var/www/mynode/device_info.py @@ -190,16 +190,34 @@ def has_checkin_error(): #================================== def get_app_current_version(app): version = "unknown" - filename = "/home/bitcoin/.mynode/"+app+"_version" - if os.path.isfile(filename): - version = get_file_contents(filename) + filename1 = "/home/bitcoin/.mynode/"+app+"_version" + filename2 = "/mnt/hdd/mynode/settings/"+app+"_version" + if os.path.isfile(filename1): + version = get_file_contents(filename1) + elif os.path.isfile(filename2): + version = get_file_contents(filename2) + else: + version = "not installed" + + # For versions that are hashes, shorten them + version = version[0:16] + return version def get_app_latest_version(app): version = "unknown" - filename = "/home/bitcoin/.mynode/"+app+"_version_latest" - if os.path.isfile(filename): - version = get_file_contents(filename) + filename1 = "/home/bitcoin/.mynode/"+app+"_version_latest" + filename2 = "/mnt/hdd/mynode/settings/"+app+"_version_latest" + if os.path.isfile(filename1): + version = get_file_contents(filename1) + elif os.path.isfile(filename2): + version = get_file_contents(filename2) + else: + version = "error" + + # For versions that are hashes, shorten them + version = version[0:16] + return version diff --git a/rootfs/standard/var/www/mynode/templates/manage_apps.html b/rootfs/standard/var/www/mynode/templates/manage_apps.html index f12e408c..e8341c80 100644 --- a/rootfs/standard/var/www/mynode/templates/manage_apps.html +++ b/rootfs/standard/var/www/mynode/templates/manage_apps.html @@ -2,6 +2,25 @@ {{ title }} {% include 'includes/head.html' %} + + {% include 'includes/logo_header.html' %} @@ -18,7 +37,7 @@ Application Current Version Latest Version - Actions + Actions {% for app in apps %} @@ -26,7 +45,14 @@ {{ app.name }} {{ app.current_version }} {{ app.latest_version }} - + + {% if app.current_version != app.latest_version %} + + {% endif %} + + + + {% endfor %} diff --git a/rootfs/standard/var/www/mynode/templates/settings.html b/rootfs/standard/var/www/mynode/templates/settings.html index eea4b63d..5aca2d38 100644 --- a/rootfs/standard/var/www/mynode/templates/settings.html +++ b/rootfs/standard/var/www/mynode/templates/settings.html @@ -576,16 +576,16 @@ Status - +
User Interface