From b1e68c6a69d27a058dbddc0adfeb48068e23ce74 Mon Sep 17 00:00:00 2001 From: Taylor Helsper Date: Wed, 5 Feb 2020 19:15:32 -0600 Subject: [PATCH] Add electrum server reset; remove balanceofsatoshis --- rootfs/standard/usr/bin/mynode_post_upgrade.sh | 4 ++-- rootfs/standard/var/www/mynode/device_info.py | 16 ++++++++++++++++ rootfs/standard/var/www/mynode/settings.py | 15 +++++++++++++++ .../var/www/mynode/templates/settings.html | 10 ++++++++++ setup/setup_device.sh | 4 ++-- 5 files changed, 45 insertions(+), 4 deletions(-) diff --git a/rootfs/standard/usr/bin/mynode_post_upgrade.sh b/rootfs/standard/usr/bin/mynode_post_upgrade.sh index 7dc45489..4338da4c 100755 --- a/rootfs/standard/usr/bin/mynode_post_upgrade.sh +++ b/rootfs/standard/usr/bin/mynode_post_upgrade.sh @@ -26,7 +26,7 @@ apt-get -y install pv sysstat network-manager unzip pkg-config libfreetype6-dev apt-get -y install libatlas-base-dev libffi-dev libssl-dev glances python3-bottle apt-get -y -qq install apt-transport-https ca-certificates apt-get -y install libgmp-dev automake libtool libltdl-dev libltdl7 -apt-get -y install xorg chromium openbox lightdm openjdk-11-jre libevent-dev +apt-get -y install xorg chromium openbox lightdm openjdk-11-jre libevent-dev ncurses-dev # Make sure some software is removed apt-get -y purge ntp # (conflicts with systemd-timedatectl) @@ -39,6 +39,7 @@ pip install tzupdate virtualenv --no-cache-dir # Install any pip3 software pip3 install python-bitcointx --no-cache-dir +pip3 install gnureadline --no-cache-dir pip3 install lndmanage==0.9.0 --no-cache-dir # Install LND Manage (keep up to date with LND) pip3 install docker-compose --no-cache-dir @@ -71,7 +72,6 @@ usermod -aG docker root # Install node packages -sudo -u admin npm install balanceofsatoshis # Upgrade BTC diff --git a/rootfs/standard/var/www/mynode/device_info.py b/rootfs/standard/var/www/mynode/device_info.py index a5f0ac52..ac28c8f4 100644 --- a/rootfs/standard/var/www/mynode/device_info.py +++ b/rootfs/standard/var/www/mynode/device_info.py @@ -398,6 +398,22 @@ def delete_lnd_data(): return True +#================================== +# Electrum Server Functions +#================================== +def stop_electrs(): + os.system("systemctl stop electrs") + +def delete_electrs_data(): + os.system("rm -rf /mnt/hdd/mynode/electrs") + +def reset_electrs(): + stop_electrs() + delete_electrs_data() + reboot_device() + + + #================================== # Tor Functions #================================== diff --git a/rootfs/standard/var/www/mynode/settings.py b/rootfs/standard/var/www/mynode/settings.py index 77038828..a1dd18c0 100644 --- a/rootfs/standard/var/www/mynode/settings.py +++ b/rootfs/standard/var/www/mynode/settings.py @@ -305,6 +305,21 @@ def rescan_blockchain_page(): t.start() return redirect("/settings") +@mynode_settings.route("/settings/reset-electrs") +def reset_electrs_page(): + check_logged_in() + t = Timer(1.0, reset_electrs) + t.start() + + # Display wait page + templateData = { + "title": "myNode", + "header_text": "Resetting Electrum Data", + "subheader_text": "This will take several minutes...", + "ui_settings": read_ui_settings() + } + return render_template('reboot.html', **templateData) + @mynode_settings.route("/settings/factory-reset", methods=['POST']) def factory_reset_page(): check_logged_in() diff --git a/rootfs/standard/var/www/mynode/templates/settings.html b/rootfs/standard/var/www/mynode/templates/settings.html index a7531331..42fb1b2f 100644 --- a/rootfs/standard/var/www/mynode/templates/settings.html +++ b/rootfs/standard/var/www/mynode/templates/settings.html @@ -748,6 +748,16 @@ +
+
Electrum Server
+ +
Reset Electrum Server
+ Advanced: This will delete your Electrum Server data and reboot your device. +
+ Reset Data +
+ +
Tor
diff --git a/setup/setup_device.sh b/setup/setup_device.sh index 5f3b9be5..17160128 100755 --- a/setup/setup_device.sh +++ b/setup/setup_device.sh @@ -94,7 +94,7 @@ apt-get -y install pv sysstat network-manager rsync parted unzip pkg-config apt-get -y install libfreetype6-dev libpng-dev libatlas-base-dev libgmp-dev libltdl-dev apt-get -y install libffi-dev libssl-dev glances python3-bottle automake libtool libltdl7 apt -y -qq install apt-transport-https ca-certificates -apt-get -y install xorg chromium openbox lightdm openjdk-11-jre libevent-dev +apt-get -y install xorg chromium openbox lightdm openjdk-11-jre libevent-dev ncurses-dev # Make sure some software is removed @@ -148,6 +148,7 @@ fi pip3 install wheel setuptools pip3 install bitstring lnd-grpc pycoin aiohttp connectrum python-bitcoinlib pip3 install python-bitcointx +pip3 install gnureadline pip3 install lndmanage==0.9.0 # Install LND Manage (keep up to date with LND) pip3 install docker-compose @@ -181,7 +182,6 @@ usermod -aG docker root # Install node packages npm install -g pug-cli browserify uglify-js babel-cli -sudo -u admin npm install balanceofsatoshis # Remove existing MOTD login info rm -rf /etc/motd