summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-travelmate/luasrc/view/travelmate/runtime.htm
diff options
context:
space:
mode:
authorDirk Brenken <dev@brenken.org>2018-10-05 10:21:34 +0200
committerDirk Brenken <dev@brenken.org>2018-10-05 10:27:36 +0200
commit8a1fe2ad6d05c4b9c6943198ac475ab29e22a0a7 (patch)
treeac05abb1d79b18bfdd6247c79c62c53037612a2e /applications/luci-app-travelmate/luasrc/view/travelmate/runtime.htm
parent24cf28b5ec148bc29d2d150e94f8928d96c1d1e6 (diff)
luci-app-travelmate: sync with update 1.2.4
* with the config option 'trm_radio' you can now restrict travelmate to a single radio (e.g. 'radio1') or change the overall scanning order (e.g. 'radio1 radio2 radio0') * LuCI: show QR codes now inline on the overview page (collapsed by default) Signed-off-by: Dirk Brenken <dev@brenken.org>
Diffstat (limited to 'applications/luci-app-travelmate/luasrc/view/travelmate/runtime.htm')
-rw-r--r--applications/luci-app-travelmate/luasrc/view/travelmate/runtime.htm80
1 files changed, 80 insertions, 0 deletions
diff --git a/applications/luci-app-travelmate/luasrc/view/travelmate/runtime.htm b/applications/luci-app-travelmate/luasrc/view/travelmate/runtime.htm
index 272612600..1a53b577d 100644
--- a/applications/luci-app-travelmate/luasrc/view/travelmate/runtime.htm
+++ b/applications/luci-app-travelmate/luasrc/view/travelmate/runtime.htm
@@ -75,6 +75,15 @@ This is free software, licensed under the Apache License, Version 2.0
}
}
+ function toggle_qrcode() {
+ var view = document.getElementById("qrcode");
+ if (view.style.display === "none") {
+ view.style.display = "block";
+ } else {
+ view.style.display = "none";
+ }
+ }
+
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "travelmate", "status")%>', null,
function(x, json_info)
{
@@ -142,3 +151,74 @@ This is free software, licensed under the Apache License, Version 2.0
<span id="btn1_running" style="display:inline-block; width:16px; height:16px; margin:0 5px"></span>
</div>
</div>
+<div class="cbi-value" id="button_2">
+ <label class="cbi-value-title" for="button_2"><%:View AP QR-Codes%></label>
+ <div class="cbi-value-field">
+ <input class="cbi-button cbi-button-apply" type="button" value="<%:Show/Hide QR-Codes%>" onclick="toggle_qrcode()" />
+ </div>
+</div>
+<div class="cbi-value" style="margin-bottom: 0px">
+ <span class="cbi-value" style="display: none" id="qrcode">
+<%-
+ 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 .. "';'")
+-%>
+ <div class="cbi-value" style="border-bottom: 0px; margin-bottom: 0px; padding: 0.25em 0.6em; text-align: left">
+ <%=qrcode%>
+ </div>
+ <div class="cbi-value" style="border-bottom: 0px; margin-bottom: 0px; padding: 0.25em 0.6em; text-align: left">
+ <em><%:AP on %><%=device%><%: with SSID %>"<%=ssid%>"</em>
+ <hr />
+ </div>
+<%-
+ end
+ end
+ end
+ end)
+ if not qrcode then
+-%>
+ <div class="cbi-value" style="border-bottom: 0px; margin-bottom: 0px; padding: 0.25em 0.6em; text-align: left">
+ <em><%:For QR-Code support please install package 'qrencode'!%></em>
+ </div>
+<%-
+ end
+-%>
+ </span>
+</div>