diff options
author | Dirk Brenken <dev@brenken.org> | 2018-03-05 12:26:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-05 12:26:19 +0100 |
commit | 41b7a90e079b4c652889825370521008ca841a48 (patch) | |
tree | c728d30ada44568d73efdf7c6750b48723003bc3 /applications/luci-app-travelmate/luasrc | |
parent | d9039fc2c37d77c9323e505c9c17cb66a7e61bb9 (diff) | |
parent | 898b8a9904f597be38eb7e80201ee958bab65668 (diff) |
Merge pull request #1662 from dibdot/travelmate
luci-app-travelmate: fixes for new QR code template
Diffstat (limited to 'applications/luci-app-travelmate/luasrc')
-rw-r--r-- | applications/luci-app-travelmate/luasrc/view/travelmate/ap_qr.htm | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/applications/luci-app-travelmate/luasrc/view/travelmate/ap_qr.htm b/applications/luci-app-travelmate/luasrc/view/travelmate/ap_qr.htm index 6d6615095..e6e4ede5a 100644 --- a/applications/luci-app-travelmate/luasrc/view/travelmate/ap_qr.htm +++ b/applications/luci-app-travelmate/luasrc/view/travelmate/ap_qr.htm @@ -18,19 +18,18 @@ This is free software, licensed under the Apache License, Version 2.0 local mode = s.mode or "" local ssid = s.ssid or "" local enc = s.encryption or "" - local key = s.key or "nokey" + local key = s.key or "" local hidden = s.hidden or "false" local disabled = s.disabled or "" - if device ~= "" and mode == "ap" and disabled ~= "1" then - if string.match(enc, '^psk2') then - enc = "wpa2" - elseif string.match(enc, '^psk') then - enc = "wpa" + local wep_slots = {s.key1 or "", s.key2 or "", s.key3 or "", s.key4 or ""} + + if device and mode == "ap" and disabled ~= "1" then + if string.match(enc, '^psk') then + enc = "WPA" elseif string.match(enc, '^wep') then + enc = "WEP" if tonumber(key) then - enc = "" - else - enc = "wep" + key = wep_slots[tonumber(key)] end elseif enc == "none" then enc = "nopass" @@ -41,9 +40,9 @@ This is free software, licensed under the Apache License, Version 2.0 if hidden == "1" then hidden = "true" end - if ssid ~= "" and enc ~= "" then - local e_ssid = string.gsub(ssid,"[\";\\:, ]","\\%1") - local e_key = string.gsub(key,"[\";\\:, ]","\\%1") + if ssid and enc and key then + local e_ssid = string.gsub(ssid,"[\"\\';:, ]",[[\\\%1]]) + local e_key = string.gsub(key,"[\"\\';:, ]",[[\\\%1]]) local qrcode = "" if nixio.fs.access("/usr/bin/qrencode") then qrcode = luci.sys.exec("/usr/bin/qrencode -I -t SVG -8 -o - 'WIFI:S:\"'" .. e_ssid .. "'\";T:'" .. enc .. "';P:\"'" .. e_key .. "'\";H:'" .. hidden .. "';'") |