Browse Source

Show onion email address as QR code on user control panel

Bob Mottram 7 years ago
parent
commit
60b4b077d8
1 changed files with 37 additions and 15 deletions
  1. 37
    15
      src/freedombone-controlpanel-user

+ 37
- 15
src/freedombone-controlpanel-user View File

856
     if [ -f "$HOME/.email_onion_domain" ]; then
856
     if [ -f "$HOME/.email_onion_domain" ]; then
857
         onion_domain=$(cat "$HOME/.email_onion_domain")
857
         onion_domain=$(cat "$HOME/.email_onion_domain")
858
     fi
858
     fi
859
+    dialog_height=14
859
     if [[ "$HOSTNAME" != *'.onion' && "$onion_domain" ]]; then
860
     if [[ "$HOSTNAME" != *'.onion' && "$onion_domain" ]]; then
860
-        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"
861
+        if [ ! -f ~/.mutt/bdsmail ]; then
862
+            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"
863
+            dialog_height=17
864
+        else
865
+            bdsmail_address=$(grep 'set from=' ~/.mutt/bdsmail | awk -F '=' '{print $2}')
866
+            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}"
867
+            dialog_height=20
868
+        fi
861
     else
869
     else
862
-        msgstr=$"Email Address: $MY_EMAIL_ADDRESS\\n\\nKey ID: $GPG_ID\\n\\nFingerprint: $GPG_FINGERPRINT\\n\\nCreated: $GPG_DATE"
870
+        if [ ! -f ~/.mutt/bdsmail ]; then
871
+            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"
872
+            dialog_height=14
873
+        else
874
+            bdsmail_address=$(grep 'set from=' ~/.mutt/bdsmail | awk -F '=' '{print $2}')
875
+            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}"
876
+            dialog_height=17
877
+        fi
863
     fi
878
     fi
864
-    if [ ! -f ~/.mutt/bdsmail ]; then
865
-        dialog --title $"Show your Email Address" \
866
-               --backtitle $"Freedombone User Control Panel" \
867
-               --msgbox "$msgstr" 14 100
868
-    else
869
-        bdsmail_address=$(grep 'set from=' ~/.mutt/bdsmail | awk -F '=' '{print $2}')
870
-        dialog --title $"Show your Email Address" \
871
-               --backtitle $"Freedombone User Control Panel" \
872
-               --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
873
-        clear
879
+
880
+    dialog --title $"Show your Email Address" \
881
+           --backtitle $"Freedombone User Control Panel" \
882
+           --msgbox "$msgstr" $dialog_height 100
883
+
884
+    clear
885
+    qr_code_shown=
886
+    if [ "$onion_domain" ]; then
874
         echo ''
887
         echo ''
875
-        echo $'Your bdsmail address as a QR code'
888
+        echo $'Your onion email address:'
876
         echo ''
889
         echo ''
877
-        echo -n "${bdsmail_address}" | qrencode -t UTF8
890
+        echo -n "${USER}@${onion_domain}" | qrencode -t UTF8
891
+        echo ''
892
+        qr_code_shown=1
893
+    fi
894
+    if [ -f ~/.mutt/bdsmail ]; then
895
+        echo ''
896
+        echo $'Your bdsmail address:'
878
         echo ''
897
         echo ''
879
-        echo "${bdsmail_address}"
898
+        echo -n "${bdsmail_address}" | qrencode -t UTF8
880
         echo ''
899
         echo ''
900
+        qr_code_shown=1
901
+    fi
902
+    if [ $qr_code_shown ]; then
881
         any_key
903
         any_key
882
     fi
904
     fi
883
 }
905
 }