From 8a1fe2ad6d05c4b9c6943198ac475ab29e22a0a7 Mon Sep 17 00:00:00 2001 From: Dirk Brenken Date: Fri, 5 Oct 2018 10:21:34 +0200 Subject: 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 --- .../luasrc/controller/travelmate.lua | 1 - .../luasrc/model/cbi/travelmate/overview_tab.lua | 23 ++----- .../luasrc/view/travelmate/ap_qr.htm | 66 ------------------ .../luasrc/view/travelmate/runtime.htm | 80 ++++++++++++++++++++++ 4 files changed, 85 insertions(+), 85 deletions(-) delete mode 100644 applications/luci-app-travelmate/luasrc/view/travelmate/ap_qr.htm (limited to 'applications/luci-app-travelmate/luasrc') diff --git a/applications/luci-app-travelmate/luasrc/controller/travelmate.lua b/applications/luci-app-travelmate/luasrc/controller/travelmate.lua index 775831d9d..0c5890810 100644 --- a/applications/luci-app-travelmate/luasrc/controller/travelmate.lua +++ b/applications/luci-app-travelmate/luasrc/controller/travelmate.lua @@ -27,7 +27,6 @@ function index() entry({"admin", "services", "travelmate", "logread"}, call("logread"), nil).leaf = true entry({"admin", "services", "travelmate", "status"}, call("status_update"), nil).leaf = true entry({"admin", "services", "travelmate", "action"}, call("trm_action"), nil).leaf = true - entry({"admin", "services", "travelmate", "apqr"}, template("travelmate/ap_qr")).leaf = true entry({"admin", "services", "travelmate", "wifiscan"}, template("travelmate/wifi_scan")).leaf = true entry({"admin", "services", "travelmate", "wifiadd"}, form("travelmate/wifi_add", {hideresetbtn=true, hidesavebtn=true})).leaf = true entry({"admin", "services", "travelmate", "wifiedit"}, form("travelmate/wifi_edit", {hideresetbtn=true, hidesavebtn=true})).leaf = true diff --git a/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/overview_tab.lua b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/overview_tab.lua index a1a7ed72c..9ba4cf3bf 100644 --- a/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/overview_tab.lua +++ b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/overview_tab.lua @@ -56,7 +56,7 @@ end s = m:section(NamedSection, "global", "travelmate") -o1 = s:option(Flag, "trm_enabled", translate("Enable travelmate")) +o1 = s:option(Flag, "trm_enabled", translate("Enable Travelmate")) o1.default = o1.disabled o1.rmempty = false @@ -78,18 +78,6 @@ end o3.default = trmiface o3.rmempty = false -if fs.access("/usr/bin/qrencode") then - btn = s:option(Button, "btn", translate("View AP QR-Codes"), - translate("Connect your Android or iOS devices to your router's WiFi using the shown QR code.")) - btn.inputtitle = translate("QR-Codes") - btn.inputstyle = "apply" - btn.disabled = false - - function btn.write() - luci.http.redirect(luci.dispatcher.build_url("admin", "services", "travelmate", "apqr")) - end -end - -- Runtime information ds = s:option(DummyValue, "_dummy") @@ -97,16 +85,15 @@ ds.template = "travelmate/runtime" -- Extra options -e = m:section(NamedSection, "global", "travelmate", translate("Extra options"), +e = m:section(NamedSection, "global", "travelmate", translate("Extra Options"), translate("Options for further tweaking in case the defaults are not suitable for you.")) -e1 = e:option(Flag, "trm_debug", translate("Enable verbose debug logging")) +e1 = e:option(Flag, "trm_debug", translate("Enable Verbose Debug Logging")) e1.default = e1.disabled e1.rmempty = false -e2 = e:option(Value, "trm_radio", translate("Radio selection"), - translate("Restrict travelmate to a dedicated radio, e.g. 'radio0'.")) -e2.datatype = "and(uciname,rangelength(6,6))" +e2 = e:option(Value, "trm_radio", translate("Radio Selection / Order"), + translate("Restrict travelmate to a single radio (e.g. 'radio1') or change the overall scanning order (e.g. 'radio1 radio2 radio0').")) e2.rmempty = true e3 = e:option(Value, "trm_triggerdelay", translate("Trigger Delay"), diff --git a/applications/luci-app-travelmate/luasrc/view/travelmate/ap_qr.htm b/applications/luci-app-travelmate/luasrc/view/travelmate/ap_qr.htm deleted file mode 100644 index 3f01a81e3..000000000 --- a/applications/luci-app-travelmate/luasrc/view/travelmate/ap_qr.htm +++ /dev/null @@ -1,66 +0,0 @@ -<%# -Copyright 2018 Dirk Brenken (dev@brenken.org) -This is free software, licensed under the Apache License, Version 2.0 --%> - -<%+header%> - -
-
- <%=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.")%> -
- <%- 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 "" - 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]]) - local qrcode = "" - - qrcode = luci.sys.exec("/usr/bin/qrencode --inline --8bit --type=SVG --output=- 'WIFI:S:\"'" .. e_ssid .. "'\";T:'" .. enc .. "';P:\"'" .. e_key .. "'\";H:'" .. hidden .. "';'") - -%> -
-

AP on <%=device%> with SSID "<%=ssid%>"

-

<%=qrcode%>

-
- <%- - end - end - end) - -%> -
-
-
- -
-
- -<%+footer%> 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 +
+ +
+ +
+
+
+ +
-- cgit v1.2.3