diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-02-19 11:29:14 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-02-19 11:29:14 +0100 |
commit | b60be8cfd82e83818013fafce00c9433e0c38376 (patch) | |
tree | dfbcb43e4c9d91f62a38dfbc4949531f17b1c068 /applications/luci-app-firewall/htdocs/luci-static/resources | |
parent | b8d2bcd432ab23a883de1dd4fbce29f9751a6e84 (diff) |
luci-app-firewall: properly handle custom multi IP/MAC input
Store multiple space separated custom address values as separate uci
list items in the configuration.
Fixes: #4822
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'applications/luci-app-firewall/htdocs/luci-static/resources')
-rw-r--r-- | applications/luci-app-firewall/htdocs/luci-static/resources/tools/firewall.js | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/applications/luci-app-firewall/htdocs/luci-static/resources/tools/firewall.js b/applications/luci-app-firewall/htdocs/luci-static/resources/tools/firewall.js index d365467835..bc3dc12c99 100644 --- a/applications/luci-app-firewall/htdocs/luci-static/resources/tools/firewall.js +++ b/applications/luci-app-firewall/htdocs/luci-static/resources/tools/firewall.js @@ -425,8 +425,23 @@ return baseclass.extend({ opt.addChoices(choices[0], choices[1]); }, + CBIDynamicMultiValueList: form.DynamicList.extend({ + renderWidget: function(/* ... */) { + var dl = form.DynamicList.prototype.renderWidget.apply(this, arguments), + inst = dom.findClassInstance(dl); + + inst.addItem = function(dl, value, text, flash) { + var values = L.toArray(value); + for (var i = 0; i < values.length; i++) + ui.DynamicList.prototype.addItem.call(this, dl, values[i], null, true); + }; + + return dl; + } + }), + addIPOption: function(s, tab, name, label, description, family, hosts, multiple) { - var o = s.taboption(tab, multiple ? form.DynamicList : form.Value, name, label, description); + var o = s.taboption(tab, multiple ? this.CBIDynamicMultiValueList : form.Value, name, label, description); o.modalonly = true; o.datatype = 'list(neg(ipmask))'; @@ -474,7 +489,7 @@ return baseclass.extend({ }, addMACOption: function(s, tab, name, label, description, hosts) { - var o = s.taboption(tab, form.DynamicList, name, label, description); + var o = s.taboption(tab, this.CBIDynamicMultiValueList, name, label, description); o.modalonly = true; o.datatype = 'list(macaddr)'; |