luci-app-mtk: update apcli pages

This commit is contained in:
hanwckf 2022-11-13 01:31:20 +08:00
parent 7b216caf26
commit 3bc497af8f
3 changed files with 15 additions and 53 deletions

View File

@ -55,46 +55,7 @@ local cfgs = mtkwifi.load_profile(dev.profile)
<script type="text/javascript" src="<%=resource%>/cbi.js?v=git-17.250.41546-90ac861"></script>
<script type="text/javascript">
var intervalId = "";
var waiting_count = 0;
function hi(to, devname, vifname)
{
var a;
var x;
var tables = new Array();
tables.push("vif-cfg-apcli");
tables.push("vif-cfg-apcli-config");
tables.push("apcli_form_buttons");
var tabs = new Array();
tabs.push("vif-cfg-tab-apcli");
document.getElementById("__activeTab").value = to;
for (x in tables)
{
a = document.getElementById(tables[x]);
if (tables[x].indexOf(to) == -1)
{
a.style.display = "none";
}
else
{
a.style.display = "";
}
}
for (y in tabs)
{
a = document.getElementById(tabs[y]);
if(tabs[y].indexOf(to) == -1)
{
a.className = "cbi-tab-disabled";
}
else
{
a.className = "cbi-tab";
}
}
}
</script>
@ -111,11 +72,6 @@ function hi(to, devname, vifname)
<span style="color:red;">( <a href="javascript:location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "reload", devname)%>'">Click here</a> to apply changes)</span>
<%end%>
</legend>
<ul class="cbi-tabmenu">
<li class="cbi-tab" id="vif-cfg-tab-apcli">
<a href="javascript:hi('apcli', <%="'"..devname.."', '"..vifname.."'"%>);this.blur(); ">AP Client</a>
</li>
</ul>
<input type="hidden" name="__activeTab" id="__activeTab" value="apcli">
<input type="hidden" name="__pin_ap_ssid" id="__pin_ap_ssid" value="">
<input type="hidden" name="ApCliAuthMode" id="ApCliAuthMode" value="<%=cfgs.ApCliAuthMode%>">

View File

@ -177,10 +177,8 @@ local chipname
<% if dev.ApCliEnable ~= "1" then %>
<% if dev.apcli.state == "up" then %>
<input class="cbi-button cbi-button-reset" style="width:100px" title="Disable this network" value="Disable" type="button" onclick="visit_url('<%=dev.apcli.devname%>','<%=luci.dispatcher.build_url("admin", "network", "wifi", "vif_disable", dev.apcli.vifname)%>')">
<% else %>
<input class="cbi-button cbi-button-apply" style="width:100px" title="Enable this network" value="Enable" type="button" onclick="visit_url('<%=dev.apcli.devname%>','<%=luci.dispatcher.build_url("admin", "network", "wifi", "vif_enable", dev.apcli.vifname)%>')">
<% end %>
<input class="cbi-button cbi-button-reload" style="width:100px" title="Reload WiFi network" value="Connect" type="button" onclick="visit_url('<%=dev.apcli.devname%>','<%=luci.dispatcher.build_url("admin", "network", "wifi", "apcli_connect", dev.devname, dev.apcli.vifname)%>')">
<% end %>
<input class="cbi-button cbi-button-edit" style="width:100px" title="Configure WiFi device" value="Config" type="button" onclick="visit_url('<%=dev.apcli.devname%>','<%=luci.dispatcher.build_url("admin", "network", "wifi", "apcli_cfg_view", dev.devname, dev.apcli.vifname)%>')">
<% else %>
<input class="cbi-button cbi-button-reset" id="ApCliDownBtn_<%=dev.apcli.devname%>" style="width:100px;display:none" title="Disable this network" value="Disable" type="button" onclick="visit_url('<%=dev.apcli.devname%>','<%=luci.dispatcher.build_url("admin", "network", "wifi", "vif_disable", dev.apcli.vifname)%>')">
@ -351,10 +349,9 @@ local chipname
XHR.poll(3, "<%=luci.dispatcher.build_url("admin", "network", "wifi", "sta_info")%>/" + stainfo[i].ifname, null,
function(x)
{
this.idx = i;
try{
//console.log(x.responseText);
response = JSON.parse(x.responseText);
var response = JSON.parse(x.responseText);
for (var j=0; stainfo[j]; j++) {
if (response[0].ifname == stainfo[j].ifname) {
response.shift(); //delete first item

View File

@ -509,16 +509,16 @@ local WirelessModeList = {
[6] = "N in 2.4G only",
[7] = "G/GN", -- i.e., no CCK mode
[8] = "A/N in 5 band",
[9] = "B/G/GN mode",
[9] = "B/G/GN",
-- [10] = "A/AN/G/GN mode", --not support B mode
[11] = "only N in 5G band",
-- [12] = "B/G/GN/A/AN/AC mixed",
-- [13] = "G/GN/A/AN/AC mixed", -- no B mode
[14] = "A/AC/AN mixed",
[15] = "AC/AN mixed", --but no A mode
[16] = "HE_2G mode", --HE Wireless Mode
[17] = "HE_5G mode", --HE Wireless Mode
[18] = "HE_6G mode", --HE Wireless Mode
[16] = "HE_2G", --HE Wireless Mode
[17] = "HE_5G", --HE Wireless Mode
[18] = "HE_6G", --HE Wireless Mode
}
local DevicePropertyMap = {
@ -1447,6 +1447,11 @@ end
function mtkwifi.scan_ap(vifname)
local flags = tonumber(mtkwifi.read_pipe("cat /sys/class/net/"..vifname.."/flags 2>/dev/null")) or 0
if flags%2 ~= 1 then
os.execute("ifconfig "..vifname.." up")
end
os.execute("iwpriv "..vifname.." set SiteSurvey=0")
os.execute("sleep 5") -- depends on your env
local op = c_scanResult(vifname, 0)
@ -1544,6 +1549,10 @@ function mtkwifi.scan_ap(vifname)
end
end
if flags%2 ~= 1 then
os.execute("ifconfig "..vifname.." down")
end
return ap_list
end