Browse Source

Show QR code for selected about screen entries on control panel

Bob Mottram 6 years ago
parent
commit
f2c9325b9b
1 changed files with 14 additions and 1 deletions
  1. 14
    1
      src/freedombone-controlpanel

+ 14
- 1
src/freedombone-controlpanel View File

@@ -331,7 +331,20 @@ function show_domains {
331 331
     height=$(tput lines)
332 332
 
333 333
     # shellcheck disable=SC2068
334
-    dialog --backtitle $"Freedombone Control Panel" --title $"Domains" --menu $"Use Shift+cursors to select and copy onion addresses" $((height-4)) $((width-4)) $((height-4)) "${W[@]}" 3>&2 2>&1 1>&3
334
+    selected=$(dialog --backtitle $"Freedombone Control Panel" --title $"Domains" --menu $"Use Shift+cursors to select and copy onion addresses" $((height-4)) $((width-4)) $((height-4)) "${W[@]}" 3>&2 2>&1 1>&3)
335
+    if [[ "$selected" != *'.onion'* ]]; then
336
+        return
337
+    fi
338
+    intermediate=$(echo "$selected" | awk -F '.' '{print $2}')
339
+    if [[ "$intermediate" == *'/'* ]]; then
340
+        onion_addr=$(echo "$intermediate" | awk -F ' ' '{print $3}').onion
341
+    else
342
+        onion_addr="$selected".onion
343
+    fi
344
+    clear
345
+    echo "$onion_addr"
346
+    echo -n "$onion_addr" | qrencode -t UTF8
347
+    any_key
335 348
 }
336 349
 
337 350
 function show_users {