1
0
Fork 0
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:
Ycarus 2018-07-23 17:36:03 +02:00
parent 7a86a163f5
commit 602a83668e
74 changed files with 7498 additions and 3067 deletions

View file

@ -8,20 +8,17 @@
<%
local fs = require "nixio.fs"
local has_ping6 = fs.access("/bin/ping6") or fs.access("/usr/bin/ping6")
local has_traceroute6 = fs.access("/usr/bin/traceroute6")
local has_traceroute6 = fs.access("/bin/traceroute6") or fs.access("/usr/bin/traceroute6")
local has_speedtest = fs.access("/usr/sbin/speedtestc")
local has_iperf3 = fs.access("/usr/bin/iperf3")
local has_curl = fs.access("/usr/bin/curl")
local has_netstat = fs.access("/bin/netstat")
local dns_host = luci.config.diag and luci.config.diag.dns or "dev.openwrt.org"
local ping_host = luci.config.diag and luci.config.diag.ping or "dev.openwrt.org"
local route_host = luci.config.diag and luci.config.diag.route or "dev.openwrt.org"
local iperf3_host = luci.config.diag and luci.config.diag.iperf3 or "ping-ams1.online.net"
local getip_host = luci.config.diag and luci.config.diag.getip or "ifconfig.co"
%>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<script type="text/javascript">//<![CDATA[
var stxhr = new XHR();
@ -113,13 +110,6 @@ local getip_host = luci.config.diag and luci.config.diag.getip or "ifconfig.co"
</div>
<% end %>
<% if has_iperf3 then %>
<div class="td left">
<input style="margin: 5px 0" type="text" value="<%=iperf3_host%>" name="iperf3" /><br />
<input type="button" value="<%:Iperf3%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.iperf3)" />
</div>
<% end %>
<% if has_curl then %>
<div class="td left">
<input style="margin: 5px 0" type="hidden" value="<%=getip_host%>" name="getip" /><br />

View file

