Pārlūkot izejas kodu

Blocking menu style

Bob Mottram 7 gadus atpakaļ
vecāks
revīzija
6c97c1601e
1 mainītis faili ar 10 papildinājumiem un 21 dzēšanām
  1. 10
    21
      src/freedombone-controlpanel

+ 10
- 21
src/freedombone-controlpanel Parādīt failu

@@ -2073,33 +2073,22 @@ function domain_blocking_show {
2073 2073
 function domain_blocking {
2074 2074
     while true
2075 2075
     do
2076
-        data=$(mktemp 2>/dev/null)
2077
-        dialog --backtitle $"Freedombone Control Panel" \
2078
-               --title $"Domain or User Blocking" \
2079
-               --radiolist $"Choose an operation:" 14 60 6 \
2080
-               1 $"Block a domain or user" off \
2081
-               2 $"Unblock a domain or user" off \
2082
-               3 $"Block an IP address" off \
2083
-               4 $"Unblock an IP address" off \
2084
-               5 $"Show blocked domains and users" off \
2085
-               6 $"Back to main menu" on 2> "$data"
2086
-        sel=$?
2087
-        case $sel in
2088
-            1) rm -f "$data"
2089
-               break;;
2090
-            255) rm -f "$data"
2091
-                 break;;
2092
-        esac
2093
-        case $(cat "$data") in
2076
+        W=(1 $"Block a domain or user"
2077
+           2 $"Unblock a domain or user"
2078
+           3 $"Block an IP address"
2079
+           4 $"Unblock an IP address"
2080
+           5 $"Show blocked domains and users")
2081
+
2082
+        # shellcheck disable=SC2068
2083
+        selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"Domain or User Blocking" --menu $"Choose an operation, or ESC for main menu:" 13 70 6 "${W[@]}" 3>&2 2>&1 1>&3)
2084
+
2085
+        case $selection in
2094 2086
             1) domain_blocking_add;;
2095 2087
             2) domain_blocking_remove;;
2096 2088
             3) ip_blocking_add;;
2097 2089
             4) ip_blocking_remove;;
2098 2090
             5) domain_blocking_show;;
2099
-            6) rm -f "$data"
2100
-               break;;
2101 2091
         esac
2102
-        rm -f "$data"
2103 2092
     done
2104 2093
 }
2105 2094