Selaa lähdekoodia

New menu style for pihole

Bob Mottram 6 vuotta sitten
vanhempi
commit
c6c72d4b38
1 muutettua tiedostoa jossa 15 lisäystä ja 22 poistoa
  1. 15
    22
      src/freedombone-app-pihole

+ 15
- 22
src/freedombone-app-pihole Näytä tiedosto

@@ -255,27 +255,23 @@ function pihole_resume {
255 255
 }
256 256
 
257 257
 function configure_interactive_pihole {
258
+    W=(1 $"Edit ads list"
259
+       2 $"Edit blacklisted domain names"
260
+       3 $"Edit whitelisted domain names"
261
+       4 $"Change upstream DNS servers"
262
+       5 $"Pause blocker"
263
+       6 $"Resume blocker")
264
+
258 265
     while true
259 266
     do
260
-        data=$(mktemp 2>/dev/null)
261
-        dialog --backtitle $"Freedombone Control Panel" \
262
-               --title $"Ad Blocker" \
263
-               --radiolist $"Choose an operation:" 16 70 7 \
264
-               1 $"Edit ads list" off \
265
-               2 $"Edit blacklisted domain names" off \
266
-               3 $"Edit whitelisted domain names" off \
267
-               4 $"Change upstream DNS servers" off \
268
-               5 $"Pause blocker" off \
269
-               6 $"Resume blocker" off \
270
-               7 $"Exit" on 2> "$data"
271
-        sel=$?
272
-        case $sel in
273
-            1) rm -f "$data"
274
-               exit 1;;
275
-            255) rm -f "$data"
276
-                 exit 1;;
277
-        esac
278
-        case $(cat "$data") in
267
+        # shellcheck disable=SC2068
268
+        selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Ad blocker" --menu $"Choose an operation, or ESC for main menu:" 19 70 12 "${W[@]}" 3>&2 2>&1 1>&3)
269
+
270
+        if [ ! "$selection" ]; then
271
+           break
272
+        fi
273
+
274
+        case $selection in
279 275
             1) editor $PIHOLE_CUSTOM_ADLIST
280 276
                update_pihole_interactive
281 277
                ;;
@@ -292,10 +288,7 @@ function configure_interactive_pihole {
292 288
                ;;
293 289
             6) pihole_resume
294 290
                ;;
295
-            7) rm -f "$data"
296
-               break;;
297 291
         esac
298
-        rm -f "$data"
299 292
     done
300 293
 }
301 294