2 Copyright 2018 Dirk Brenken (dev@brenken.org)
3 This is free software, licensed under the Apache License, Version 2.0
9 <div class="cbi-map-descr">
10 <%=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.")%>
13 local write = io.write
14 local uci = require("luci.model.uci").cursor()
16 uci:foreach("wireless", "wifi-iface", function(s)
17 local device = s.device or ""
18 local mode = s.mode or ""
19 local ssid = s.ssid or ""
20 local enc = s.encryption or ""
21 local key = s.key or "nokey"
22 local hidden = s.hidden or "false"
23 local disabled = s.disabled or ""
24 if device ~= "" and mode == "ap" and disabled ~= "1" then
25 if string.match(enc, '^psk2') then
27 elseif string.match(enc, '^psk') then
29 elseif string.match(enc, '^wep') then
35 elseif enc == "none" then
44 if ssid ~= "" and enc ~= "" then
45 local e_ssid = string.gsub(ssid,"[\";\\:, ]","\\%1")
46 local e_key = string.gsub(key,"[\";\\:, ]","\\%1")
48 if nixio.fs.access("/usr/bin/qrencode") then
49 qrcode = luci.sys.exec("/usr/bin/qrencode -I -t SVG -8 -o - 'WIFI:S:\"'" .. e_ssid .. "'\";T:'" .. enc .. "';P:\"'" .. e_key .. "'\";H:'" .. hidden .. "';'")
52 <fieldset class="cbi-section">
53 <legend>AP on <%=device%> with SSID "<%=ssid%>"</legend>
54 <h3 name="content"><%=qrcode%></h3>