test IP2TOR question

This commit is contained in:
rootzoll 2020-05-27 02:36:27 +02:00
parent f14de857ea
commit 4195e5f14f

View File

@ -5,25 +5,30 @@ source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
justLocal=1
aks4IP2TOR=0
# if TOR is activated then outside reach is possible (no notice)
if [ "${runBehindTor}" = "on" ]; then
justLocal=0
aks4IP2TOR=1
fi
# if dynDomain is set connect from outside is possible (no notice)
if [ ${#dynDomain} -gt 0 ]; then
justLocal=0
aks4IP2TOR=0
fi
# if sshtunnel to 10009/8080 then outside reach is possible (no notice)
isForwarded=$(echo ${sshtunnel} | grep -c "10009<")
if [ ${isForwarded} -gt 0 ]; then
justLocal=0
aks4IP2TOR=0
fi
isForwarded=$(echo ${sshtunnel} | grep -c "8080<")
if [ ${isForwarded} -gt 0 ]; then
justLocal=0
fi
# if TOR is activated then outside reach is possible (no notice)
if [ "${runBehindTor}" = "on" ]; then
justLocal=0
aks4IP2TOR=0
fi
# check if dynamic domain is set
@ -67,6 +72,50 @@ choose_IP_or_TOR()
fi
}
# fuction to if already activated or user wants to activate IP2TOR
# needs parameter: #1 "LND-REST-API" or "LND-GRPC-API"
ip2tor=""
checkIP2TOR()
{
echo "checkIP2TOR"
echo "$1"
exit
# check if IP2TOR service is already available
error=""
source <(/home/admin/config.scripts/blitz.subscriptions.ip2tor.py subscription-by-service $1)
if [ ${#error} -eq 0 ]; then
ip2tor=$1
fi
# if IP2TOR is not already available:
# and the checks from avove showed there is SSH forwarding / dynDNS
# then ask user if IP2TOR subscription is wanted
if [ ${#ip2tor} -eq 0 ] && [ ${aks4IP2TOR} -eq 1 ]; then
whiptail --title " Want to use a IP2TOR Bridge? " \
--yes-button "Go To Shop" \
--no-button "No Thanks" \
--yesno "It can be hard to configure your router or phone to connect to your RaspiBlitz at home.\n\nDo you like to subscribe to a IP2TOR bridge service that will make it easy to connect your mobile wallet?" 12 60
if [ $? -eq 0 ]; then
echo "# yes-button -> Send To Shop"
port="10009"
toraddress=$(sudo cat /mnt/hdd/tor/lndrpc10009/hostname)
if [ "$1" == "LND-REST-API" ]; then
port="8080"
toraddress=$(sudo cat /mnt/hdd/tor/lndrest8080/hostname)
fi
/home/admin/config.scripts/blitz.subscriptions.ip2tor.py create-ssh-dialog $1 ${toraddress} ${port}
fi
# check again if IP2TOR service is now already available
error=""
source <(/home/admin/config.scripts/blitz.subscriptions.ip2tor.py subscription-by-service $1)
if [ ${#error} -eq 0 ]; then
ip2tor=$1
fi
}
# Options
OPTIONS=(ZAP_IOS "Zap Wallet (iOS)" \
ZAP_ANDROID "Zap Wallet (Android)" \
@ -81,10 +130,8 @@ if [ "${runBehindTor}" = "on" ]; then
OPTIONS+=(FULLY_NODED "Fully Noded (IOS+TOR)")
fi
# Additinal Options with no TOR
#if [ "${runBehindTor}" != "on" ]; then
OPTIONS+=(SENDMANY_ANDROID "SendMany (Android)")
#fi
# add SEND MANY APP
OPTIONS+=(SENDMANY_ANDROID "SendMany (Android)")
CHOICE=$(whiptail --clear --title "Choose Mobile Wallet" --menu "" 14 50 8 "${OPTIONS[@]}" 2>&1 >/dev/tty)
@ -125,6 +172,7 @@ case $CHOICE in
exit 1;
;;
ZAP_IOS)
# choose IP or TOR --> function call
choose_IP_or_TOR
appstoreLink="https://apps.apple.com/us/app/zap-bitcoin-lightning-wallet/id1406311960"
/home/admin/config.scripts/blitz.lcd.sh qr ${appstoreLink}
@ -196,8 +244,11 @@ Please go to MAINMENU > SERVICES and activate KEYSEND first.
exit 1;
;;
ZEUS_ANDROID)
checkIP2TOR "LND-REST-API"
# choose IP or TOR --> function call
choose_IP_or_TOR
if [ ${#ip2tor} -eq 0 ]; then
choose_IP_or_TOR
fi
appstoreLink="https://play.google.com/store/apps/details?id=com.zeusln.zeus"
/home/admin/config.scripts/blitz.lcd.sh qr ${appstoreLink}
whiptail --title "Install Zeus on your Android Phone" \