diff options
Diffstat (limited to 'applications/luci-app-travelmate/luasrc/view/travelmate/ap_qr.htm')
-rw-r--r-- | applications/luci-app-travelmate/luasrc/view/travelmate/ap_qr.htm | 101 |
1 files changed, 51 insertions, 50 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 a92dbe1469..3f01a81e35 100644 --- a/applications/luci-app-travelmate/luasrc/view/travelmate/ap_qr.htm +++ b/applications/luci-app-travelmate/luasrc/view/travelmate/ap_qr.htm @@ -6,60 +6,61 @@ This is free software, licensed under the Apache License, Version 2.0 <%+header%> <div class="cbi-map"> - <div class="cbi-map-descr"> - <%=translate("Here you'll find the QR codes from all of your configured Access Points. It allows you to connect your Android or iOS devices to your router's WiFi using the QR code shown below.")%> - </div> -<%- - local write = io.write - local uci = require("luci.model.uci").cursor() + <div class="cbi-map-descr"> + <%=translate("Here you'll find the QR codes from all of your configured Access Points. It allows you to connect your Android or iOS devices to your router's WiFi using the QR code shown below.")%> + </div> + <%- local uci = require("luci.model.uci").cursor() - uci:foreach("wireless", "wifi-iface", function(s) - local device = s.device or "" - local mode = s.mode or "" - local ssid = s.ssid or "" - local enc = s.encryption or "" - local key = s.key or "" - local hidden = s.hidden or "false" - local disabled = s.disabled or "" - local wep_slots = {s.key1 or "", s.key2 or "", s.key3 or "", s.key4 or ""} + uci:foreach("wireless", "wifi-iface", function(s) + local device = s.device or "" + local mode = s.mode or "" + local ssid = s.ssid or "" + local enc = s.encryption or "" + local key = s.key or "" + local hidden = s.hidden or "false" + local disabled = s.disabled or "" + 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 - key = wep_slots[tonumber(key)] - end - elseif enc == "none" then - enc = "nopass" - key = "nokey" - else - enc = "" - end - if hidden == "1" then - hidden = "true" - end - if ssid and enc and key then - local e_ssid = string.gsub(ssid,"[\"\\';:, ]",[[\\\%1]]) - local e_key = string.gsub(key,"[\"\\';:, ]",[[\\\%1]]) - local qrcode = "" - qrcode = luci.sys.exec("/usr/bin/qrencode --inline --8bit --type=SVG --output=- 'WIFI:S:\"'" .. e_ssid .. "'\";T:'" .. enc .. "';P:\"'" .. e_key .. "'\";H:'" .. hidden .. "';'") --%> - <fieldset class="cbi-section"> - <legend>AP on <%=device%> with SSID "<%=ssid%>"</legend> - <h3 name="content"><%=qrcode%></h3> - </fieldset> -<%- - end - end - end) -%> + 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 + key = wep_slots[tonumber(key)] + end + elseif enc == "none" then + enc = "nopass" + key = "nokey" + else + enc = "" + end + + if hidden == "1" then + hidden = "true" + end + + if ssid and enc and key then + local e_ssid = string.gsub(ssid,"[\"\\';:, ]",[[\\\%1]]) + local e_key = string.gsub(key,"[\"\\';:, ]",[[\\\%1]]) + local qrcode = "" + + qrcode = luci.sys.exec("/usr/bin/qrencode --inline --8bit --type=SVG --output=- 'WIFI:S:\"'" .. e_ssid .. "'\";T:'" .. enc .. "';P:\"'" .. e_key .. "'\";H:'" .. hidden .. "';'") + -%> + <div class="cbi-section"> + <h3>AP on <%=device%> with SSID "<%=ssid%>"</h3> + <h3><%=qrcode%></h3> + </div> + <%- + end + end + end) + -%> </div> <div class="cbi-page-actions right"> - <form class="inline" action="<%=luci.dispatcher.build_url('admin/services/travelmate/tab_from_cbi')%>" method="post"> - <input class="cbi-button cbi-button-reset" type="submit" value="<%:Back to overview%>"/> - </form> + <form class="inline" action="<%=luci.dispatcher.build_url('admin/services/travelmate/tab_from_cbi')%>" method="post"> + <input class="cbi-button cbi-button-reset" type="submit" value="<%:Back to overview%>" /> + </form> </div> <%+footer%> |