2018-08-31 20:52:29 +02:00
#!/bin/bash
2018-12-21 01:22:30 +01:00
# get raspiblitz config
2019-02-02 23:49:04 +01:00
source /home/admin/raspiblitz.info
2018-12-21 01:22:30 +01:00
source /mnt/hdd/raspiblitz.conf
2019-04-03 13:07:25 +01:00
justLocal = 1
2020-05-27 02:36:27 +02:00
aks4IP2TOR = 0
# if TOR is activated then outside reach is possible (no notice)
if [ " ${ runBehindTor } " = "on" ] ; then
justLocal = 0
aks4IP2TOR = 1
fi
2019-04-03 13:07:25 +01:00
# if dynDomain is set connect from outside is possible (no notice)
if [ ${# dynDomain } -gt 0 ] ; then
justLocal = 0
2020-05-27 02:36:27 +02:00
aks4IP2TOR = 0
2019-04-03 13:07:25 +01:00
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
2020-05-27 02:36:27 +02:00
aks4IP2TOR = 0
2019-04-03 13:07:25 +01:00
fi
isForwarded = $( echo ${ sshtunnel } | grep -c "8080<" )
if [ ${ isForwarded } -gt 0 ] ; then
justLocal = 0
2020-05-27 02:36:27 +02:00
aks4IP2TOR = 0
2020-01-23 17:23:51 +01:00
fi
2018-12-21 01:22:30 +01:00
# check if dynamic domain is set
2019-04-03 13:07:25 +01:00
if [ ${ justLocal } -eq 1 ] ; then
2019-02-24 07:08:33 +01:00
whiptail --title " Just Local Network? " --yesno " If you want to connect with your RaspiBlitz
2018-12-21 01:22:30 +01:00
also from outside your local network you need to
2019-04-03 13:07:25 +01:00
activate 'Services' -> 'DynamicDNS' FIRST.
2020-01-23 17:23:51 +01:00
OR use SSH tunnel forwarding for port 10009
OR have TOR activated.
2018-12-21 01:22:30 +01:00
2018-12-21 01:32:43 +01:00
Do you JUST want to connect with your mobile
2018-12-21 01:22:30 +01:00
when your are on the same LOCAL NETWORK?
2019-04-03 13:07:25 +01:00
" 15 54
2018-12-21 01:22:30 +01:00
response = $?
case $response in
1) exit ; ;
esac
fi
2020-01-24 17:57:21 +01:00
if [ " ${ chain } " = = "test" ] ; then
whiptail --title " Testnet Notice " --msgbox " You are running your node in testnet.
Not all mobile Apps may support running in testnet.
For full support switch to mainnet.
" 9 55
fi
2020-01-27 16:59:26 +01:00
# fuction to call for wallets that support TOR
connect = "ip"
choose_IP_or_TOR( )
{
whiptail --title " How to Connect? " \
--yes-button "TOR" \
--no-button "IP/Domain" \
2020-01-27 17:19:51 +01:00
--yesno "The mobile wallet you selected supports TOR.\nDo you want to connect over TOR to your RaspiBlitz or fallback to Domain/IP?" 9 60
2020-01-27 16:59:26 +01:00
if [ $? -eq 0 ] ; then
echo "# yes-button -> TOR"
connect = "tor"
else
echo "# no-button -> IP"
connect = "ip"
fi
}
2020-05-27 02:36:27 +02:00
# fuction to if already activated or user wants to activate IP2TOR
# needs parameter: #1 "LND-REST-API" or "LND-GRPC-API"
ip2tor = ""
checkIP2TOR( )
{
# check if IP2TOR service is already available
2020-05-27 02:50:47 +02:00
error = ""
source <( /home/admin/config.scripts/blitz.subscriptions.ip2tor.py subscription-by-service $1 )
if [ ${# error } -eq 0 ] ; then
ip2tor = " $1 "
fi
2020-05-27 02:36:27 +02:00
# 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
2020-05-27 02:51:57 +02:00
if [ ${# ip2tor } -eq 0 ] && [ ${ aks4IP2TOR } -eq 1 ] ; then
2020-05-27 03:08:50 +02:00
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 give you a public IP while hidden behind TOR) and make it more easy to connect your mobile wallet?" 12 60
2020-05-27 02:51:57 +02:00
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
2020-05-31 17:47:12 +02:00
userHasActiveChannels = $( sudo -u bitcoin lncli listchannels | grep -c '"active": true' )
if [ ${ userHasActiveChannels } -gt 0 ] ; then
2020-06-22 20:55:17 +02:00
sudo -u admin /home/admin/config.scripts/blitz.subscriptions.ip2tor.py create-ssh-dialog " $1 " " $toraddress " " $port "
2020-05-31 17:47:12 +02:00
else
whiptail --title " Lightning not Ready " --msgbox "\nYou need at least one active Lightning channel.\n\nPlease make sure that your node is funded and\nyou have a confirmed and active channel running.\nThen try again to connect the mobile wallet." 13 52
exit 0
fi
2020-05-27 02:55:37 +02:00
clear
2020-05-27 02:51:57 +02:00
fi
fi
2020-05-27 02:36:27 +02:00
# check again if IP2TOR service is now already available
2020-05-27 02:50:47 +02:00
error = ""
source <( /home/admin/config.scripts/blitz.subscriptions.ip2tor.py subscription-by-service " $1 " )
if [ ${# error } -eq 0 ] ; then
ip2tor = " $1 "
fi
2020-05-27 02:36:27 +02:00
}
2020-01-27 16:59:26 +01:00
# Options
2019-08-13 00:48:13 +02:00
OPTIONS = ( ZAP_IOS "Zap Wallet (iOS)" \
ZAP_ANDROID "Zap Wallet (Android)" \
2019-04-04 03:25:13 +01:00
SHANGO_IOS "Shango Wallet (iOS)" \
SHANGO_ANDROID "Shango Wallet (Android)" \
ZEUS_IOS "Zeus Wallet (iOS)" \
ZEUS_ANDROID "Zeus Wallet (Android)"
2019-02-23 17:00:39 +01:00
)
2018-08-31 20:52:29 +02:00
2020-01-27 16:59:26 +01:00
# Additinal Options with TOR
2020-01-23 19:09:52 +01:00
if [ " ${ runBehindTor } " = "on" ] ; then
2020-01-27 23:55:12 +01:00
OPTIONS += ( FULLY_NODED "Fully Noded (IOS+TOR)" )
2020-01-23 19:09:52 +01:00
fi
2020-05-27 02:36:27 +02:00
# add SEND MANY APP
OPTIONS += ( SENDMANY_ANDROID "SendMany (Android)" )
2020-04-05 16:13:14 +02:00
2020-05-08 13:05:43 +02:00
CHOICE = $( whiptail --clear --title "Choose Mobile Wallet" --menu "" 14 50 8 " ${ OPTIONS [@] } " 2>& 1 >/dev/tty)
2019-02-24 07:08:33 +01:00
2020-01-24 17:31:59 +01:00
/home/admin/config.scripts/blitz.lcd.sh hide
2018-08-31 20:52:29 +02:00
clear
2019-08-13 00:53:14 +02:00
echo "creating install info ..."
2018-08-31 20:52:29 +02:00
case $CHOICE in
2019-04-04 02:44:42 +01:00
CLOSE)
exit 1;
; ;
2019-02-23 17:00:39 +01:00
SHANGO_IOS)
2020-01-24 17:57:21 +01:00
appstoreLink = "https://testflight.apple.com/join/WwCjFnS8"
/home/admin/config.scripts/blitz.lcd.sh qr ${ appstoreLink }
2019-04-04 02:44:42 +01:00
whiptail --title "Install Testflight and Shango on your iOS device" \
2020-01-24 17:57:21 +01:00
--yes-button "continue" \
--no-button "link as QR code" \
--yesno " At the moment this app is in public beta testing:\n\n ${ appstoreLink } \n\nJoin testing and follow ALL instructions.\n\nWhen installed and started -> continue " 10 60
2019-04-04 02:44:42 +01:00
if [ $? -eq 1 ] ; then
2020-01-24 17:57:21 +01:00
/home/admin/config.scripts/blitz.lcd.sh qr-console ${ appstoreLink }
2019-04-04 02:44:42 +01:00
fi
2020-01-24 17:31:59 +01:00
/home/admin/config.scripts/blitz.lcd.sh hide
2020-05-31 17:50:46 +02:00
checkIP2TOR LND-GRPC-API
2020-01-27 16:59:26 +01:00
/home/admin/config.scripts/bonus.lndconnect.sh shango-ios ${ connect }
2019-04-04 02:44:42 +01:00
exit 1;
; ;
2019-02-23 17:00:39 +01:00
SHANGO_ANDROID)
2020-01-24 17:57:21 +01:00
appstoreLink = "https://play.google.com/store/apps/details?id=com.shango"
/home/admin/config.scripts/blitz.lcd.sh qr ${ appstoreLink }
2019-04-04 02:44:42 +01:00
whiptail --title "Install Shango on your Android Phone" \
2020-01-24 17:31:59 +01:00
--yes-button "continue" \
--no-button "link as QR code" \
2020-01-24 17:57:21 +01:00
--yesno " At the moment this app is in public beta testing:\n\n ${ appstoreLink } \n\nEasiest way to install scan QR code on LCD with phone.\n\nWhen installed and started -> continue " 10 60
2019-04-04 02:44:42 +01:00
if [ $? -eq 1 ] ; then
2020-01-24 17:57:21 +01:00
/home/admin/config.scripts/blitz.lcd.sh qr-console ${ appstoreLink }
2019-04-04 02:44:42 +01:00
fi
2020-01-24 17:31:59 +01:00
/home/admin/config.scripts/blitz.lcd.sh hide
2020-05-31 17:50:46 +02:00
checkIP2TOR LND-GRPC-API
2020-01-27 16:59:26 +01:00
/home/admin/config.scripts/bonus.lndconnect.sh shango-android ${ connect }
2020-01-24 17:31:59 +01:00
exit 1;
; ;
2019-08-13 00:48:13 +02:00
ZAP_IOS)
2020-01-24 17:57:21 +01:00
appstoreLink = "https://apps.apple.com/us/app/zap-bitcoin-lightning-wallet/id1406311960"
2020-01-24 17:41:46 +01:00
/home/admin/config.scripts/blitz.lcd.sh qr ${ appstoreLink }
2019-04-04 03:25:13 +01:00
whiptail --title "Install Testflight and Zap on your iOS device" \
2020-01-24 17:31:59 +01:00
--yes-button "continue" \
--no-button "link as QR code" \
2020-01-24 17:41:46 +01:00
--yesno " Search for 'Zap Bitcoin' in Apple Appstore for basic version\nOr join public beta test for latest features:\n ${ appstoreLink } \n\nJoin testing and follow ALL instructions.\n\nWhen installed and started -> continue " 11 65
2019-04-04 03:25:13 +01:00
if [ $? -eq 1 ] ; then
2020-01-24 17:41:46 +01:00
/home/admin/config.scripts/blitz.lcd.sh qr-console ${ appstoreLink }
2019-04-04 03:25:13 +01:00
fi
2020-05-31 17:50:46 +02:00
/home/admin/config.scripts/blitz.lcd.sh hide
2020-05-27 03:08:50 +02:00
checkIP2TOR LND-GRPC-API
2020-07-16 18:26:51 +02:00
see https://github.com/rootzoll/raspiblitz/issues/1001#issuecomment-634580257
if [ ${# ip2tor } -eq 0 ] ; then
choose_IP_or_TOR
fi
2020-01-27 16:59:26 +01:00
/home/admin/config.scripts/bonus.lndconnect.sh zap-ios ${ connect }
2020-01-24 17:31:59 +01:00
exit 1;
2019-04-04 02:44:42 +01:00
; ;
2019-08-13 00:48:13 +02:00
ZAP_ANDROID)
2020-01-24 17:57:21 +01:00
appstoreLink = "https://play.google.com/store/apps/details?id=zapsolutions.zap"
/home/admin/config.scripts/blitz.lcd.sh qr ${ appstoreLink }
2019-08-13 00:48:13 +02:00
whiptail --title "Install Zap from PlayStore on your Android device" \
2020-01-24 17:31:59 +01:00
--yes-button "continue" \
--no-button "link as QR code" \
2020-05-28 15:22:12 +02:00
--yesno " Find & install the Zap Wallet on the Android Play Store:\n\n ${ appstoreLink } \n\nEasiest way to install scan QR code on LCD with phone.\n\nWhen installed and started -> continue. " 10 67
2019-08-13 00:48:13 +02:00
if [ $? -eq 1 ] ; then
2020-01-24 17:57:21 +01:00
/home/admin/config.scripts/blitz.lcd.sh qr-console ${ appstoreLink }
2019-08-13 00:48:13 +02:00
fi
2020-05-31 17:50:46 +02:00
/home/admin/config.scripts/blitz.lcd.sh hide
2020-05-27 03:08:50 +02:00
checkIP2TOR LND-GRPC-API
2020-07-04 16:49:47 +02:00
if [ ${# ip2tor } -eq 0 ] ; then
choose_IP_or_TOR
fi
2020-01-27 16:59:26 +01:00
/home/admin/config.scripts/bonus.lndconnect.sh zap-android ${ connect }
2020-01-24 17:31:59 +01:00
exit 1;
2019-08-13 00:48:13 +02:00
; ;
2020-04-05 16:13:14 +02:00
SENDMANY_ANDROID)
2020-04-05 16:25:41 +02:00
# check if keysend is activated first
source <( /home/admin/config.scripts/lnd.keysend.sh status)
if [ " ${ keysendOn } " = = "0" ] ; then
whiptail --title " KEYSEND NEEDED " --msgbox "
To use the chat feature of the SendMany app, you need to activate the Keysend feature first.
Please go to MAINMENU > SERVICES and activate KEYSEND first.
" 12 65
exit 1
fi
2020-04-05 16:13:14 +02:00
appstoreLink = "https://github.com/fusion44/sendmany/releases"
/home/admin/config.scripts/blitz.lcd.sh qr ${ appstoreLink }
2020-05-08 13:05:43 +02:00
whiptail --title "Install SendMany APK from GithubReleases (open assets) on your device" \
2020-04-05 16:13:14 +02:00
--yes-button "continue" \
--no-button "link as QR code" \
2020-05-08 13:05:43 +02:00
--yesno " Download & install the SendMany APK (armeabi-v7) from GitHub:\n\n ${ appstoreLink } \n\nEasiest way to scan QR code on LCD and download/install.\n\nWhen installed and started -> continue. " 13 65
2020-04-05 16:13:14 +02:00
if [ $? -eq 1 ] ; then
/home/admin/config.scripts/blitz.lcd.sh qr-console ${ appstoreLink }
fi
/home/admin/config.scripts/blitz.lcd.sh hide
2020-05-31 17:50:46 +02:00
checkIP2TOR LND-GRPC-API
2020-04-05 16:13:14 +02:00
/home/admin/config.scripts/bonus.lndconnect.sh sendmany-android ${ connect }
exit 1;
; ;
2019-04-04 03:25:13 +01:00
ZEUS_IOS)
2020-01-24 17:57:21 +01:00
appstoreLink = "https://testflight.apple.com/join/gpVFzEHN"
/home/admin/config.scripts/blitz.lcd.sh qr ${ appstoreLink }
2019-04-04 03:25:13 +01:00
whiptail --title "Install Testflight and Zeus on your iOS device" \
2020-01-24 17:31:59 +01:00
--yes-button "continue" \
--no-button "link as QR code" \
2020-01-24 17:57:21 +01:00
--yesno " At the moment this app is in public beta testing:\n\n ${ appstoreLink } \n\nJoin testing and follow ALL instructions.\n\nWhen installed and started -> continue " 10 60
2019-04-04 03:25:13 +01:00
if [ $? -eq 1 ] ; then
2020-01-24 17:57:21 +01:00
/home/admin/config.scripts/blitz.lcd.sh qr-console ${ appstoreLink }
2019-04-04 03:25:13 +01:00
fi
2020-01-24 17:31:59 +01:00
/home/admin/config.scripts/blitz.lcd.sh hide
2020-05-31 17:50:46 +02:00
checkIP2TOR LND-REST-API
2020-01-27 16:59:26 +01:00
/home/admin/config.scripts/bonus.lndconnect.sh zeus-ios ${ connect }
2020-01-24 17:31:59 +01:00
exit 1;
2019-04-04 03:25:13 +01:00
; ;
ZEUS_ANDROID)
2020-01-24 17:57:21 +01:00
appstoreLink = "https://play.google.com/store/apps/details?id=com.zeusln.zeus"
/home/admin/config.scripts/blitz.lcd.sh qr ${ appstoreLink }
2020-01-27 23:55:12 +01:00
whiptail --title "Install Zeus on your Android Phone" \
2020-01-24 17:31:59 +01:00
--yes-button "continue" \
--no-button "link as QR code" \
2020-01-27 23:55:12 +01:00
--yesno " Find and install the Zeus Wallet on the Android Play Store:\n\n ${ appstoreLink } \n\nEasiest way to install scan QR code on LCD with phone.\n\nWhen installed and started -> continue. " 10 65
2019-04-04 03:25:13 +01:00
if [ $? -eq 1 ] ; then
2020-01-24 17:57:21 +01:00
/home/admin/config.scripts/blitz.lcd.sh qr-console ${ appstoreLink }
2019-04-04 03:25:13 +01:00
fi
2020-05-31 17:50:46 +02:00
/home/admin/config.scripts/blitz.lcd.sh hide
2020-05-27 03:08:50 +02:00
checkIP2TOR LND-REST-API
if [ ${# ip2tor } -eq 0 ] ; then
choose_IP_or_TOR
fi
2020-01-27 16:59:26 +01:00
/home/admin/config.scripts/bonus.lndconnect.sh zeus-android ${ connect }
2020-01-24 17:31:59 +01:00
exit 1;
2019-04-04 02:44:42 +01:00
; ;
2020-01-25 01:15:38 +01:00
FULLY_NODED)
2020-07-19 01:01:09 +02:00
appstoreLink = "https://apps.apple.com/us/app/fully-noded/id1436425586"
2020-01-25 01:15:38 +01:00
/home/admin/config.scripts/blitz.lcd.sh qr ${ appstoreLink }
whiptail --title "Install Fully Noded on your iOS device" \
--yes-button "continue" \
--no-button "link as QR code" \
2020-07-19 01:01:09 +02:00
--yesno " Download the app from the AppStore:\n\n ${ appstoreLink } \n\nWhen installed and started -> continue " 8 60
2020-01-25 01:15:38 +01:00
if [ $? -eq 1 ] ; then
/home/admin/config.scripts/blitz.lcd.sh qr-console ${ appstoreLink }
fi
/home/admin/config.scripts/blitz.lcd.sh hide
/home/admin/config.scripts/bonus.fullynoded.sh
exit 1;
; ;
2020-01-24 17:31:59 +01:00
esac