@ -1,251 +0,0 @@
<%#
Copyright 2010 Jo-Philipp Wich <jow@openwrt.org>
Licensed to the public under the Apache License 2.0.
-%>
<%-
local ntm = require "luci.model.network".init()
local fwm = require "luci.model.firewall".init()
local net
local ifaces = { }
local netlist = { }
for _, net in ipairs(ntm:get_networks()) do
if net:name() ~= "loopback" then
local z = fwm:get_zone_by_network(net:name())
ifaces[#ifaces+1] = net:name()
netlist[#netlist+1] = {
net:name(), z and z:name() or "-", z
}
end
end
table.sort(netlist,
function(a, b)
if a[2] ~= b[2] then
return a[2] < b[2]
else
return a[1] < b[1]
end
end)
-%>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<script type="text/javascript">//<![CDATA[
function iface_shutdown(id, reconnect) {
if (!reconnect && !confirm(<%=luci.http.write_json(translate('Really shutdown interface "%s"? You might lose access to this device if you are connected via this interface.'))%>.format(id)))
return;
var d = document.getElementById(id + '-ifc-description');
if (d)
d.innerHTML = reconnect
? '<em><%:Interface is reconnecting...%></em>'
: '<em><%:Interface is shutting down...%></em>';
var s = document.getElementById('ifc-rc-status');
if (s)
{
s.parentNode.style.display = 'block';
s.innerHTML = '<%:Waiting for changes to be applied...%>';
}
(new XHR()).post('<%=url('admin/network')%>/iface_' + (reconnect ? 'reconnect' : 'shutdown') + '/' + id, { token: '<%=token%>' },
function(x)
{
if (s)
{
s.innerHTML = reconnect
? '<%:Interface reconnected%>'
: '<%:Interface shut down%>';
window.setTimeout(function() {
s.parentNode.style.display = 'none';
}, 1000);
}
}
);
}
function iface_delete(id) {
if (!confirm(<%=luci.http.write_json(translate('Really delete this interface? The deletion cannot be undone! You might lose access to this device if you are connected via this interface'))%>))
return;
(new XHR()).post('<%=url('admin/network/iface_delete')%>/' + id, { token: '<%=token%>' },
function(x) {
location.href = '<%=url('admin/network/network')%>';
}
);
}
var iwxhr = new XHR();
var wifidevs = <%=luci.http.write_json(netdevs)%>;
var arptable = <%=luci.http.write_json(arpcache)%>;
XHR.poll(5, '<%=url('admin/network/iface_status', table.concat(ifaces, ","))%>', null,
function(x, ifcs)
{
if (ifcs)
{
for (var idx = 0; idx < ifcs.length; idx++)
{
var ifc = ifcs[idx];
var html = '';
var s = document.getElementById(ifc.id + '-ifc-devices');
if (s)
{
var stat = String.format(
'<img src="<%=resource%>/icons/%s%s.png" style="width:16px; height:16px; vertical-align:middle" />',
ifc.type,
ifc.is_up ? '' : '_disabled'
);
if (ifc.subdevices && ifc.subdevices.length)
{
stat += ' <strong>(';
for (var j = 0; j < ifc.subdevices.length; j++)
{
var sif = ifc.subdevices[j];
stat += String.format(
'<img src="<%=resource%>/icons/%s%s.png" style="width:16px; height:16px; vertical-align:middle" title="%h" />',
sif.type,
sif.is_up ? '' : '_disabled',
sif.name
);
}
stat += ')</strong>';
}
stat += String.format(
'<br /><small>%h</small>',
ifc.name
);
s.innerHTML = stat;
}
var d = document.getElementById(ifc.id + '-ifc-description');
if (d && ifc.proto && ifc.ifname)
{
if (ifc.is_up)
{
html += String.format('<strong><%:Uptime%>:</strong> %t<br />', ifc.uptime);
}
if (ifc.macaddr)
{
html += String.format('<strong><%:MAC-Address%>:</strong> %s<br />', ifc.macaddr);
}
html += String.format(
'<strong><%:RX%>:</strong> %.2mB (%d <%:Pkts.%>)<br />' +
'<strong><%:TX%>:</strong> %.2mB (%d <%:Pkts.%>)<br />',
ifc.rx_bytes, ifc.rx_packets,
ifc.tx_bytes, ifc.tx_packets
);
if (ifc.ipaddrs && ifc.ipaddrs.length)
{
for (var i = 0; i < ifc.ipaddrs.length; i++)
html += String.format(
'<strong><%:IPv4%>:</strong> %s<br />',
ifc.ipaddrs[i]
);
}
if (ifc.ip6addrs && ifc.ip6addrs.length)
{
for (var i = 0; i < ifc.ip6addrs.length; i++)
html += String.format(
'<strong><%:IPv6%>:</strong> %s<br />',
ifc.ip6addrs[i]
);
}
if (ifc.ip6prefix)
{
html += String.format('<strong><%:IPv6-PD%>:</strong> %s<br />', ifc.ip6prefix);
}
d.innerHTML = html;
}
else if (d && !ifc.proto)
{
var e = document.getElementById(ifc.id + '-ifc-edit');
if (e)
e.disabled = true;
d.innerHTML = String.format(
'<em><%:Unsupported protocol type.%></em><br />' +
'<a href="%h"><%:Install protocol extensions...%></a>',
'<%=url("admin/system/packages")%>?query=luci-proto&display=available'
);
}
else if (d && !ifc.ifname)
{
d.innerHTML = String.format(
'<em><%:Network without interfaces.%></em><br />' +
'<a href="<%=url("admin/network/network/%s")%>?tab.network.%s=physical"><%:Assign interfaces...%></a>',
ifc.name, ifc.name
);
}
else if (d)
{
d.innerHTML = '<em><%:Interface not present or not connected yet.%></em>';
}
}
}
}
);
//]]></script>
<fieldset class="cbi-section" style="display:none">
<legend><%:Reconnecting interface%></legend>
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" />
<span id="ifc-rc-status"><%:Waiting for changes to be applied...%></span>
</fieldset>
<div class="cbi-map">
<div class="cbi-section">
<legend><%:Interface Overview%></legend>
<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")
%>
<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">
<img src="<%=resource%>/icons/ethernet_disabled.png" style="width:16px; height:16px" /><br />
<small>?</small>
</div>
</div>
</div>
<div class="td col-5 left" id="<%=net[1]%>-ifc-description">
<em><%:Collecting data...%></em>
</div>
<div class="td cbi-section-actions">
<input type="button" class="cbi-button cbi-button-neutral" onclick="iface_shutdown('<%=net[1]%>', true)" title="<%:Reconnect this interface%>" value="<%:Connect%>" />
<input type="button" class="cbi-button cbi-button-neutral" onclick="iface_shutdown('<%=net[1]%>', false)" title="<%:Shutdown this interface%>" value="<%:Stop%>" />
<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" />
<input type="button" class="cbi-button cbi-button-negative" onclick="iface_delete('<%=net[1]%>')" value="<%:Delete%>" />
</div>
</div>
<% end %>
</div>
</div>
<input type="button" class="cbi-button cbi-button-add" value="<%:Add new interface...%>" onclick="location.href='<%=url("admin/network/iface_add")%>'" />
</div>
</div>

View file

@ -0,0 +1,183 @@
<%#
Copyright 2010-2018 Jo-Philipp Wich <jo@mein.io>
Licensed to the public under the Apache License 2.0.
-%>
<script type="text/javascript">//<![CDATA[
function iface_reconnect(id) {
XHR.halt();
var d = document.getElementById(id + '-ifc-description');
if (d) d.innerHTML = '<em><%:Interface is reconnecting...%></em>';
(new XHR()).post('<%=url('admin/network/iface_reconnect')%>/' + id,
{ token: '<%=token%>' }, XHR.run);
}
function iface_delete(ev) {
if (!confirm(<%=luci.http.write_json(translate('Really delete this interface? The deletion cannot be undone! You might lose access to this device if you are connected via this interface'))%>)) {
ev.preventDefault();
return false;
}
ev.target.previousElementSibling.value = '1';
return true;
}
var networks = [];
document.querySelectorAll('[data-network]').forEach(function(n) {
networks.push(n.getAttribute('data-network'));
});
function render_iface(ifc) {
return E('span', { class: 'cbi-tooltip-container' }, [
E('img', { 'class' : 'middle', 'src': '<%=resource%>/icons/%s%s.png'.format(
ifc.is_alias ? 'alias' : ifc.type,
ifc.is_up ? '' : '_disabled') }),
E('span', { 'class': 'cbi-tooltip ifacebadge large' }, [
E('img', { 'src': '<%=resource%>/icons/%s%s.png'.format(
ifc.type, ifc.is_up ? '' : '_disabled') }),
E('span', { 'class': 'left' }, [
E('strong', '<%:Type%>: '), ifc.typename, E('br'),
E('strong', '<%:Device%>: '), ifc.ifname, E('br'),
E('strong', '<%:Connected%>: '), ifc.is_up ? '<%:yes%>' : '<%:no%>', E('br'),
ifc.macaddr ? E('strong', '<%:MAC%>: ') : '',
ifc.macaddr ? ifc.macaddr : '',
ifc.macaddr ? E('br') : '',
E('strong', '<%:RX%>: '), '%.2mB (%d <%:Pkts.%>)'.format(ifc.rx_bytes, ifc.rx_packets), E('br'),
E('strong', '<%:TX%>: '), '%.2mB (%d <%:Pkts.%>)'.format(ifc.tx_bytes, ifc.tx_packets)
])
])
]);
}
XHR.poll(5, '<%=url('admin/network/iface_status')%>/' + networks.join(','), null,
function(x, ifcs)
{
if (ifcs)
{
for (var idx = 0; idx < ifcs.length; idx++)
{
var ifc = ifcs[idx];
var html = '';
var s = document.getElementById(ifc.id + '-ifc-devices');
if (s)
{
while (s.firstChild)
s.removeChild(s.firstChild);
s.appendChild(render_iface(ifc));
if (ifc.subdevices && ifc.subdevices.length)
{
var sifs = [ ' (' ];
for (var j = 0; j < ifc.subdevices.length; j++)
sifs.push(render_iface(ifc.subdevices[j]));
sifs.push(')');
s.appendChild(E('span', {}, sifs));
}
s.appendChild(E('br'));
s.appendChild(E('small', {}, ifc.is_alias ? '<%:Alias of "%s"%>'.format(ifc.is_alias) : ifc.name));
}
var d = document.getElementById(ifc.id + '-ifc-description');
if (d && ifc.proto && ifc.ifname)
{
var desc = null;
if (ifc.is_dynamic)
desc = '<%:Virtual dynamic interface%>';
else if (ifc.is_alias)
desc = '<%:Alias interface%>';
if (ifc.desc)
desc = desc ? '%s (%s)'.format(desc, ifc.desc) : ifc.desc;
html += String.format('<strong><%:Protocol%>:</strong> %h<br />', desc || '?');
if (ifc.is_up)
{
html += String.format('<strong><%:Uptime%>:</strong> %t<br />', ifc.uptime);
}
if (!ifc.is_dynamic && !ifc.is_alias)
{
if (ifc.macaddr)
html += String.format('<strong><%:MAC-Address%>:</strong> %s<br />', ifc.macaddr);
html += String.format(
'<strong><%:RX%>:</strong> %.2mB (%d <%:Pkts.%>)<br />' +
'<strong><%:TX%>:</strong> %.2mB (%d <%:Pkts.%>)<br />',
ifc.rx_bytes, ifc.rx_packets,
ifc.tx_bytes, ifc.tx_packets
);
}
if (ifc.ipaddrs && ifc.ipaddrs.length)
{
for (var i = 0; i < ifc.ipaddrs.length; i++)
html += String.format(
'<strong><%:IPv4%>:</strong> %s<br />',
ifc.ipaddrs[i]
);
}
if (ifc.ip6addrs && ifc.ip6addrs.length)
{
for (var i = 0; i < ifc.ip6addrs.length; i++)
html += String.format(
'<strong><%:IPv6%>:</strong> %s<br />',
ifc.ip6addrs[i]
);
}
if (ifc.ip6prefix)
html += String.format('<strong><%:IPv6-PD%>:</strong> %s<br />', ifc.ip6prefix);
if (ifc.errors)
{
for (var i = 0; i < ifc.errors.length; i++)
html += String.format(
'<em class="error"><strong><%:Error%>:</strong> %h</em><br />',
ifc.errors[i]
);
}
d.innerHTML = html;
}
else if (d && !ifc.proto)
{
var e = document.getElementById(ifc.id + '-ifc-edit');
if (e)
e.disabled = true;
d.innerHTML = String.format(
'<em><%:Unsupported protocol type.%></em><br />' +
'<a href="%h"><%:Install protocol extensions...%></a>',
'<%=url("admin/system/packages")%>?query=luci-proto&display=available'
);
}
else if (d && !ifc.ifname)
{
d.innerHTML = String.format(
'<em><%:Network without interfaces.%></em><br />' +
'<a href="<%=url("admin/network/network/%s")%>?tab.network.%s=physical"><%:Assign interfaces...%></a>',
ifc.name, ifc.name
);
}
else if (d)
{
d.innerHTML = '<em><%:Interface not present or not connected yet.%></em>';
}
}
}
}
);
//]]></script>

View file

@ -8,56 +8,6 @@
local sys = require "luci.sys"
local utl = require "luci.util"
function guess_wifi_signal(info)
local scale = (100 / (info.quality_max or 100) * (info.quality or 0))
local icon
if not info.bssid or info.bssid == "00:00:00:00:00:00" then
icon = resource .. "/icons/signal-none.png"
elseif scale < 15 then
icon = resource .. "/icons/signal-0.png"
elseif scale < 35 then
icon = resource .. "/icons/signal-0-25.png"
elseif scale < 55 then
icon = resource .. "/icons/signal-25-50.png"
elseif scale < 75 then
icon = resource .. "/icons/signal-50-75.png"
else
icon = resource .. "/icons/signal-75-100.png"
end
return icon
end
function percent_wifi_signal(info)
local qc = info.quality or 0
local qm = info.quality_max or 0
if info.bssid and qc > 0 and qm > 0 then
return math.floor((100 / qm) * qc)
else
return 0
end
end
function format_wifi_encryption(info)
if info.wep == true then
return "WEP"
elseif info.wpa > 0 then
return translatef("<abbr title='Pairwise: %s / Group: %s'>%s - %s</abbr>",
table.concat(info.pair_ciphers, ", "),
table.concat(info.group_ciphers, ", "),
(info.wpa == 3) and translate("mixed WPA/WPA2")
or (info.wpa == 2 and "WPA2" or "WPA"),
table.concat(info.auth_suites, ", ")
)
elseif info.enabled then
return "<em>%s</em>" % translate("unknown")
else
return "<em>%s</em>" % translate("open")
end
end
local dev = luci.http.formvalue("device")
local iw = luci.sys.wifi.getiwinfo(dev)
@ -65,91 +15,198 @@
luci.http.redirect(luci.dispatcher.build_url("admin/network/wireless"))
return
end
function scanlist(times)
local i, k, v
local l = { }
local s = { }
for i = 1, times do
for k, v in ipairs(iw.scanlist or { }) do
if not s[v.bssid] then
l[#l+1] = v
s[v.bssid] = true
end
end
end
return l
end
-%>
<%+header%>
<script type="text/javascript">//<![CDATA[
var xhr = new XHR(),
poll = null;
function format_signal(bss) {
var qval = bss.quality || 0,
qmax = bss.quality_max || 100,
scale = 100 / qmax * qval,
range = 'none';
if (!bss.bssid || bss.bssid == '00:00:00:00:00:00')
range = 'none';
else if (scale < 15)
range = '0';
else if (scale < 35)
range = '0-25';
else if (scale < 55)
range = '25-50';
else if (scale < 75)
range = '50-75';
else
range = '75-100';
return E('span', {
class: 'ifacebadge',
title: '<%:Signal%>: %d<%:dB%> / <%:Quality%>: %d/%d'.format(bss.signal, qval, qmax)
}, [
E('img', { src: '<%=resource%>/icons/signal-%s.png'.format(range) }),
' %d%%'.format(scale)
]);
}
function format_encryption(bss) {
var enc = bss.encryption || { }
if (enc.wep === true)
return 'WEP';
else if (enc.wpa > 0)
return E('abbr', {
title: 'Pairwise: %h / Group: %h'.format(
enc.pair_ciphers.join(', '),
enc.group_ciphers.join(', '))
},
'%h - %h'.format(
(enc.wpa === 3) ? '<%:mixed WPA/WPA2%>' : (enc.wpa === 2 ? 'WPA2' : 'WPA'),
enc.auth_suites.join(', ')));
else if (enc.enabled)
return '<em><%:unknown%></em>';
else
return '<em><%:open%></em>';
}
function format_actions(bss) {
var enc = bss.encryption || { },
input = [
E('input', { type: 'submit', class: 'cbi-button cbi-button-action important', value: '<%:Join Network%>' }),
E('input', { type: 'hidden', name: 'token', value: '<%=token%>' }),
E('input', { type: 'hidden', name: 'device', value: '<%=dev%>' }),
E('input', { type: 'hidden', name: 'join', value: bss.ssid }),
E('input', { type: 'hidden', name: 'mode', value: bss.mode }),
E('input', { type: 'hidden', name: 'bssid', value: bss.bssid }),
E('input', { type: 'hidden', name: 'channel', value: bss.channel }),
E('input', { type: 'hidden', name: 'clbridge', value: <%=iw.type == "wl" and 1 or 0%> }),
E('input', { type: 'hidden', name: 'wep', value: enc.wep ? 1 : 0 })
];
if (enc.wpa) {
input.push(E('input', { type: 'hidden', name: 'wpa_version', value: enc.wpa }));
enc.auth_suites.forEach(function(s) {
input.push(E('input', { type: 'hidden', name: 'wpa_suites', value: s }));
});
enc.group_ciphers.forEach(function(s) {
input.push(E('input', { type: 'hidden', name: 'wpa_group', value: s }));
});
enc.pair_ciphers.forEach(function(s) {
input.push(E('input', { type: 'hidden', name: 'wpa_pairwise', value: s }));
});
}
return E('form', {
class: 'inline',
method: 'post',
action: '<%=url("admin/network/wireless_join")%>'
}, input);
}
function fade(bss, content) {
if (bss.stale)
return E('span', { style: 'opacity:0.5' }, content);
else
return content;
}
function flush() {
XHR.stop(poll);
XHR.halt();
scan();
}
function scan() {
var tbl = document.getElementById('scan_results');
cbi_update_table(tbl, [], '<em><img src="<%=resource%>/icons/loading.gif" class="middle" /> <%:Starting wireless scan...%></em>');
xhr.post('<%=url("admin/network/wireless_scan_trigger", dev)%>', { token: '<%=token%>' },
function(s) {
if (s.status !== 200) {
cbi_update_table(tbl, [], '<em><%:Scan request failed%></em>');
return;
}
var count = 0;
poll = XHR.poll(3, '<%=url("admin/network/wireless_scan_results", dev)%>', null,
function(s, results) {
if (Array.isArray(results)) {
var bss = [];
results.sort(function(a, b) {
var diff = (b.quality - a.quality) || (a.channel - b.channel);
if (diff)
return diff;
if (a.ssid < b.ssid)
return -1;
else if (a.ssid > b.ssid)
return 1;
if (a.bssid < b.bssid)
return -1;
else if (a.bssid > b.bssid)
return 1;
}).forEach(function(res) {
bss.push([
fade(res, format_signal(res)),
fade(res, res.ssid ? '%h'.format(res.ssid) : E('em', {}, '<%:hidden%>')),
fade(res, res.channel),
fade(res, res.mode),
fade(res, res.bssid),
fade(res, format_encryption(res)),
format_actions(res)
]);
});
cbi_update_table(tbl, bss, '<em><img src="<%=resource%>/icons/loading.gif" class="middle" /> <%:No scan results available yet...%>');
}
if (count++ >= 3) {
count = 0;
xhr.post('<%=url("admin/network/wireless_scan_trigger", dev, "1")%>',
{ token: '<%=token%>' }, function() { });
}
});
XHR.run();
});
}
document.addEventListener('DOMContentLoaded', scan);
//]]></script>
<h2 name="content"><%:Join Network: Wireless Scan%></h2>
<div class="cbi-map">
<div class="cbi-section">
<div class="table">
<div class="table" id="scan_results">
<div class="tr table-titles">
<div class="th col-1 center"><%:Signal%></div>
<div class="th col-5 left"><%:SSID%></div>
<div class="th col-2 center"><%:Channel%></div>
<div class="th col-2 left"><%:Mode%></div>
<div class="th col-3 left"><%:BSSID%></div>
<div class="th col-2 left"><%:Encryption%></div>
<div class="th col-1 middle center"><%:Signal%></div>
<div class="th col-5 middle left"><%:SSID%></div>
<div class="th col-2 middle center"><%:Channel%></div>
<div class="th col-2 middle left"><%:Mode%></div>
<div class="th col-3 middle left"><%:BSSID%></div>
<div class="th col-2 middle left"><%:Encryption%></div>
<div class="th cbi-section-actions">&#160;</div>
</div>
<!-- scan list -->
<% for i, net in ipairs(scanlist(3)) do net.encryption = net.encryption or { } %>
<div class="tr cbi-rowstyle-<%=1 + ((i-1) % 2)%>">
<div class="td col-1 center">
<abbr title="<%:Signal%>: <%=net.signal%> <%:dB%> / <%:Quality%>: <%=net.quality%>/<%=net.quality_max%>">
<img src="<%=guess_wifi_signal(net)%>" /><br />
<small><%=percent_wifi_signal(net)%>%</small>
</abbr>
</div>
<div class="td col-5 left" data-title="<%:SSID%>">
<strong><%=net.ssid and utl.pcdata(net.ssid) or "<em>%s</em>" % translate("hidden")%></strong>
</div>
<div class="td col-2 center" data-title="<%:Channel%>">
<%=net.channel%>
</div>
<div class="td col-2 left" data-title="<%:Mode%>">
<%=net.mode%>
</div>
<div class="td col-3 left" data-title="<%:BSSID%>">
<%=net.bssid%>
</div>
<div class="td col-2 left" data-title="<%:Encryption%>">
<%=format_wifi_encryption(net.encryption)%>
</div>
<div class="td cbi-section-actions">
<form action="<%=url('admin/network/wireless_join')%>" method="post">
<input type="hidden" name="token" value="<%=token%>" />
<input type="hidden" name="device" value="<%=utl.pcdata(dev)%>" />
<input type="hidden" name="join" value="<%=utl.pcdata(net.ssid)%>" />
<input type="hidden" name="mode" value="<%=net.mode%>" />
<input type="hidden" name="bssid" value="<%=net.bssid%>" />
<input type="hidden" name="channel" value="<%=net.channel%>" />
<input type="hidden" name="wep" value="<%=net.encryption.wep and 1 or 0%>" />
<% if net.encryption.wpa then %>
<input type="hidden" name="wpa_version" value="<%=net.encryption.wpa%>" />
<% for _, v in ipairs(net.encryption.auth_suites) do %><input type="hidden" name="wpa_suites" value="<%=v%>" />
<% end; for _, v in ipairs(net.encryption.group_ciphers) do %><input type="hidden" name="wpa_group" value="<%=v%>" />
<% end; for _, v in ipairs(net.encryption.pair_ciphers) do %><input type="hidden" name="wpa_pairwise" value="<%=v%>" />
<% end; end %>
<input type="hidden" name="clbridge" value="<%=iw.type == "wl" and 1 or 0%>" />
<input class="cbi-button cbi-button-action important" type="submit" value="<%:Join Network%>" />
</form>
<div class="tr placeholder">
<div class="td">
<img src="<%=resource%>/icons/loading.gif" class="middle" />
<em><%:Collecting data...%></em>
</div>
</div>
<% end %>
<!-- /scan list -->
</div>
</div>
</div>
@ -160,7 +217,7 @@
<form class="inline" action="<%=url('admin/network/wireless_join')%>" method="post">
<input type="hidden" name="token" value="<%=token%>" />
<input type="hidden" name="device" value="<%=utl.pcdata(dev)%>" />
<input class="cbi-button cbi-button-action" type="submit" value="<%:Repeat scan%>" />
<input type="button" class="cbi-button cbi-button-action" value="<%:Repeat scan%>" onclick="flush()" />
</form>
</div>

View file

@ -1,354 +0,0 @@
<%#
Copyright 2008-2009 Steven Barth <steven@midlink.org>
Copyright 2008-2015 Jo-Philipp Wich <jow@openwrt.org>
Licensed to the public under the Apache License 2.0.
-%>
<%-
local ip = require "luci.ip"
local fs = require "nixio.fs"
local utl = require "luci.util"
local uci = require "luci.model.uci".cursor()
local ntm = require "luci.model.network"
local has_iwinfo = pcall(require, "iwinfo")
ntm.init(uci)
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
-- ralink
elseif name == "ra" then
return translatef("RaLink 802.11%s Wireless Controller", bands)
-- hermes
elseif name == "eth" then
return translate("Hermes 802.11b Wireless Controller")
-- hostap
elseif name == "wlan" and fs.stat("/proc/net/hostap/" .. ifname, "type") == "dir" then
return translate("Prism2/2.5/3 802.11b Wireless Controller")
-- dunno yet
else
return translatef("Generic 802.11%s Wireless Controller", bands)
end
end
local devices = ntm:get_wifidevs()
local netlist = { }
local netdevs = { }
local dev
for _, dev in ipairs(devices) do
local net
for _, net in ipairs(dev:get_wifinets()) do
netlist[#netlist+1] = net:id()
netdevs[net:id()] = dev:name()
end
end
-%>
<%+header%>
<% if not has_iwinfo then %>
<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 %>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<script type="text/javascript">//<![CDATA[
var wifidevs = <%=luci.http.write_json(netdevs)%>;
var is_reconnecting = false;
function wifi_shutdown(id, toggle) {
var reconnect = (toggle.getAttribute('active') == 'false');
if (!reconnect && !confirm(<%=luci.http.write_json(translate('Really shut down network? You might lose access to this device if you are connected via this interface'))%>))
return;
is_reconnecting = true;
var s = document.getElementById('iw-rc-status');
if (s)
{
s.parentNode.style.display = 'block';
s.innerHTML = '<%:Waiting for changes to be applied...%>';
}
for (var net in wifidevs)
{
var st = document.getElementById(net + '-iw-status');
if (st)
st.innerHTML = '<em><%:Wireless is restarting...%></em>';
}
(new XHR()).post('<%=url('admin/network')%>/wireless_' + (reconnect ? 'reconnect' : 'shutdown') + '/' + id, { token: '<%=token%>' },
function(x)
{
if (s)
{
s.innerHTML = reconnect
? '<%:Wireless restarted%>'
: '<%:Wireless shut down%>';
window.setTimeout(function() {
s.parentNode.style.display = 'none';
is_reconnecting = false;
}, 1000);
}
}
);
}
function wifi_delete(id) {
if (!confirm(<%=luci.http.write_json(translate('Really delete this wireless network? The deletion cannot be undone! You might lose access to this device if you are connected via this network.'))%>))
return;
(new XHR()).post('<%=url('admin/network/wireless_delete')%>/' + id, { token: '<%=token%>' },
function(x) {
location.href = '<%=url('admin/network/wireless')%>';
}
);
}
var hosts = <%=luci.http.write_json(luci.sys.net.host_hints())%>;
XHR.poll(5, '<%=url('admin/network/wireless_status', table.concat(netlist, ","))%>', null,
function(x, st)
{
if (st)
{
var rowstyle = 1;
var radiostate = { };
st.forEach(function(s) {
var r = radiostate[wifidevs[s.id]] || (radiostate[wifidevs[s.id]] = {});
s.is_assoc = (s.bssid && s.bssid != '00:00:00:00:00:00' && s.channel && s.mode != 'Unknown' && !s.disabled);
r.up = r.up || s.is_assoc;
r.channel = r.channel || s.channel;
r.bitrate = r.bitrate || s.bitrate;
r.frequency = r.frequency || s.frequency;
});
for( var i = 0; i < st.length; i++ )
{
var iw = st[i];
var p = iw.quality;
var q = iw.is_assoc ? p : -1;
var icon;
if (q < 0)
icon = "<%=resource%>/icons/signal-none.png";
else if (q == 0)
icon = "<%=resource%>/icons/signal-0.png";
else if (q < 25)
icon = "<%=resource%>/icons/signal-0-25.png";
else if (q < 50)
icon = "<%=resource%>/icons/signal-25-50.png";
else if (q < 75)
icon = "<%=resource%>/icons/signal-50-75.png";
else
icon = "<%=resource%>/icons/signal-75-100.png";
var sig = document.getElementById(iw.id + '-iw-signal');
if (sig)
sig.innerHTML = String.format(
'<span class="ifacebadge" title="<%:Signal%>: %d <%:dBm%> / <%:Noise%>: %d <%:dBm%>"><img src="%s" /> %d%%</span>',
iw.signal, iw.noise, icon, p
);
var toggle = document.getElementById(iw.id + '-iw-toggle');
if (toggle)
{
if (!iw.disabled)
{
toggle.className = 'cbi-button cbi-button-neutral';
toggle.value = '<%:Disable%>';
toggle.title = '<%:Shutdown this network%>';
}
else
{
toggle.className = 'cbi-button cbi-button-neutral';
toggle.value = '<%:Enable%>';
toggle.title = '<%:Activate this network%>';
}
toggle.setAttribute('active', !iw.disabled);
}
var info = document.getElementById(iw.id + '-iw-status');
if (info)
{
if (iw.is_assoc)
info.innerHTML = String.format(
'<strong><%:SSID%>:</strong> %h | ' +
'<strong><%:Mode%>:</strong> %s<br />' +
'<strong><%:BSSID%>:</strong> %s | ' +
'<strong><%:Encryption%>:</strong> %s',
iw.ssid, iw.mode, iw.bssid,
iw.encryption ? iw.encryption : '<%:None%>'
);
else
info.innerHTML = String.format(
'<strong><%:SSID%>:</strong> %h | ' +
'<strong><%:Mode%>:</strong> %s<br />' +
'<em>%s</em>',
iw.ssid || '?', iw.mode,
is_reconnecting
? '<em><%:Wireless is restarting...%></em>'
: '<em><%:Wireless is disabled or not associated%></em>'
);
}
}
for (var dev in radiostate)
{
var img = document.getElementById(dev + '-iw-upstate');
if (img)
img.src = '<%=resource%>/icons/wifi' + (radiostate[dev].up ? '' : '_disabled') + '.png';
var stat = document.getElementById(dev + '-iw-devinfo');
if (stat)
stat.innerHTML = String.format(
'<strong><%:Channel%>:</strong> %s (%s <%:GHz%>) | ' +
'<strong><%:Bitrate%>:</strong> %s <%:Mbit/s%>',
radiostate[dev].channel ? radiostate[dev].channel : '?',
radiostate[dev].frequency ? radiostate[dev].frequency : '?',
radiostate[dev].bitrate ? radiostate[dev].bitrate : '?'
);
}
}
}
);
//]]></script>
<h2 name="content"><%:Wireless Overview%></h2>
<div class="cbi-section" style="display:none">
<legend><%:Reconnecting interface%></legend>
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" />
<span id="iw-rc-status"><%:Waiting for changes to be applied...%></span>
</div>
<div id="cbi-wireless-overview" class="cbi-map">
<% for _, dev in ipairs(devices) do local nets = dev:get_wifinets() %>
<!-- device <%=dev:name()%> -->
<div class="cbi-section-node">
<div class="table">
<!-- physical device -->
<div class="tr">
<div class="td col-2 center">
<span class="ifacebadge"><img src="<%=resource%>/icons/wifi_disabled.png" id="<%=dev:name()%>-iw-upstate" /> <%=dev:name()%></span>
</div>
<div class="td col-7 left">
<big><strong><%=guess_wifi_hw(dev)%></strong></big><br />
<span id="<%=dev:name()%>-iw-devinfo"></span>
</div>
<div class="td cbi-section-actions">
<form action="<%=url('admin/network/wireless_join')%>" method="post" class="inline">
<input type="hidden" name="device" value="<%=dev:name()%>" />
<input type="hidden" name="token" value="<%=token%>" />
<input type="submit" class="cbi-button cbi-button-action" title="<%:Find and join network%>" value="<%:Scan%>" />
</form>
<form action="<%=url('admin/network/wireless_add')%>" method="post" class="inline">
<input type="hidden" name="device" value="<%=dev:name()%>" />
<input type="hidden" name="token" value="<%=token%>" />
<input type="submit" class="cbi-button cbi-button-add" title="<%:Provide new network%>" value="<%:Add%>" />
</form>
</div>
</div>
<!-- /physical device -->
<!-- network list -->
<% if #nets > 0 then %>
<% for i, net in ipairs(nets) do %>
<div class="tr cbi-rowstyle-<%=1 + ((i-1) % 2)%>">
<div class="td col-2 center" id="<%=net:id()%>-iw-signal">
<span class="ifacebadge" title="<%:Not associated%>"><img src="<%=resource%>/icons/signal-none.png" /> 0%</span>
</div>
<div class="td col-7 left" id="<%=net:id()%>-iw-status">
<em><%:Collecting data...%></em>
</div>
<div class="td cbi-section-actions">
<input id="<%=net:id()%>-iw-toggle" type="button" class="cbi-button cbi-button-neutral" onclick="wifi_shutdown('<%=net:id()%>', this)" title="<%:Enable this network%>" value="<%:Enable%>" />
<input type="button" class="cbi-button cbi-button-action important" onclick="location.href='<%=net:adminlink()%>'" title="<%:Edit this network%>" value="<%:Edit%>" />
<input type="button" class="cbi-button cbi-button-negative" onclick="wifi_delete('<%=net:id()%>')" title="<%:Delete this network%>" value="<%:Remove%>" />
</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>
<!-- /device <%=dev:name()%> -->
<% end %>
<h2><%:Associated Stations%></h2>
<%+admin_network/wifi_assoclist%>
</div>
<%+footer%>

View file

@ -0,0 +1,127 @@
<%#
Copyright 2008-2009 Steven Barth <steven@midlink.org>
Copyright 2008-2018 Jo-Philipp Wich <jo@mein.io>
Licensed to the public under the Apache License 2.0.
-%>
<script type="text/javascript">//<![CDATA[
function wifi_delete(ev) {
if (!confirm(<%=luci.http.write_json(translate('Really delete this wireless network? The deletion cannot be undone! You might lose access to this device if you are connected via this network.'))%>)) {
ev.preventDefault();
return false;
}
ev.target.previousElementSibling.value = '1';
return true;
}
function wifi_restart(ev) {
XHR.halt();
findParent(ev.target, '.table').querySelectorAll('[data-disabled="false"]').forEach(function(s) {
s.innerHTML = '<em><%:Wireless is restarting...%></em>';
});
(new XHR()).post('<%=url('admin/network/wireless_reconnect')%>/' + ev.target.getAttribute('data-radio'),
{ token: '<%=token%>' }, XHR.run);
}
var networks = [ ];
document.querySelectorAll('[data-network]').forEach(function(n) {
networks.push(n.getAttribute('data-network'));
});
XHR.poll(5, '<%=url('admin/network/wireless_status')%>/' + networks.join(','), null,
function(x, st)
{
if (st)
{
var rowstyle = 1;
var radiostate = { };
st.forEach(function(s) {
var r = radiostate[s.device.device] || (radiostate[s.device.device] = {});
s.is_assoc = (s.bssid && s.bssid != '00:00:00:00:00:00' && s.channel && s.mode != 'Unknown' && !s.disabled);
r.up = r.up || s.is_assoc;
r.channel = r.channel || s.channel;
r.bitrate = r.bitrate || s.bitrate;
r.frequency = r.frequency || s.frequency;
});
for( var i = 0; i < st.length; i++ )
{
var iw = st[i],
sig = document.getElementById(iw.id + '-iw-signal'),
info = document.getElementById(iw.id + '-iw-status'),
disabled = (info && info.getAttribute('data-disabled') === 'true');
var p = iw.quality;
var q = disabled ? -1 : p;
var icon;
if (q < 0)
icon = "<%=resource%>/icons/signal-none.png";
else if (q == 0)
icon = "<%=resource%>/icons/signal-0.png";
else if (q < 25)
icon = "<%=resource%>/icons/signal-0-25.png";
else if (q < 50)
icon = "<%=resource%>/icons/signal-25-50.png";
else if (q < 75)
icon = "<%=resource%>/icons/signal-50-75.png";
else
icon = "<%=resource%>/icons/signal-75-100.png";
if (sig)
sig.innerHTML = String.format(
'<span class="ifacebadge" title="<%:Signal%>: %d <%:dBm%> / <%:Noise%>: %d <%:dBm%>"><img src="%s" /> %d%%</span>',
iw.signal, iw.noise, icon, p
);
if (info)
{
if (iw.is_assoc)
info.innerHTML = String.format(
'<strong><%:SSID%>:</strong> %h | ' +
'<strong><%:Mode%>:</strong> %s<br />' +
'<strong><%:BSSID%>:</strong> %s | ' +
'<strong><%:Encryption%>:</strong> %s',
iw.ssid, iw.mode, iw.bssid,
iw.encryption ? iw.encryption : '<%:None%>'
);
else
info.innerHTML = String.format(
'<strong><%:SSID%>:</strong> %h | ' +
'<strong><%:Mode%>:</strong> %s<br />' +
'<em>%s</em>',
iw.ssid || '?', iw.mode,
disabled ? '<em><%:Wireless is disabled%></em>'
: '<em><%:Wireless is not associated%></em>'
);
}
}
for (var dev in radiostate)
{
var img = document.getElementById(dev + '-iw-upstate');
if (img)
img.src = '<%=resource%>/icons/wifi' + (radiostate[dev].up ? '' : '_disabled') + '.png';
var stat = document.getElementById(dev + '-iw-devinfo');
if (stat)
stat.innerHTML = String.format(
'<strong><%:Channel%>:</strong> %s (%s <%:GHz%>) | ' +
'<strong><%:Bitrate%>:</strong> %s <%:Mbit/s%>',
radiostate[dev].channel ? radiostate[dev].channel : '?',
radiostate[dev].frequency ? radiostate[dev].frequency : '?',
radiostate[dev].bitrate ? radiostate[dev].bitrate : '?'
);
}
}
}
);
//]]></script>

View file

@ -8,7 +8,7 @@
{
var is_assoc = (iw.bssid && iw.bssid != '00:00:00:00:00:00' && iw.channel && !iw.disabled);
var p = iw.quality;
var q = is_assoc ? p : -1;
var q = iw.disabled ? -1 : p;
var icon;
if (q < 0)
@ -55,8 +55,10 @@
info.innerHTML = String.format(
'<strong><%:SSID%>:</strong> %h | ' +
'<strong><%:Mode%>:</strong> %s<br />' +
'<em><%:Wireless is disabled or not associated%></em>',
iw.ssid || '?', iw.mode
'<em>%s</em>',
iw.ssid || '?', iw.mode,
iw.disabled ? '<em><%:Wireless is disabled%></em>'
: '<em><%:Wireless is not associated%></em>'
);
}
}

View file

@ -19,7 +19,6 @@
<%+header%>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<script type="text/javascript">//<![CDATA[
var bwxhr = new XHR();
@ -59,6 +58,8 @@
var label_scale;
Math.log2 = Math.log2 || function(x) { return Math.log(x) * Math.LOG2E; };
function bandwidth_label(bytes, br)
{
var uby = '<%:kB/s%>';
@ -149,7 +150,7 @@
var text = G.createElementNS('http://www.w3.org/2000/svg', 'text');
text.setAttribute('x', i + 5);
text.setAttribute('y', 15);
text.setAttribute('style', 'fill:#999999; font-size:9pt');
text.setAttribute('style', 'fill:#eee; font-size:9pt; font-family:sans-serif; text-shadow:1px 1px 1px #000');
text.appendChild(G.createTextNode(Math.round((width - i) / step / 60) + 'm'));
label_25.parentNode.appendChild(line);

View file

@ -5,7 +5,6 @@
<%+header%>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<script type="text/javascript">//<![CDATA[
var bwxhr = new XHR();
@ -124,7 +123,7 @@
var text = G.createElementNS('http://www.w3.org/2000/svg', 'text');
text.setAttribute('x', i + 5);
text.setAttribute('y', 15);
text.setAttribute('style', 'fill:#999999; font-size:9pt');
text.setAttribute('style', 'fill:#eee; font-size:9pt; font-family:sans-serif; text-shadow:1px 1px 1px #000');
text.appendChild(G.createTextNode(Math.round((width - i) / step / 60) + 'm'));
label_25.parentNode.appendChild(line);
@ -137,12 +136,9 @@
XHR.poll(3, '<%=build_url("admin/status/realtime/connections_status")%>', null,
function(x, json)
{
var rows = [];
var conn = json.connections;
while (conn_table.firstElementChild !== conn_table.lastElementChild)
conn_table.removeChild(conn_table.lastElementChild);
var lookup_queue = [ ];
conn.sort(function(a, b) {
@ -166,15 +162,17 @@
var src = dns_cache[c.src] || (c.layer3 == 'ipv6' ? '[' + c.src + ']' : c.src);
var dst = dns_cache[c.dst] || (c.layer3 == 'ipv6' ? '[' + c.dst + ']' : c.dst);
conn_table.appendChild(E('<div class="tr cbi-section-table-row cbi-rowstyle-%d">'.format(1 + (i % 2)), [
E('<div class="td">', c.layer3.toUpperCase()),
E('<div class="td">', c.layer4.toUpperCase()),
E('<div class="td">', [ src, ':', c.sport ]),
E('<div class="td">', [ dst, ':', c.dport ]),
E('<div class="td" style="white-space:nowrap">', '%1024.2mB (%d <%:Pkts.%>)'.format(c.bytes, c.packets)),
]));
rows.push([
c.layer3.toUpperCase(),
c.layer4.toUpperCase(),
src + ':' + c.sport,
dst + ':' + c.dport,
'%1024.2mB (%d <%:Pkts.%>)'.format(c.bytes, c.packets)
]);
}
cbi_update_table(conn_table, rows, '<em><%:No information available%></em>');
if (lookup_queue.length > 0)
XHR.get('<%=build_url("admin/status/nameinfo")%>/' + lookup_queue.slice(0, 100).join('/'), null,
function(x, json)
@ -322,7 +320,7 @@
<div style="text-align:right"><small id="scale">-</small></div>
<br />
<div class="table" style="width:100%; table-layout:fixed" cellspacing="5">
<div class="table">
<div class="tr">
<div class="td" style="text-align:right; vertical-align:top"><strong style="border-bottom:2px solid blue"><%:UDP:%></strong></div>
<div class="td" id="lb_udp_cur">0</div>
@ -357,16 +355,20 @@
<br />
<div class="cbi-section-node">
<div class="table cbi-section-table" id="connections">
<div class="tr cbi-section-table-titles">
<div class="th cbi-section-table-cell"><%:Network%></div>
<div class="th cbi-section-table-cell"><%:Protocol%></div>
<div class="th cbi-section-table-cell"><%:Source%></div>
<div class="th cbi-section-table-cell"><%:Destination%></div>
<div class="th cbi-section-table-cell"><%:Transfer%></div>
<div class="table" id="connections">
<div class="tr table-titles">
<div class="th col-2 hide-xs"><%:Network%></div>
<div class="th col-2"><%:Protocol%></div>
<div class="th col-7"><%:Source%></div>
<div class="th col-7"><%:Destination%></div>
<div class="th col-4"><%:Transfer%></div>
</div>
<div class="tr"><div class="td" colspan="5"><em><%:Collecting data...%></em></div></div>
<div class="tr placeholder">
<div class="td">
<em><%:Collecting data...%></em>
</div>
</div>
</div>
</div>
</fieldset>

View file

@ -115,7 +115,6 @@
<%+header%>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<script type="text/javascript">//<![CDATA[
function progressbar(v, m)
{
@ -303,9 +302,9 @@
var is_assoc = (net.bssid != '00:00:00:00:00:00' && net.channel && !net.disabled);
var icon;
if (!is_assoc)
if (net.disabled)
icon = "<%=resource%>/icons/signal-none.png";
else if (net.quality == 0)
else if (net.quality <= 0)
icon = "<%=resource%>/icons/signal-0.png";
else if (net.quality < 25)
icon = "<%=resource%>/icons/signal-0-25.png";
@ -324,7 +323,7 @@
'<%:BSSID%>', is_assoc ? (net.bssid || '-') : null,
'<%:Encryption%>', is_assoc ? net.encryption : null,
'<%:Associations%>', is_assoc ? (net.num_assoc || '-') : null,
null, is_assoc ? null : E('em', '<%:Wireless is disabled or not associated%>')));
null, is_assoc ? null : E('em', net.disabled ? '<%:Wireless is disabled%>' : '<%:Wireless is not associated%>')));
}
ws.appendChild(renderBox(
@ -436,11 +435,13 @@
<div class="cbi-section">
<h3><%:Network%></h3>
<% if has_mptcp == 0 then %>
<div id="upstream_status_table" class="network-status-table">
<em><%:Collecting data...%></em>
<p><em><%:Collecting data...%></em></p>
</div>
<% end %>
<div class="table" width="100%">
<div class="tr"><div class="td left" width="33%"><%:Active Connections%></div><div class="td left" id="conns">-</div></div>
</div>
@ -477,7 +478,7 @@
<h3><%:Wireless%></h3>
<div id="wifi_status_table" class="network-status-table">
<em><%:Collecting data...%></em>
<p><em><%:Collecting data...%></em></p>
</div>
</div>

View file

@ -62,7 +62,6 @@
<%+header%>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<style type="text/css">
span:target {
color: blue;

View file

@ -5,7 +5,6 @@
<%+header%>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<script type="text/javascript">//<![CDATA[
var bwxhr = new XHR();
@ -119,7 +118,7 @@
var text = G.createElementNS('http://www.w3.org/2000/svg', 'text');
text.setAttribute('x', i + 5);
text.setAttribute('y', 15);
text.setAttribute('style', 'fill:#999999; font-size:9pt');
text.setAttribute('style', 'fill:#eee; font-size:9pt; font-family:sans-serif; text-shadow:1px 1px 1px #000');
text.appendChild(G.createTextNode(Math.round((width - i) / step / 60) + 'm'));
label_25.parentNode.appendChild(line);

View file

@ -32,7 +32,6 @@
<%+header%>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<div class="cbi-map" id="cbi-network">
<h2 name="content"><%:Routes%></h2>

View file

@ -19,7 +19,6 @@
<%+header%>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<script type="text/javascript">//<![CDATA[
var bwxhr = new XHR();
@ -141,7 +140,7 @@
var text = G.createElementNS('http://www.w3.org/2000/svg', 'text');
text.setAttribute('x', i + 5);
text.setAttribute('y', 15);
text.setAttribute('style', 'fill:#999999; font-size:9pt');
text.setAttribute('style', 'fill:#eee; font-size:9pt; font-family:sans-serif; text-shadow:1px 1px 1px #000');
text.appendChild(G.createTextNode(Math.round((width - i) / step / 60) + 'm'));
label_25.parentNode.appendChild(line);
@ -158,7 +157,7 @@
var text2 = G2.createElementNS('http://www.w3.org/2000/svg', 'text');
text2.setAttribute('x', i + 5);
text2.setAttribute('y', 15);
text2.setAttribute('style', 'fill:#999999; font-size:9pt');
text2.setAttribute('style', 'fill:#eee; font-size:9pt; font-family:sans-serif; text-shadow:1px 1px 1px #000');
text2.appendChild(G.createTextNode(Math.round((width - i) / step / 60) + 'm'));
label_25_2.parentNode.appendChild(line2);

View file

@ -10,12 +10,12 @@
<ul class="cbi-tabmenu">
<li class="cbi-tab"><a href="#"><%:Actions%></a></li>
<li class="cbi-tab-disabled"><a href="<%=REQUEST_URI%>/backupfiles"><%:Configuration%></a></li>
<li class="cbi-tab-disabled"><a href="<%=url('admin/system/flashops/backupfiles')%>"><%:Configuration%></a></li>
</ul>
<div class="cbi-section">
<h3><%:Backup / Restore%></h3>
<div class="cbi-section-descr"><%:Click "Generate archive" to download a tar archive of the current configuration files. To reset the firmware to its initial state, click "Perform reset" (only possible with squashfs images).%></div>
<h3><%:Backup%></h3>
<div class="cbi-section-descr"><%:Click "Generate archive" to download a tar archive of the current configuration files.%></div>
<div class="cbi-section-node">
<form class="inline" method="post" action="<%=url('admin/system/flashops/backup')%>">
<input type="hidden" name="token" value="<%=token%>" />
@ -26,6 +26,11 @@
</div>
</div>
</form>
</div>
<h3><%:Restore%></h3>
<div class="cbi-section-descr"><%:To restore configuration files, you can upload a previously generated backup archive here. To reset the firmware to its initial state, click "Perform reset" (only possible with squashfs images).%></div>
<div class="cbi-section-node">
<% if reset_avail then %>
<form class="inline" method="post" action="<%=url('admin/system/flashops/reset')%>">
<input type="hidden" name="token" value="<%=token%>" />
@ -37,9 +42,6 @@
</div>
</form>
<% end %>
</div>
<div class="cbi-section-descr"><%:To restore configuration files, you can upload a previously generated backup archive here.%></div>
<div class="cbi-section-node">
<form class="inline" method="post" action="<%=url('admin/system/flashops/restore')%>" enctype="multipart/form-data">
<div class="cbi-value cbi-value-last">
<label class="cbi-value-title" for="archive"><%:Restore backup%>:</label>
@ -47,13 +49,16 @@
<input type="hidden" name="token" value="<%=token%>" />
<input type="file" name="archive" id="archive" />
<input type="submit" class="cbi-button cbi-button-action important" name="restore" value="<%:Upload archive...%>" />
<% if reset_avail then %>
<div class="cbi-value-description"><%:Custom files (certificates, scripts) may remain on the system. To prevent this, perform a factory-reset first.%></div>
<% end %>
</div>
</div>
</form>
<% if backup_invalid then %>
<div class="cbi-section-error"><%:The backup archive does not appear to be a valid gzip file.%></div>
<% end %>
</div>
<% if reset_avail then %>
<div class="alert-message warning"><%:Custom files (certificates, scripts) may remain on the system. To prevent this, perform a factory-reset first.%></div>
<% end %>
</div>
<div class="cbi-section">

View file

@ -44,7 +44,6 @@ end
<%+header%>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<h2 name="content"><%:Software%></h2>

View file

@ -16,18 +16,24 @@
<hr />
<input class="cbi-button cbi-button-action important" type="button" value="<%:Perform reboot%>" onclick="reboot(this)" />
<p class="alert-message notice reboot-message" style="display:none">
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" />
<span><%:Device is rebooting...%></span>
</p>
<script type="text/javascript">//<![CDATA[
var tries = 0;
var tries = 0,
message = document.querySelector('p.reboot-message'),
label = message.querySelector('span');
function ok() {
window.location = '<%=controller%>/admin';
window.location = '<%=url("admin")%>';
}
function check() {
if (tries++ < 12)
window.setTimeout(ping, 5000);
else
alert('<%:Device unreachable%>');
window.setTimeout(ping, 5000);
}
function ping() {
@ -37,22 +43,20 @@
img.onerror = check;
img.src = '<%=resource%>/icons/loading.gif?' + Math.random();
document.getElementById('reboot-message').innerHTML = '<%:Waiting for device...%>';
if (tries++ >= 30) {
message.classList.remove('notice');
message.classList.add('warning');
label.innerHTML = '<%:Device unreachable! Still waiting for device...%>';
}
}
function reboot(button) {
button.style.display = 'none';
document.getElementById('reboot-message').parentNode.style.display = '';
message.style.display = '';
label.innerHTML = '<%:Waiting for device...%>';
(new XHR()).post('<%=controller%>/admin/system/reboot/call', { token: '<%=token%>' }, check);
(new XHR()).post('<%=url("admin/system/reboot/call")%>', { token: '<%=token%>' }, check);
}
//]]></script>
<input class="cbi-button cbi-button-action important" type="button" value="<%:Perform reboot%>" onclick="reboot(this)" />
<p class="alert-message" style="display:none">
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" />
<span id="reboot-message"><%:Device is rebooting...%></span>
</p>
<%+footer%>