%#
Copyright 2017-2018 Dirk Brenken (dev@brenken.org)
This is free software, licensed under the Apache License, Version 2.0
-%>
<%+travelmate/travelmate_css%>
<%:Runtime Information%>
-
-
-
-
-
-
<%-
local fs = require("nixio.fs")
local uci = require("luci.model.uci").cursor()
local qrcode
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]])
if fs.access("/usr/bin/qrencode") then
qrcode = luci.sys.exec("/usr/bin/qrencode --inline --8bit --type=SVG --output=- 'WIFI:S:\"'" .. e_ssid .. "'\";T:'" .. enc .. "';P:\"'" .. e_key .. "'\";H:'" .. hidden .. "';'")
-%>
<%=qrcode%>
<%:AP on %><%=device%><%: with SSID %>"<%=ssid%>"
<%-
end
end
end
end)
if not qrcode then
-%>
<%:For QR-Code support please install package 'qrencode'!%>