Преглед изворни кода

Switch mesh vpn connection to zenity

Bob Mottram пре 7 година
родитељ
комит
504c561ea3
1 измењених фајлова са 8 додато и 25 уклоњено
  1. 8
    25
      src/freedombone-mesh-connect

+ 8
- 25
src/freedombone-mesh-connect Прегледај датотеку

@@ -152,8 +152,7 @@ function mesh_setup_vpn {
152 152
     chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/vpn.tar.gz
153 153
 
154 154
     if [ -f vpn.tar.gz ]; then
155
-        dialog --title $"Generate VPN client keys" \
156
-               --msgbox $"\nNew VPN client keys have been generated in the /home/fbone directory.\n\nYou can find it by selecting \"Places\" then \"Home Directory\" on the top menu bar. Transmit the vpn.tar.gz file to whoever is running the other mesh network so that they can connect to yours.\n\nThey should uncompress vpn.tar.gz to their /home/fbone directory, forward port $VPN_MESH_TLS_PORT then connect using your IP address or domain name." 15 70
155
+        zenity --info --title $"Generate VPN client keys" --text $"\nNew VPN client keys have been generated in the /home/fbone directory.\n\nYou can find it by selecting \"Places\" then \"Home Directory\" on the top menu bar. Transmit the vpn.tar.gz file to whoever is running the other mesh network so that they can connect to yours.\n\nThey should uncompress vpn.tar.gz to their /home/fbone directory, forward port $VPN_MESH_TLS_PORT then connect using your IP address or domain name." --width 600
157 156
     fi
158 157
 }
159 158
 
@@ -164,15 +163,11 @@ function connect_to_mesh {
164 163
         connect_title=$"Connect from $(cat $HIDDEN_SERVICE_PATH) to another mesh network"
165 164
     fi
166 165
 
167
-    data=$(tempfile 2>/dev/null)
168
-    trap "rm -f $data" 0 1 2 5 15
169
-    dialog --title "$connect_title" \
170
-           --backtitle $"Freedombone Mesh" \
171
-           --inputbox $'Enter the IP address or domain name of the other mesh.' 10 60 2>$data
166
+    data=$(zenity --entry --title "$connect_title" --text $'Enter the IP address or domain name of the other mesh')
172 167
     sel=$?
173 168
     case $sel in
174 169
         0)
175
-            ip_or_domain=$(<$data)
170
+            ip_or_domain="$data"
176 171
             if [ ${#ip_or_domain} -gt 1 ]; then
177 172
                 if [[ "$ip_or_domain" == *'.'* ]]; then
178 173
 
@@ -188,9 +183,7 @@ function connect_to_mesh {
188 183
                     fi
189 184
 
190 185
                     if [ $connect_failed ]; then
191
-                        dialog --title $"Connect to another mesh network" \
192
-                               --msgbox $"\nObtain the vpn.tar.gz file from the other mesh administrator, uncompress it into the /home/fbone directory and also forwarded port $VPN_MESH_TLS_PORT from your internet router to this system." 10 50
193
-                        rm $data
186
+                        zenity --info --title $"Connect to another mesh network" --text $"\nObtain the vpn.tar.gz file from the other mesh administrator, uncompress it into the /home/fbone directory and also forwarded port $VPN_MESH_TLS_PORT from your internet router to this system." --width 400
194 187
                         exit 1
195 188
                     fi
196 189
 
@@ -204,27 +197,17 @@ function connect_to_mesh {
204 197
             fi
205 198
             ;;
206 199
     esac
207
-
208
-    rm $data
209 200
 }
210 201
 
211
-data=$(tempfile 2>/dev/null)
212
-trap "rm -f $data" 0 1 2 5 15
213
-dialog --backtitle $"Freedombone Mesh" \
214
-       --title $"Connect to another mesh network" \
215
-       --radiolist $"Choose an operation:" 10 75 2 \
216
-       1 $"Connect to another mesh network" on \
217
-       2 $"Generate VPN keys for another mesh network to connect to me" off 2> $data
202
+data=$(zenity --list 1 $"Connect to another mesh network" 2 $"Generate VPN keys for another mesh network to connect to me" --column="id" --title $"Connect to another mesh network" --column=$"Choose an operation:" --hide-column=1 --print-column=1 --width=500 --height=100)
218 203
 sel=$?
219 204
 case $sel in
220 205
     1) exit 1;;
221 206
     255) exit 1;;
222 207
 esac
223
-case $(cat $data) in
224
-    1) rm $data
225
-       connect_to_mesh;;
226
-    2) rm $data
227
-       mesh_setup_vpn;;
208
+case $data in
209
+    1) connect_to_mesh;;
210
+    2) mesh_setup_vpn;;
228 211
 esac
229 212
 
230 213
 exit 0