summaryrefslogtreecommitdiffhomepage
path: root/applications
diff options
context:
space:
mode:
authorDirk Brenken <dev@brenken.org>2018-03-02 18:06:38 +0100
committerDirk Brenken <dev@brenken.org>2018-03-02 18:06:38 +0100
commit8a199c3e1e6fe6bd55ef63a9151dd113efdb4272 (patch)
treee6d00bf27377e68bbbbe362625432e48d629b03c /applications
parent391a7bfc01ffea8557dc522224e8c59b2d5e4472 (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')
-rw-r--r--applications/luci-app-travelmate/Makefile4
-rw-r--r--applications/luci-app-travelmate/luasrc/controller/travelmate.lua4
-rw-r--r--applications/luci-app-travelmate/luasrc/view/travelmate/ap_qr.htm63
-rw-r--r--applications/luci-app-travelmate/luasrc/view/travelmate/stations.htm1
4 files changed, 67 insertions, 5 deletions
diff --git a/applications/luci-app-travelmate/Makefile b/applications/luci-app-travelmate/Makefile
index 6170f9d4c3..2bd25bc171 100644
--- a/applications/luci-app-travelmate/Makefile
+++ b/applications/luci-app-travelmate/Makefile
@@ -1,11 +1,11 @@
-# Copyright 2017 Dirk Brenken (dev@brenken.org)
+# Copyright 2017-2018 Dirk Brenken (dev@brenken.org)
# This is free software, licensed under the Apache License, Version 2.0
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for Travelmate
-LUCI_DEPENDS:=+travelmate +luci-lib-jsonc
+LUCI_DEPENDS:=+travelmate +luci-lib-jsonc +qrencode
LUCI_PKGARCH:=all
include ../../luci.mk
diff --git a/applications/luci-app-travelmate/luasrc/controller/travelmate.lua b/applications/luci-app-travelmate/luasrc/controller/travelmate.lua
index 0f7583497f..14b8d77ff6 100644
--- a/applications/luci-app-travelmate/luasrc/controller/travelmate.lua
+++ b/applications/luci-app-travelmate/luasrc/controller/travelmate.lua
@@ -3,7 +3,6 @@
module("luci.controller.travelmate", package.seeall)
-local fs = require("nixio.fs")
local util = require("luci.util")
local i18n = require("luci.i18n")
local templ = require("luci.template")
@@ -15,7 +14,8 @@ function index()
entry({"admin", "services", "travelmate"}, firstchild(), _("Travelmate"), 40).dependent = false
entry({"admin", "services", "travelmate", "tab_from_cbi"}, cbi("travelmate/overview_tab", {hideresetbtn=true, hidesavebtn=true}), _("Overview"), 10).leaf = true
entry({"admin", "services", "travelmate", "stations"}, template("travelmate/stations"), _("Wireless Stations"), 20).leaf = true
- entry({"admin", "services", "travelmate", "logfile"}, call("logread"), _("View Logfile"), 30).leaf = true
+ entry({"admin", "services", "travelmate", "apqr"}, template("travelmate/ap_qr"), _("AP QR-Codes"), 30).leaf = true
+ entry({"admin", "services", "travelmate", "logfile"}, call("logread"), _("View Logfile"), 40).leaf = true
entry({"admin", "services", "travelmate", "advanced"}, firstchild(), _("Advanced"), 100)
entry({"admin", "services", "travelmate", "advanced", "configuration"}, cbi("travelmate/configuration_tab"), _("Edit Travelmate Configuration"), 110).leaf = true
entry({"admin", "services", "travelmate", "advanced", "cfg_wireless"}, cbi("travelmate/cfg_wireless_tab"), _("Edit Wireless Configuration"), 120).leaf = true
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>