From 16ce3e39df9d704a2333279d6b2e1f16e5460bb8 Mon Sep 17 00:00:00 2001 From: Dirk Brenken Date: Mon, 21 Oct 2019 20:43:27 +0200 Subject: [PATCH] luci-app-travelmate: sync with update 1.5.1 * fix wireless and travelmate section naming * fix other small visual issues Signed-off-by: Dirk Brenken --- .../luasrc/model/cbi/travelmate/wifi_add.lua | 10 ++--- .../luasrc/model/cbi/travelmate/wifi_edit.lua | 39 +++++++++---------- .../luasrc/view/travelmate/stations.htm | 6 +-- 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 406e17e42b..e0d0cedd7e 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 725bd59770..ef97e26a25 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 5c28966339..e6d297cd93 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
- <%=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)%>
@@ -131,7 +131,7 @@ This is free software, licensed under the Apache License, Version 2.0 - +
-- 2.30.2