diff --git a/home.admin/97addMobileWallet.sh b/home.admin/97addMobileWallet.sh index 9063f26..cf91fed 100755 --- a/home.admin/97addMobileWallet.sh +++ b/home.admin/97addMobileWallet.sh @@ -6,7 +6,7 @@ source /mnt/hdd/raspiblitz.conf # check if dynamic domain is set if [ ${#dynDomain} -eq 0 ]; then - dialog --title " Just Local Network? " --yesno "If you want to connect with your RaspiBlitz + whiptail --title " Just Local Network? " --yesno "If you want to connect with your RaspiBlitz also from outside your local network you need to activate 'Services' -> 'DynamicDNS' FIRST. @@ -29,7 +29,9 @@ OPTIONS=(ZAP "Zap Wallet (iOS)" \ SHANGO_ANDROID "Shango Wallet for Android" ) -CHOICE=$(dialog --clear --title "Choose Mobile Wallet" --menu "" 10 50 6 "${OPTIONS[@]}" 2>&1 >/dev/tty) +CHOICE=$(whiptail --clear --title "Choose Mobile Wallet" --menu "" 15 50 6 "${OPTIONS[@]}" 2>&1 >/dev/tty) + +./XXdisplayQRlcd_hide.sh clear case $CHOICE in @@ -37,27 +39,41 @@ case $CHOICE in exit 1; ;; SHANGO_IOS) - echo "************************************" - echo "Install Testflight and Shango-Wallet" - echo "************************************" - echo "At the moment this app is in public beta testing:" - echo - echo "https://testflight.apple.com/join/WwCjFnS8" echo "https://testflight.apple.com/join/WwCjFnS8" > qr.txt - echo - ./XXdisplayQR.sh + ./XXdisplayLCD.sh /home/admin/assets/install_shango.jpg + + whiptail --title "Install Testflight and Shango on your iOS device" \ + --yes-button "show link as QR" \ + --no-button "continue" \ + --yesno "At the moment this app is in public beta testing:\n\nhttps://testflight.apple.com/join/WwCjFnS8" 20 60 + + if [ $? -eq 0 ]; then + /home/admin/XXdisplayQR.sh + fi + + shred qr.txt + rm -f qr.txt + /home/admin/XXdisplayQRlcd_hide.sh + ./97addMobileWalletShango.sh exit 1; ;; SHANGO_ANDROID) - echo "*******************************************" - echo "Install Shango-Wallet on your Android Phone" - echo "*******************************************" - echo - echo "At the moment this app is in public beta testing:" - echo "https://play.google.com/apps/testing/com.shango" >qr.txt - echo "https://play.google.com/apps/testing/com.shango" - ./XXdisplayQR.sh + echo "https://play.google.com/apps/testing/com.shango" > qr.txt + ./XXdisplayQRlcd.sh + whiptail --title "Install Shango on your Android Phone" \ + --yes-button "show link as QR" \ + --no-button "continue" \ + --yesno "At the moment this app is in public beta testing:\n\nhttps://play.google.com/apps/testing/com.shango \n\nDo you want to see a QR code with an Playstore link?" 20 60 + + if [ $? -eq 0 ]; then + /home/admin/XXdisplayQR.sh + fi + + shred qr.txt + rm -f qr.txt + /home/admin/XXdisplayQRlcd_hide.sh + ./97addMobileWalletShango.sh exit 1; ;; diff --git a/home.admin/97addMobileWalletShango.sh b/home.admin/97addMobileWalletShango.sh index 7ac5453..743113e 100755 --- a/home.admin/97addMobileWalletShango.sh +++ b/home.admin/97addMobileWalletShango.sh @@ -14,33 +14,33 @@ if [ ${#dynDomain} -gt 0 ]; then myip="${dynDomain}" fi -clear -echo "******************************" -echo "Connect Shango Mobile Wallet" -echo "******************************" -echo "" -echo "*** STEP 1 ***" +#echo -e "${myip}:10009,\n$(xxd -p -c2000 ./.lnd/data/chain/${network}/${chain}net/admin.macaroon)," > qr.txt && cat ./.lnd/tls.cert >>qr.txt +echo -e "${myip}:10009,\n$(xxd -p -c2000 ./.lnd/data/chain/${network}/${chain}net/admin.macaroon)," > qr.txt + +./XXdisplayQRlcd.sh + +msg="" if [ ${#dynDomain} -eq 0 ]; then - echo "Once you have the app is running make sure you are on the same local network (WLAN same as LAN)." + msg="Once you have the app is running make sure you are on the same local network (WLAN same as LAN)." fi -echo "On Setup Step 'Choose LND Server Type' connect to 'DIY SELF HOSTED'" -echo "(Or in the App go to --> 'Settings' > 'Connect to your LND Server')" -echo "There you see three 3 form fields to fill out. Skip those and go right to the buttons below." -echo "" -echo "Click on the 'Scan QR' button and PRESS ENTER" +msg="${msg}On Setup Step 'Choose LND Server Type' connect to 'DIY SELF HOSTED' \n\n (Or in the App go to --> 'Settings' > 'Connect to your LND Server') \n\nThere you see three 3 form fields to fill out. Skip those and go right to the buttons below.\n\nClick on the 'Scan QR' button. Scan the QR on the LCD and or to see it in this window." -read key -clear -echo "*** STEP 2 : SCAN MACAROON (make whole QR code fill camera) ***" +whiptail --backtitle "Connecting Shango Mobile Wallet" \ + --title "Setup Shango Step 1" \ + --yes-button "show QR" \ + --no-button "continue" \ + --yesno "${msg}" 20 65 -echo -e "${myip}:10009,\n$(xxd -p -c2000 ./.lnd/data/chain/${network}/${chain}net/admin.macaroon)," > qr.txt && cat ./.lnd/tls.cert >>qr.txt +if [ $? -eq 0 ]; then + /home/admin/XXdisplayQR.sh +fi +shred qr.txt +rm -f qr.txt -./XXdisplayQR.sh +whiptail --backtitle "Connecting Shango Mobile Wallet" \ + --title "Press Connect on Shango" \ + --msgbox "Now press 'Connect' within the Shango Wallet.\n\nIf its not working - check issues on GitHub:\n\nhttps://github.com/neogeno/shango-lightning-wallet/issues" 15 65 -clear -echo -echo "Now press 'Connect' within the Shango Wallet." -echo "If its not working - check issues on GitHub:" -echo -echo "https://github.com/neogeno/shango-lightning-wallet/issues" -echo "" +./XXdisplayQRlcd_hide.sh +shred qr.png 2> /dev/null +rm -f qr.png diff --git a/home.admin/BBcreateInvoice.sh b/home.admin/BBcreateInvoice.sh index 7d20010..abbd5ab 100755 --- a/home.admin/BBcreateInvoice.sh +++ b/home.admin/BBcreateInvoice.sh @@ -25,6 +25,7 @@ if [ ${chainInSync} -eq 0 ]; then echo "!!!!!!!!!!!!!!!!!!!" echo "" exit 1 + # TODO: Wait and loop. Offer the user a "abort wait" button fi # check number of connected peers @@ -51,6 +52,8 @@ if [ ${#amount} -eq 0 ]; then exit 1 fi +# TODO let user enter a description + # build command command="lncli --chain=${network} --network=${chain}net addinvoice ${amount}" @@ -83,18 +86,44 @@ else # echo "WIN" # echo "******************************" # echo "${result}" - echo "" + + rhash=$(echo "$result" | grep r_hash | cut -d '"' -f4) payReq=$(echo "$result" | grep pay_req | cut -d '"' -f4) + echo -e "${payReq}" > qr.txt + ./XXdisplayQRlcd.sh + + echo + echo "********************" + echo "Here is your invoice" + echo "********************" + echo echo "Give this Invoice/PaymentRequest to someone to pay it:" - echo "" - echo ${payReq} - echo "" - echo "You can use 'lncli --chain=${network} --network=${chain}net lookupinvoice ${rhash}' to check the payment. " + echo + echo "${payReq}" + echo + echo "Do you want to see the invoice QR-code in this terminal? (Y/N)" - # TODO: Offer to go into monitor for incommin payment loop. + read -n1 key + if [ "$key" = "y" ]; then + /home/admin/XXdisplayQR.sh + fi + + shred qr.txt + rm -f qr.txt + clear + echo "************" + echo "What's next?" + echo "************" + echo + echo "You can use" + echo + echo "lncli --chain=${network} --network=${chain}net lookupinvoice ${rhash}" + echo + echo "to check the payment." + + /home/admin/XXdisplayQRlcd_hide.sh + # TODO: Offer to go into monitor for incommin payment loop. + # Or simply start the loop and show success status when payment occured fi -echo "" -echo -e "${payReq}" > qr.txt -./XXdisplayQR.sh diff --git a/home.admin/BBfundWallet.sh b/home.admin/BBfundWallet.sh index 6e24223..edb6461 100755 --- a/home.admin/BBfundWallet.sh +++ b/home.admin/BBfundWallet.sh @@ -56,19 +56,29 @@ if [ "$chain" = "test" ]; then coininfo="TESTNET Bitcoin" fi -# output info -echo "" -echo "******************************" -echo "TODO" -echo "******************************" -echo "Send ${coininfo} to address --> ${address}" +msg="Send ${coininfo} to address --> ${address}\n\nScan the QR code on the LCD with your mobile wallet or copy paste the address." if [ "$chain" = "test" ]; then - echo "get some testnet coins from https://testnet-faucet.mempool.co" + msg="${msg} \n\n Get some testnet coins from https://testnet-faucet.mempool.co" fi echo -e "$network:${address}" > qr.txt -/home/admin/XXdisplayQR.sh +/home/admin/XXdisplayQRlcd.sh -echo "Whats next? --> Wait for confirmations. You can use info on LCD to check if funds have arrived." -echo "If you want your lighting node to open channels automatically, activate the 'Autopilot' under 'Activate/Deactivate Services'" -echo "" +whiptail --backtitle "Fund your on chain wallet" \ + --title "Send ${coininfo}" \ + --yes-button "show QR" \ + --no-button "continue" \ + --yesno "${msg} \n\n Do you want to see the QR-code for ${coininfo}:${address} in this window?" 0 0 + +if [ $? -eq 0 ]; then + /home/admin/XXdisplayQR.sh +fi + +shred qr.txt +rm -f qr.txt + +whiptail --backtitle "Fund your on chain wallet" \ + --title "What's next?" \ + --msgbox "Wait for confirmations. \n\nYou can use info on LCD to check if funds have arrived. \n\nIf you want your lighting node to open channels automatically, activate the 'Autopilot' under 'Activate/Deactivate Services'" 0 0 + +/home/admin/XXdisplayQRlcd_hide.sh diff --git a/home.admin/XXaptInstall.sh b/home.admin/XXaptInstall.sh new file mode 100755 index 0000000..2adc88d --- /dev/null +++ b/home.admin/XXaptInstall.sh @@ -0,0 +1,4 @@ +# Installs package if not yet installed +if [ $(sudo dpkg-query -l | grep "ii $1" | wc -l) = 0 ]; then + sudo apt-get install $1 -y > /dev/null +fi diff --git a/home.admin/XXdisplayLCD.sh b/home.admin/XXdisplayLCD.sh new file mode 100755 index 0000000..868c07a --- /dev/null +++ b/home.admin/XXdisplayLCD.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Display an image on the LCD + +# make sure fbi is installed +./XXaptInstall.sh fbi + +sudo fbi -a -T 1 -d /dev/fb1 --noverbose $1 2> /dev/null diff --git a/home.admin/XXdisplayQR.sh b/home.admin/XXdisplayQR.sh index 09de15c..f7d6cb0 100755 --- a/home.admin/XXdisplayQR.sh +++ b/home.admin/XXdisplayQR.sh @@ -2,24 +2,17 @@ # Display a QR code for the string in qr.txt -echo -echo "Please wait. Generating QR-code..." -echo # make sure qrcode-encode and fbi are installed -sudo apt-get install qrencode fbi -y > /dev/null +#clear +#echo "*** Setup ***" -qrencode -l L -o /home/admin/qr.png < /home/admin/qr.txt > /dev/null -sudo fbi -a -T 1 -d /dev/fb1 --noverbose /home/admin/qr.png 2> /dev/null +echo 50 | whiptail --title "Installing" --backtitle "QR-Code" --gauge "please wait" 4 40 100 +./XXaptInstall.sh qrencode +echo 90 | whiptail --title "Installing" --backtitle "QR-Code" --gauge "please wait" 4 40 100 +./XXaptInstall.sh fbi -echo "************************************" -echo "Scan the QR-Code on the LCD-Display." -echo "************************************" -echo -echo "If you don't have access to the LCD, you can view it here." -echo "Make the this terminal window as big as possible - fullscreen would be best." -echo "Then PRESS ENTER here in the terminal to show QR code." - -read key +whiptail --title "Get ready" --backtitle "QR-Code in Terminal Window" \ + --msgbox "Make this terminal window as large as possible - fullscreen would be best. \n\nThe QR-Code might be too large for your display. In that case, shrink the letters by pressing the keys Ctrl and Minus (or Cmd and Minus if you are on a Mac) \n\nPRESS ENTER when you are ready to see the QR-code." 20 60 clear qrencode -t ANSI256 < /home/admin/qr.txt @@ -29,8 +22,3 @@ echo "(To shrink QR code: macOS press CMD- / LINUX press CTRL-) Press ENTER when read key clear - -# remove the QR picture on the raspi LCD -sudo killall -3 fbi -shred /home/admin/qr.png -rm -f /home/admin/qr.png diff --git a/home.admin/XXdisplayQRlcd.sh b/home.admin/XXdisplayQRlcd.sh new file mode 100755 index 0000000..1aa7ad2 --- /dev/null +++ b/home.admin/XXdisplayQRlcd.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Display a QR code for the string in qr.txt + +# make sure qrcode-encode and fbi are installed +./XXaptInstall.sh qrencode +./XXaptInstall.sh fbi + +qrencode -l L -o /home/admin/qr.png < /home/admin/qr.txt > /dev/null +sudo fbi -a -T 1 -d /dev/fb1 --noverbose /home/admin/qr.png 2> /dev/null diff --git a/home.admin/XXdisplayQRlcd_hide.sh b/home.admin/XXdisplayQRlcd_hide.sh new file mode 100755 index 0000000..98a6782 --- /dev/null +++ b/home.admin/XXdisplayQRlcd_hide.sh @@ -0,0 +1,4 @@ +#!/bin/bash +sudo killall -3 fbi +shred /home/admin/qr.png 2> /dev/null +rm -f /home/admin/qr.png 2> /dev/null diff --git a/home.admin/assets/install_shango.jpg b/home.admin/assets/install_shango.jpg new file mode 100644 index 0000000..c83e8e8 Binary files /dev/null and b/home.admin/assets/install_shango.jpg differ