summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/luci.js6
-rw-r--r--modules/luci-base/luasrc/dispatcher.lua82
-rw-r--r--modules/luci-base/luasrc/dispatcher.luadoc9
-rw-r--r--modules/luci-mod-network/htdocs/luci-static/resources/view/network/iface_status.js42
-rw-r--r--modules/luci-mod-network/htdocs/luci-static/resources/view/network/wifi_join.js159
-rw-r--r--modules/luci-mod-network/htdocs/luci-static/resources/view/network/wifi_status.js59
-rw-r--r--modules/luci-mod-network/luasrc/controller/admin/network.lua2
-rw-r--r--modules/luci-mod-network/luasrc/model/cbi/admin_network/wifi.lua42
-rw-r--r--modules/luci-mod-network/luasrc/view/admin_network/iface_status.htm62
-rw-r--r--modules/luci-mod-network/luasrc/view/admin_network/wifi_join.htm183
-rw-r--r--modules/luci-mod-network/luasrc/view/admin_network/wifi_status.htm71
-rw-r--r--modules/luci-mod-system/luasrc/view/admin_system/sshkeys.htm13
12 files changed, 362 insertions, 368 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/luci.js b/modules/luci-base/htdocs/luci-static/resources/luci.js
index dcda941f7b..04c460182f 100644
--- a/modules/luci-base/htdocs/luci-static/resources/luci.js
+++ b/modules/luci-base/htdocs/luci-static/resources/luci.js
@@ -74,6 +74,7 @@
return XHR.get(url, data, cb);
},
+ stop: function(entry) { XHR.stop(entry) },
halt: function() { XHR.halt() },
run: function() { XHR.run() },
@@ -310,7 +311,10 @@
function LuCI(env) {
this.env = env;
- modalDiv = document.body.appendChild(this.dom.create('div', { id: 'modal_overlay' }, this.dom.create('div', { class: 'modal' })));
+ modalDiv = document.body.appendChild(
+ this.dom.create('div', { id: 'modal_overlay' },
+ this.dom.create('div', { class: 'modal', role: 'dialog', 'aria-modal': true })));
+
tooltipDiv = document.body.appendChild(this.dom.create('div', { class: 'cbi-tooltip' }));
document.addEventListener('mouseover', this.showTooltip.bind(this), true);
diff --git a/modules/luci-base/luasrc/dispatcher.lua b/modules/luci-base/luasrc/dispatcher.lua
index c4066a2592..d85cb58243 100644
--- a/modules/luci-base/luasrc/dispatcher.lua
+++ b/modules/luci-base/luasrc/dispatcher.lua
@@ -40,6 +40,28 @@ function build_url(...)
return table.concat(url, "")
end
+function _ordered_children(node)
+ local name, child, children = nil, nil, {}
+
+ for name, child in pairs(node.nodes) do
+ children[#children+1] = {
+ name = name,
+ node = child,
+ order = child.order or 100
+ }
+ end
+
+ table.sort(children, function(a, b)
+ if a.order == b.order then
+ return a.name < b.name
+ else
+ return a.order < b.order
+ end
+ end)
+
+ return children
+end
+
function node_visible(node)
if node then
return not (
@@ -55,15 +77,10 @@ end
function node_childs(node)
local rv = { }
if node then
- local k, v
- for k, v in util.spairs(node.nodes,
- function(a, b)
- return (node.nodes[a].order or 100)
- < (node.nodes[b].order or 100)
- end)
- do
- if node_visible(v) then
- rv[#rv+1] = k
+ local _, child
+ for _, child in ipairs(_ordered_children(node)) do
+ if node_visible(child.node) then
+ rv[#rv+1] = child.name
end
end
end
@@ -595,11 +612,9 @@ function createtree()
local ctx = context
local tree = {nodes={}, inreq=true}
- local modi = {}
ctx.treecache = setmetatable({}, {__mode="v"})
ctx.tree = tree
- ctx.modifiers = modi
local scope = setmetatable({}, {__index = luci.dispatcher})
@@ -609,28 +624,9 @@ function createtree()
v()
end
- local function modisort(a,b)
- return modi[a].order < modi[b].order
- end
-
- for _, v in util.spairs(modi, modisort) do
- scope._NAME = v.module
- setfenv(v.func, scope)
- v.func()
- end
-
return tree
end
-function modifier(func, order)
- context.modifiers[#context.modifiers+1] = {
- func = func,
- order = order or 0,
- module
- = getfenv(2)._NAME
- }
-end
-
function assign(path, clone, title, order)
local obj = node(unpack(path))
obj.nodes = nil
@@ -720,24 +716,7 @@ end
-- Subdispatchers --
function _find_eligible_node(root, prefix, deep, types, descend)
- local _, cur_name, cur_node
- local childs = { }
-
- for cur_name, cur_node in pairs(root.nodes) do
- childs[#childs+1] = {
- node = cur_node,
- name = cur_name,
- order = cur_node.order or 100
- }
- end
-
- table.sort(childs, function(a, b)
- if a.order == b.order then
- return a.name < b.name
- else
- return a.order < b.order
- end
- end)
+ local children = _ordered_children(root)
if not root.leaf and deep ~= nil then
local sub_path = { unpack(prefix) }
@@ -746,10 +725,11 @@ function _find_eligible_node(root, prefix, deep, types, descend)
deep = nil
end
- for _, cur_node in ipairs(childs) do
- sub_path[#prefix+1] = cur_node.name
+ local _, child
+ for _, child in ipairs(children) do
+ sub_path[#prefix+1] = child.name
- local res_path = _find_eligible_node(cur_node.node, sub_path,
+ local res_path = _find_eligible_node(child.node, sub_path,
deep, types, true)
if res_path then
diff --git a/modules/luci-base/luasrc/dispatcher.luadoc b/modules/luci-base/luasrc/dispatcher.luadoc
index f26256953a..a77f8d8b07 100644
--- a/modules/luci-base/luasrc/dispatcher.luadoc
+++ b/modules/luci-base/luasrc/dispatcher.luadoc
@@ -82,15 +82,6 @@ Build the index before if it does not exist yet.
]]
---[[
-Register a tree modifier.
-
-@class function
-@name modifier
-@param func Modifier function
-@param order Modifier order value (optional)
-]]
-
----[[
Clone a node of the dispatching tree to another position.
@class function
diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/iface_status.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/iface_status.js
new file mode 100644
index 0000000000..88f48d189a
--- /dev/null
+++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/iface_status.js
@@ -0,0 +1,42 @@
+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();
+ });
+});
diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wifi_join.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wifi_join.js
new file mode 100644
index 0000000000..d5bd7b0a6d
--- /dev/null
+++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wifi_join.js
@@ -0,0 +1,159 @@
+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);
diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wifi_status.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wifi_status.js
new file mode 100644
index 0000000000..7e14d999bd
--- /dev/null
+++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wifi_status.js
@@ -0,0 +1,59 @@
+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'), '%h'.format(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();
+ });
+});
diff --git a/modules/luci-mod-network/luasrc/controller/admin/network.lua b/modules/luci-mod-network/luasrc/controller/admin/network.lua
index a200f79b51..1da5eac464 100644
--- a/modules/luci-mod-network/luasrc/controller/admin/network.lua
+++ b/modules/luci-mod-network/luasrc/controller/admin/network.lua
@@ -321,7 +321,7 @@ function wifi_scan_trigger(radio, update)
return
end
- luci.http.status(200, "Scan scheduled")
+ luci.http.status(204, "Scan scheduled")
if nixio.fork() == 0 then
io.stderr:close()
diff --git a/modules/luci-mod-network/luasrc/model/cbi/admin_network/wifi.lua b/modules/luci-mod-network/luasrc/model/cbi/admin_network/wifi.lua
index 8ed39df486..9ab282c3ab 100644
--- a/modules/luci-mod-network/luasrc/model/cbi/admin_network/wifi.lua
+++ b/modules/luci-mod-network/luasrc/model/cbi/admin_network/wifi.lua
@@ -17,7 +17,9 @@ local acct_port, acct_secret, acct_server, anonymous_identity, ant1, ant2,
privkeypwd2, r0_key_lifetime, r0kh, r1_key_holder, r1kh,
reassociation_deadline, retry_timeout, ssid, st, tp, wepkey, wepslot,
wmm, wpakey, wps, disassoc_low_ack, short_preamble, beacon_int, dtim_period,
- wparekey, inactivitypool, maxinactivity, listeninterval
+ wparekey, inactivitypool, maxinactivity, listeninterval,
+ dae_client, dae_port, dae_port
+
arg[1] = arg[1] or ""
@@ -755,6 +757,30 @@ acct_secret:depends({mode="ap-wds", encryption="wpa2"})
acct_secret.rmempty = true
acct_secret.password = true
+dae_client = s:taboption("encryption", Value, "dae_client", translate("DAE-Client"))
+dae_client:depends({mode="ap", encryption="wpa"})
+dae_client:depends({mode="ap", encryption="wpa2"})
+dae_client:depends({mode="ap-wds", encryption="wpa"})
+dae_client:depends({mode="ap-wds", encryption="wpa2"})
+dae_client.rmempty = true
+dae_client.datatype = "host(0)"
+
+dae_port = s:taboption("encryption", Value, "dae_port", translate("DAE-Port"), translatef("Default %d", 3799))
+dae_port:depends({mode="ap", encryption="wpa"})
+dae_port:depends({mode="ap", encryption="wpa2"})
+dae_port:depends({mode="ap-wds", encryption="wpa"})
+dae_port:depends({mode="ap-wds", encryption="wpa2"})
+dae_port.rmempty = true
+dae_port.datatype = "port"
+
+dae_secret = s:taboption("encryption", Value, "dae_secret", translate("DAE-Secret"))
+dae_secret:depends({mode="ap", encryption="wpa"})
+dae_secret:depends({mode="ap", encryption="wpa2"})
+dae_secret:depends({mode="ap-wds", encryption="wpa"})
+dae_secret:depends({mode="ap-wds", encryption="wpa2"})
+dae_secret.rmempty = true
+dae_secret.password = true
+
wpakey = s:taboption("encryption", Value, "_wpa_key", translate("Key"))
wpakey:depends("encryption", "psk")
wpakey:depends("encryption", "psk2")
@@ -872,12 +898,14 @@ if hwtype == "mac80211" or hwtype == "prism2" then
ft_psk_generate_local = s:taboption("encryption", Flag, "ft_psk_generate_local",
translate("Generate PMK locally"),
- translate("When using a PSK, the PMK can be generated locally without inter AP communications"))
+ translate("When using a PSK, the PMK can be automatically generated. When enabled, the R0/R1 key options below are not applied. Disable this to use the R0 and R1 key options."))
ft_psk_generate_local:depends({ieee80211r="1"})
+ ft_psk_generate_local.default = ft_psk_generate_local.enabled
+ ft_psk_generate_local.rmempty = false
r0_key_lifetime = s:taboption("encryption", Value, "r0_key_lifetime",
translate("R0 Key Lifetime"), translate("minutes"))
- r0_key_lifetime:depends({ieee80211r="1", ft_psk_generate_local=""})
+ r0_key_lifetime:depends({ieee80211r="1"})
r0_key_lifetime.placeholder = "10000"
r0_key_lifetime.datatype = "uinteger"
r0_key_lifetime.rmempty = true
@@ -885,13 +913,13 @@ if hwtype == "mac80211" or hwtype == "prism2" then
r1_key_holder = s:taboption("encryption", Value, "r1_key_holder",
translate("R1 Key Holder"),
translate("6-octet identifier as a hex string - no colons"))
- r1_key_holder:depends({ieee80211r="1", ft_psk_generate_local=""})
+ r1_key_holder:depends({ieee80211r="1"})
r1_key_holder.placeholder = "00004f577274"
r1_key_holder.datatype = "and(hexstring,rangelength(12,12))"
r1_key_holder.rmempty = true
pmk_r1_push = s:taboption("encryption", Flag, "pmk_r1_push", translate("PMK R1 Push"))
- pmk_r1_push:depends({ieee80211r="1", ft_psk_generate_local=""})
+ pmk_r1_push:depends({ieee80211r="1"})
pmk_r1_push.placeholder = "0"
pmk_r1_push.rmempty = true
@@ -901,7 +929,7 @@ if hwtype == "mac80211" or hwtype == "prism2" then
"<br />This list is used to map R0KH-ID (NAS Identifier) to a destination " ..
"MAC address when requesting PMK-R1 key from the R0KH that the STA " ..
"used during the Initial Mobility Domain Association."))
- r0kh:depends({ieee80211r="1", ft_psk_generate_local=""})
+ r0kh:depends({ieee80211r="1"})
r0kh.rmempty = true
r1kh = s:taboption("encryption", DynamicList, "r1kh", translate("External R1 Key Holder List"),
@@ -910,7 +938,7 @@ if hwtype == "mac80211" or hwtype == "prism2" then
"<br />This list is used to map R1KH-ID to a destination MAC address " ..
"when sending PMK-R1 key from the R0KH. This is also the " ..
"list of authorized R1KHs in the MD that can request PMK-R1 keys."))
- r1kh:depends({ieee80211r="1", ft_psk_generate_local=""})
+ r1kh:depends({ieee80211r="1"})
r1kh.rmempty = true
-- End of 802.11r options
diff --git a/modules/luci-mod-network/luasrc/view/admin_network/iface_status.htm b/modules/luci-mod-network/luasrc/view/admin_network/iface_status.htm
index 34be35dd20..a75b2755cd 100644
--- a/modules/luci-mod-network/luasrc/view/admin_network/iface_status.htm
+++ b/modules/luci-mod-network/luasrc/view/admin_network/iface_status.htm
@@ -1,66 +1,12 @@
<%+cbi/valueheader%>
-<script type="text/javascript">//<![CDATA[
- XHR.poll(5, '<%=url('admin/network/iface_status', self.network)%>', null,
- function(x, ifc)
- {
- if (ifc && (ifc = ifc[0]))
- {
- var s = document.getElementById('<%=self.option%>-ifc-status'),
- img = s.querySelector('img'),
- info = s.querySelector('span'),
- html = '<strong><%:Device%>:</strong> %h<br />'.format(ifc.ifname);
-
- if (ifc.ifname)
- {
- if (ifc.is_up)
- html += String.format('<strong><%:Uptime%>:</strong> %t<br />', ifc.uptime);
-
- if (ifc.macaddr)
- html += String.format('<strong><%:MAC%>:</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);
-
- info.innerHTML = html;
- }
- else
- {
- info.innerHTML = '<em><%:Interface not present or not connected yet.%></em>';
- }
-
- img.src = '<%=resource%>/icons/%s%s.png'.format(ifc.type, ifc.is_up ? '' : '_disabled');
- }
- }
- );
-//]]></script>
-
-<span class="ifacebadge large" id="<%=self.option%>-ifc-status">
+<span class="ifacebadge large"<%=attr("data-iface-status", self.network)%>>
<img src="<%=resource%>/icons/ethernet_disabled.png" />
<span>
- <em><%:Collecting data...%></em>
+ <em class="spinning"><%:Collecting data...%></em>
</span>
</span>
+<script type="text/javascript" src="<%=resource%>/view/network/iface_status.js"></script>
+
<%+cbi/valuefooter%>
diff --git a/modules/luci-mod-network/luasrc/view/admin_network/wifi_join.htm b/modules/luci-mod-network/luasrc/view/admin_network/wifi_join.htm
index 987123642f..5a61ba099c 100644
--- a/modules/luci-mod-network/luasrc/view/admin_network/wifi_join.htm
+++ b/modules/luci-mod-network/luasrc/view/admin_network/wifi_join.htm
@@ -19,185 +19,18 @@
<%+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" id="scan_results">
+ <div class="table"<%=attr("data-wifi-scan", dev) .. attr("data-wifi-type", iw.type)%>>
<div class="tr table-titles">
- <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 col-2 middle center"><%:Signal%></div>
+ <div class="th col-4 middle left"><%:SSID%></div>
+ <div class="th col-2 middle center hide-xs"><%:Channel%></div>
+ <div class="th col-2 middle left hide-xs"><%:Mode%></div>
+ <div class="th col-3 middle left hide-xs"><%:BSSID%></div>
+ <div class="th col-3 middle left"><%:Encryption%></div>
<div class="th cbi-section-actions">&#160;</div>
</div>
@@ -221,4 +54,6 @@
</form>
</div>
+<script type="text/javascript" src="<%=resource%>/view/network/wifi_join.js"></script>
+
<%+footer%>
diff --git a/modules/luci-mod-network/luasrc/view/admin_network/wifi_status.htm b/modules/luci-mod-network/luasrc/view/admin_network/wifi_status.htm
index bfad3d0804..93ae2f51fb 100644
--- a/modules/luci-mod-network/luasrc/view/admin_network/wifi_status.htm
+++ b/modules/luci-mod-network/luasrc/view/admin_network/wifi_status.htm
@@ -1,77 +1,14 @@
<%+cbi/valueheader%>
-<script type="text/javascript">//<![CDATA[
- XHR.poll(5, '<%=url('admin/network/wireless_status', self.ifname)%>', null,
- function(x, iw)
- {
- if (iw && (iw = iw[0]))
- {
- 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 = "<%=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 s = document.getElementById('<%=self.option%>-iw-status'),
- small = s.querySelector('small'),
- info = s.querySelector('span');
-
- small.innerHTML = info.innerHTML = String.format(
- '<img src="%s" title="<%:Signal%>: %d <%:dBm%> / <%:Noise%>: %d <%:dBm%>" />&#160;<br />%d%%&#160;',
- icon, iw.signal, iw.noise, p
- );
-
- if (is_assoc)
- info.innerHTML = String.format(
- '<strong><%:Mode%>:</strong> %s | ' +
- '<strong><%:SSID%>:</strong> %h<br />' +
- '<strong><%:BSSID%>:</strong> %s<br />' +
- '<strong><%:Encryption%>:</strong> %s<br />' +
- '<strong><%:Channel%>:</strong> %d (%.3f <%:GHz%>)<br />' +
- '<strong><%:Tx-Power%>:</strong> %d <%:dBm%><br />' +
- '<strong><%:Signal%>:</strong> %d <%:dBm%> | ' +
- '<strong><%:Noise%>:</strong> %d <%:dBm%><br />' +
- '<strong><%:Bitrate%>:</strong> %.1f <%:Mbit/s%> | ' +
- '<strong><%:Country%>:</strong> %s',
- iw.mode, iw.ssid, iw.bssid,
- iw.encryption ? iw.encryption : '<%:None%>',
- iw.channel, iw.frequency ? iw.frequency : 0,
- iw.txpower, iw.signal, iw.noise,
- iw.bitrate ? iw.bitrate : 0, iw.country
- );
- else
- info.innerHTML = String.format(
- '<strong><%:SSID%>:</strong> %h | ' +
- '<strong><%:Mode%>:</strong> %s<br />' +
- '<em>%s</em>',
- iw.ssid || '?', iw.mode,
- iw.disabled ? '<em><%:Wireless is disabled%></em>'
- : '<em><%:Wireless is not associated%></em>'
- );
- }
- }
- );
-//]]></script>
-
-<span class="ifacebadge large" id="<%=self.option%>-iw-status">
+<span class="ifacebadge large"<%=attr("data-wifi-status", self.ifname)%>>
<small>
<img src="<%=resource%>/icons/signal-none.png" title="<%:Not associated%>" />&#160;
</small>
<span>
- <em><%:Collecting data...%></em>
+ <em class="spinning"><%:Collecting data...%></em>
</span>
</span>
+<script type="text/javascript" src="<%=resource%>/view/network/wifi_status.js"></script>
+
<%+cbi/valuefooter%>
diff --git a/modules/luci-mod-system/luasrc/view/admin_system/sshkeys.htm b/modules/luci-mod-system/luasrc/view/admin_system/sshkeys.htm
index 77efa11a0f..e0917995e4 100644
--- a/modules/luci-mod-system/luasrc/view/admin_system/sshkeys.htm
+++ b/modules/luci-mod-system/luasrc/view/admin_system/sshkeys.htm
@@ -4,6 +4,19 @@
.cbi-dynlist {
max-width: 100%;
}
+
+ .cbi-dynlist .item > small {
+ display: block;
+ direction: rtl;
+ overflow: hidden;
+ text-align: left;
+ }
+
+ .cbi-dynlist .item > small > code {
+ direction: ltr;
+ white-space: nowrap;
+ unicode-bidi: bidi-override;
+ }
</style>
<div class="cbi-map">