mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Update luci-base and luci-mod-admin-full to latest upstream version
This commit is contained in:
parent
7a86a163f5
commit
602a83668e
74 changed files with 7498 additions and 3067 deletions
|
@ -122,6 +122,9 @@ s:taboption("advanced", Flag, "strictorder",
|
|||
translate("<abbr title=\"Domain Name System\">DNS</abbr> servers will be queried in the " ..
|
||||
"order of the resolvfile")).optional = true
|
||||
|
||||
s:taboption("advanced", Flag, "allservers",
|
||||
translate("All Servers"),
|
||||
translate("Query all available upstream <abbr title=\"Domain Name System\">DNS</abbr> servers")).optional = true
|
||||
|
||||
bn = s:taboption("advanced", DynamicList, "bogusnxdomain", translate("Bogus NX Domain Override"),
|
||||
translate("List of hosts that supply bogus NX domain results"))
|
||||
|
|
|
@ -10,6 +10,10 @@ m = SimpleForm("network", translate("Create Interface"))
|
|||
m.redirect = luci.dispatcher.build_url("admin/network/network")
|
||||
m.reset = false
|
||||
|
||||
function m.on_cancel()
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin/network/network"))
|
||||
end
|
||||
|
||||
newnet = m:field(Value, "_netname", translate("Name of the new interface"),
|
||||
translate("The allowed characters are: <code>A-Z</code>, <code>a-z</code>, " ..
|
||||
"<code>0-9</code> and <code>_</code>"
|
||||
|
|
|
@ -315,6 +315,7 @@ if not net:is_floating() then
|
|||
ifname_single.template = "cbi/network_ifacelist"
|
||||
ifname_single.widget = "radio"
|
||||
ifname_single.nobridges = true
|
||||
ifname_single.noaliases = false
|
||||
ifname_single.rmempty = false
|
||||
ifname_single.network = arg[1]
|
||||
ifname_single:depends("type", "")
|
||||
|
@ -325,12 +326,18 @@ if not net:is_floating() then
|
|||
end
|
||||
|
||||
function ifname_single.write(self, s, val)
|
||||
local i
|
||||
local _, i
|
||||
local new_ifs = { }
|
||||
local old_ifs = { }
|
||||
|
||||
for _, i in ipairs(net:get_interfaces() or { net:get_interface() }) do
|
||||
old_ifs[#old_ifs+1] = i:name()
|
||||
local alias = net:is_alias()
|
||||
|
||||
if alias then
|
||||
old_ifs[1] = '@' .. alias
|
||||
else
|
||||
for _, i in ipairs(net:get_interfaces() or { net:get_interface() }) do
|
||||
old_ifs[#old_ifs+1] = i:name()
|
||||
end
|
||||
end
|
||||
|
||||
for i in ut.imatch(val) do
|
||||
|
@ -365,6 +372,7 @@ if not net:is_virtual() then
|
|||
ifname_multi = s:taboption("physical", Value, "ifname_multi", translate("Interface"))
|
||||
ifname_multi.template = "cbi/network_ifacelist"
|
||||
ifname_multi.nobridges = true
|
||||
ifname_multi.noaliases = true
|
||||
ifname_multi.rmempty = false
|
||||
ifname_multi.network = arg[1]
|
||||
ifname_multi.widget = "checkbox"
|
||||
|
|
|
@ -3,12 +3,147 @@
|
|||
-- Licensed to the public under the Apache License 2.0.
|
||||
|
||||
local fs = require "nixio.fs"
|
||||
local tpl = require "luci.template"
|
||||
local ntm = require "luci.model.network".init()
|
||||
local fwm = require "luci.model.firewall".init()
|
||||
local json = require "luci.jsonc"
|
||||
local sys = require "luci.sys"
|
||||
|
||||
m = Map("network", translate("Interfaces"))
|
||||
m:chain("wireless")
|
||||
m:chain("firewall")
|
||||
m:chain("dhcp")
|
||||
m.pageaction = false
|
||||
m:section(SimpleSection).template = "admin_network/iface_overview"
|
||||
|
||||
|
||||
local tpl_networks = tpl.Template(nil, [[
|
||||
<div class="cbi-section-node">
|
||||
<div class="table">
|
||||
<%
|
||||
for i, net in ipairs(netlist) do
|
||||
local z = net[3]
|
||||
local c = z and z:get_color() or "#EEEEEE"
|
||||
local t = z and translate("Part of zone %q" % z:name()) or translate("No zone assigned")
|
||||
local disabled = (net[4]:get("auto") == "0")
|
||||
local dynamic = net[4]:is_dynamic()
|
||||
%>
|
||||
<div class="tr cbi-rowstyle-<%=i % 2 + 1%>">
|
||||
<div class="td col-3 center middle">
|
||||
<div class="ifacebox">
|
||||
<div class="ifacebox-head" style="background-color:<%=c%>" title="<%=pcdata(t)%>">
|
||||
<strong><%=net[1]:upper()%></strong>
|
||||
</div>
|
||||
<div class="ifacebox-body" id="<%=net[1]%>-ifc-devices" data-network="<%=net[1]%>">
|
||||
<img src="<%=resource%>/icons/ethernet_disabled.png" style="width:16px; height:16px" /><br />
|
||||
<small>?</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="td col-5 left middle" id="<%=net[1]%>-ifc-description">
|
||||
<em><%:Collecting data...%></em>
|
||||
</div>
|
||||
<div class="td cbi-section-actions">
|
||||
<div>
|
||||
<input type="button" class="cbi-button cbi-button-neutral" onclick="iface_reconnect('<%=net[1]%>')" title="<%:Reconnect this interface%>" value="<%:Restart%>"<%=ifattr(disabled or dynamic, "disabled", "disabled")%> />
|
||||
|
||||
<% if disabled then %>
|
||||
<input type="hidden" name="cbid.network.<%=net[1]%>.__disable__" value="1" />
|
||||
<input type="submit" name="cbi.apply" class="cbi-button cbi-button-neutral" onclick="this.previousElementSibling.value='0'" title="<%:Reconnect this interface%>" value="<%:Connect%>"<%=ifattr(dynamic, "disabled", "disabled")%> />
|
||||
<% else %>
|
||||
<input type="hidden" name="cbid.network.<%=net[1]%>.__disable__" value="0" />
|
||||
<input type="submit" name="cbi.apply" class="cbi-button cbi-button-neutral" onclick="this.previousElementSibling.value='1'" title="<%:Shutdown this interface%>" value="<%:Stop%>"<%=ifattr(dynamic, "disabled", "disabled")%> />
|
||||
<% end %>
|
||||
|
||||
<input type="button" class="cbi-button cbi-button-action important" onclick="location.href='<%=url("admin/network/network", net[1])%>'" title="<%:Edit this interface%>" value="<%:Edit%>" id="<%=net[1]%>-ifc-edit"<%=ifattr(dynamic, "disabled", "disabled")%> />
|
||||
|
||||
<input type="hidden" name="cbid.network.<%=net[1]%>.__delete__" value="" />
|
||||
<input type="submit" name="cbi.apply" class="cbi-button cbi-button-negative" onclick="iface_delete(event)" value="<%:Delete%>"<%=ifattr(dynamic, "disabled", "disabled")%> />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-section-create">
|
||||
<input type="button" class="cbi-button cbi-button-add" value="<%:Add new interface...%>" onclick="location.href='<%=url("admin/network/iface_add")%>'" />
|
||||
</div>
|
||||
]])
|
||||
|
||||
local _, net
|
||||
local ifaces, netlist = { }, { }
|
||||
|
||||
for _, net in ipairs(ntm:get_networks()) do
|
||||
if net:name() ~= "loopback" then
|
||||
local zn = net:zonename()
|
||||
local z = zn and fwm:get_zone(zn) or fwm:get_zone_by_network(net:name())
|
||||
|
||||
local w = 1
|
||||
if net:is_alias() then
|
||||
w = 2
|
||||
elseif net:is_dynamic() then
|
||||
w = 3
|
||||
end
|
||||
|
||||
ifaces[#ifaces+1] = net:name()
|
||||
netlist[#netlist+1] = {
|
||||
net:name(), z and z:name() or "-", z, net, w
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(netlist,
|
||||
function(a, b)
|
||||
if a[2] ~= b[2] then
|
||||
return a[2] < b[2]
|
||||
elseif a[5] ~= b[5] then
|
||||
return a[5] < b[5]
|
||||
else
|
||||
return a[1] < b[1]
|
||||
end
|
||||
end)
|
||||
|
||||
s = m:section(TypedSection, "interface", translate("Interface Overview"))
|
||||
|
||||
function s.sections(self)
|
||||
local _, net, sl = nil, nil, { }
|
||||
|
||||
for _, net in ipairs(netlist) do
|
||||
sl[#sl+1] = net[1]
|
||||
end
|
||||
|
||||
return sl
|
||||
end
|
||||
|
||||
function s.render(self)
|
||||
tpl_networks:render({
|
||||
netlist = netlist
|
||||
})
|
||||
end
|
||||
|
||||
o = s:option(Value, "__disable__")
|
||||
|
||||
function o.cfgvalue(self, sid)
|
||||
return (m:get(sid, "auto") == "0") and "1" or "0"
|
||||
end
|
||||
|
||||
function o.write(self, sid, value)
|
||||
if value ~= "1" then
|
||||
m:set(sid, "auto", "")
|
||||
else
|
||||
m:set(sid, "auto", "0")
|
||||
end
|
||||
end
|
||||
|
||||
o.remove = o.write
|
||||
|
||||
o = s:option(Value, "__delete__")
|
||||
|
||||
function o.write(self, sid, value)
|
||||
ntm:del_network(sid)
|
||||
end
|
||||
|
||||
|
||||
m:section(SimpleSection).template = "admin_network/iface_overview_status"
|
||||
|
||||
if fs.access("/etc/init.d/dsl_control") then
|
||||
local ok, boarddata = pcall(json.parse, fs.readfile("/etc/board.json"))
|
||||
|
|
|
@ -16,7 +16,7 @@ local acct_port, acct_secret, acct_server, anonymous_identity, ant1, ant2,
|
|||
mp, nasid, network, password, pmk_r1_push, privkey, privkey2, privkeypwd,
|
||||
privkeypwd2, r0_key_lifetime, r0kh, r1_key_holder, r1kh,
|
||||
reassociation_deadline, retry_timeout, ssid, st, tp, wepkey, wepslot,
|
||||
wmm, wpakey, wps
|
||||
wmm, wpakey, wps, disassoc_low_ack, short_preamble, beacon_int, dtim_period
|
||||
|
||||
arg[1] = arg[1] or ""
|
||||
|
||||
|
@ -250,6 +250,14 @@ if hwtype == "mac80211" then
|
|||
|
||||
s:taboption("advanced", Value, "frag", translate("Fragmentation Threshold"))
|
||||
s:taboption("advanced", Value, "rts", translate("RTS/CTS Threshold"))
|
||||
|
||||
s:taboption("advanced", Flag, "noscan", translate("Force 40MHz mode"),
|
||||
translate("Always use 40MHz channels even if the secondary channel overlaps. Using this option does not comply with IEEE 802.11n-2009!")).optional = true
|
||||
|
||||
beacon_int = s:taboption("advanced", Value, "beacon_int", translate("Beacon Interval"))
|
||||
beacon_int.optional = true
|
||||
beacon_int.placeholder = 100
|
||||
beacon_int.datatype = "range(15,65535)"
|
||||
end
|
||||
|
||||
|
||||
|
@ -491,6 +499,18 @@ if hwtype == "mac80211" then
|
|||
|
||||
ifname = s:taboption("advanced", Value, "ifname", translate("Interface name"), translate("Override default interface name"))
|
||||
ifname.optional = true
|
||||
|
||||
short_preamble = s:taboption("advanced", Flag, "short_preamble", translate("Short Preamble"))
|
||||
short_preamble.default = short_preamble.enabled
|
||||
|
||||
dtim_period = s:taboption("advanced", Value, "dtim_period", translate("DTIM Interval"), translate("Delivery Traffic Indication Message Interval"))
|
||||
dtim_period.optional = true
|
||||
dtim_period.placeholder = 2
|
||||
dtim_period.datatype = "range(1,255)"
|
||||
|
||||
disassoc_low_ack = s:taboption("advanced", Flag, "disassoc_low_ack", translate("Disassociate On Low Acknowledgement"),
|
||||
translate("Allow AP mode to disconnect STAs based on low ACK condition"))
|
||||
disassoc_low_ack.default = disassoc_low_ack.enabled
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,223 @@
|
|||
-- Copyright 2018 Jo-Philipp Wich <jo@mein.io>
|
||||
-- Licensed to the public under the Apache License 2.0.
|
||||
|
||||
local fs = require "nixio.fs"
|
||||
local utl = require "luci.util"
|
||||
local tpl = require "luci.template"
|
||||
local ntm = require "luci.model.network"
|
||||
|
||||
local has_iwinfo = pcall(require, "iwinfo")
|
||||
|
||||
function guess_wifi_hw(dev)
|
||||
local bands = ""
|
||||
local ifname = dev:name()
|
||||
local name, idx = ifname:match("^([a-z]+)(%d+)")
|
||||
idx = tonumber(idx)
|
||||
|
||||
if has_iwinfo then
|
||||
local bl = dev.iwinfo.hwmodelist
|
||||
if bl and next(bl) then
|
||||
if bl.a then bands = bands .. "a" end
|
||||
if bl.b then bands = bands .. "b" end
|
||||
if bl.g then bands = bands .. "g" end
|
||||
if bl.n then bands = bands .. "n" end
|
||||
if bl.ac then bands = bands .. "ac" end
|
||||
end
|
||||
|
||||
local hw = dev.iwinfo.hardware_name
|
||||
if hw then
|
||||
return "%s 802.11%s" %{ hw, bands }
|
||||
end
|
||||
end
|
||||
|
||||
-- wl.o
|
||||
if name == "wl" then
|
||||
local name = translatef("Broadcom 802.11%s Wireless Controller", bands)
|
||||
local nm = 0
|
||||
|
||||
local fd = nixio.open("/proc/bus/pci/devices", "r")
|
||||
if fd then
|
||||
local ln
|
||||
for ln in fd:linesource() do
|
||||
if ln:match("wl$") then
|
||||
if nm == idx then
|
||||
local version = ln:match("^%S+%s+%S%S%S%S([0-9a-f]+)")
|
||||
name = translatef(
|
||||
"Broadcom BCM%04x 802.11 Wireless Controller",
|
||||
tonumber(version, 16)
|
||||
)
|
||||
|
||||
break
|
||||
else
|
||||
nm = nm + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
fd:close()
|
||||
end
|
||||
|
||||
return name
|
||||
|
||||
-- dunno yet
|
||||
else
|
||||
return translatef("Generic 802.11%s Wireless Controller", bands)
|
||||
end
|
||||
end
|
||||
|
||||
local tpl_radio = tpl.Template(nil, [[
|
||||
<div class="cbi-section-node">
|
||||
<div class="table">
|
||||
<!-- physical device -->
|
||||
<div class="tr cbi-rowstyle-2">
|
||||
<div class="td col-2 center middle">
|
||||
<span class="ifacebadge"><img src="<%=resource%>/icons/wifi_toggled.png" id="<%=dev:name()%>-iw-upstate" /> <%=dev:name()%></span>
|
||||
</div>
|
||||
<div class="td col-7 left middle">
|
||||
<big><strong><%=hw%></strong></big><br />
|
||||
<span id="<%=dev:name()%>-iw-devinfo"></span>
|
||||
</div>
|
||||
<div class="td middle cbi-section-actions">
|
||||
<div>
|
||||
<input type="button" class="cbi-button cbi-button-neutral" title="<%:Restart radio interface%>" value="<%:Restart%>" data-radio="<%=dev:name()%>" onclick="wifi_restart(event)" />
|
||||
<input type="button" class="cbi-button cbi-button-action important" title="<%:Find and join network%>" value="<%:Scan%>" onclick="cbi_submit(this, 'device', '<%=dev:name()%>', '<%=url('admin/network/wireless_join')%>')" />
|
||||
<input type="button" class="cbi-button cbi-button-add" title="<%:Provide new network%>" value="<%:Add%>" onclick="cbi_submit(this, 'device', '<%=dev:name()%>', '<%=url('admin/network/wireless_add')%>')" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /physical device -->
|
||||
|
||||
<!-- network list -->
|
||||
<% if #wnets > 0 then %>
|
||||
<% for i, net in ipairs(wnets) do local disabled = (dev:get("disabled") == "1" or net:get("disabled") == "1") %>
|
||||
<div class="tr cbi-rowstyle-<%=1 + ((i-1) % 2)%>">
|
||||
<div class="td col-2 center middle" id="<%=net:id()%>-iw-signal">
|
||||
<span class="ifacebadge" title="<%:Not associated%>"><img src="<%=resource%>/icons/signal-<%= disabled and "none" or "0" %>.png" /> 0%</span>
|
||||
</div>
|
||||
<div class="td col-7 left middle" id="<%=net:id()%>-iw-status" data-network="<%=net:id()%>" data-disabled="<%= disabled and "true" or "false" %>">
|
||||
<em><%= disabled and translate("Wireless is disabled") or translate("Collecting data...") %></em>
|
||||
</div>
|
||||
<div class="td middle cbi-section-actions">
|
||||
<div>
|
||||
<% if disabled then %>
|
||||
<input name="cbid.wireless.<%=net:name()%>.__disable__" type="hidden" value="1" />
|
||||
<input name="cbi.apply" type="submit" class="cbi-button cbi-button-neutral" title="<%:Enable this network%>" value="<%:Enable%>" onclick="this.previousElementSibling.value='0'" />
|
||||
<% else %>
|
||||
<input name="cbid.wireless.<%=net:name()%>.__disable__" type="hidden" value="0" />
|
||||
<input name="cbi.apply" type="submit" class="cbi-button cbi-button-neutral" title="<%:Disable this network%>" value="<%:Disable%>" onclick="this.previousElementSibling.value='1'" />
|
||||
<% end %>
|
||||
|
||||
<input type="button" class="cbi-button cbi-button-action important" onclick="location.href='<%=net:adminlink()%>'" title="<%:Edit this network%>" value="<%:Edit%>" />
|
||||
|
||||
<input name="cbid.wireless.<%=net:name()%>.__delete__" type="hidden" value="" />
|
||||
<input name="cbi.apply" type="submit" class="cbi-button cbi-button-negative" title="<%:Delete this network%>" value="<%:Remove%>" onclick="wifi_delete(event)" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="tr cbi-rowstyle-2">
|
||||
<div class="td left">
|
||||
<em><%:No network configured on this device%></em>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- /network list -->
|
||||
</div>
|
||||
</div>
|
||||
]])
|
||||
|
||||
|
||||
m = Map("wireless", translate("Wireless Overview"))
|
||||
m:chain("network")
|
||||
m.pageaction = false
|
||||
|
||||
if not has_iwinfo then
|
||||
s = m:section(NamedSection, "__warning__")
|
||||
|
||||
function s.render(self)
|
||||
tpl.render_string([[
|
||||
<div class="alert-message warning">
|
||||
<h4><%:Package libiwinfo required!%></h4>
|
||||
<p><%_The <em>libiwinfo-lua</em> package is not installed. You must install this component for working wireless configuration!%></p>
|
||||
</div>
|
||||
]])
|
||||
end
|
||||
end
|
||||
|
||||
local _, dev, net
|
||||
for _, dev in ipairs(ntm:get_wifidevs()) do
|
||||
s = m:section(TypedSection)
|
||||
s.wnets = dev:get_wifinets()
|
||||
|
||||
function s.render(self, sid)
|
||||
tpl_radio:render({
|
||||
hw = guess_wifi_hw(dev),
|
||||
dev = dev,
|
||||
wnets = self.wnets
|
||||
})
|
||||
end
|
||||
|
||||
function s.cfgsections(self)
|
||||
local _, net, sl = nil, nil, { }
|
||||
for _, net in ipairs(self.wnets) do
|
||||
sl[#sl+1] = net:name()
|
||||
self.wnets[net:name()] = net
|
||||
end
|
||||
return sl
|
||||
end
|
||||
|
||||
o = s:option(Value, "__disable__")
|
||||
|
||||
function o.cfgvalue(self, sid)
|
||||
local wnet = self.section.wnets[sid]
|
||||
local wdev = wnet:get_device()
|
||||
|
||||
return ((wnet and wnet:get("disabled") == "1") or
|
||||
(wdev and wdev:get("disabled") == "1")) and "1" or "0"
|
||||
end
|
||||
|
||||
function o.write(self, sid, value)
|
||||
local wnet = self.section.wnets[sid]
|
||||
local wdev = wnet:get_device()
|
||||
|
||||
if value ~= "1" then
|
||||
wnet:set("disabled", nil)
|
||||
wdev:set("disabled", nil)
|
||||
else
|
||||
wnet:set("disabled", "1")
|
||||
end
|
||||
end
|
||||
|
||||
o.remove = o.write
|
||||
|
||||
|
||||
o = s:option(Value, "__delete__")
|
||||
|
||||
function o.write(self, sid, value)
|
||||
local wnet = self.section.wnets[sid]
|
||||
local nets = wnet:get_networks()
|
||||
|
||||
ntm:del_wifinet(wnet:id())
|
||||
|
||||
local _, net
|
||||
for _, net in ipairs(nets) do
|
||||
if net:is_empty() then
|
||||
ntm:del_network(net:name())
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
s = m:section(NamedSection, "__script__")
|
||||
s.template = "admin_network/wifi_overview_status"
|
||||
|
||||
s = m:section(NamedSection, "__assoclist__")
|
||||
|
||||
function s.render(self, sid)
|
||||
tpl.render_string([[
|
||||
<h2><%:Associated Stations%></h2>
|
||||
<%+admin_network/wifi_assoclist%>
|
||||
]])
|
||||
end
|
||||
|
||||
return m
|
Loading…
Add table
Add a link
Reference in a new issue