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 ""
22 local hidden = s.hidden or "false"
23 local disabled = s.disabled or ""
24 local wep_slots = {s.key1 or "", s.key2 or "", s.key3 or "", s.key4 or ""}
26 if device and mode == "ap" and disabled ~= "1" then
27 if string.match(enc, '^psk') then
29 elseif string.match(enc, '^wep') then
32 key = wep_slots[tonumber(key)]
34 elseif enc == "none" then
43 if ssid and enc and key then
44 local e_ssid = string.gsub(ssid,"[\"\\';:, ]",[[\\\%1]])
45 local e_key = string.gsub(key,"[\"\\';:, ]",[[\\\%1]])
47 if nixio.fs.access("/usr/bin/qrencode") then
48 qrcode = luci.sys.exec("/usr/bin/qrencode -I -t SVG -8 -o - 'WIFI:S:\"'" .. e_ssid .. "'\";T:'" .. enc .. "';P:\"'" .. e_key .. "'\";H:'" .. hidden .. "';'")
51 <fieldset class="cbi-section">
52 <legend>AP on <%=device%> with SSID "<%=ssid%>"</legend>
53 <h3 name="content"><%=qrcode%></h3>