diff options
Diffstat (limited to 'applications/luci-app-firewall/luasrc')
3 files changed, 7 insertions, 64 deletions
diff --git a/applications/luci-app-firewall/luasrc/model/cbi/firewall/rule-details.lua b/applications/luci-app-firewall/luasrc/model/cbi/firewall/rule-details.lua index a4763d5dc4..def01c6690 100644 --- a/applications/luci-app-firewall/luasrc/model/cbi/firewall/rule-details.lua +++ b/applications/luci-app-firewall/luasrc/model/cbi/firewall/rule-details.lua @@ -1,15 +1,10 @@ -- Copyright 2008 Steven Barth <steven@midlink.org> -- Copyright 2010-2012 Jo-Philipp Wich <jow@openwrt.org> -- Licensed to the public under the Apache License 2.0. - -local sys = require "luci.sys" -local utl = require "luci.util" local dsp = require "luci.dispatcher" -local nxo = require "nixio" - local ft = require "luci.tools.firewall" local nw = require "luci.model.network" -local m, s, o, k, v +local m, s, o, v, _ arg[1] = arg[1] or "" @@ -46,22 +41,6 @@ elseif rule_type == "redirect" then m.title = "%s - %s" %{ translate("Firewall - Traffic Rules"), name } - local wan_zone = nil - - m.uci:foreach("firewall", "zone", - function(s) - local n = s.network or s.name - if n then - local i - for i in utl.imatch(n) do - if i == "wan" then - wan_zone = s.name - return false - end - end - end - end) - s = m:section(NamedSection, arg[1], "redirect", "") s.anonymous = true s.addremove = false @@ -154,9 +133,9 @@ elseif rule_type == "redirect" then o.rmempty = false o.datatype = "ip4addr" - for k, v in ipairs(nw:get_interfaces()) do + for _, v in ipairs(nw:get_interfaces()) do local a - for k, a in ipairs(v:ipaddrs()) do + for _, a in ipairs(v:ipaddrs()) do o:value(a:host():string(), '%s (%s)' %{ a:host():string(), v:shortname() }) diff --git a/applications/luci-app-firewall/luasrc/view/firewall/cbi_addforward.htm b/applications/luci-app-firewall/luasrc/view/firewall/cbi_addforward.htm index f48599b505..38f36b49c8 100644 --- a/applications/luci-app-firewall/luasrc/view/firewall/cbi_addforward.htm +++ b/applications/luci-app-firewall/luasrc/view/firewall/cbi_addforward.htm @@ -71,35 +71,17 @@ </div> <script type="text/javascript">//<![CDATA[ - cbi_bind(document.getElementById('_newfwd.extport'), 'blur', + document.getElementById('_newfwd.extport').addEventListener('blur', function() { var n = document.getElementById('_newfwd.name'); var p = document.getElementById('_newfwd.proto'); var i = document.getElementById('_newfwd.intport'); - var hints = { - /* port name 0=both, 1=tcp, 2=udp, 3=other */ - 21: [ 'FTP', 1 ], - 22: [ 'SSH', 1 ], - 53: [ 'DNS', 0 ], - 80: [ 'HTTP', 1 ], - 443: [ 'HTTPS', 1 ], - 3389: [ 'RDP', 1 ], - 5900: [ 'VNC', 1 ], - }; if (!this.className.match(/invalid/)) { if (!i.value) i.value = this.value; - var hint = hints[this.value || 0] || hints[i.value || 0]; - if (hint) - { - p.selectedIndex = hint[1]; - - if (!n.value) - n.value = hint[0]; - } - else if (!n.value) + if (!n.value) { n.value = 'Forward' + this.value; } diff --git a/applications/luci-app-firewall/luasrc/view/firewall/cbi_addrule.htm b/applications/luci-app-firewall/luasrc/view/firewall/cbi_addrule.htm index 82168712ae..e0092a7a56 100644 --- a/applications/luci-app-firewall/luasrc/view/firewall/cbi_addrule.htm +++ b/applications/luci-app-firewall/luasrc/view/firewall/cbi_addrule.htm @@ -72,36 +72,18 @@ <% if #zones > 0 then %> <script type="text/javascript">//<![CDATA[ cbi_validate_field('_newopen.extport', true, 'list(neg(portrange))'); - cbi_bind(document.getElementById('_newopen.extport'), 'blur', + document.getElementById('_newopen.extport').addEventListener('blur', function() { var n = document.getElementById('_newopen.name'); var p = document.getElementById('_newopen.proto'); - var hints = { - /* port name 0=both, 1=tcp, 2=udp, 3=other */ - 22: [ 'SSH', 1 ], - 53: [ 'DNS', 0 ], - 80: [ 'HTTP', 1 ], - 443: [ 'HTTPS', 1 ], - }; if (!this.className.match(/invalid/)) { - var hint = hints[this.value || 0]; - if (hint) - { - p.selectedIndex = hint[1]; - - if (!n.value) - n.value = hint[0]; - } - else if (!n.value && this.value) + if (!n.value && this.value) { n.value = 'Open' + this.value; } } }); - - - cbi_validate_field('cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>', true, 'uciname'); //]]></script> <% end %> |