Merge pull request #1658 from dibdot/travelmate
luci-app-travelmate: sync with release 1.1.3
This commit is contained in:
commit
1e46a671ea
4 changed files with 67 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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%>
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue