diff options
3 files changed, 26 insertions, 29 deletions
diff --git a/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_add.lua b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_add.lua index 406e17e42..e0d0cedd7 100644 --- a/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_add.lua +++ b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_add.lua @@ -155,7 +155,7 @@ elseif m.hidden.wpa_version > 0 then end end -local login_section = (m.hidden.ssid or "") .. (m.hidden.bssid or "") +local login_section = (m.hidden.device or "") .. "_" .. (m.hidden.ssid or "") .. "_" .. (m.hidden.bssid or "") login_section = login_section:gsub("[^%w_]", "_") local cmd = uci:get("travelmate", login_section, "command") local cmd_args_default = uci:get("travelmate", login_section, "command_args") @@ -172,7 +172,7 @@ cmd_list.default = cmd or "none" cmd_args.default = cmd_args_default function wssid.write(self, section, value) - newsection = uci:section("wireless", "wifi-iface", "trm_" .. login_section, { + newsection = uci:section("wireless", "wifi-iface", login_section, { mode = "sta", network = trmiface, device = m.hidden.device, @@ -181,7 +181,7 @@ function wssid.write(self, section, value) disabled = "1" }) - if encr:formvalue(section) then + if encr then if string.find(encr:formvalue(section), '^wep') then uci:set("wireless", newsection, "encryption", encr:formvalue(section)) uci:set("wireless", newsection, "key", wkey:formvalue(section) or "") @@ -197,7 +197,7 @@ function wssid.write(self, section, value) elseif encr:formvalue(section) ~= "owe" then uci:set("wireless", newsection, "key", wkey:formvalue(section) or "") end - if ciph:formvalue(section) and ciph:formvalue(section) ~= "auto" then + if ciph and ciph:formvalue(section) ~= "auto" then uci:set("wireless", newsection, "encryption", encr:formvalue(section) .. "+" .. ciph:formvalue(section)) else uci:set("wireless", newsection, "encryption", encr:formvalue(section)) @@ -206,8 +206,6 @@ function wssid.write(self, section, value) uci:set("wireless", newsection, "encryption", "none") end - local login_section = (wssid:formvalue(section) or "") .. (bssid:formvalue(section) or "") - login_section = login_section:gsub("[^%w_]", "_") if not uci:get("travelmate", login_section) and cmd_list:formvalue(section) ~= "none" then uci:set("travelmate", login_section, "login") end diff --git a/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_edit.lua b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_edit.lua index 725bd5977..ef97e26a2 100644 --- a/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_edit.lua +++ b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_edit.lua @@ -141,30 +141,30 @@ if s ~= nil then wkey.default = s.key end end - - local login_section = (s.ssid or "") .. (s.bssid or "") - login_section = login_section:gsub("[^%w_]", "_") - local cmd = uci:get("travelmate", login_section, "command") - local cmd_args_default = uci:get("travelmate", login_section, "command_args") - cmd_list = m:field(ListValue, "cmdlist", translate("Auto Login Script"), - translate("External script reference which will be called for automated captive portal logins.")) - cmd_args = m:field(Value, "cmdargs", translate("Optional Arguments"), - translate("Space separated list of additional arguments passed to the Auto Login Script, i.e. username and password")) - for _, z in ipairs(scripts) do - cmd_list:value(z) - cmd_args:depends("cmdlist", z) - end - cmd_list:value("none") - cmd_list.default = cmd or "none" - cmd_args.default = cmd_args_default else m.on_cancel() end +local login_section = (s.device or "") .. "_" .. (s.ssid or "") .. "_" .. (s.bssid or "") +login_section = login_section:gsub("[^%w_]", "_") +local cmd = uci:get("travelmate", login_section, "command") +local cmd_args_default = uci:get("travelmate", login_section, "command_args") +cmd_list = m:field(ListValue, "cmdlist", translate("Auto Login Script"), + translate("External script reference which will be called for automated captive portal logins.")) +cmd_args = m:field(Value, "cmdargs", translate("Optional Arguments"), + translate("Space separated list of additional arguments passed to the Auto Login Script, i.e. username and password")) +for _, z in ipairs(scripts) do + cmd_list:value(z) + cmd_args:depends("cmdlist", z) +end +cmd_list:value("none") +cmd_list.default = cmd or "none" +cmd_args.default = cmd_args_default + function wssid.write(self, section, value) uci:set("wireless", m.hidden.cfg, "ssid", wssid:formvalue(section)) uci:set("wireless", m.hidden.cfg, "bssid", bssid:formvalue(section)) - if encr:formvalue(section) then + if encr then if string.find(encr:formvalue(section), '^wep') then uci:set("wireless", m.hidden.cfg, "encryption", encr:formvalue(section)) uci:set("wireless", m.hidden.cfg, "key", wkey:formvalue(section) or "") @@ -181,14 +181,13 @@ function wssid.write(self, section, value) if encr:formvalue(section) ~= "owe" then uci:set("wireless", m.hidden.cfg, "key", wkey:formvalue(section) or "") end - if ciph:formvalue(section) and ciph:formvalue(section) ~= "auto" then + if ciph and ciph:formvalue(section) ~= "auto" then uci:set("wireless", m.hidden.cfg, "encryption", encr:formvalue(section) .. "+" .. ciph:formvalue(section)) else uci:set("wireless", m.hidden.cfg, "encryption", encr:formvalue(section)) end end - local login_section = (wssid:formvalue(section) or "") .. (bssid:formvalue(section) or "") - login_section = login_section:gsub("[^%w_]", "_") + if not uci:get("travelmate", login_section) and cmd_list:formvalue(section) ~= "none" then uci:set("travelmate", login_section, "login") end diff --git a/applications/luci-app-travelmate/luasrc/view/travelmate/stations.htm b/applications/luci-app-travelmate/luasrc/view/travelmate/stations.htm index 5c2896633..e6d297cd9 100644 --- a/applications/luci-app-travelmate/luasrc/view/travelmate/stations.htm +++ b/applications/luci-app-travelmate/luasrc/view/travelmate/stations.htm @@ -1,5 +1,5 @@ <%# -Copyright 2017-2018 Dirk Brenken (dev@brenken.org) +Copyright 2017-2019 Dirk Brenken (dev@brenken.org) This is free software, licensed under the Apache License, Version 2.0 -%> @@ -100,7 +100,7 @@ This is free software, licensed under the Apache License, Version 2.0 <div class="cbi-map"> <div class="cbi-map-descr"> - <%=translatef("Provides an overview of all configured uplinks for the travelmate interface (%s). You can edit, delete or re-order existing uplinks or scan for a new one. The currently used uplink is emphasized in blue, faulty stations in red.", trmiface)%> + <%=translatef("Provides an overview of all configured uplinks for the travelmate interface (%s). You can edit, remove or re-order/prioritize existing uplinks or scan for new ones. The currently used uplink is emphasized in blue, faulty stations in red.", trmiface)%> </div> <div class="cbi-section"> @@ -131,7 +131,7 @@ This is free software, licensed under the Apache License, Version 2.0 <input class="cbi-button cbi-button-up" type="button" value="<%:Up%>" onclick="location.href='<%=luci.dispatcher.build_url('admin/services/travelmate/wifiorder')%>?cfg=<%=section%>&dir=up'" alt="<%:Move up%>" title="<%:Move up%>" /> <input class="cbi-button cbi-button-down" type="button" value="<%:Down%>" onclick="location.href='<%=luci.dispatcher.build_url('admin/services/travelmate/wifiorder')%>?cfg=<%=section%>&dir=down'" alt="<%:Move down%>" title="<%:Move down%>" /> <input class="cbi-button cbi-button-edit" type="button" value="<%:Edit%>" onclick="location.href='<%=luci.dispatcher.build_url('admin/services/travelmate/wifiedit')%>?cfg=<%=section%>'" title="<%:Edit this Uplink%>" /> - <input class="cbi-button cbi-button-remove" type="button" value="<%:Delete%>" onclick="location.href='<%=luci.dispatcher.build_url('admin/services/travelmate/wifidelete')%>?cfg=<%=section%>'" title="<%:Delete this Uplink%>" /> + <input class="cbi-button cbi-button-remove" type="button" value="<%:Remove%>" onclick="location.href='<%=luci.dispatcher.build_url('admin/services/travelmate/wifidelete')%>?cfg=<%=section%>'" title="<%:Remove this Uplink%>" /> </div> </div> </div> |