luci-app-dynapoint: new package
Add luci-app-dynapoint to repo LuCI Support for DynaPoint Dynapoint allows dynamic access point creation and deletion depending on changes of certain network conditions. More information: https://github.com/thuehn/dynapoint Signed-off-by: Tobias Ilte <tobias.ilte@campus.tu-berlin.de>
This commit is contained in:
parent
d4c3372020
commit
cd8096b0ce
8 changed files with 364 additions and 0 deletions
20
applications/luci-app-dynapoint/Makefile
Normal file
20
applications/luci-app-dynapoint/Makefile
Normal file
|
@ -0,0 +1,20 @@
|
|||
#
|
||||
# Copyright (C) 2016 The LuCI Team <luci@lists.subsignal.org>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI Support for DynaPoint
|
||||
LUCI_DEPENDS:=+dynapoint
|
||||
|
||||
PKG_NAME:=luci-app-dynapoint
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_LICENSE:=GPL-3.0+
|
||||
PKG_MAINTAINER:=Tobias Ilte <tobias.ilte@campus.tu-berlin.de>
|
||||
include ../../luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
module("luci.controller.dynapoint", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/dynapoint") then
|
||||
return
|
||||
end
|
||||
entry({"admin", "services", "dynapoint"}, cbi("dynapoint"), _("DynaPoint"))
|
||||
end
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
local uci = require "luci.model.uci".cursor()
|
||||
local a = require "luci.model.ipkg"
|
||||
local DISP = require "luci.dispatcher"
|
||||
|
||||
local wlcursor = luci.model.uci.cursor_state()
|
||||
local wireless = wlcursor:get_all("wireless")
|
||||
local ifaces = {}
|
||||
|
||||
for k, v in pairs(wireless) do
|
||||
if v[".type"] == "wifi-iface" then
|
||||
table.insert(ifaces, v)
|
||||
end
|
||||
end
|
||||
|
||||
m = Map("dynapoint")
|
||||
m:chain("wireless")
|
||||
|
||||
s = m:section(NamedSection, "internet", "rule", translate("Configuration"), translate("Check Internet connectivity via HTTP header download"))
|
||||
|
||||
hosts = s:option(DynamicList, "hosts", translate("List of host addresses"), translate("List of host addresses (url or IP) to track and request http headers from"))
|
||||
hosts.datatype = "string"
|
||||
|
||||
interval = s:option(Value, "interval", translate("Test-run interval"), translate("Time interval in seconds to re-start a new test run"))
|
||||
interval.datatype = "uinteger"
|
||||
interval.default = "30"
|
||||
|
||||
offline_treshold = s:option(Value, "offline_threshold", translate("Switch_to_offline threshold"), translate("Failure counter after how many failed download attempts, the state is considered as offline"))
|
||||
offline_treshold.datatype = "uinteger"
|
||||
offline_treshold.default = "1"
|
||||
|
||||
add_hostname_to_ssid = s:option(Flag, "add_hostname_to_ssid", translate("Append hostname to ssid"), translate("Append the router's hostname to the SSID when connectivity check fails"))
|
||||
add_hostname_to_ssid.rmempty = false
|
||||
|
||||
|
||||
if (a.installed("curl") == true) then
|
||||
use_curl = s:option(Flag, "use_curl", translate("Use curl"), translate("Use curl instead of wget for testing the connectivity."))
|
||||
use_curl.rmempty = false
|
||||
|
||||
curl_interface = s:option(Value, "curl_interface", translate("Used interface"), translate("Which interface should curl use. (Use ifconfig to find out)"))
|
||||
curl_interface.datatype = "string"
|
||||
curl_interface:depends("use_curl","1")
|
||||
curl_interface.placeholder = "eth0"
|
||||
else
|
||||
use_curl = s:option(Flag, "use_curl", translate("Use curl instead of wget"), translate("Curl is currently not installed.")
|
||||
.." Please install the package in the "
|
||||
..[[<a href="]] .. DISP.build_url("admin", "system", "packages")
|
||||
.. "?display=available&query=curl"..[[">]]
|
||||
.. "Software Section" .. [[</a>]]
|
||||
.. "."
|
||||
)
|
||||
use_curl.rmempty = false
|
||||
use_curl.template = "dynapoint/cbi_checkbox"
|
||||
end
|
||||
|
||||
m1 = Map("wireless", "DynaPoint", translate("Dynamic Access Point Manager"))
|
||||
|
||||
aps = m1:section(TypedSection, "wifi-iface", translate("List of Wireless Virtual Interfaces (wVIF)"))
|
||||
aps.addremove = false
|
||||
aps.anonymous = true
|
||||
aps.template = "cbi/tblsection"
|
||||
|
||||
status = aps:option(DummyValue, "disabled", translate("WiFi Status"))
|
||||
status.template = "dynapoint/cbi_color"
|
||||
|
||||
function status.cfgvalue(self,section)
|
||||
local val = m1:get(section, "disabled")
|
||||
if val == "1" then return translate("Disabled") end
|
||||
if (val == nil or val == "0") then return translate("Enabled") end
|
||||
return val
|
||||
end
|
||||
|
||||
device = aps:option(DummyValue, "device", translate("Device"))
|
||||
function device.cfgvalue(self,section)
|
||||
local dev = m1:get(section, "device")
|
||||
local val = m1:get(dev, "hwmode")
|
||||
if val == "11a" then return dev .. " (5 GHz)" else
|
||||
return dev .. " (2,4 GHz)"
|
||||
end
|
||||
return val
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
mode = aps:option(DummyValue, "mode", translate("Mode"))
|
||||
|
||||
ssid = aps:option(DummyValue, "ssid", translate("SSID"))
|
||||
|
||||
|
||||
action = aps:option(ListValue, "dynapoint_rule", translate("Activate this wVIF if status is:"))
|
||||
action.widget="select"
|
||||
action:value("internet",translate("Online"))
|
||||
action:value("!internet",translate("Offline"))
|
||||
action:value("",translate("Not used by DynaPoint"))
|
||||
action.default = ""
|
||||
|
||||
return m1,m
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<%+cbi/valueheader%>
|
||||
|
||||
<input class="cbi-input-checkbox" disabled data-update="click change" type="checkbox" id="cbid.dynapoint.internet.use_curl" name="cbid.dynapoint.internet.use_curl" value="1" />
|
||||
|
||||
|
||||
<%+cbi/valuefooter%>
|
|
@ -0,0 +1,18 @@
|
|||
<%+cbi/valueheader%>
|
||||
|
||||
|
||||
<%
|
||||
if (self:cfgvalue(section) == translate("Disabled")) then
|
||||
%>
|
||||
|
||||
<span id="<%=cbid%>.disabled" style="background-color:red;"><%=self:cfgvalue(section)%></span>
|
||||
|
||||
<%
|
||||
else
|
||||
%>
|
||||
<span id="<%=cbid%>.disabled" style="background-color:lime;"><%=self:cfgvalue(section)%></span>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
|
||||
<%+cbi/valuefooter%>
|
106
applications/luci-app-dynapoint/po/de/dynapoint.po
Normal file
106
applications/luci-app-dynapoint/po/de/dynapoint.po
Normal file
|
@ -0,0 +1,106 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"PO-Revision-Date: 2016-08-31 15:51+0200\n"
|
||||
"Language-Team: German\n"
|
||||
"Language: de\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
msgid "Activate this wVIF if status is:"
|
||||
msgstr "Aktiviere diese drahtlose Schnittstelle wenn:"
|
||||
|
||||
msgid "Append hostname to ssid"
|
||||
msgstr "Anfügen des hostname zur SSID"
|
||||
|
||||
msgid "Append the router's hostname to the SSID when connectivity check fails"
|
||||
msgstr ""
|
||||
"Fügt den hostname des routers zur SSID an, wenn die Verbindungsüberprüfung "
|
||||
"fehl schlägt"
|
||||
|
||||
msgid "Check Internet connectivity via HTTP header download"
|
||||
msgstr "Testen der Internetverfügbarkeit via HTTP header download"
|
||||
|
||||
msgid "Configuration"
|
||||
msgstr "Konfiguration"
|
||||
|
||||
msgid "Curl is currently not installed."
|
||||
msgstr "Curl ist momentan nicht installiert."
|
||||
|
||||
msgid "Device"
|
||||
msgstr "Gerät"
|
||||
|
||||
msgid "Disabled"
|
||||
msgstr "Deaktiviert"
|
||||
|
||||
msgid "DynaPoint"
|
||||
msgstr ""
|
||||
|
||||
msgid "Dynamic Access Point Manager"
|
||||
msgstr ""
|
||||
|
||||
msgid "Enabled"
|
||||
msgstr "Aktiviert"
|
||||
|
||||
msgid ""
|
||||
"Failure counter after how many failed download attempts, the state is "
|
||||
"considered as offline"
|
||||
msgstr ""
|
||||
"Anzahl der fehlgeschlagenen Downloadversuche, nach denen die Verbindung als offline angesehen wird"
|
||||
|
||||
msgid "List of Wireless Virtual Interfaces (wVIF)"
|
||||
msgstr "Liste der Drahtlosen virtuellen Schnittstellen"
|
||||
|
||||
msgid "List of host addresses"
|
||||
msgstr "Liste der Zieladressen"
|
||||
|
||||
msgid ""
|
||||
"List of host addresses (url or IP) to track and request http headers from"
|
||||
msgstr "Liste der Zieladressen (URL oder IP) für den HTTP header download"
|
||||
|
||||
msgid "Mode"
|
||||
msgstr "Modus"
|
||||
|
||||
msgid "Not used by DynaPoint"
|
||||
msgstr "Nicht von DynaPoint benutzt"
|
||||
|
||||
msgid "Offline"
|
||||
msgstr "Offline"
|
||||
|
||||
msgid "Online"
|
||||
msgstr "Online"
|
||||
|
||||
msgid "SSID"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch_to_offline threshold"
|
||||
msgstr "Offline-Schwelle"
|
||||
|
||||
msgid "Test-run interval"
|
||||
msgstr "Testlaufintervall"
|
||||
|
||||
msgid "Time interval in seconds to re-start a new test run"
|
||||
msgstr "Zeitintervall in Sekunden für einen Testlauf"
|
||||
|
||||
msgid "Use curl"
|
||||
msgstr "Curl benutzen"
|
||||
|
||||
msgid "Use curl instead of wget"
|
||||
msgstr "Curl anstatt wget benutzen"
|
||||
|
||||
msgid "Use curl instead of wget for testing the connectivity."
|
||||
msgstr "Curl anstatt wget benutzen, um die Internetverbindung zu überprüfen."
|
||||
|
||||
msgid "Used interface"
|
||||
msgstr "Benutztes interface"
|
||||
|
||||
msgid "Which interface should curl use. (Use ifconfig to find out)"
|
||||
msgstr ""
|
||||
"Welches Interface von curl benutzt werden soll. (ifconfig benutzen, um das "
|
||||
"herauszufinden"
|
||||
|
||||
msgid "WiFi Status"
|
||||
msgstr ""
|
||||
|
93
applications/luci-app-dynapoint/po/templates/dynapoint.pot
Normal file
93
applications/luci-app-dynapoint/po/templates/dynapoint.pot
Normal file
|
@ -0,0 +1,93 @@
|
|||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||
|
||||
msgid "Activate this wVIF if status is:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Append hostname to ssid"
|
||||
msgstr ""
|
||||
|
||||
msgid "Append the router's hostname to the SSID when connectivity check fails"
|
||||
msgstr ""
|
||||
|
||||
msgid "Check Internet connectivity via HTTP header download"
|
||||
msgstr ""
|
||||
|
||||
msgid "Configuration"
|
||||
msgstr ""
|
||||
|
||||
msgid "Curl is currently not installed."
|
||||
msgstr ""
|
||||
|
||||
msgid "Device"
|
||||
msgstr ""
|
||||
|
||||
msgid "Disabled"
|
||||
msgstr ""
|
||||
|
||||
msgid "DynaPoint"
|
||||
msgstr ""
|
||||
|
||||
msgid "Dynamic Access Point Manager"
|
||||
msgstr ""
|
||||
|
||||
msgid "Enabled"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"Failure counter after how many failed download attempts, the state is "
|
||||
"considered as offline"
|
||||
msgstr ""
|
||||
|
||||
msgid "List of Wireless Virtual Interfaces (wVIF)"
|
||||
msgstr ""
|
||||
|
||||
msgid "List of host addresses"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"List of host addresses (url or IP) to track and request http headers from"
|
||||
msgstr ""
|
||||
|
||||
msgid "Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Not used by DynaPoint"
|
||||
msgstr ""
|
||||
|
||||
msgid "Offline"
|
||||
msgstr ""
|
||||
|
||||
msgid "Online"
|
||||
msgstr ""
|
||||
|
||||
msgid "SSID"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch_to_offline threshold"
|
||||
msgstr ""
|
||||
|
||||
msgid "Test-run interval"
|
||||
msgstr ""
|
||||
|
||||
msgid "Time interval in seconds to re-start a new test run"
|
||||
msgstr ""
|
||||
|
||||
msgid "Use curl"
|
||||
msgstr ""
|
||||
|
||||
msgid "Use curl instead of wget"
|
||||
msgstr ""
|
||||
|
||||
msgid "Use curl instead of wget for testing the connectivity."
|
||||
msgstr ""
|
||||
|
||||
msgid "Used interface"
|
||||
msgstr ""
|
||||
|
||||
msgid "Which interface should curl use. (Use ifconfig to find out)"
|
||||
msgstr ""
|
||||
|
||||
msgid "WiFi Status"
|
||||
msgstr ""
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
# needed for "Save and Apply" to restart dynapoint
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@dynapoint[-1]
|
||||
add ucitrack dynapoint
|
||||
set ucitrack.@dynapoint[-1].init="dynapoint"
|
||||
commit dynapoint
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
|
Loading…
Reference in a new issue