From 39bf07ece278008709c6415b1e458eb7eb9b671d Mon Sep 17 00:00:00 2001 From: Taylor Helsper Date: Fri, 24 Jul 2020 13:02:15 -0500 Subject: [PATCH] More version check improvements --- .../standard/usr/bin/mynode_get_latest_version.sh | 13 +++++++++++++ rootfs/standard/usr/bin/mynode_post_www.sh | 10 +++++++--- rootfs/standard/var/www/mynode/config.py | 2 -- rootfs/standard/var/www/mynode/device_info.py | 3 +-- 4 files changed, 21 insertions(+), 7 deletions(-) create mode 100755 rootfs/standard/usr/bin/mynode_get_latest_version.sh diff --git a/rootfs/standard/usr/bin/mynode_get_latest_version.sh b/rootfs/standard/usr/bin/mynode_get_latest_version.sh new file mode 100755 index 00000000..ce443b08 --- /dev/null +++ b/rootfs/standard/usr/bin/mynode_get_latest_version.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -x + +source /usr/share/mynode/mynode_config.sh + +torify wget $LATEST_VERSION_URL -O /usr/share/mynode/latest_version || \ + ( sleep 1s && torify wget $LATEST_VERSION_URL -O /usr/share/mynode/latest_version ) || \ + ( sleep 1s && wget $LATEST_VERSION_URL -O /usr/share/mynode/latest_version ) + +torify wget $LATEST_BETA_VERSION_URL -O /usr/share/mynode/latest_beta_version || \ + ( sleep 1s && torify wget $LATEST_BETA_VERSION_URL -O /usr/share/mynode/latest_beta_version ) || \ + ( sleep 1s && wget $LATEST_BETA_VERSION_URL -O /usr/share/mynode/latest_beta_version ) \ No newline at end of file diff --git a/rootfs/standard/usr/bin/mynode_post_www.sh b/rootfs/standard/usr/bin/mynode_post_www.sh index 5546c213..b8220a3c 100755 --- a/rootfs/standard/usr/bin/mynode_post_www.sh +++ b/rootfs/standard/usr/bin/mynode_post_www.sh @@ -4,7 +4,11 @@ source /usr/share/mynode/mynode_config.sh set -x -sleep 10s +sleep 2s -# Load webpage once to trigger initial load -curl http://localhost/ +# Load webpage once to trigger initial load - some setup is not triggered until first page load +curl http://localhost/ || \ + ( sleep 5s && curl http://localhost/ ) || \ + ( sleep 5s && curl http://localhost/ ) || \ + ( sleep 5s && curl http://localhost/ ) || \ + ( sleep 5s && curl http://localhost/ ) diff --git a/rootfs/standard/var/www/mynode/config.py b/rootfs/standard/var/www/mynode/config.py index 29dc301a..cf3e6cd2 100644 --- a/rootfs/standard/var/www/mynode/config.py +++ b/rootfs/standard/var/www/mynode/config.py @@ -8,8 +8,6 @@ CONFIG["btcrpcexplorer_enabled"] = True CONFIG["lndhub_enabled"] = True # myNode variables -LATEST_VERSION_URL = "https://www.mynodebtc.com/device/latest_version" -LATEST_BETA_VERSION_URL = "https://www.mynodebtc.com/device/latest_beta_version" CHECKIN_URL = "https://www.mynodebtc.com/device_api/check_in.php" # Bitcoin Variables diff --git a/rootfs/standard/var/www/mynode/device_info.py b/rootfs/standard/var/www/mynode/device_info.py index 7613aed1..e438bb3e 100644 --- a/rootfs/standard/var/www/mynode/device_info.py +++ b/rootfs/standard/var/www/mynode/device_info.py @@ -99,8 +99,7 @@ def get_current_beta_version(): return current_beta_version def update_latest_version(): - os.system("torify wget "+LATEST_VERSION_URL+" -O /usr/share/mynode/latest_version") - os.system("torify wget "+LATEST_BETA_VERSION_URL+" -O /usr/share/mynode/latest_beta_version") + os.system("/usr/bin/mynode_get_latest_version.sh") return True def get_latest_version():