diff --git a/conf/init_ynh-vpnclient b/conf/init_ynh-vpnclient index eb3dacf..6132add 100644 --- a/conf/init_ynh-vpnclient +++ b/conf/init_ynh-vpnclient @@ -58,14 +58,26 @@ set_serverip6route() { start_openvpn() { ip6_gw=$1 server_ip6=$2 - proto=udp - [ ! -z "${ip6_gw}" -a ! -z "${server_ip6}" ] && proto=udp6 + if [ ! -z "${ip6_gw}" -a ! -z "${server_ip6}" ]; then + proto=udp6 + [ "${ynh_server_proto}" == tcp ] && proto=tcp6-client + else + proto=udp + [ "${ynh_server_proto}" == tcp ] && proto=tcp-client + else + cp /etc/openvpn/client.conf{.tpl,} sed "s||${ynh_server_name}|g" -i /etc/openvpn/client.conf - sed "s||${proto}|" -i /etc/openvpn/client.conf - sed 's|^||' -i /etc/openvpn/client.conf + sed "s||${ynh_server_port}|g" -i /etc/openvpn/client.conf + sed "s||${proto}|g" -i /etc/openvpn/client.conf + + if [ "${proto}" =~ udp ] + sed 's|^||' -i /etc/openvpn/client.conf + else + sed 's|^|;|' -i /etc/openvpn/client.conf + fi service openvpn start client } @@ -120,6 +132,8 @@ moulinette_set() { echo -n "Retrieving Yunohost settings... " ynh_server_name=$(moulinette_get server_name) +ynh_server_port=$(moulinette_get server_port) +ynh_server_proto=$(moulinette_get server_proto) ynh_ip6_addr=$(moulinette_get ip6_addr) old_ip6_gw=$(moulinette_get ip6_gw) @@ -183,6 +197,7 @@ case "$1" in fi fi + # Update dynamic settings moulinette_set server_ip6 "${new_server_ip6}" moulinette_set ip6_gw "${new_ip6_gw}" moulinette_set wired_device "${new_wired_device}" diff --git a/conf/openvpn_client.conf.tpl b/conf/openvpn_client.conf.tpl index 6d80e50..4c0a610 100644 --- a/conf/openvpn_client.conf.tpl +++ b/conf/openvpn_client.conf.tpl @@ -9,6 +9,7 @@ dev tun tun-ipv6 keepalive 10 30 comp-lzo adaptive +port # UDP only explicit-exit-notify diff --git a/scripts/install b/scripts/install index c49fc71..1ffd300 100644 --- a/scripts/install +++ b/scripts/install @@ -30,8 +30,10 @@ ip6_net=$(sipcalc "${ip6_net}" | grep Compressed | awk '{ print $NF; }') ip6_addr=$(echo "$(echo "${ip6_expanded_net}" | cut -d: -f1-7):1") ip6_addr=$(sipcalc "${ip6_addr}" | grep Compressed | awk '{ print $NF; }') -# Save arguments for future upgrades +# Save arguments sudo yunohost app setting vpnclient server_name -v "${server_name}" +sudo yunohost app setting vpnclient server_port -v 1194 +sudo yunohost app setting vpnclient server_proto -v udp sudo yunohost app setting vpnclient ip6_addr -v "${ip6_addr}" sudo yunohost app setting vpnclient ip6_net -v "${ip6_net}" diff --git a/sources/public/js/custom.js b/sources/public/js/custom.js new file mode 100644 index 0000000..6fc696d --- /dev/null +++ b/sources/public/js/custom.js @@ -0,0 +1,5 @@ +$(document).ready(function() { + $('.btn-group').button(); + $('[data-toggle="tooltip"]').tooltip(); +}); + diff --git a/sources/views/layout.html.php b/sources/views/layout.html.php index 8f4e07c..1573f93 100644 --- a/sources/views/layout.html.php +++ b/sources/views/layout.html.php @@ -13,6 +13,7 @@ +
diff --git a/sources/views/settings.html.php b/sources/views/settings.html.php index f3f2890..9ed7ffe 100644 --- a/sources/views/settings.html.php +++ b/sources/views/settings.html.php @@ -1,42 +1,55 @@ -

+


- +
- +
- +
- +
- -
- -
+ +
+ + + +
-
-
- -
-
+ +
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
- +