mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Use master package instead of some customs
This commit is contained in:
parent
043502dada
commit
2f918b6f54
292 changed files with 0 additions and 239852 deletions
|
@ -1,419 +0,0 @@
|
|||
'use strict';
|
||||
'require rpc';
|
||||
'require uci';
|
||||
'require form';
|
||||
|
||||
var callHostHints, callDUIDHints, callDHCPLeases, CBILeaseStatus;
|
||||
|
||||
callHostHints = rpc.declare({
|
||||
object: 'luci',
|
||||
method: 'getHostHints',
|
||||
expect: { '': {} }
|
||||
});
|
||||
|
||||
callDUIDHints = rpc.declare({
|
||||
object: 'luci',
|
||||
method: 'getDUIDHints',
|
||||
expect: { '': {} }
|
||||
});
|
||||
|
||||
callDHCPLeases = rpc.declare({
|
||||
object: 'luci',
|
||||
method: 'getDHCPLeases',
|
||||
params: [ 'family' ],
|
||||
expect: { dhcp_leases: [] }
|
||||
});
|
||||
|
||||
CBILeaseStatus = form.DummyValue.extend({
|
||||
renderWidget: function(section_id, option_id, cfgvalue) {
|
||||
return E([
|
||||
E('h4', _('Active DHCP Leases')),
|
||||
E('div', { 'id': 'lease_status_table', 'class': 'table' }, [
|
||||
E('div', { 'class': 'tr table-titles' }, [
|
||||
E('div', { 'class': 'th' }, _('Hostname')),
|
||||
E('div', { 'class': 'th' }, _('IPv4-Address')),
|
||||
E('div', { 'class': 'th' }, _('MAC-Address')),
|
||||
E('div', { 'class': 'th' }, _('Leasetime remaining'))
|
||||
]),
|
||||
E('div', { 'class': 'tr placeholder' }, [
|
||||
E('div', { 'class': 'td' }, E('em', _('Collecting data...')))
|
||||
])
|
||||
])
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
return L.view.extend({
|
||||
|
||||
|
||||
load: function() {
|
||||
return Promise.all([
|
||||
callHostHints(),
|
||||
callDUIDHints()
|
||||
]);
|
||||
},
|
||||
|
||||
render: function(hosts_duids) {
|
||||
var hosts = hosts_duids[0],
|
||||
duids = hosts_duids[1],
|
||||
m, s, o, ss, so;
|
||||
|
||||
m = new form.Map('dhcp', _('DHCP and DNS'), _('Dnsmasq is a combined <abbr title="Dynamic Host Configuration Protocol">DHCP</abbr>-Server and <abbr title="Domain Name System">DNS</abbr>-Forwarder for <abbr title="Network Address Translation">NAT</abbr> firewalls'));
|
||||
|
||||
s = m.section(form.TypedSection, 'dnsmasq', _('Server Settings'));
|
||||
s.anonymous = true;
|
||||
s.addremove = false;
|
||||
|
||||
s.tab('general', _('General Settings'));
|
||||
s.tab('files', _('Resolv and Hosts Files'));
|
||||
s.tab('tftp', _('TFTP Settings'));
|
||||
s.tab('advanced', _('Advanced Settings'));
|
||||
s.tab('leases', _('Static Leases'));
|
||||
|
||||
s.taboption('general', form.Flag, 'domainneeded',
|
||||
_('Domain required'),
|
||||
_('Don\'t forward <abbr title="Domain Name System">DNS</abbr>-Requests without <abbr title="Domain Name System">DNS</abbr>-Name'));
|
||||
|
||||
s.taboption('general', form.Flag, 'authoritative',
|
||||
_('Authoritative'),
|
||||
_('This is the only <abbr title="Dynamic Host Configuration Protocol">DHCP</abbr> in the local network'));
|
||||
|
||||
|
||||
s.taboption('files', form.Flag, 'readethers',
|
||||
_('Use <code>/etc/ethers</code>'),
|
||||
_('Read <code>/etc/ethers</code> to configure the <abbr title="Dynamic Host Configuration Protocol">DHCP</abbr>-Server'));
|
||||
|
||||
s.taboption('files', form.Value, 'leasefile',
|
||||
_('Leasefile'),
|
||||
_('file where given <abbr title="Dynamic Host Configuration Protocol">DHCP</abbr>-leases will be stored'));
|
||||
|
||||
s.taboption('files', form.Flag, 'noresolv',
|
||||
_('Ignore resolve file')).optional = true;
|
||||
|
||||
o = s.taboption('files', form.Value, 'resolvfile',
|
||||
_('Resolve file'),
|
||||
_('local <abbr title="Domain Name System">DNS</abbr> file'));
|
||||
|
||||
o.depends('noresolv', '');
|
||||
o.optional = true;
|
||||
|
||||
|
||||
s.taboption('files', form.Flag, 'nohosts',
|
||||
_('Ignore <code>/etc/hosts</code>')).optional = true;
|
||||
|
||||
s.taboption('files', form.DynamicList, 'addnhosts',
|
||||
_('Additional Hosts files')).optional = true;
|
||||
|
||||
o = s.taboption('advanced', form.Flag, 'quietdhcp',
|
||||
_('Suppress logging'),
|
||||
_('Suppress logging of the routine operation of these protocols'));
|
||||
o.optional = true;
|
||||
|
||||
o = s.taboption('advanced', form.Flag, 'sequential_ip',
|
||||
_('Allocate IP sequentially'),
|
||||
_('Allocate IP addresses sequentially, starting from the lowest available address'));
|
||||
o.optional = true;
|
||||
|
||||
o = s.taboption('advanced', form.Flag, 'boguspriv',
|
||||
_('Filter private'),
|
||||
_('Do not forward reverse lookups for local networks'));
|
||||
o.default = o.enabled;
|
||||
|
||||
s.taboption('advanced', form.Flag, 'filterwin2k',
|
||||
_('Filter useless'),
|
||||
_('Do not forward requests that cannot be answered by public name servers'));
|
||||
|
||||
|
||||
s.taboption('advanced', form.Flag, 'localise_queries',
|
||||
_('Localise queries'),
|
||||
_('Localise hostname depending on the requesting subnet if multiple IPs are available'));
|
||||
|
||||
//local have_dnssec_support = luci.util.checklib('/usr/sbin/dnsmasq', 'libhogweed.so');
|
||||
var have_dnssec_support = true;
|
||||
|
||||
if (have_dnssec_support) {
|
||||
o = s.taboption('advanced', form.Flag, 'dnssec',
|
||||
_('DNSSEC'));
|
||||
o.optional = true;
|
||||
|
||||
o = s.taboption('advanced', form.Flag, 'dnsseccheckunsigned',
|
||||
_('DNSSEC check unsigned'),
|
||||
_('Requires upstream supports DNSSEC; verify unsigned domain responses really come from unsigned domains'));
|
||||
o.optional = true;
|
||||
}
|
||||
|
||||
s.taboption('general', form.Value, 'local',
|
||||
_('Local server'),
|
||||
_('Local domain specification. Names matching this domain are never forwarded and are resolved from DHCP or hosts files only'));
|
||||
|
||||
s.taboption('general', form.Value, 'domain',
|
||||
_('Local domain'),
|
||||
_('Local domain suffix appended to DHCP names and hosts file entries'));
|
||||
|
||||
s.taboption('advanced', form.Flag, 'expandhosts',
|
||||
_('Expand hosts'),
|
||||
_('Add local domain suffix to names served from hosts files'));
|
||||
|
||||
s.taboption('advanced', form.Flag, 'nonegcache',
|
||||
_('No negative cache'),
|
||||
_('Do not cache negative replies, e.g. for not existing domains'));
|
||||
|
||||
s.taboption('advanced', form.Value, 'serversfile',
|
||||
_('Additional servers file'),
|
||||
_('This file may contain lines like \'server=/domain/1.2.3.4\' or \'server=1.2.3.4\' for domain-specific or full upstream <abbr title="Domain Name System">DNS</abbr> servers.'));
|
||||
|
||||
s.taboption('advanced', form.Flag, 'strictorder',
|
||||
_('Strict order'),
|
||||
_('<abbr title="Domain Name System">DNS</abbr> servers will be queried in the order of the resolvfile')).optional = true;
|
||||
|
||||
s.taboption('advanced', form.Flag, 'allservers',
|
||||
_('All Servers'),
|
||||
_('Query all available upstream <abbr title="Domain Name System">DNS</abbr> servers')).optional = true;
|
||||
|
||||
o = s.taboption('advanced', form.DynamicList, 'bogusnxdomain', _('Bogus NX Domain Override'),
|
||||
_('List of hosts that supply bogus NX domain results'));
|
||||
|
||||
o.optional = true;
|
||||
o.placeholder = '67.215.65.132';
|
||||
|
||||
|
||||
s.taboption('general', form.Flag, 'logqueries',
|
||||
_('Log queries'),
|
||||
_('Write received DNS requests to syslog')).optional = true;
|
||||
|
||||
o = s.taboption('general', form.DynamicList, 'server', _('DNS forwardings'),
|
||||
_('List of <abbr title="Domain Name System">DNS</abbr> servers to forward requests to'));
|
||||
|
||||
o.optional = true;
|
||||
o.placeholder = '/example.org/10.1.2.3';
|
||||
|
||||
|
||||
o = s.taboption('general', form.Flag, 'rebind_protection',
|
||||
_('Rebind protection'),
|
||||
_('Discard upstream RFC1918 responses'));
|
||||
|
||||
o.rmempty = false;
|
||||
|
||||
|
||||
o = s.taboption('general', form.Flag, 'rebind_localhost',
|
||||
_('Allow localhost'),
|
||||
_('Allow upstream responses in the 127.0.0.0/8 range, e.g. for RBL services'));
|
||||
|
||||
o.depends('rebind_protection', '1');
|
||||
|
||||
|
||||
o = s.taboption('general', form.DynamicList, 'rebind_domain',
|
||||
_('Domain whitelist'),
|
||||
_('List of domains to allow RFC1918 responses for'));
|
||||
o.optional = true;
|
||||
|
||||
o.depends('rebind_protection', '1');
|
||||
o.datatype = 'host(1)';
|
||||
o.placeholder = 'ihost.netflix.com';
|
||||
|
||||
|
||||
o = s.taboption('advanced', form.Value, 'port',
|
||||
_('<abbr title="Domain Name System">DNS</abbr> server port'),
|
||||
_('Listening port for inbound DNS queries'));
|
||||
|
||||
o.optional = true;
|
||||
o.datatype = 'port';
|
||||
o.placeholder = 53;
|
||||
|
||||
|
||||
o = s.taboption('advanced', form.Value, 'queryport',
|
||||
_('<abbr title="Domain Name System">DNS</abbr> query port'),
|
||||
_('Fixed source port for outbound DNS queries'));
|
||||
|
||||
o.optional = true;
|
||||
o.datatype = 'port';
|
||||
o.placeholder = _('any');
|
||||
|
||||
|
||||
o = s.taboption('advanced', form.Value, 'dhcpleasemax',
|
||||
_('<abbr title="maximal">Max.</abbr> <abbr title="Dynamic Host Configuration Protocol">DHCP</abbr> leases'),
|
||||
_('Maximum allowed number of active DHCP leases'));
|
||||
|
||||
o.optional = true;
|
||||
o.datatype = 'uinteger';
|
||||
o.placeholder = _('unlimited');
|
||||
|
||||
|
||||
o = s.taboption('advanced', form.Value, 'ednspacket_max',
|
||||
_('<abbr title="maximal">Max.</abbr> <abbr title="Extension Mechanisms for Domain Name System">EDNS0</abbr> packet size'),
|
||||
_('Maximum allowed size of EDNS.0 UDP packets'));
|
||||
|
||||
o.optional = true;
|
||||
o.datatype = 'uinteger';
|
||||
o.placeholder = 1280;
|
||||
|
||||
|
||||
o = s.taboption('advanced', form.Value, 'dnsforwardmax',
|
||||
_('<abbr title="maximal">Max.</abbr> concurrent queries'),
|
||||
_('Maximum allowed number of concurrent DNS queries'));
|
||||
|
||||
o.optional = true;
|
||||
o.datatype = 'uinteger';
|
||||
o.placeholder = 150;
|
||||
|
||||
o = s.taboption('advanced', form.Value, 'cachesize',
|
||||
_('Size of DNS query cache'),
|
||||
_('Number of cached DNS entries (max is 10000, 0 is no caching)'));
|
||||
o.optional = true;
|
||||
o.datatype = 'range(0,10000)';
|
||||
o.placeholder = 150;
|
||||
|
||||
s.taboption('tftp', form.Flag, 'enable_tftp',
|
||||
_('Enable TFTP server')).optional = true;
|
||||
|
||||
o = s.taboption('tftp', form.Value, 'tftp_root',
|
||||
_('TFTP server root'),
|
||||
_('Root directory for files served via TFTP'));
|
||||
|
||||
o.optional = true;
|
||||
o.depends('enable_tftp', '1');
|
||||
o.placeholder = '/';
|
||||
|
||||
|
||||
o = s.taboption('tftp', form.Value, 'dhcp_boot',
|
||||
_('Network boot image'),
|
||||
_('Filename of the boot image advertised to clients'));
|
||||
|
||||
o.optional = true;
|
||||
o.depends('enable_tftp', '1');
|
||||
o.placeholder = 'pxelinux.0';
|
||||
|
||||
o = s.taboption('general', form.Flag, 'localservice',
|
||||
_('Local Service Only'),
|
||||
_('Limit DNS service to subnets interfaces on which we are serving DNS.'));
|
||||
o.optional = false;
|
||||
o.rmempty = false;
|
||||
|
||||
o = s.taboption('general', form.Flag, 'nonwildcard',
|
||||
_('Non-wildcard'),
|
||||
_('Bind dynamically to interfaces rather than wildcard address (recommended as linux default)'));
|
||||
o.optional = false;
|
||||
o.rmempty = true;
|
||||
|
||||
o = s.taboption('general', form.DynamicList, 'interface',
|
||||
_('Listen Interfaces'),
|
||||
_('Limit listening to these interfaces, and loopback.'));
|
||||
o.optional = true;
|
||||
|
||||
o = s.taboption('general', form.DynamicList, 'notinterface',
|
||||
_('Exclude interfaces'),
|
||||
_('Prevent listening on these interfaces.'));
|
||||
o.optional = true;
|
||||
|
||||
o = s.taboption('leases', form.SectionValue, '__leases__', form.GridSection, 'host', null,
|
||||
_('Static leases are used to assign fixed IP addresses and symbolic hostnames to DHCP clients. They are also required for non-dynamic interface configurations where only hosts with a corresponding lease are served.') + '<br />' +
|
||||
_('Use the <em>Add</em> Button to add a new lease entry. The <em>MAC-Address</em> identifies the host, the <em>IPv4-Address</em> specifies the fixed address to use, and the <em>Hostname</em> is assigned as a symbolic name to the requesting host. The optional <em>Lease time</em> can be used to set non-standard host-specific lease time, e.g. 12h, 3d or infinite.'));
|
||||
|
||||
ss = o.subsection;
|
||||
|
||||
ss.addremove = true;
|
||||
ss.anonymous = true;
|
||||
|
||||
so = ss.option(form.Value, 'name', _('Hostname'));
|
||||
so.datatype = 'hostname("strict")';
|
||||
so.rmempty = true;
|
||||
so.write = function(section, value) {
|
||||
uci.set('dhcp', section, 'name', value);
|
||||
uci.set('dhcp', section, 'dns', '1');
|
||||
};
|
||||
so.remove = function(section) {
|
||||
uci.unset('dhcp', section, 'name');
|
||||
uci.unset('dhcp', section, 'dns');
|
||||
};
|
||||
|
||||
so = ss.option(form.Value, 'mac', _('<abbr title="Media Access Control">MAC</abbr>-Address'));
|
||||
so.datatype = 'list(unique(macaddr))';
|
||||
so.rmempty = true;
|
||||
so.cfgvalue = function(section) {
|
||||
var macs = uci.get('dhcp', section, 'mac'),
|
||||
result = [];
|
||||
|
||||
if (!Array.isArray(macs))
|
||||
macs = (macs != null && macs != '') ? macs.split(/\ss+/) : [];
|
||||
|
||||
for (var i = 0, mac; (mac = macs[i]) != null; i++)
|
||||
if (/^([0-9a-fA-F]{1,2}):([0-9a-fA-F]{1,2}):([0-9a-fA-F]{1,2}):([0-9a-fA-F]{1,2}):([0-9a-fA-F]{1,2}):([0-9a-fA-F]{1,2})$/.test(mac))
|
||||
result.push('%02X:%02X:%02X:%02X:%02X:%02X'.format(
|
||||
parseInt(RegExp.$1, 16), parseInt(RegExp.$2, 16),
|
||||
parseInt(RegExp.$3, 16), parseInt(RegExp.$4, 16),
|
||||
parseInt(RegExp.$5, 16), parseInt(RegExp.$6, 16)));
|
||||
|
||||
return result.length ? result.join(' ') : null;
|
||||
};
|
||||
Object.keys(hosts).forEach(function(mac) {
|
||||
so.value(mac);
|
||||
});
|
||||
|
||||
so = ss.option(form.Value, 'ip', _('<abbr title="Internet Protocol Version 4">IPv4</abbr>-Address'));
|
||||
so.datatype = 'or(ip4addr,"ignore")';
|
||||
so.validate = function(section, value) {
|
||||
var mac = this.map.lookupOption('mac', section),
|
||||
name = this.map.lookupOption('name', section),
|
||||
m = mac ? mac[0].formvalue(section) : null,
|
||||
n = name ? name[0].formvalue(section) : null;
|
||||
|
||||
if ((m == null || m == '') && (n == null || n == ''))
|
||||
return _('One of hostname or mac address must be specified!');
|
||||
|
||||
return true;
|
||||
};
|
||||
Object.keys(hosts).forEach(function(mac) {
|
||||
if (hosts[mac].ipv4)
|
||||
so.value(hosts[mac].ipv4);
|
||||
});
|
||||
|
||||
so = ss.option(form.Value, 'gw', _('Gateway IPv4 Address'));
|
||||
so.rmempty = true;
|
||||
so.datatype = 'or(ip4addr,"ignore")';
|
||||
Object.keys(hosts).forEach(function(mac) {
|
||||
if (hosts[mac].ipv4)
|
||||
so.value(hosts[mac].ipv4);
|
||||
});
|
||||
|
||||
so = ss.option(form.Value, 'leasetime', _('Lease time'));
|
||||
so.rmempty = true;
|
||||
|
||||
so = ss.option(form.Value, 'duid', _('<abbr title="The DHCP Unique Identifier">DUID</abbr>'));
|
||||
so.datatype = 'and(rangelength(20,36),hexstring)';
|
||||
Object.keys(duids).forEach(function(duid) {
|
||||
so.value(duid, '%s (%s)'.format(duid, duids[duid].name || '?'));
|
||||
});
|
||||
|
||||
so = ss.option(form.Value, 'hostid', _('<abbr title="Internet Protocol Version 6">IPv6</abbr>-Suffix (hex)'));
|
||||
|
||||
o = s.taboption('leases', CBILeaseStatus, '__status__');
|
||||
|
||||
return m.render().then(function(mapEl) {
|
||||
L.Poll.add(function() {
|
||||
return callDHCPLeases(4).then(function(leases) {
|
||||
cbi_update_table(mapEl.querySelector('#lease_status_table'),
|
||||
leases.map(function(lease) {
|
||||
var exp;
|
||||
|
||||
if (lease.expires === false)
|
||||
exp = E('em', _('unlimited'));
|
||||
else if (lease.expires <= 0)
|
||||
exp = E('em', _('expired'));
|
||||
else
|
||||
exp = '%t'.format(lease.expires);
|
||||
|
||||
return [
|
||||
lease.hostname || '?',
|
||||
lease.ipaddr,
|
||||
lease.macaddr,
|
||||
exp
|
||||
];
|
||||
}),
|
||||
E('em', _('There are no active leases')));
|
||||
});
|
||||
});
|
||||
|
||||
return mapEl;
|
||||
});
|
||||
}
|
||||
});
|
|
@ -1,42 +0,0 @@
|
|||
'use strict';
|
||||
'require rpc';
|
||||
'require form';
|
||||
|
||||
return L.view.extend({
|
||||
callHostHints: rpc.declare({
|
||||
object: 'luci',
|
||||
method: 'getHostHints',
|
||||
expect: { '': {} }
|
||||
}),
|
||||
|
||||
load: function() {
|
||||
return this.callHostHints();
|
||||
},
|
||||
|
||||
render: function(hosts) {
|
||||
var m, s, o;
|
||||
|
||||
m = new form.Map('dhcp', _('Hostnames'));
|
||||
|
||||
s = m.section(form.GridSection, 'domain', _('Host entries'));
|
||||
s.addremove = true;
|
||||
s.anonymous = true;
|
||||
s.sortable = true;
|
||||
|
||||
o = s.option(form.Value, 'name', _('Hostname'));
|
||||
o.datatype = 'hostname';
|
||||
o.rmempty = true;
|
||||
|
||||
o = s.option(form.Value, 'ip', _('IP address'));
|
||||
o.datatype = 'ipaddr';
|
||||
o.rmempty = true;
|
||||
L.sortedKeys(hosts, 'ipv4', 'addr').forEach(function(mac) {
|
||||
o.value(hosts[mac].ipv4, '%s (%s)'.format(
|
||||
hosts[mac].ipv4,
|
||||
hosts[mac].name || mac
|
||||
));
|
||||
});
|
||||
|
||||
return m.render();
|
||||
}
|
||||
});
|
|
@ -1,42 +0,0 @@
|
|||
requestAnimationFrame(function() {
|
||||
document.querySelectorAll('[data-iface-status]').forEach(function(container) {
|
||||
var network = container.getAttribute('data-iface-status'),
|
||||
icon = container.querySelector('img'),
|
||||
info = container.querySelector('span');
|
||||
|
||||
L.poll(5, L.url('admin/network/iface_status', network), null, function(xhr, ifaces) {
|
||||
var ifc = Array.isArray(ifaces) ? ifaces[0] : null;
|
||||
if (!ifc)
|
||||
return;
|
||||
|
||||
L.itemlist(info, [
|
||||
_('Device'), ifc.ifname,
|
||||
_('Uptime'), ifc.is_up ? '%t'.format(ifc.uptime) : null,
|
||||
_('MAC'), ifc.ifname ? ifc.macaddr : null,
|
||||
_('RX'), ifc.ifname ? '%.2mB (%d %s)'.format(ifc.rx_bytes, ifc.rx_packets, _('Pkts.')) : null,
|
||||
_('TX'), ifc.ifname ? '%.2mB (%d %s)'.format(ifc.tx_bytes, ifc.tx_packets, _('Pkts.')) : null,
|
||||
_('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[0] : null,
|
||||
_('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[1] : null,
|
||||
_('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[2] : null,
|
||||
_('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[3] : null,
|
||||
_('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[4] : null,
|
||||
_('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[0] : null,
|
||||
_('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[1] : null,
|
||||
_('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[2] : null,
|
||||
_('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[3] : null,
|
||||
_('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[4] : null,
|
||||
_('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[5] : null,
|
||||
_('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[6] : null,
|
||||
_('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[7] : null,
|
||||
_('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[8] : null,
|
||||
_('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[9] : null,
|
||||
_('IPv6-PD'), ifc.ip6prefix,
|
||||
null, ifc.ifname ? null : E('em', _('Interface not present or not connected yet.'))
|
||||
]);
|
||||
|
||||
icon.src = L.resource('icons/%s%s.png').format(ifc.type, ifc.is_up ? '' : '_disabled');
|
||||
});
|
||||
|
||||
L.run();
|
||||
});
|
||||
});
|
|
@ -1,136 +0,0 @@
|
|||
function iface_reconnect(id) {
|
||||
L.halt();
|
||||
L.dom.content(document.getElementById(id + '-ifc-description'), E('em', _('Interface is reconnecting...')));
|
||||
L.post(L.url('admin/network/iface_reconnect', id), null, L.run);
|
||||
}
|
||||
|
||||
function iface_delete(ev) {
|
||||
if (!confirm(_('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': L.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': L.resource('icons/%s%s.png').format(
|
||||
ifc.type, ifc.is_up ? '' : '_disabled') }),
|
||||
L.itemlist(E('span', { 'class': 'left' }), [
|
||||
_('Type'), ifc.typename,
|
||||
_('Device'), ifc.ifname,
|
||||
_('Connected'), ifc.is_up ? _('yes') : _('no'),
|
||||
_('MAC'), ifc.macaddr,
|
||||
_('RX'), '%.2mB (%d %s)'.format(ifc.rx_bytes, ifc.rx_packets, _('Pkts.')),
|
||||
_('TX'), '%.2mB (%d %s)'.format(ifc.tx_bytes, ifc.tx_packets, _('Pkts.'))
|
||||
])
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
L.poll(5, L.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 s = document.getElementById(ifc.id + '-ifc-devices');
|
||||
if (s) {
|
||||
var c = [ 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(')');
|
||||
|
||||
c.push(E('span', {}, sifs));
|
||||
}
|
||||
|
||||
c.push(E('br'));
|
||||
c.push(E('small', {}, ifc.is_alias ? _('Alias of "%s"').format(ifc.is_alias) : ifc.name));
|
||||
|
||||
L.dom.content(s, c);
|
||||
}
|
||||
|
||||
var d = document.getElementById(ifc.id + '-ifc-description');
|
||||
if (d && ifc.proto && ifc.ifname) {
|
||||
var desc = null, c = [];
|
||||
|
||||
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;
|
||||
|
||||
L.itemlist(d, [
|
||||
_('Protocol'), desc || '?',
|
||||
_('Uptime'), ifc.is_up ? '%t'.format(ifc.uptime) : null,
|
||||
_('MAC'), (!ifc.is_dynamic && !ifc.is_alias && ifc.macaddr) ? ifc.macaddr : null,
|
||||
_('RX'), (!ifc.is_dynamic && !ifc.is_alias) ? '%.2mB (%d %s)'.format(ifc.rx_bytes, ifc.rx_packets, _('Pkts.')) : null,
|
||||
_('TX'), (!ifc.is_dynamic && !ifc.is_alias) ? '%.2mB (%d %s)'.format(ifc.tx_bytes, ifc.tx_packets, _('Pkts.')) : null,
|
||||
_('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[0] : null,
|
||||
_('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[1] : null,
|
||||
_('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[2] : null,
|
||||
_('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[3] : null,
|
||||
_('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[4] : null,
|
||||
_('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[0] : null,
|
||||
_('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[1] : null,
|
||||
_('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[2] : null,
|
||||
_('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[3] : null,
|
||||
_('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[4] : null,
|
||||
_('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[5] : null,
|
||||
_('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[6] : null,
|
||||
_('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[7] : null,
|
||||
_('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[8] : null,
|
||||
_('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[9] : null,
|
||||
_('IPv6-PD'), ifc.ip6prefix,
|
||||
_('Information'), ifc.is_auto ? null : _('Not started on boot'),
|
||||
_('Error'), ifc.errors ? ifc.errors[0] : null,
|
||||
_('Error'), ifc.errors ? ifc.errors[1] : null,
|
||||
_('Error'), ifc.errors ? ifc.errors[2] : null,
|
||||
_('Error'), ifc.errors ? ifc.errors[3] : null,
|
||||
_('Error'), ifc.errors ? ifc.errors[4] : null,
|
||||
]);
|
||||
}
|
||||
else if (d && !ifc.proto) {
|
||||
var e = document.getElementById(ifc.id + '-ifc-edit');
|
||||
if (e) e.disabled = true;
|
||||
|
||||
var link = L.url('admin/system/opkg') + '?query=luci-proto';
|
||||
L.dom.content(d, [
|
||||
E('em', _('Unsupported protocol type.')), E('br'),
|
||||
E('a', { href: link }, _('Install protocol extensions...'))
|
||||
]);
|
||||
}
|
||||
else if (d && !ifc.ifname) {
|
||||
var link = L.url('admin/network/network', ifc.name) + '?tab.network.%s=physical'.format(ifc.name);
|
||||
L.dom.content(d, [
|
||||
E('em', _('Network without interfaces.')), E('br'),
|
||||
E('a', { href: link }, _('Assign interfaces...'))
|
||||
]);
|
||||
}
|
||||
else if (d) {
|
||||
L.dom.content(d, E('em' ,_('Interface not present or not connected yet.')));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
|
@ -1,102 +0,0 @@
|
|||
'use strict';
|
||||
'require form';
|
||||
'require network';
|
||||
'require tools.widgets as widgets';
|
||||
|
||||
return L.view.extend({
|
||||
load: function() {
|
||||
return network.getDevices();
|
||||
},
|
||||
|
||||
render: function(netdevs) {
|
||||
var m, s, o;
|
||||
|
||||
m = new form.Map('network', _('Routes'), _('Routes specify over which interface and gateway a certain host or network can be reached.'));
|
||||
m.tabbed = true;
|
||||
|
||||
for (var i = 4; i <= 6; i += 2) {
|
||||
s = m.section(form.GridSection, (i == 4) ? 'route' : 'route6', (i == 4) ? _('Static IPv4 Routes') : _('Static IPv6 Routes'));
|
||||
s.anonymous = true;
|
||||
s.addremove = true;
|
||||
s.sortable = true;
|
||||
|
||||
s.tab('general', _('General Settings'));
|
||||
s.tab('advanced', _('Advanced Settings'));
|
||||
|
||||
o = s.taboption('general', widgets.NetworkSelect, 'interface', _('Interface'));
|
||||
o.rmempty = false;
|
||||
o.nocreate = true;
|
||||
|
||||
o = s.taboption('general', form.Value, 'target', _('Target'), (i == 4) ? _('Host-<abbr title="Internet Protocol Address">IP</abbr> or Network') : _('<abbr title="Internet Protocol Version 6">IPv6</abbr>-Address or Network (CIDR)'));
|
||||
o.datatype = (i == 4) ? 'ip4addr' : 'ip6addr';
|
||||
o.rmempty = false;
|
||||
|
||||
if (i == 4) {
|
||||
o = s.taboption('general', form.Value, 'netmask', _('<abbr title="Internet Protocol Version 4">IPv4</abbr>-Netmask'), _('if target is a network'));
|
||||
o.placeholder = '255.255.255.255';
|
||||
o.datatype = 'ip4addr';
|
||||
o.rmempty = true;
|
||||
}
|
||||
|
||||
o = s.taboption('general', form.Value, 'gateway', (i == 4) ? _('<abbr title="Internet Protocol Version 4">IPv4</abbr>-Gateway') : _('<abbr title="Internet Protocol Version 6">IPv6</abbr>-Gateway'));
|
||||
o.datatype = (i == 4) ? 'ip4addr' : 'ip6addr';
|
||||
o.rmempty = true;
|
||||
|
||||
o = s.taboption('advanced', form.Value, 'metric', _('Metric'));
|
||||
o.placeholder = 0;
|
||||
o.datatype = (i == 4) ? 'range(0,255)' : 'range(0,65535)';
|
||||
o.rmempty = true;
|
||||
o.textvalue = function(section_id) {
|
||||
return this.cfgvalue(section_id) || 0;
|
||||
};
|
||||
|
||||
o = s.taboption('advanced', form.Value, 'mtu', _('MTU'));
|
||||
o.placeholder = 1500;
|
||||
o.datatype = 'range(64,9000)';
|
||||
o.rmempty = true;
|
||||
o.modalonly = true;
|
||||
|
||||
o = s.taboption('advanced', form.ListValue, 'type', _('Route type'));
|
||||
o.value('', 'unicast');
|
||||
o.value('local');
|
||||
o.value('broadcast');
|
||||
o.value('multicast');
|
||||
o.value('unreachable');
|
||||
o.value('prohibit');
|
||||
o.value('blackhole');
|
||||
o.value('anycast');
|
||||
o.default = '';
|
||||
o.rmempty = true;
|
||||
o.modalonly = true;
|
||||
|
||||
o = s.taboption('advanced', form.Value, 'table', _('Route table'));
|
||||
o.value('local', 'local (255)');
|
||||
o.value('main', 'main (254)');
|
||||
o.value('default', 'default (253)');
|
||||
o.rmempty = true;
|
||||
o.modalonly = true;
|
||||
o.cfgvalue = function(section_id) {
|
||||
var cfgvalue = this.super('cfgvalue', [section_id]);
|
||||
return cfgvalue || 'main';
|
||||
};
|
||||
|
||||
o = s.taboption('advanced', form.Value, 'source', _('Source Address'));
|
||||
o.placeholder = E('em', _('automatic'));
|
||||
for (var j = 0; j < netdevs.length; j++) {
|
||||
var addrs = netdevs[j].getIPAddrs();
|
||||
for (var k = 0; k < addrs.length; k++)
|
||||
o.value(addrs[k].split('/')[0]);
|
||||
}
|
||||
o.datatype = (i == 4) ? 'ip4addr' : 'ip6addr';
|
||||
o.default = '';
|
||||
o.rmempty = true;
|
||||
o.modalonly = true;
|
||||
|
||||
o = s.taboption('advanced', form.Flag, 'onlink', _('On-Link route'));
|
||||
o.default = o.disabled;
|
||||
o.rmempty = true;
|
||||
}
|
||||
|
||||
return m.render();
|
||||
}
|
||||
});
|
|
@ -1,159 +0,0 @@
|
|||
var 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: '%s: %d%s / %s: %d/%d'.format(_('Signal'), bss.signal, _('dB'), _('Quality'), qval, qmax)
|
||||
}, [
|
||||
E('img', { src: L.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
|
||||
return E('em', enc.enabled ? _('unknown') : _('open'));
|
||||
}
|
||||
|
||||
function format_actions(dev, type, 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: L.env.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: type === 'wl' ? 1 : 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: L.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() {
|
||||
L.stop(poll);
|
||||
L.halt();
|
||||
|
||||
scan();
|
||||
}
|
||||
|
||||
function scan() {
|
||||
var tbl = document.querySelector('[data-wifi-scan]'),
|
||||
dev = tbl.getAttribute('data-wifi-scan'),
|
||||
type = tbl.getAttribute('data-wifi-type');
|
||||
|
||||
cbi_update_table(tbl, [], E('em', { class: 'spinning' }, _('Starting wireless scan...')));
|
||||
|
||||
L.post(L.url('admin/network/wireless_scan_trigger', dev), null, function(s) {
|
||||
if (s.status !== 204) {
|
||||
cbi_update_table(tbl, [], E('em', _('Scan request failed')));
|
||||
return;
|
||||
}
|
||||
|
||||
var count = 0;
|
||||
|
||||
poll = L.poll(3, L.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(dev, type, res)
|
||||
]);
|
||||
});
|
||||
|
||||
cbi_update_table(tbl, bss, E('em', { class: 'spinning' }, _('No scan results available yet...')));
|
||||
}
|
||||
|
||||
if (count++ >= 3) {
|
||||
count = 0;
|
||||
L.post(L.url('admin/network/wireless_scan_trigger', dev, 1), null, function() {});
|
||||
}
|
||||
});
|
||||
|
||||
L.run();
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', scan);
|
|
@ -1,59 +0,0 @@
|
|||
requestAnimationFrame(function() {
|
||||
document.querySelectorAll('[data-wifi-status]').forEach(function(container) {
|
||||
var ifname = container.getAttribute('data-wifi-status'),
|
||||
small = container.querySelector('small'),
|
||||
info = container.querySelector('span');
|
||||
|
||||
L.poll(5, L.url('admin/network/wireless_status', ifname), null, function(xhr, iws) {
|
||||
var iw = Array.isArray(iws) ? iws[0] : null;
|
||||
if (!iw)
|
||||
return;
|
||||
|
||||
var is_assoc = (iw.bssid && iw.bssid != '00:00:00:00:00:00' && iw.channel && !iw.disabled);
|
||||
var p = iw.quality;
|
||||
var q = iw.disabled ? -1 : p;
|
||||
|
||||
var icon;
|
||||
if (q < 0)
|
||||
icon = L.resource('icons/signal-none.png');
|
||||
else if (q == 0)
|
||||
icon = L.resource('icons/signal-0.png');
|
||||
else if (q < 25)
|
||||
icon = L.resource('icons/signal-0-25.png');
|
||||
else if (q < 50)
|
||||
icon = L.resource('icons/signal-25-50.png');
|
||||
else if (q < 75)
|
||||
icon = L.resource('icons/signal-50-75.png');
|
||||
else
|
||||
icon = L.resource('icons/signal-75-100.png');
|
||||
|
||||
L.dom.content(small, [
|
||||
E('img', {
|
||||
src: icon,
|
||||
title: '%s: %d %s / %s: %d %s'.format(
|
||||
_('Signal'), iw.signal, _('dBm'),
|
||||
_('Noise'), iw.noise, _('dBm'))
|
||||
}),
|
||||
'\u00a0', E('br'), '%d%%\u00a0'.format(p)
|
||||
]);
|
||||
|
||||
L.itemlist(info, [
|
||||
_('Mode'), iw.mode,
|
||||
_('SSID'), iw.ssid || '?',
|
||||
_('BSSID'), is_assoc ? iw.bssid : null,
|
||||
_('Encryption'), is_assoc ? iw.encryption || _('None') : null,
|
||||
_('Channel'), is_assoc ? '%d (%.3f %s)'.format(iw.channel, iw.frequency || 0, _('GHz')) : null,
|
||||
_('Tx-Power'), is_assoc ? '%d %s'.format(iw.txpower, _('dBm')) : null,
|
||||
_('Signal'), is_assoc ? '%d %s'.format(iw.signal, _('dBm')) : null,
|
||||
_('Noise'), is_assoc ? '%d %s'.format(iw.noise, _('dBm')) : null,
|
||||
_('Bitrate'), is_assoc ? '%.1f %s'.format(iw.bitrate || 0, _('Mbit/s')) : null,
|
||||
_('Country'), is_assoc ? iw.country : null
|
||||
], [ ' | ', E('br'), E('br'), E('br'), E('br'), E('br'), ' | ', E('br'), ' | ' ]);
|
||||
|
||||
if (!is_assoc)
|
||||
L.dom.append(info, E('em', iw.disabled ? _('Wireless is disabled') : _('Wireless is not associated')));
|
||||
});
|
||||
|
||||
L.run();
|
||||
});
|
||||
});
|
|
@ -1,93 +0,0 @@
|
|||
function wifi_delete(ev) {
|
||||
if (!confirm(_('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) {
|
||||
L.halt();
|
||||
|
||||
findParent(ev.target, '.table').querySelectorAll('[data-disabled="false"]').forEach(function(s) {
|
||||
L.dom.content(s, E('em', _('Wireless is restarting...')));
|
||||
});
|
||||
|
||||
L.post(L.url('admin/network/wireless_reconnect', ev.target.getAttribute('data-radio')), L.run);
|
||||
}
|
||||
|
||||
var networks = [ ];
|
||||
|
||||
document.querySelectorAll('[data-network]').forEach(function(n) {
|
||||
networks.push(n.getAttribute('data-network'));
|
||||
});
|
||||
|
||||
L.poll(5, L.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 = L.resource('icons/signal-none.png');
|
||||
else if (q == 0)
|
||||
icon = L.resource('icons/signal-0.png');
|
||||
else if (q < 25)
|
||||
icon = L.resource('icons/signal-0-25.png');
|
||||
else if (q < 50)
|
||||
icon = L.resource('icons/signal-25-50.png');
|
||||
else if (q < 75)
|
||||
icon = L.resource('icons/signal-50-75.png');
|
||||
else
|
||||
icon = L.resource('icons/signal-75-100.png');
|
||||
|
||||
L.dom.content(sig, E('span', {
|
||||
class: 'ifacebadge',
|
||||
title: '%s %d %s / %s: %d %s'.format(_('Signal'), iw.signal, _('dBm'), _('Noise'), iw.noise, _('dBm'))
|
||||
}, [ E('img', { src: icon }), ' %d%%'.format(p) ]));
|
||||
|
||||
L.itemlist(info, [
|
||||
_('SSID'), iw.ssid || '?',
|
||||
_('Mode'), iw.mode,
|
||||
_('BSSID'), iw.is_assoc ? iw.bssid : null,
|
||||
_('Encryption'), iw.is_assoc ? iw.encryption || _('None') : null,
|
||||
null, iw.is_assoc ? null : E('em', disabled ? _('Wireless is disabled') : _('Wireless is not associated'))
|
||||
], [ ' | ', E('br') ]);
|
||||
}
|
||||
|
||||
for (var dev in radiostate) {
|
||||
var img = document.getElementById(dev + '-iw-upstate');
|
||||
if (img) img.src = L.resource('icons/wifi' + (radiostate[dev].up ? '' : '_disabled') + '.png');
|
||||
|
||||
var stat = document.getElementById(dev + '-iw-devinfo');
|
||||
L.itemlist(stat, [
|
||||
_('Channel'), '%s (%s %s)'.format(radiostate[dev].channel || '?', radiostate[dev].frequency || '?', _('GHz')),
|
||||
_('Bitrate'), '%s %s'.format(radiostate[dev].bitrate || '?', _('Mbit/s'))
|
||||
], ' | ');
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue