Show onion email address as QR code on user control panel

This commit is contained in:
Bob Mottram 2018-04-07 11:35:48 +01:00
parent 43133492dd
commit 60b4b077d8
1 changed files with 37 additions and 15 deletions

View File

@ -856,28 +856,50 @@ function show_your_email_address {
if [ -f "$HOME/.email_onion_domain" ]; then if [ -f "$HOME/.email_onion_domain" ]; then
onion_domain=$(cat "$HOME/.email_onion_domain") onion_domain=$(cat "$HOME/.email_onion_domain")
fi fi
dialog_height=14
if [[ "$HOSTNAME" != *'.onion' && "$onion_domain" ]]; then if [[ "$HOSTNAME" != *'.onion' && "$onion_domain" ]]; then
msgstr=$"Email Address: $MY_EMAIL_ADDRESS\\n\\nOnion Email: ${USER}@${onion_domain}\\n\\nKey ID: $GPG_ID\\n\\nFingerprint: $GPG_FINGERPRINT\\n\\nCreated: $GPG_DATE" if [ ! -f ~/.mutt/bdsmail ]; then
msgstr=$"\\nYou can press SHIFT and then drag the mouse and right click to copy.\\n\\nEmail Address: $MY_EMAIL_ADDRESS\\n\\nOnion Email: ${USER}@${onion_domain}\\n\\nKey ID: $GPG_ID\\n\\nFingerprint: $GPG_FINGERPRINT\\n\\nCreated: $GPG_DATE"
dialog_height=17
else
bdsmail_address=$(grep 'set from=' ~/.mutt/bdsmail | awk -F '=' '{print $2}')
msgstr=$"\\nYou can press SHIFT and then drag the mouse and right click to copy.\\n\\nEmail Address: $MY_EMAIL_ADDRESS\\n\\nOnion Email: ${USER}@${onion_domain}\\n\\nKey ID: $GPG_ID\\n\\nFingerprint: $GPG_FINGERPRINT\\n\\nCreated: $GPG_DATE\\n\\nI2P Address: ${bdsmail_address}"
dialog_height=20
fi
else else
msgstr=$"Email Address: $MY_EMAIL_ADDRESS\\n\\nKey ID: $GPG_ID\\n\\nFingerprint: $GPG_FINGERPRINT\\n\\nCreated: $GPG_DATE" if [ ! -f ~/.mutt/bdsmail ]; then
msgstr=$"\\nYou can press SHIFT and then drag the mouse and right click to copy.\\n\\nEmail Address: $MY_EMAIL_ADDRESS\\n\\nKey ID: $GPG_ID\\n\\nFingerprint: $GPG_FINGERPRINT\\n\\nCreated: $GPG_DATE"
dialog_height=14
else
bdsmail_address=$(grep 'set from=' ~/.mutt/bdsmail | awk -F '=' '{print $2}')
msgstr=$"\\nYou can press SHIFT and then drag the mouse and right click to copy.\\n\\nEmail Address: $MY_EMAIL_ADDRESS\\n\\nKey ID: $GPG_ID\\n\\nFingerprint: $GPG_FINGERPRINT\\n\\nCreated: $GPG_DATE\\n\\nI2P Address: ${bdsmail_address}"
dialog_height=17
fi
fi fi
if [ ! -f ~/.mutt/bdsmail ]; then
dialog --title $"Show your Email Address" \ dialog --title $"Show your Email Address" \
--backtitle $"Freedombone User Control Panel" \ --backtitle $"Freedombone User Control Panel" \
--msgbox "$msgstr" 14 100 --msgbox "$msgstr" $dialog_height 100
else
bdsmail_address=$(grep 'set from=' ~/.mutt/bdsmail | awk -F '=' '{print $2}') clear
dialog --title $"Show your Email Address" \ qr_code_shown=
--backtitle $"Freedombone User Control Panel" \ if [ "$onion_domain" ]; then
--msgbox $"\\nYou can press SHIFT and then drag the mouse and right click to copy.\\n\\nEmail Address: $MY_EMAIL_ADDRESS\\n\\nKey ID: $GPG_ID\\n\\nFingerprint: $GPG_FINGERPRINT\\n\\nCreated: $GPG_DATE\\n\\nI2P Address: ${bdsmail_address}" 17 100
clear
echo '' echo ''
echo $'Your bdsmail address as a QR code' echo $'Your onion email address:'
echo ''
echo -n "${USER}@${onion_domain}" | qrencode -t UTF8
echo ''
qr_code_shown=1
fi
if [ -f ~/.mutt/bdsmail ]; then
echo ''
echo $'Your bdsmail address:'
echo '' echo ''
echo -n "${bdsmail_address}" | qrencode -t UTF8 echo -n "${bdsmail_address}" | qrencode -t UTF8
echo '' echo ''
echo "${bdsmail_address}" qr_code_shown=1
echo '' fi
if [ $qr_code_shown ]; then
any_key any_key
fi fi
} }