added RPC Explorer to main menu

This commit is contained in:
rootzoll 2020-01-27 02:20:18 +01:00
parent 37ecec65de
commit 540d53240c
2 changed files with 37 additions and 17 deletions

View file

@ -45,6 +45,9 @@ fi
if [ "${ElectRS}" == "on" ]; then
OPTIONS+=(ELECTRS "Electrum Rust Server")
fi
if [ "${BTCRPCexplorer}" == "on" ]; then
OPTIONS+=(EXPLORE "BTC RPC Explorer")
fi
if [ "${lndmanage}" == "on" ]; then
OPTIONS+=(LNDMANAGE "LND Manage Script")
fi
@ -146,6 +149,10 @@ case $CHOICE in
/home/admin/config.scripts/bonus.btcpayserver.sh menu
./00mainMenu.sh
;;
EXPLORE)
/home/admin/config.scripts/bonus.btc-rpc-explorer.sh menu
./00mainMenu.sh
;;
ELECTRS)
/home/admin/config.scripts/bonus.electrs.sh menu
./00mainMenu.sh

View file

@ -13,6 +13,36 @@ fi
source /mnt/hdd/raspiblitz.conf
# show info menu
if [ "$1" = "menu" ]; then
# get network info
localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
toraddress=$(sudo cat /mnt/hdd/tor/btc-rpc-explorer/hostname 2>/dev/null)
if [ "${runBehindTor}" = "on" ] && [ ${#toraddress} -gt 0 ]; then
# TOR
/home/admin/config.scripts/blitz.lcd.sh qr "${toraddress}"
whiptail --title " BTC-RPC-Explorer " --msgbox "Open the following URL in your local web browser:
http://${localip}:3002\n
Hidden Service address for TOR Browser (QR see LCD):
${toraddress}
" 12 67
/home/admin/config.scripts/blitz.lcd.sh hide
else
# IP + Domain
whiptail --title " BTC-RPC-Explorer " --msgbox "Open the following URL in your local web browser:
http://${localip}:3002\n
Activate TOR to access the web block explorer from outside your local network.
" 11 54
fi
echo "please wait ..."
exit 0
fi
# add default value to raspi config if needed
if ! grep -Eq "^BTCRPCexplorer=" /mnt/hdd/raspiblitz.conf; then
echo "BTCRPCexplorer=off" >> /mnt/hdd/raspiblitz.conf
@ -179,23 +209,6 @@ EOF
# correct old Hidden Service with port
sudo sed -i "s/^HiddenServicePort 3002 127.0.0.1:3002/HiddenServicePort 80 127.0.0.1:3002/g" /etc/tor/torrc
/home/admin/config.scripts/internet.hiddenservice.sh btc-rpc-explorer 80 3002
TOR_ADDRESS=$(sudo cat /mnt/hdd/tor/btc-rpc-explorer/hostname)
if [ -z "$TOR_ADDRESS" ]; then
echo "Waiting for the Hidden Service"
sleep 10
TOR_ADDRESS=$(sudo cat /mnt/hdd/tor/btc-rpc-explorer/hostname)
if [ -z "$TOR_ADDRESS" ]; then
echo " FAIL - The Hidden Service address could not be found - Tor error?"
exit 1
fi
fi
echo ""
echo "***"
echo "The Tor Hidden Service address for btc-rpc-explorer is:"
echo "$TOR_ADDRESS"
echo "***"
echo ""
fi
exit 0
fi