luci-proto-openconnect: use the uri configuration option

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>
pull/7141/head
Nikos Mavrogiannopoulos 2024-05-18 21:00:25 +02:00 committed by Paul Donald
parent 46a2acac92
commit 03d6dec7d2
1 changed files with 3 additions and 7 deletions

View 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'));