mirror of
https://github.com/mynodebtc/mynode.git
synced 2024-09-23 01:10:03 +00:00
Add option to reset RTL config
This commit is contained in:
parent
48189cef99
commit
87502b2d3a
|
@ -9,6 +9,7 @@ After=bitcoin.service
|
||||||
[Service]
|
[Service]
|
||||||
ExecStartPre=/usr/bin/is_not_shutting_down.sh
|
ExecStartPre=/usr/bin/is_not_shutting_down.sh
|
||||||
ExecStartPre=/usr/bin/wait_on_lnd.sh
|
ExecStartPre=/usr/bin/wait_on_lnd.sh
|
||||||
|
ExecStartPre=+/usr/bin/mynode_pre_rtl.sh
|
||||||
WorkingDirectory=/opt/mynode/RTL
|
WorkingDirectory=/opt/mynode/RTL
|
||||||
ExecStart=/usr/bin/node rtl
|
ExecStart=/usr/bin/node rtl
|
||||||
|
|
||||||
|
|
46
rootfs/standard/usr/bin/mynode_pre_rtl.sh
Executable file
46
rootfs/standard/usr/bin/mynode_pre_rtl.sh
Executable file
|
@ -0,0 +1,46 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source /usr/share/mynode/mynode_config.sh
|
||||||
|
|
||||||
|
set -x
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# RTL config
|
||||||
|
sudo -u bitcoin mkdir -p /opt/mynode/RTL
|
||||||
|
sudo -u bitcoin mkdir -p /mnt/hdd/mynode/rtl
|
||||||
|
chown -R bitcoin:bitcoin /mnt/hdd/mynode/rtl
|
||||||
|
chown -R bitcoin:bitcoin /mnt/hdd/mynode/rtl_backup
|
||||||
|
|
||||||
|
# If local settings file is not a symlink, delete and setup symlink to HDD
|
||||||
|
if [ ! -L /opt/mynode/RTL/RTL-Config.json ]; then
|
||||||
|
rm -f /opt/mynode/RTL/RTL-Config.json
|
||||||
|
sudo -u bitcoin ln -s /mnt/hdd/mynode/rtl/RTL-Config.json /opt/mynode/RTL/RTL-Config.json
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If config file on HDD does not exist, create it
|
||||||
|
if [ ! -f /mnt/hdd/mynode/rtl/RTL-Config.json ]; then
|
||||||
|
cp -f /usr/share/mynode/RTL-Config.json /mnt/hdd/mynode/rtl/RTL-Config.json
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Force update of RTL config file (increment to force new update)
|
||||||
|
RTL_CONFIG_UPDATE_NUM=1
|
||||||
|
if [ ! -f /mnt/hdd/mynode/rtl/update_settings_$RTL_CONFIG_UPDATE_NUM ]; then
|
||||||
|
cp -f /usr/share/mynode/RTL-Config.json /mnt/hdd/mynode/rtl/RTL-Config.json
|
||||||
|
touch /mnt/hdd/mynode/rtl/update_settings_$RTL_CONFIG_UPDATE_NUM
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update RTL config file to use mynode pw
|
||||||
|
if [ -f /home/bitcoin/.mynode/.hashedpw ]; then
|
||||||
|
HASH=$(cat /home/bitcoin/.mynode/.hashedpw)
|
||||||
|
sed -i "s/\"multiPassHashed\":.*/\"multiPassHashed\": \"$HASH\",/g" /mnt/hdd/mynode/rtl/RTL-Config.json
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update for testnet
|
||||||
|
if [ -f /mnt/hdd/mynode/settings/.testnet_enabled ]; then
|
||||||
|
sed -i "s/mainnet/testnet/g" /mnt/hdd/mynode/rtl/RTL-Config.json || true
|
||||||
|
else
|
||||||
|
sed -i "s/testnet/mainnet/g" /mnt/hdd/mynode/rtl/RTL-Config.json || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
sync
|
||||||
|
sleep 3s
|
|
@ -379,36 +379,7 @@ if [ $IS_RASPI4 -eq 1 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# RTL config
|
# RTL config
|
||||||
sudo -u bitcoin mkdir -p /opt/mynode/RTL
|
# Moved to mynode_pre_rtl.sh
|
||||||
sudo -u bitcoin mkdir -p /mnt/hdd/mynode/rtl
|
|
||||||
chown -R bitcoin:bitcoin /mnt/hdd/mynode/rtl
|
|
||||||
chown -R bitcoin:bitcoin /mnt/hdd/mynode/rtl_backup
|
|
||||||
# If local settings file is not a symlink, delete and setup symlink to HDD
|
|
||||||
if [ ! -L /opt/mynode/RTL/RTL-Config.json ]; then
|
|
||||||
rm -f /opt/mynode/RTL/RTL-Config.json
|
|
||||||
sudo -u bitcoin ln -s /mnt/hdd/mynode/rtl/RTL-Config.json /opt/mynode/RTL/RTL-Config.json
|
|
||||||
fi
|
|
||||||
# If config file on HDD does not exist, create it
|
|
||||||
if [ ! -f /mnt/hdd/mynode/rtl/RTL-Config.json ]; then
|
|
||||||
cp -f /usr/share/mynode/RTL-Config.json /mnt/hdd/mynode/rtl/RTL-Config.json
|
|
||||||
fi
|
|
||||||
# Force update of RTL config file (increment to force new update)
|
|
||||||
RTL_CONFIG_UPDATE_NUM=1
|
|
||||||
if [ ! -f /mnt/hdd/mynode/rtl/update_settings_$RTL_CONFIG_UPDATE_NUM ]; then
|
|
||||||
cp -f /usr/share/mynode/RTL-Config.json /mnt/hdd/mynode/rtl/RTL-Config.json
|
|
||||||
touch /mnt/hdd/mynode/rtl/update_settings_$RTL_CONFIG_UPDATE_NUM
|
|
||||||
fi
|
|
||||||
# Update RTL config file to use mynode pw
|
|
||||||
if [ -f /home/bitcoin/.mynode/.hashedpw ]; then
|
|
||||||
HASH=$(cat /home/bitcoin/.mynode/.hashedpw)
|
|
||||||
sed -i "s/\"multiPassHashed\":.*/\"multiPassHashed\": \"$HASH\",/g" /mnt/hdd/mynode/rtl/RTL-Config.json
|
|
||||||
fi
|
|
||||||
# Update for testnet
|
|
||||||
if [ -f /mnt/hdd/mynode/settings/.testnet_enabled ]; then
|
|
||||||
sed -i "s/mainnet/testnet/g" /mnt/hdd/mynode/rtl/RTL-Config.json || true
|
|
||||||
else
|
|
||||||
sed -i "s/testnet/mainnet/g" /mnt/hdd/mynode/rtl/RTL-Config.json || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# BTCPay Server Setup
|
# BTCPay Server Setup
|
||||||
mkdir -p /opt/mynode/btcpayserver
|
mkdir -p /opt/mynode/btcpayserver
|
||||||
|
|
|
@ -596,7 +596,7 @@ def set_flask_session_timeout(days, hours):
|
||||||
|
|
||||||
|
|
||||||
#==================================
|
#==================================
|
||||||
# Uploader Functions
|
# Web Server Functions
|
||||||
#==================================
|
#==================================
|
||||||
def restart_flask():
|
def restart_flask():
|
||||||
os.system("systemctl restart www")
|
os.system("systemctl restart www")
|
||||||
|
@ -904,6 +904,12 @@ def reset_electrs():
|
||||||
delete_electrs_data()
|
delete_electrs_data()
|
||||||
restart_electrs()
|
restart_electrs()
|
||||||
|
|
||||||
|
#==================================
|
||||||
|
# RTL Functions
|
||||||
|
#==================================
|
||||||
|
def reset_rtl_config():
|
||||||
|
os.system("rm -rf /mnt/hdd/mynode/rtl/RTL-Config.json")
|
||||||
|
os.system("systemctl restart rtl")
|
||||||
|
|
||||||
#==================================
|
#==================================
|
||||||
# Sphinx Relay Server Functions
|
# Sphinx Relay Server Functions
|
||||||
|
|
|
@ -545,6 +545,16 @@ def clear_mempool_cache_page():
|
||||||
flash("Mempool Cache Cleared", category="message")
|
flash("Mempool Cache Cleared", category="message")
|
||||||
return redirect("/settings")
|
return redirect("/settings")
|
||||||
|
|
||||||
|
@mynode_settings.route("/settings/reset-rtl-config")
|
||||||
|
def reset_rtl_config_page():
|
||||||
|
check_logged_in()
|
||||||
|
|
||||||
|
t = Timer(1.0, reset_rtl_config)
|
||||||
|
t.start()
|
||||||
|
|
||||||
|
flash("RTL Configuration Reset", category="message")
|
||||||
|
return redirect("/settings")
|
||||||
|
|
||||||
@mynode_settings.route("/settings/reset-specter-config")
|
@mynode_settings.route("/settings/reset-specter-config")
|
||||||
def reset_specter_config_page():
|
def reset_specter_config_page():
|
||||||
check_logged_in()
|
check_logged_in()
|
||||||
|
|
|
@ -822,7 +822,17 @@
|
||||||
This will regenerate your Electrum Server certificate.
|
This will regenerate your Electrum Server certificate.
|
||||||
<br/>
|
<br/>
|
||||||
<a href="/settings/regen-electrs-certs" class="ui-button ui-widget ui-corner-all settings_button">Regenerate</a>
|
<a href="/settings/regen-electrs-certs" class="ui-button ui-widget ui-corner-all settings_button">Regenerate</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="settings_block">
|
||||||
|
<a id="rtl"></a>
|
||||||
|
<div class="settings_block_header">Ride the Lightning</div>
|
||||||
|
|
||||||
|
<div class="settings_block_subheader">Reset RTL Configuration</div>
|
||||||
|
This will delete your RTL configuration and restart the application.
|
||||||
|
<br/>
|
||||||
|
<a href="/settings/reset-rtl-config" class="ui-button ui-widget ui-corner-all settings_button">Reset Configuration</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user