diff options
author | Dirk Brenken <dev@brenken.org> | 2018-03-02 18:06:38 +0100 |
---|---|---|
committer | Dirk Brenken <dev@brenken.org> | 2018-03-02 18:06:38 +0100 |
commit | 8a199c3e1e6fe6bd55ef63a9151dd113efdb4272 (patch) | |
tree | e6d00bf27377e68bbbbe362625432e48d629b03c /applications/luci-app-travelmate/luasrc/view | |
parent | 391a7bfc01ffea8557dc522224e8c59b2d5e4472 (diff) |
luci-app-travelmate: sync with release 1.1.3
* show WiFi QR codes from all configured Access Points
Signed-off-by: Dirk Brenken <dev@brenken.org>
Diffstat (limited to 'applications/luci-app-travelmate/luasrc/view')
-rw-r--r-- | applications/luci-app-travelmate/luasrc/view/travelmate/ap_qr.htm | 63 | ||||
-rw-r--r-- | applications/luci-app-travelmate/luasrc/view/travelmate/stations.htm | 1 |
2 files changed, 63 insertions, 1 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 new file mode 100644 index 0000000000..6d6615095e --- /dev/null +++ b/applications/luci-app-travelmate/luasrc/view/travelmate/ap_qr.htm @@ -0,0 +1,63 @@ +<%# +Copyright 2018 Dirk Brenken (dev@brenken.org) +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() + + 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 "nokey" + 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" + elseif string.match(enc, '^wep') then + if tonumber(key) then + enc = "" + else + enc = "wep" + end + elseif enc == "none" then + enc = "nopass" + key = "nokey" + else + enc = "" + end + 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") + 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 .. "';'") + end +-%> + <fieldset class="cbi-section"> + <legend>AP on <%=device%> with SSID "<%=ssid%>"</legend> + <h3 name="content"><%=qrcode%></h3> + </fieldset> +<%- + end + end + end) +%> +</div> + +<%+footer%> diff --git a/applications/luci-app-travelmate/luasrc/view/travelmate/stations.htm b/applications/luci-app-travelmate/luasrc/view/travelmate/stations.htm index a267339950..1dacb6e24b 100644 --- a/applications/luci-app-travelmate/luasrc/view/travelmate/stations.htm +++ b/applications/luci-app-travelmate/luasrc/view/travelmate/stations.htm @@ -12,7 +12,6 @@ This is free software, licensed under the Apache License, Version 2.0 <%+header%> <div class="cbi-map"> -<h2 name="content"><%:Wireless Stations%></h2> <div class="cbi-map-descr"> <%=translatef("Provides an overview of all configured uplinks for the travelmate interface (%s). You can edit, delete or re-order existing uplinks or scan for a new one. The currently used uplink is emphasized in blue.", trmiface)%> </div> |