2 local supports_deauth = {}
5 for _, v in ipairs(luci.util.ubus()) do
6 local iface = v:match(
"^hostapd%.(.+)$")
8 local funcs = luci.util.ubus(v)
9 if type(funcs) ==
"table" and funcs.del_client then
10 supports_deauth[iface] = true
16 <script type=
"text/javascript">//<![CDATA[
17 var supports_deauth = <%= luci.http.write_json(supports_deauth) %
>;
19 function wifirate(bss, rx) {
20 var p = rx ? 'rx_' : 'tx_',
21 s = '%
.1f <%:Mbit/s%
>, %d<%:MHz%
>'
22 .format(bss[p+'rate'] /
1000, bss[p+'mhz']),
23 ht = bss[p+'ht'], vht = bss[p+'vht'],
24 mhz = bss[p+'mhz'], nss = bss[p+'nss'],
25 mcs = bss[p+'mcs'], sgi = bss[p+'short_gi'];
28 if (vht) s += ', VHT-MCS %d'.format(mcs);
29 if (nss) s += ', VHT-NSS %d'.format(nss);
30 if (ht) s += ', MCS %s'.format(mcs);
31 if (sgi) s += ', <%:Short GI%
>';
37 function handleDeauth(ev) {
38 (new XHR()).post('<%=url('admin/wireless_deauth')%
>', {
40 iface: ev.target.getAttribute('data-iface'),
41 bssid: ev.target.getAttribute('data-bssid')
43 ev.target.disabled = true;
47 XHR.poll(-
1, '<%=url('admin/wireless_assoclist')%
>', null,
50 var tb = document.getElementById('wifi_assoclist_table');
55 st.forEach(function(bss) {
57 var q = (-
1 * (bss.noise - bss.signal)) /
5;
59 icon =
"<%=resource%>/icons/signal-0.png";
61 icon =
"<%=resource%>/icons/signal-0-25.png";
63 icon =
"<%=resource%>/icons/signal-25-50.png";
65 icon =
"<%=resource%>/icons/signal-50-75.png";
67 icon =
"<%=resource%>/icons/signal-75-100.png";
70 '
<span class=
"ifacebadge" title=
"%q"><img src=
"<%=resource%>/icons/wifi.png" /> <a href=
"%s">%h
</a><small> (%h)
</small></span>'.format(
76 bss.host_hint ? '%h (%h)'.format(bss.host_name || '?', bss.host_hint) : (bss.host_name || '?'),
77 '
<span class=
"ifacebadge" title=
"<%:Signal%>: %d <%:dBm%> / <%:Noise%>: %d <%:dBm%> / <%:SNR%>: %d"><img src=
"%s" /> %d / %d <%:dBm%
></span>'.format(
80 bss.signal - bss.noise,
85 E('span', wifirate(bss, true)),
87 E('span', wifirate(bss, false))
89 supports_deauth[bss.ifname] ? E('input', {
91 class: 'cbi-button cbi-button-remove',
92 value: '<%:Disconnect%
>',
93 'data-bssid': bss.bssid,
94 'data-iface': bss.ifname,
100 cbi_update_table(tb, rows, '
<em><%:No information available%
></em>');
106 <div class=
"table" id=
"wifi_assoclist_table">
107 <div class=
"tr table-titles">
108 <div class=
"th nowrap"><%:Network%
></div>
109 <div class=
"th hide-xs"><%:MAC-Address%
></div>
110 <div class=
"th nowrap"><%:Host%
></div>
111 <div class=
"th nowrap"><%:Signal%
> / <%:Noise%
></div>
112 <div class=
"th nowrap"><%:RX Rate%
> / <%:TX Rate%
></div>
113 <% if next(supports_deauth) then %
>
114 <div class=
"th right"><%:Disconnect%
></div>
117 <div class=
"tr placeholder">
118 <div class=
"td"><em><%:Collecting data...%
></em></div>