local_wifi.signal = -10;
local_wifi.ssid = 'Local Interface';
+ q = Math.min((local_wifi.signal + 110) / 70 * 100, 100);
this.add_wifi_to_graph(chan_analysis, local_wifi, scanCache, center_channels, chan_width);
rows.push([
results.push(scanCache[k].data);
results.sort(function(a, b) {
- if (a.channel - b.channel)
- return 1;
+ if (a.channel !== b.channel)
+ return a.channel - b.channel;
if (a.ssid < b.ssid)
return -1;
return -1;
else if (a.bssid > b.bssid)
return 1;
+
+ return 0;
});
for (let res of results) {
return fs.exec_direct('/bin/dmesg', [ '-r' ]).then(logdata => {
let loglines = [];
let lastSeverity = null;
+ let lastTime = null;
logdata.trim().split(/\n/).forEach(line => {
const priorityMatch = line.match(/^<(\w+)>/);
const cleanLine = line.replace(/^<\w+>/, '');
const timeMatch = cleanLine.match(/^\[\s*(\d+(?:\.\d+)?)\]/);
const time = timeMatch ? parseFloat(timeMatch[1]) : null;
+ if (time != null)
+ lastTime = time;
if (!isCont) {
lastSeverity = parseInt(tag, 10); // update severity
loglines.push({
severity: isCont ? lastSeverity : parseInt(tag, 10),
isCont,
- time,
+ time: time != null ? time : lastTime,
text: cleanLine
});
});
// Filter by severity
loglines = loglines.filter(entry => {
- if (!entry.isCont) {
- if (!this.invertMinSeverity)
- return (entry.severity >= this.minSeverity);
- else
- return (entry.severity < this.minSeverity);
- }
+ if (this.invertMinSeverity)
+ return entry.severity < this.minSeverity;
+ else
+ return entry.severity >= this.minSeverity;
});
// Filter by text
E('div', {}, renderBadge(
L.resource('icons/%s.svg').format(dev ? dev.getType() : 'ethernet_disabled'), null,
_('Device'), dev ? dev.getI18n() : '-',
- _('MAC address'), dev.getMAC())
+ _('MAC address'), dev ? dev.getMAC() : '')
)
])
]);
return E('em', _('No active leases found'));
const machints = host_hints.getMACHints(false);
const isReadonlyView = !L.hasViewPermission();
+ this.isMACStatic = Object.create(null);
+ this.isDUIDStatic = Object.create(null);
+ this.isDUIDIAIDStatic = Object.create(null);
for (const host of uci.sections('dhcp', 'host')) {
for (let i = 0; i < radios_networks_hints.length; i++) {
tasks.push(L.resolveDefault(radios_networks_hints[i].getAssocList(), []).then(L.bind((net, list) => {
- net.assoclist = list.sort((a, b) => { return a.mac > b.mac });
+ net.assoclist = list.sort((a, b) => a.mac.localeCompare(b.mac));
}, this, radios_networks_hints[i])));
if (hasWPS && uci.get('wireless', radios_networks_hints[i].sid, 'wps_pushbutton') == '1') {
const table = E('div', { 'class': 'network-status-table' });
- for (let i = 0; i < radios.sort((a, b) => { a.getName() > b.getName() }).length; i++)
+ for (let i = 0; i < radios.sort((a, b) => a.getName().localeCompare(b.getName())).length; i++)
table.appendChild(this.renderbox(radios[i],
networks.filter(net => { return net.getWifiDeviceName() == radios[i].getName() })));
const cmp_addr = address || target;
if (!cmp_addr) continue;
+ if (typeof cmp_mask !== 'number') continue;
if (applyMask(cmp_addr, cmp_mask, v6) !== applyMask(addr, cmp_mask, v6) || mask < cmp_mask)
continue;
const res = [];
for (const line of nbs.trim().split(/\n/)) {
- const [, addr = null, f = [], state = null] = line.match(/^([0-9a-f:.]+) (.+) (\S+) *$/);
+ const [, addr = null, f = [], state = null] = (line.match(/^([0-9a-f:.]+) (.+) (\S+) *$/) || []);
const flags = f?.trim?.().split?.(/\s+/);
let vendor;
const res = [];
for (const line of routes.trim().split(/\n/)) {
- const [, type = 'unicast', d, f = [] ] = line.match(/^(?:([a-z_]+|\d+) )?(default|[0-9a-f:./]+) (.+)$/);
+ const [, type = 'unicast', d, f = [] ] = (line.match(/^(?:([a-z_]+|\d+) )?(default|[0-9a-f:./]+) (.+)$/) || []);
const dest = d == 'default' ? (v6 ? '::/0' : '0.0.0.0/0') : d;
const flags = f?.trim?.().split?.(/\s+/);
const cmp_addr = address || target;
if (!cmp_addr) continue;
+ if (typeof cmp_mask !== 'number') continue;
if (applyMask(cmp_addr, cmp_mask, v6) !== applyMask(addr, cmp_mask, v6) || mask < cmp_mask)
continue;
for (const n of this.parseJSON(nbs)) {
let vendor;
- if (n.dst.match(/^fe[89a-f][0-9a-f]:/))
+ if (n.dst?.match(/^fe[89a-f][0-9a-f]:/))
continue;
- if (n.state.find(f => {return f == 'FAILED'}))
+ if ((n.state || []).some(f => f === 'FAILED'))
continue;
for (let mac in macs) {