|
@@ -797,28 +797,37 @@ function add_tor_bridge {
|
797
|
797
|
}
|
798
|
798
|
|
799
|
799
|
function remove_tor_bridge {
|
|
800
|
+ bridge_removed=
|
800
|
801
|
data=$(tempfile 2>/dev/null)
|
801
|
802
|
trap "rm -f $data" 0 1 2 5 15
|
802
|
|
- dialog --backtitle $"Freedombone Control Panel" \
|
803
|
|
- --title $"Remove obfs4 Tor bridge" \
|
804
|
|
- --form "\n" 7 60 1 \
|
805
|
|
- $"IP address:" 1 1 " . . . " 1 15 16 16 \
|
806
|
|
- 2> $data
|
|
803
|
+ dialog --title $"Remove obfs4 Tor bridge" \
|
|
804
|
+ --backtitle $"Freedombone Control Panel" \
|
|
805
|
+ --inputbox $"Enter the IP address, key or Nickname of the bridge" 8 65 2>$data
|
807
|
806
|
sel=$?
|
808
|
807
|
case $sel in
|
809
|
|
- 1) return;;
|
810
|
|
- 255) return;;
|
|
808
|
+ 0)
|
|
809
|
+ response=$(<$data)
|
|
810
|
+ if [ ${#response} -gt 2 ]; then
|
|
811
|
+ if [[ "${response}" != *" "* ]]; then
|
|
812
|
+ if [[ "${response}" == *"."* ]]; then
|
|
813
|
+ if grep "Bridge ${response}" /etc/tor/torrc; then
|
|
814
|
+ tor_remove_bridge "${response}"
|
|
815
|
+ bridge_removed=1
|
|
816
|
+ fi
|
|
817
|
+ else
|
|
818
|
+ if grep " $response" /etc/tor/torrc; then
|
|
819
|
+ tor_remove_bridge "${response}"
|
|
820
|
+ bridge_removed=1
|
|
821
|
+ fi
|
|
822
|
+ fi
|
|
823
|
+ fi
|
|
824
|
+ fi
|
|
825
|
+ ;;
|
811
|
826
|
esac
|
812
|
|
- bridge_ip_address=$(cat $data | sed -n 1p)
|
813
|
|
- if [[ "${bridge_ip_address}" == *" "* ]]; then
|
814
|
|
- return
|
|
827
|
+ if [ $bridge_removed ]; then
|
|
828
|
+ dialog --title $"Remove obfs4 Tor bridge" \
|
|
829
|
+ --msgbox $"Bridge removed" 6 40
|
815
|
830
|
fi
|
816
|
|
- if [[ "${bridge_ip_address}" != *"."* ]]; then
|
817
|
|
- return
|
818
|
|
- fi
|
819
|
|
- tor_remove_bridge "${bridge_ip_address}"
|
820
|
|
- dialog --title $"Remove obfs4 Tor bridge" \
|
821
|
|
- --msgbox $"Bridge removed" 6 40
|
822
|
831
|
}
|
823
|
832
|
|
824
|
833
|
function add_tor_bridge_relay {
|