diff options
author | Dirk Brenken <dev@brenken.org> | 2019-10-21 20:43:27 +0200 |
---|---|---|
committer | Dirk Brenken <dev@brenken.org> | 2019-10-21 20:43:27 +0200 |
commit | 16ce3e39df9d704a2333279d6b2e1f16e5460bb8 (patch) | |
tree | b9243209d310839c2c086579b3bfd130df49d8f0 /applications/luci-app-travelmate/luasrc/model | |
parent | f7120fb43a0e7ac840a815d0409240d557c47732 (diff) |
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 <dev@brenken.org>
Diffstat (limited to 'applications/luci-app-travelmate/luasrc/model')
-rw-r--r-- | applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_add.lua | 10 | ||||
-rw-r--r-- | applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_edit.lua | 39 |
2 files changed, 23 insertions, 26 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 |