Reduced Options ParallelMenu

This commit is contained in:
rootzoll 2021-08-31 13:27:35 +02:00
parent 9beda86434
commit 45fd101836
2 changed files with 38 additions and 147 deletions

View File

@ -133,13 +133,16 @@ fi
if [ "${circuitbreaker}" == "on" ]; then
OPTIONS+=(CIRCUIT "Circuitbreaker (LND firewall)")
fi
if [ "${testnet}" == "on" ]; then
OPTIONS+=(TESTNET "Testnet Service Options")
fi
if [ ${chain} != "main" ]; then
OPTIONS+=(MAINNET "Mainnet Service Options")
OPTIONS+=(TESTNETS "Testnet/Signet Options")
fi
# dont offer to switch to "testnet view for now" - so no wswitch back to mainnet needed
#if [ ${chain} != "main" ]; then
# OPTIONS+=(MAINNET "Mainnet Service Options")
#fi
# Basic Options
OPTIONS+=(INFO "RaspiBlitz Status Screen")
@ -290,12 +293,9 @@ case $CHOICE in
CIRCUIT)
sudo /home/admin/config.scripts/bonus.circuitbreaker.sh menu
;;
TESTNET)
/home/admin/00parallelChainsMenu.sh testnet
;;
MAINNET)
/home/admin/00parallelChainsMenu.sh mainnet
;;
TESTNETS)
/home/admin/00parallelChainsMenu.sh
;;
SUBSCRIBE)
/home/admin/config.scripts/blitz.subscriptions.py
;;

View File

