From c5669a94645370b5e195a866adec09e67cffb15f Mon Sep 17 00:00:00 2001 From: Raumi <@raumi75> Date: Sat, 23 Feb 2019 16:38:06 +0100 Subject: [PATCH] Added QR display on LCD-screen for fundWallet, createInvoice and addMobileWalletShango --- home.admin/97addMobileWalletShango.sh | 21 +++++++-------- home.admin/BBcreateInvoice.sh | 12 +++++---- home.admin/BBfundWallet.sh | 15 +++-------- home.admin/XXdisplayQR.sh | 37 ++++++++++++++++++--------- 4 files changed, 45 insertions(+), 40 deletions(-) mode change 100644 => 100755 home.admin/97addMobileWalletShango.sh diff --git a/home.admin/97addMobileWalletShango.sh b/home.admin/97addMobileWalletShango.sh old mode 100644 new mode 100755 index 3070efb..43a339a --- a/home.admin/97addMobileWalletShango.sh +++ b/home.admin/97addMobileWalletShango.sh @@ -4,10 +4,7 @@ source /home/admin/raspiblitz.info source /mnt/hdd/raspiblitz.conf -# make sure qrcode-encoder in installed clear -echo "*** Setup ***" -sudo apt-get install qrencode -y # get local IP myip=$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p') @@ -35,20 +32,20 @@ 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" -echo "Make the this terminal as big as possible - fullscreen would be best." -echo "Then PRESS ENTER here in the terminal to generare the QR code and scan it with the app." -read key +echo "Click on the 'Scan QR' button and PRESS ENTER" +read key clear echo "*** STEP 2 : SCAN MACAROON (make whole QR code fill camera) ***" -echo -e "${myip}:10009,\n$(xxd -p -c2000 ./.lnd/data/chain/${network}/${chain}net/admin.macaroon)," > qr.txt && cat ./.lnd/tls.cert >>qr.txt && qrencode -t ANSI256 < qr.txt -echo "(To shrink QR code: OSX->CMD- / LINUX-> CTRL-) Press ENTER when finished." -read key -shred qr.txt + +echo -e "${myip}:10009,\n$(xxd -p -c2000 ./.lnd/data/chain/${network}/${chain}net/admin.macaroon)," > qr.txt && cat ./.lnd/tls.cert >>qr.txt + +./XXdisplayQR.sh 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 "" \ No newline at end of file +echo "" diff --git a/home.admin/BBcreateInvoice.sh b/home.admin/BBcreateInvoice.sh index 1f8fef8..7d20010 100755 --- a/home.admin/BBcreateInvoice.sh +++ b/home.admin/BBcreateInvoice.sh @@ -79,10 +79,10 @@ if [ ${#error} -gt 0 ]; then echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo "${error}" else - echo "******************************" - echo "WIN" - echo "******************************" - echo "${result}" +# echo "******************************" +# echo "WIN" +# echo "******************************" +# echo "${result}" echo "" rhash=$(echo "$result" | grep r_hash | cut -d '"' -f4) payReq=$(echo "$result" | grep pay_req | cut -d '"' -f4) @@ -95,4 +95,6 @@ else # TODO: Offer to go into monitor for incommin payment loop. fi -echo "" \ No newline at end of file +echo "" +echo -e "${payReq}" > qr.txt +./XXdisplayQR.sh diff --git a/home.admin/BBfundWallet.sh b/home.admin/BBfundWallet.sh index 6d1413c..6e24223 100755 --- a/home.admin/BBfundWallet.sh +++ b/home.admin/BBfundWallet.sh @@ -65,17 +65,10 @@ echo "Send ${coininfo} to address --> ${address}" if [ "$chain" = "test" ]; then echo "get some testnet coins from https://testnet-faucet.mempool.co" fi + +echo -e "$network:${address}" > qr.txt +/home/admin/XXdisplayQR.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 "" - -echo "" -echo "******************************" -echo "QR-Code? (Y/N)" -echo "******************************" -echo "Would you like to see a QR-code of this address? Press Y" -read -n1 key - -if [ "$key" = "y" ]; then - /home/admin/XXdisplayQR.sh $network:${address} -fi diff --git a/home.admin/XXdisplayQR.sh b/home.admin/XXdisplayQR.sh index 1d03012..09de15c 100755 --- a/home.admin/XXdisplayQR.sh +++ b/home.admin/XXdisplayQR.sh @@ -1,23 +1,36 @@ #!/bin/bash -# Display a QR code provided as parameter $1 +# Display a QR code for the string in qr.txt -qrcode=$1 +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 -# make sure qrcode-encoder in installed -clear -echo "*** Setup ***" -sudo apt-get install qrencode -y +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 "************************************" +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." -clear -echo "Make the this terminal as big as possible - fullscreen would be best." -echo "Then PRESS ENTER here in the terminal to generare the QR code and scan it with the app." read key clear -echo -e "$1" | qrencode -t ANSI256 -echo -e "$1" -echo "(To shrink QR code: OSX->CMD- / LINUX-> CTRL-) Press ENTER when finished." +qrencode -t ANSI256 < /home/admin/qr.txt +shred /home/admin/qr.txt +rm -f /home/admin/qr.txt +echo "(To shrink QR code: macOS press CMD- / LINUX press CTRL-) Press ENTER when finished." 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