Browse Source

Display Shango logo and QR-link on LCD during setup and made QR-display a little smoother

dev
Raumi 6 years ago
parent
commit
43fce1f609
  1. 50
      home.admin/97addMobileWallet.sh
  2. 48
      home.admin/97addMobileWalletShango.sh
  3. 47
      home.admin/BBcreateInvoice.sh
  4. 30
      home.admin/BBfundWallet.sh
  5. 4
      home.admin/XXaptInstall.sh
  6. 8
      home.admin/XXdisplayLCD.sh
  7. 28
      home.admin/XXdisplayQR.sh
  8. 10
      home.admin/XXdisplayQRlcd.sh
  9. 4
      home.admin/XXdisplayQRlcd_hide.sh
  10. BIN
      home.admin/assets/install_shango.jpg

50
home.admin/97addMobileWallet.sh

@ -6,7 +6,7 @@ source /mnt/hdd/raspiblitz.conf
# check if dynamic domain is set # check if dynamic domain is set
if [ ${#dynDomain} -eq 0 ]; then 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 also from outside your local network you need to
activate 'Services' -> 'DynamicDNS' FIRST. activate 'Services' -> 'DynamicDNS' FIRST.
@ -29,7 +29,9 @@ OPTIONS=(ZAP "Zap Wallet (iOS)" \
SHANGO_ANDROID "Shango Wallet for Android" 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 clear
case $CHOICE in case $CHOICE in
@ -37,27 +39,41 @@ case $CHOICE in
exit 1; exit 1;
;; ;;
SHANGO_IOS) 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 "https://testflight.apple.com/join/WwCjFnS8" > qr.txt
echo ./XXdisplayLCD.sh /home/admin/assets/install_shango.jpg
./XXdisplayQR.sh
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 ./97addMobileWalletShango.sh
exit 1; exit 1;
;; ;;
SHANGO_ANDROID) 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" > qr.txt
echo "https://play.google.com/apps/testing/com.shango" ./XXdisplayQRlcd.sh
./XXdisplayQR.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 ./97addMobileWalletShango.sh
exit 1; exit 1;
;; ;;

48
home.admin/97addMobileWalletShango.sh

@ -14,33 +14,33 @@ if [ ${#dynDomain} -gt 0 ]; then
myip="${dynDomain}" myip="${dynDomain}"
fi fi
clear #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 "******************************" echo -e "${myip}:10009,\n$(xxd -p -c2000 ./.lnd/data/chain/${network}/${chain}net/admin.macaroon)," > qr.txt
echo "Connect Shango Mobile Wallet"
echo "******************************" ./XXdisplayQRlcd.sh
echo ""
echo "*** STEP 1 ***" msg=""
if [ ${#dynDomain} -eq 0 ]; then 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 fi
echo "On Setup Step 'Choose LND Server Type' connect to 'DIY SELF HOSTED'" 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 <continue> or <show QR> to see it in this window."
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"
read key whiptail --backtitle "Connecting Shango Mobile Wallet" \
clear --title "Setup Shango Step 1" \
echo "*** STEP 2 : SCAN MACAROON (make whole QR code fill camera) ***" --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 ./XXdisplayQRlcd_hide.sh
echo shred qr.png 2> /dev/null
echo "Now press 'Connect' within the Shango Wallet." rm -f qr.png
echo "If its not working - check issues on GitHub:"
echo
echo "https://github.com/neogeno/shango-lightning-wallet/issues"
echo ""

47
home.admin/BBcreateInvoice.sh

@ -25,6 +25,7 @@ if [ ${chainInSync} -eq 0 ]; then
echo "!!!!!!!!!!!!!!!!!!!" echo "!!!!!!!!!!!!!!!!!!!"
echo "" echo ""
exit 1 exit 1
# TODO: Wait and loop. Offer the user a "abort wait" button
fi fi
# check number of connected peers # check number of connected peers
@ -51,6 +52,8 @@ if [ ${#amount} -eq 0 ]; then
exit 1 exit 1
fi fi
# TODO let user enter a description
# build command # build command
command="lncli --chain=${network} --network=${chain}net addinvoice ${amount}" command="lncli --chain=${network} --network=${chain}net addinvoice ${amount}"
@ -83,18 +86,44 @@ else
# echo "WIN" # echo "WIN"
# echo "******************************" # echo "******************************"
# echo "${result}" # echo "${result}"
echo ""
rhash=$(echo "$result" | grep r_hash | cut -d '"' -f4) rhash=$(echo "$result" | grep r_hash | cut -d '"' -f4)
payReq=$(echo "$result" | grep pay_req | 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 "Give this Invoice/PaymentRequest to someone to pay it:"
echo "" echo
echo ${payReq} echo "${payReq}"
echo "" echo
echo "You can use 'lncli --chain=${network} --network=${chain}net lookupinvoice ${rhash}' to check the payment. " 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 fi
echo ""
echo -e "${payReq}" > qr.txt
./XXdisplayQR.sh

30
home.admin/BBfundWallet.sh

@ -56,19 +56,29 @@ if [ "$chain" = "test" ]; then
coininfo="TESTNET Bitcoin" coininfo="TESTNET Bitcoin"
fi fi
# output info msg="Send ${coininfo} to address --> ${address}\n\nScan the QR code on the LCD with your mobile wallet or copy paste the address."
echo ""
echo "******************************"
echo "TODO"
echo "******************************"
echo "Send ${coininfo} to address --> ${address}"
if [ "$chain" = "test" ]; then 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 fi
echo -e "$network:${address}" > qr.txt echo -e "$network:${address}" > qr.txt
/home/admin/XXdisplayQRlcd.sh
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 /home/admin/XXdisplayQR.sh
fi
echo "Whats next? --> Wait for confirmations. You can use info on LCD to check if funds have arrived." shred qr.txt
echo "If you want your lighting node to open channels automatically, activate the 'Autopilot' under 'Activate/Deactivate Services'" rm -f qr.txt
echo ""
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

4
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

8
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

28
home.admin/XXdisplayQR.sh

@ -2,24 +2,17 @@
# Display a QR code for the string in qr.txt # 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 # 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 echo 50 | whiptail --title "Installing" --backtitle "QR-Code" --gauge "please wait" 4 40 100
sudo fbi -a -T 1 -d /dev/fb1 --noverbose /home/admin/qr.png 2> /dev/null ./XXaptInstall.sh qrencode
echo 90 | whiptail --title "Installing" --backtitle "QR-Code" --gauge "please wait" 4 40 100
./XXaptInstall.sh fbi
echo "************************************" whiptail --title "Get ready" --backtitle "QR-Code in Terminal Window" \
echo "Scan the QR-Code on the LCD-Display." --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
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
clear clear
qrencode -t ANSI256 < /home/admin/qr.txt 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 read key
clear clear
# remove the QR picture on the raspi LCD
sudo killall -3 fbi
shred /home/admin/qr.png
rm -f /home/admin/qr.png

10
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

4
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

BIN
home.admin/assets/install_shango.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Loading…
Cancel
Save