luci-proto-openconnect: use the uri configuration option
authorNikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
Sat, 18 May 2024 19:00:25 +0000 (21:00 +0200)
committerPaul Donald <newtwen+github@gmail.com>
Fri, 22 Nov 2024 18:27:48 +0000 (19:27 +0100)
This enables more advanced configuration by allowing complex URIs, including
user groups and hidden directories (camouflage). It further simplifies the configuration
by eliminating the port and usergroup parameters.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
(cherry picked from commit 03d6dec7d25cb87981b4beffe3a1d18d4cc8854c)

protocols/luci-proto-openconnect/htdocs/luci-static/resources/protocol/openconnect.js

index 6ff530eb40686463e440e4cd4403227b2d4c7808..a3d000c9530330fc5fb6dc68665f72ed620170a0 100644 (file)
@@ -101,7 +101,8 @@ return network.registerProtocol('openconnect', {
                o.value('pulse', 'Pulse Connect Secure SSL VPN');
                o.value('array', 'Array Networks SSL VPN');
 
-               o = s.taboption('general', form.Value, 'server', _('VPN Server'));
+               o = s.taboption('general', form.Value, 'uri', _('VPN Server'));
+               o.placeholder = 'https://example.com:443/usergroup';
                o.validate = function(section_id, value) {
                        var m = String(value).match(/^(?:(\w+):\/\/|)(?:\[([0-9a-f:.]{2,45})\]|([^\/:]+))(?::([0-9]{1,5}))?(?:\/.*)?$/i);
 
@@ -109,7 +110,7 @@ return network.registerProtocol('openconnect', {
                                return _('Invalid server URL');
 
                        if (m[1] != null) {
-                               if (!m[1].match(/^(?:http|https|socks|socks4|socks5)$/i))
+                               if (!m[1].match(/^(?:https|socks|socks4|socks5)$/i))
                                        return _('Unsupported protocol');
                        }
 
@@ -138,13 +139,8 @@ return network.registerProtocol('openconnect', {
                        return true;
                };
 
-               o = s.taboption('general', form.Value, 'port', _('VPN Server port'));
-               o.placeholder = '443';
-               o.datatype    = 'port';
-
                s.taboption('general', form.Value, 'serverhash', _("VPN Server's certificate SHA1 hash"));
                s.taboption('general', form.Value, 'authgroup', _('Auth Group'));
-               s.taboption('general', form.Value, 'usergroup', _('User Group'));
                s.taboption("general", form.Value, "username", _("Username"));
 
                o = s.taboption('general', form.Value, 'password', _('Password'));