@ -1,97 +1,39 @@
#!/bin/bash
# Usage:
# 00parallelChainsMenu.sh <testnet|signet|mainnet> <lnd|cln>
# For now just list all testnet/signet options available
# injecting specific perspectives can be done later
source /home/admin/raspiblitz.info
# add default value to raspi config if needed
if ! grep -Eq "^testnet=" /mnt/hdd/raspiblitz.conf; then
echo "testnet=off" >> /mnt/hdd/raspiblitz.conf
fi
if ! grep -Eq "^lightning=" /mnt/hdd/raspiblitz.conf; then
echo "lightning=lnd" >> /mnt/hdd/raspiblitz.conf
fi
source /mnt/hdd/raspiblitz.conf
# CHAIN is signet | testnet | mainnet
if [ $# -gt 0 ]; then
CHAIN=$1
if [ $1 != ${chain}net ];then
nonDefaultChain=1
fi
else
nonDefaultChain=0
CHAIN=${chain}net
fi
# LNTYPE is lnd | cln
if [ $# -gt 1 ]&&[ $2 != $lightning ];then
nonDefaultLNtype=1
LNTYPE=$2
else
nonDefaultLNtype=0
LNTYPE=$lightning
fi
# get the local network IP to be displayed on the LCD
source <(/home/admin/config.scripts/internet.sh status local)
# BASIC MENU INFO
WIDTH=64
BACKTITLE="${CHAIN} options"
TITLE=""
BACKTITLE="RaspiBlitz"
TITLE=" Testnet/Signet Options "
MENU="Choose one of the following options:"
OPTIONS=()
plus=""
if [ "${runBehindTor}" = "on" ]; then
plus=" / TOR"
fi
if [ ${#dynDomain} -gt 0 ]; then
plus="${plus} / ${dynDomain}"
fi
BACKTITLE="${localip} / ${hostname} / ${network} / ${chain}${plus}"
# Put Activated Apps on top
if [ $chain = test ]&&[ "$trtlWebinterface" = "on" ]||\
[ $chain = sig ]&& [ "$srtlWebinterface" = "on" ]||\
[ $chain = main ]&&[ "$rtlWebinterface" = "on" ]; then
OPTIONS+=(RTL "RTL Web Node Manager for LND ${CHAIN}")
if [ "${testnet}" == "on" ]; then
OPTIONS+=(tSYS "TESTNET Monitoring & Configuration")
if [ "${lightning}" == "lnd" ] || [ "${lnd}" == "on" ]; then OPTIONS+=(tLND "TESTNET LND Wallet Options"); fi
if [ "${lightning}" == "cln" ] || [ "${cln}" == "on" ]; then OPTIONS+=(tCLN "TESTNET C-Lightning Wallet Options"); fi
fi
if [ $chain = test ]&&[ "$tlnd" = "on" ]||\
[ $chain = sig ]&& [ "$slnd" = "on" ]||\
[ $chain = main ]&&[ "$lnd" = "on" ]; then
OPTIONS+=(LND "LND options for ${CHAIN}")
if [ "${signet}" == "on" ]; then
OPTIONS+=(sSYS "SIGNET Monitoring & Configuration")
if [ "${lightning}" == "cln" ] || [ "${cln}" == "on" ]; then OPTIONS+=(sCLN "SIGNET C-Lightning Wallet Options"); fi
fi
if [ "$chain" = "test" ]&&[ "$tcrtlWebinterface" = "on" ]||\
[ "$chain" = "sig" ]&& [ "$scrtlWebinterface" = "on" ]||\
[ "$chain" = "main" ]&&[ "$crtlWebinterface" = "on" ]; then
OPTIONS+=(cRTL "RTL Web Node Manager for C-lightning ${CHAIN}")
fi
# DONT OFFER SERVICES FOR TESTNET RIGHT NOW
# OPTIONS+=(RTL "RTL Web Node Manager for LND ${CHAIN}")
# OPTIONS+=(SERVICES "Additional Apps & Services on ${CHAIN}")
if [ "$chain" = "test" ]&&[ "$tcln" = "on" ]||\
[ "$chain" = "sig" ]&& [ "$scln" = "on" ]||\
[ "$chain" = "main" ]&&[ "$cln" = "on" ]; then
OPTIONS+=(CLN "C-lightning options for ${CHAIN}")
fi
OPTIONS+=(INFO "RaspiBlitz Status Screen for ${CHAIN}")
if [ "$testnet" == "on" ]; then
OPTIONS+=(SERVICES "Additional Apps & Services on ${CHAIN}")
fi
OPTIONS+=(SYSTEM "Monitoring & Configuration")
#TODO OPTIONS+=(CONNECT "Connect Apps & Show Credentials")
if [ $nonDefaultLNtype = 1 ];then
OPTIONS+=(SWITCHLN "Make ${LNTYPE} the default lightning wallet")
fi
if [ $nonDefaultChain = 1 ];then
OPTIONS+=(MKDEFAULT "Make ${CHAIN} the default chain")
fi
# MAYBE LATER
# OPTIONS+=(CONNECT "Connect Apps & Show Credentials")
CHOICE_HEIGHT=$(("${#OPTIONS[@]}/2+1"))
HEIGHT=$((CHOICE_HEIGHT+6))
@ -106,73 +48,22 @@ CHOICE=$(dialog --clear \
2>&1 >/dev/tty)
case $CHOICE in
INFO)
echo "Gathering Information (please wait) ..."
while :
do
# show the same info as on LCD screen
/home/admin/00infoBlitz.sh ${lightning} ${chain}net
# wait 6 seconds for user exiting loop
echo ""
echo -en "Screen is updating in a loop .... press 'x' now to get back to menu."
read -n 1 -t 6 keyPressed
echo -en "\rGathering information to update info ... please wait. \n"
# check if user wants to abort session
if [ "${keyPressed}" = "x" ]; then
echo ""
echo "Returning to menu ....."
sleep 4
break
fi
done
;;
RTL)
/home/admin/config.scripts/bonus.rtl.sh menu lnd $CHAIN
tSYS)
/home/admin/99systemMenu.sh testnet
;;
cRTL)
/home/admin/config.scripts/bonus.rtl.sh menu cln $CHAIN
sSYS)
/home/admin/99systemMenu.sh signet
;;
LND)
/home/admin/99lndMenu.sh $CHAIN
tLND)
/home/admin/99lndMenu.sh testnet
;;
CLN)
/home/admin/99clnMenu.sh $CHAIN
sLND)
/home/admin/99lndMenu.sh signet
;;
SERVICES)
if [ $CHAIN = testnet ];then
/home/admin/00parallelTestnetServices.sh
elif [ $CHAIN = mainnet ];then
/home/admin/00parallelMainnetServices.sh $CHAIN
fi
tCLN)
/home/admin/99clnMenu.sh testnet
;;
SYSTEM)
/home/admin/99systemMenu.sh $CHAIN
;;
CONNECT)
/home/admin/99connectMenu.sh $CHAIN
;;
SWITCHLN)
# setting value in raspi blitz config
sudo sed -i "s/^lightning=.*/lightning=$LNTYPE/g" /mnt/hdd/raspiblitz.conf
echo "# OK - Set lightning=$LNTYPE in /mnt/hdd/raspiblitz.conf"
echo
echo "Press ENTER to return to main menu."
;;
MKDEFAULT)
# setting value in raspi blitz config
newchain=${CHAIN::-3}
sudo sed -i "s/^chain=.*/chain=${newchain}/g" /mnt/hdd/raspiblitz.conf
echo "# OK - Set chain=${newchain} in /mnt/hdd/raspiblitz.conf"
sudo /home/admin/config.scripts/lnd.credentials.sh sync
if grep -Eq "^specter=on" /mnt/hdd/raspiblitz.conf; then
echo "# Restart Specter on $CHAIN"
sudo systemctl restart specter.service
fi
echo
echo "Press ENTER to return to main menu."
read key
sCLN)
/home/admin/99clnMenu.sh signet
;;
esac