luci-app-wireguard: set allowed_ips option as optional value
authorKeith Irwin <[email protected]>
Sun, 29 Aug 2021 04:44:38 +0000 (22:44 -0600)
committerFlorian Eckert <[email protected]>
Tue, 31 Aug 2021 06:05:28 +0000 (08:05 +0200)
Signed-off-by: Keith Irwin <[email protected]>
(cherry picked from commit 092109c9056444a4ba691d15031f69403ab2b37c)
fixed commit title
Signed-off-by: Florian Eckert <[email protected]>
protocols/luci-proto-wireguard/htdocs/luci-static/resources/protocol/wireguard.js

index 6321f85d9b9dde5d1dca274645666f378fc1546d..e7e69a3d5bbb206d35357bbd47520ec5de05992c 100644 (file)
@@ -140,16 +140,9 @@ return network.registerProtocol('wireguard', {
                o.validate = validateBase64;
                o.optional = true;
 
-               o = ss.option(form.DynamicList, 'allowed_ips', _('Allowed IPs'), _("Required. IP addresses and prefixes that this peer is allowed to use inside the tunnel. Usually the peer's tunnel IP addresses and the networks the peer routes through the tunnel."));
+               o = ss.option(form.DynamicList, 'allowed_ips', _('Allowed IPs'), _("Optional. IP addresses and prefixes that this peer is allowed to use inside the tunnel. Usually the peer's tunnel IP addresses and the networks the peer routes through the tunnel."));
                o.datatype = 'ipaddr';
-               o.validate = function(section, value) {
-                       var opt = this.map.lookupOption('allowed_ips', section);
-                       var ips = opt[0].formvalue(section);
-                       if (ips.length == 0) {
-                               return _('Value must not be empty');
-                       }
-                       return true;
-               };
+               o.optional = true;
 
                o = ss.option(form.Flag, 'route_allowed_ips', _('Route Allowed IPs'), _('Optional. Create routes for Allowed IPs for this peer.'));