Compare commits

...

40 commits

Author SHA1 Message Date
Jo-Philipp Wich
668f8ed7a0 luci-0.11: backport r10529 2014-09-18 09:34:05 +00:00
Jo-Philipp Wich
31daa1b90d luci-0.11: libs/sgi-uhttpd: ensure to send proper EOF under uhttpd v1 - fixes chromium compatibility 2014-07-04 14:40:44 +00:00
Jo-Philipp Wich
b703669c5f Fix swapped system and model values in admin-mini 2014-02-13 11:47:01 +00:00
Steven Barth
dd1ae30344 Fix a typo in IPv6 configuration page 2013-06-24 12:01:15 +00:00
Steven Barth
9e4f42001c Add support for stateful DHCPv6 2013-06-24 12:01:11 +00:00
Steven Barth
6d01930515 Make static IPv6-configuration more usable 2013-06-24 12:01:03 +00:00
Steven Barth
e6e22f6cde Update and simplify IPv6 RA & DHCPv6 configuration 2013-06-24 12:00:58 +00:00
Steven Barth
014adc6fdc Add DS-Lite support 2013-06-24 12:00:53 +00:00
Steven Barth
d7b8ed8f90 Fix IPv6 package dependencies 2013-06-24 12:00:49 +00:00
Steven Barth
1b455bb42e Fix dependencies for proto IPv6 2013-06-24 12:00:44 +00:00
Steven Barth
408970bddb Add LuCI support for newly introduced IPv6 options 2013-06-24 12:00:40 +00:00
Steven Barth
6e7fb14afc libs/core: fallback to ipv6-prefix-assignment if ipv6-address is empty 2013-06-24 12:00:33 +00:00
Steven Barth
c4cf9267e4 Add support for changing ULA prefix 2013-06-24 12:00:29 +00:00
Steven Barth
33998c11b8 modules/admin-full: add some additional option depends to the ra/dhcpv6 configuration page 2013-06-24 12:00:25 +00:00
Steven Barth
627191c701 libs/web: support dependencies on mvalues 2013-06-24 12:00:20 +00:00
Steven Barth
c203f084bd move dhcpv6 support into luci-proto-6x4, rename luci-proto-6x4 to luci-proto-ipv6 2013-06-24 12:00:15 +00:00
Steven Barth
cd35191cbb New IPv6 integration 2013-06-24 11:59:57 +00:00
Jo-Philipp Wich
56ece5b644 luci-0.11: merge r9842 2013-06-13 17:26:21 +00:00
Daniel Golle
2255d541bf luci-0.11: correct spelling on luci startup page 2013-02-26 21:20:22 +00:00
Jo-Philipp Wich
adc4c2932e luci-0.11: merge r9648, r9649 and r9654 2013-01-27 18:43:41 +00:00
Manuel Munz
f8ea6d5b21 luci-0.11: merge r9652 2013-01-27 00:21:19 +00:00
Manuel Munz
31e30bb566 luci-0.11: merge r9650 2013-01-26 23:13:58 +00:00
Jo-Philipp Wich
b5c9f85b00 luci-0.11: merge r9628 - r9631 2013-01-21 12:07:12 +00:00
Manuel Munz
0cbe6146d5 luci-0.11: Merge r9624 - r9626 2013-01-21 09:48:28 +00:00
Jo-Philipp Wich
03ed541b76 luci-0.11: merge r9571 - r9622 2013-01-18 14:08:37 +00:00
Jo-Philipp Wich
13224b696d luci-0.11: merge r9571 - r9573 2012-12-29 13:15:53 +00:00
Jo-Philipp Wich
60b81d978a luci-0.11: merge r9559 - r9569 2012-12-25 02:45:42 +00:00
Jo-Philipp Wich
8df855a6ac luci-0.11: merge r9560 2012-12-19 00:37:39 +00:00
Jo-Philipp Wich
839dcdc012 luci-0.11: merge outstanding trunk changes 2012-12-18 13:58:22 +00:00
Jo-Philipp Wich
31d76dbb64 luci-0.11: merge r9399-r9402 and r9412 2012-10-29 14:38:50 +00:00
Jo-Philipp Wich
f450ff8c3f applications/luci-ddns: make event interface configurable (#497) 2012-10-29 13:00:52 +00:00
Jo-Philipp Wich
5a11da7d01 applications/luci-transmission: fix link to transmission gui if uhttpd runs on a non-standard port (#496) 2012-10-29 12:56:58 +00:00
Jo-Philipp Wich
06901331f5 Fix nixio exece()
I had occasion to use nixio.exece() recently and I could not figure out what it
wanted for the third argument (the environment) as no matter what sort of table
I passed, even nixio.getenv(), would fail with bad argument #3 to 'exece'
(invalid environment).

What it should expect is a table full of string values for keys and something
that can be converted to a string as a value, however it inverts the value of
lua_type() and compares it against a type, which will never evaluate to true.

Getting past this, the code inserts the KEY=VALUE string before the arg userdata,
and then forgets to take the env userdata into account when collecting the
arguments back into a C char**. This patch addresses all these issues and
provides a working nixio.exece().

[Fixes #500]
2012-10-29 12:52:27 +00:00
Jo-Philipp Wich
74d93e3139 luci-0.11: merge r9365 - r9385 2012-10-13 10:08:38 +00:00
Manuel Munz
25a1e70804 luci-0.11: merge r9362 and r9363 2012-10-10 19:24:38 +00:00
Jo-Philipp Wich
0a6c627ac7 luci-0.11: merge r9356 - r9360 2012-10-08 11:42:27 +00:00
Jo-Philipp Wich
fef33765a3 luci-0.11: merge r9353 and r9354 2012-10-07 12:06:21 +00:00
Jo-Philipp Wich
e01533db7c luci-0.11: merge r9351 2012-10-06 23:50:52 +00:00
Jo-Philipp Wich
7741541b8a luci-0.11: prepare feed Makefile 2012-10-05 10:37:03 +00:00
Jo-Philipp Wich
c1d0ad1502 Start 0.11.x branch 2012-10-05 10:30:35 +00:00
479 changed files with 9885 additions and 5374 deletions

View file

@ -14,7 +14,7 @@ all: build
build: gccbuild luabuild
gccbuild:
make -C libs/lmo CC="cc" CFLAGS="" LDFLAGS="" SDK="$(shell test -f .running-sdk && echo 1)" host-install
make -C libs/web CC="cc" CFLAGS="" LDFLAGS="" SDK="$(shell test -f .running-sdk && echo 1)" host-install
for i in $(MODULES); do \
make -C$$i SDK="$(shell test -f .running-sdk && echo 1)" compile || { \
echo "*** Compilation of $$i failed!"; \

View file

@ -19,7 +19,7 @@ function index()
return
end
entry({"admin", "network", "ahcpd"}, cbi("ahcp"), _("AHCP Server"), 90).i18n = "ahcp"
entry({"admin", "network", "ahcpd"}, cbi("ahcp"), _("AHCP Server"), 90)
entry({"admin", "network", "ahcpd", "status"}, call("ahcp_status"))
end

View file

@ -17,7 +17,7 @@ module("luci.controller.asterisk", package.seeall)
function index()
entry({"admin", "services", "asterisk"}, cbi("asterisk"), "Asterisk", 80).i18n = "asterisk"
entry({"admin", "services", "asterisk"}, cbi("asterisk"), "Asterisk", 80)
entry({"admin", "services", "asterisk", "voice"}, cbi("asterisk-voice"), "Voice Functions", 1)
entry({"admin", "services", "asterisk", "meetme"}, cbi("asterisk-meetme"), "Meetme Conferences", 2)

View file

@ -0,0 +1,4 @@
PO = commands
include ../../build/config.mk
include ../../build/module.mk

View file

@ -0,0 +1,237 @@
--[[
LuCI - Lua Configuration Interface
Copyright 2012 Jo-Philipp Wich <jow@openwrt.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
]]--
module("luci.controller.commands", package.seeall)
function index()
entry({"admin", "system", "commands"}, firstchild(), _("Custom Commands"), 80)
entry({"admin", "system", "commands", "dashboard"}, template("commands"), _("Dashboard"), 1)
entry({"admin", "system", "commands", "config"}, cbi("commands"), _("Configure"), 2)
entry({"admin", "system", "commands", "run"}, call("action_run"), nil, 3).leaf = true
entry({"admin", "system", "commands", "download"}, call("action_download"), nil, 3).leaf = true
entry({"command"}, call("action_public"), nil, 1).leaf = true
end
--- Decode a given string into arguments following shell quoting rules
--- [[abc \def "foo\"bar" abc'def']] -> [[abc def]] [[foo"bar]] [[abcdef]]
local function parse_args(str)
local args = { }
local function isspace(c)
if c == 9 or c == 10 or c == 11 or c == 12 or c == 13 or c == 32 then
return c
end
end
local function isquote(c)
if c == 34 or c == 39 or c == 96 then
return c
end
end
local function isescape(c)
if c == 92 then
return c
end
end
local function ismeta(c)
if c == 36 or c == 92 or c == 96 then
return c
end
end
--- Convert given table of byte values into a Lua string and append it to
--- the "args" table. Segment byte value sequence into chunks of 256 values
--- to not trip over the parameter limit for string.char()
local function putstr(bytes)
local chunks = { }
local csz = 256
local upk = unpack
local chr = string.char
local min = math.min
local len = #bytes
local off
for off = 1, len, csz do
chunks[#chunks+1] = chr(upk(bytes, off, min(off + csz - 1, len)))
end
args[#args+1] = table.concat(chunks)
end
--- Scan substring defined by the indexes [s, e] of the string "str",
--- perform unquoting and de-escaping on the fly and store the result in
--- a table of byte values which is passed to putstr()
local function unquote(s, e)
local off, esc, quote
local res = { }
for off = s, e do
local byte = str:byte(off)
local q = isquote(byte)
local e = isescape(byte)
local m = ismeta(byte)
if e then
esc = true
elseif esc then
if m then res[#res+1] = 92 end
res[#res+1] = byte
esc = false
elseif q and quote and q == quote then
quote = nil
elseif q and not quote then
quote = q
else
if m then res[#res+1] = 92 end
res[#res+1] = byte
end
end
putstr(res)
end
--- Find substring boundaries in "str". Ignore escaped or quoted
--- whitespace, pass found start- and end-index for each substring
--- to unquote()
local off, esc, start, quote
for off = 1, #str + 1 do
local byte = str:byte(off)
local q = isquote(byte)
local s = isspace(byte) or (off > #str)
local e = isescape(byte)
if esc then
esc = false
elseif e then
esc = true
elseif q and quote and q == quote then
quote = nil
elseif q and not quote then
start = start or off
quote = q
elseif s and not quote then
if start then
unquote(start, off - 1)
start = nil
end
else
start = start or off
end
end
--- If the "quote" is still set we encountered an unfinished string
if quote then
unquote(start, #str)
end
return args
end
local function parse_cmdline(cmdid, args)
local uci = require "luci.model.uci".cursor()
if uci:get("luci", cmdid) == "command" then
local cmd = uci:get_all("luci", cmdid)
local argv = parse_args(cmd.command)
local i, v
if cmd.param == "1" and args then
for i, v in ipairs(parse_args(luci.http.urldecode(args))) do
argv[#argv+1] = v
end
end
for i, v in ipairs(argv) do
if v:match("[^%w%.%-i/]") then
argv[i] = '"%s"' % v:gsub('"', '\\"')
end
end
return argv
end
end
function action_run(...)
local fs = require "nixio.fs"
local argv = parse_cmdline(...)
if argv then
local outfile = os.tmpname()
local errfile = os.tmpname()
local rv = os.execute(table.concat(argv, " ") .. " >%s 2>%s" %{ outfile, errfile })
local stdout = fs.readfile(outfile, 1024 * 512) or ""
local stderr = fs.readfile(errfile, 1024 * 512) or ""
fs.unlink(outfile)
fs.unlink(errfile)
local binary = not not (stdout:match("[%z\1-\8\14-\31]"))
luci.http.prepare_content("application/json")
luci.http.write_json({
command = table.concat(argv, " "),
stdout = not binary and stdout,
stderr = stderr,
exitcode = rv,
binary = binary
})
else
luci.http.status(404, "No such command")
end
end
function action_download(...)
local fs = require "nixio.fs"
local argv = parse_cmdline(...)
if argv then
local fd = io.popen(table.concat(argv, " ") .. " 2>/dev/null")
if fd then
local chunk = fd:read(4096) or ""
local name
if chunk:match("[%z\1-\8\14-\31]") then
luci.http.header("Content-Disposition", "attachment; filename=%s"
% fs.basename(argv[1]):gsub("%W+", ".") .. ".bin")
luci.http.prepare_content("application/octet-stream")
else
luci.http.header("Content-Disposition", "attachment; filename=%s"
% fs.basename(argv[1]):gsub("%W+", ".") .. ".txt")
luci.http.prepare_content("text/plain")
end
while chunk do
luci.http.write(chunk)
chunk = fd:read(4096)
end
fd:close()
else
luci.http.status(500, "Failed to execute command")
end
else
luci.http.status(404, "No such command")
end
end
function action_public(cmdid, args)
local uci = require "luci.model.uci".cursor()
if cmdid and
uci:get("luci", cmdid) == "command" and
uci:get("luci", cmdid, "public") == "1"
then
action_download(cmdid, args)
else
luci.http.status(403, "Access to command denied")
end
end

View file

@ -0,0 +1,37 @@
--[[
LuCI - Lua Configuration Interface
Copyright 2012 Jo-Philipp Wich <jow@openwrt.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
]]--
local m, s
m = Map("luci", translate("Custom Commands"),
translate("This page allows you to configure custom shell commands which can be easily invoked from the web interface."))
s = m:section(TypedSection, "command", "")
s.template = "cbi/tblsection"
s.anonymous = true
s.addremove = true
s:option(Value, "name", translate("Description"),
translate("A short textual description of the configured command"))
s:option(Value, "command", translate("Command"),
translate("Command line to execute"))
s:option(Flag, "param", translate("Custom arguments"),
translate("Allow the user to provide additional command line arguments"))
s:option(Flag, "public", translate("Public access"),
translate("Allow executing the command and downloading its output without prior authentication"))
return m

View file

@ -0,0 +1,176 @@
<%#
LuCI - Lua Configuration Interface
Copyright 2012 Jo-Philipp Wich <jow@openwrt.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
-%>
<% css = [[
.commandbox {
height: 12em;
width: 30%;
float: left;
height: 12em;
margin: 5px;
position: relative;
}
.commandbox h3 {
font-size: 1.5em !important;
line-height: 2em !important;
margin: 0 !important;
}
.commandbox input[type="text"] {
width: 50% !important;
}
.commandbox div {
position: absolute;
left: 0;
bottom: 1.5em;
}
]] -%>
<%+header%>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<script type="text/javascript">//<![CDATA[
var stxhr = new XHR();
function command_run(id)
{
var args;
var field = document.getElementById(id);
if (field)
args = encodeURIComponent(field.value);
var legend = document.getElementById('command-rc-legend');
var output = document.getElementById('command-rc-output');
if (legend && output)
{
output.innerHTML =
'<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> ' +
'<%:Waiting for command to complete...%>'
;
legend.parentNode.style.display = 'block';
legend.style.display = 'inline';
stxhr.get('<%=luci.dispatcher.build_url("admin", "system", "commands", "run")%>/' + id + (args ? '/' + args : ''), null,
function(x, st)
{
if (st)
{
if (st.binary)
st.stdout = '[<%:Binary data not displayed, download instead.%>]';
legend.style.display = 'none';
output.innerHTML = String.format(
'<pre><strong># %h\n</strong>%h<span style="color:red">%h</span></pre>' +
'<div class="alert-message warning">%s (<%:Code:%> %d)</div>',
st.command, st.stdout, st.stderr,
(st.exitcode == 0) ? '<%:Command successful%>' : '<%:Command failed%>',
st.exitcode);
}
else
{
legend.style.display = 'none';
output.innerHTML = '<span class="error"><%:Failed to execute command!%></span>';
}
location.hash = '#output';
}
);
}
}
function command_download(id)
{
var args;
var field = document.getElementById(id);
if (field)
args = encodeURIComponent(field.value);
location.href = '<%=luci.dispatcher.build_url("admin", "system", "commands", "download")%>/' + id + (args ? '/' + args : '');
}
function command_link(id)
{
var legend = document.getElementById('command-rc-legend');
var output = document.getElementById('command-rc-output');
var args;
var field = document.getElementById(id);
if (field)
args = encodeURIComponent(field.value);
if (legend && output)
{
var link = location.protocol + '//' + location.hostname +
(location.port ? ':' + location.port : '') +
location.pathname.split(';')[0] + 'command/' +
id + (args ? '/' + args : '');
legend.style.display = 'none';
output.parentNode.style.display = 'block';
output.innerHTML = String.format(
'<div class="alert-message"><%:Access command with%> <a href="%s">%s</a></div>',
link, link
);
location.hash = '#output';
}
}
//]]></script>
<%
local uci = require "luci.model.uci".cursor()
local commands = { }
uci:foreach("luci", "command", function(s) commands[#commands+1] = s end)
%>
<form method="get" action="<%=pcdata(luci.http.getenv("REQUEST_URI"))%>">
<div class="cbi-map">
<h2><a id="content" name="content"><%:Custom Commands%></a></h2>
<fieldset class="cbi-section">
<% local _, command; for _, command in ipairs(commands) do %>
<div class="commandbox">
<h3><%=pcdata(command.name)%></h3>
<p><%:Command:%> <code><%=pcdata(command.command)%></code></p>
<% if command.param == "1" then %>
<p><%:Arguments:%> <input type="text" id="<%=command['.name']%>" /></p>
<% end %>
<div>
<input type="button" value="<%:Run%>" class="cbi-button cbi-button-apply" onclick="command_run('<%=command['.name']%>')" />
<input type="button" value="<%:Download%>" class="cbi-button cbi-button-download" onclick="command_download('<%=command['.name']%>')" />
<% if command.public == "1" then %>
<input type="button" value="<%:Link%>" class="cbi-button cbi-button-link" onclick="command_link('<%=command['.name']%>')" />
<% end %>
</div>
</div>
<% end %>
<br style="clear:both" /><br />
<a name="output"></a>
</fieldset>
</div>
<fieldset class="cbi-section" style="display:none">
<legend id="command-rc-legend"><%:Collecting data...%></legend>
<span id="command-rc-output"></span>
</fieldset>
</form>
<%+footer%>

View file

@ -18,7 +18,6 @@ function index()
local cc
cc = entry( { "admin", "services", "coovachilli" }, cbi("coovachilli"), _("CoovaChilli"), 90)
cc.i18n = "coovachilli"
cc.subindex = true
entry( { "admin", "services", "coovachilli", "network" }, cbi("coovachilli_network"), _("Network Configuration"), 10)

View file

@ -23,10 +23,8 @@ function index()
local page
page = entry({"admin", "services", "ddns"}, cbi("ddns/ddns"), _("Dynamic DNS"), 60)
page.i18n = "ddns"
page.dependent = true
page = entry({"mini", "network", "ddns"}, cbi("ddns/ddns", {autoapply=true}), _("Dynamic DNS"), 60)
page.i18n = "ddns"
page.dependent = true
end

View file

@ -13,6 +13,8 @@ You may obtain a copy of the License at
$Id$
]]--
require("luci.tools.webadmin")
local is_mini = (luci.dispatcher.context.path[1] == "mini")
@ -27,6 +29,10 @@ s.anonymous = false
s:option(Flag, "enabled", translate("Enable"))
interface = s:option(ListValue, "interface", translate("Event interface"), translate("On which interface up should start the ddns script process."))
luci.tools.webadmin.cbi_add_networks(interface)
interface.default = "wan"
svc = s:option(ListValue, "service_name", translate("Service"))
svc.rmempty = false
@ -81,7 +87,6 @@ if is_mini then
s.defaults.ip_source = "network"
s.defaults.ip_network = "wan"
else
require("luci.tools.webadmin")
src = s:option(ListValue, "ip_source",
translate("Source of IP address"))
@ -107,14 +112,19 @@ else
end
s:option(Value, "check_interval",
translate("Check for changed IP every")).default = 10
ci = s:option(Value, "check_interval", translate("Check for changed IP every"))
ci.datatype = "and(uinteger,min(1))"
ci.default = 10
unit = s:option(ListValue, "check_unit", translate("Check-time unit"))
unit.default = "minutes"
unit:value("minutes", translate("min"))
unit:value("hours", translate("h"))
s:option(Value, "force_interval", translate("Force update every")).default = 72
fi = s:option(Value, "force_interval", translate("Force update every"))
fi.datatype = "and(uinteger,min(1))"
fi.default = 72
unit = s:option(ListValue, "force_unit", translate("Force-time unit"))
unit.default = "hours"
unit:value("minutes", translate("min"))

View file

@ -11,8 +11,6 @@ You may obtain a copy of the License at
]]--
require("luci.i18n")
module("luci.controller.luci_diag", package.seeall)
function index()
@ -20,11 +18,9 @@ function index()
e = entry({"admin", "network", "diag_config"}, template("diag/network_config_index") , _("Configure Diagnostics"), 120)
e.index = true
e.i18n = "diag_core"
e.dependent = true
e = entry({"mini", "diag"}, template("diag/index"), _("Diagnostics"), 120)
e.index = true
e.i18n = "diag_core"
e.dependent = true
end

View file

@ -38,8 +38,6 @@ end
function parse_output(devmap, outnets, haslink, type, mini, debug)
local curnet = next(outnets, nil)
luci.i18n.loadc("diag_devinfo")
while (curnet) do
local output = outnets[curnet]["output"]
local subnet = outnets[curnet]["subnet"]

View file

@ -19,49 +19,38 @@ function index()
e = entry({"admin", "voice", "diag", "phones"}, arcombine(cbi("luci_diag/smap_devinfo"), cbi("luci_diag/smap_devinfo_config")), _("Phones"), 10)
e.leaf = true
e.subindex = true
e.i18n = "diag_devinfo"
e.dependent = true
e = entry({"admin", "voice", "diag", "phones", "config"}, cbi("luci_diag/smap_devinfo_config"), _("Configure"), 10)
e.i18n = "diag_devinfo"
e = entry({"admin", "status", "smap_devinfo"}, cbi("luci_diag/smap_devinfo"), _("SIP Devices on Network"), 120)
e.leaf = true
e.i18n = "diag_devinfo"
e.dependent = true
e = entry({"admin", "network", "diag_config", "netdiscover_devinfo_config"}, cbi("luci_diag/netdiscover_devinfo_config"), _("Network Device Scan"), 100)
e.leaf = true
e.i18n = "diag_devinfo"
e.dependent = true
e = entry({"admin", "network", "diag_config", "smap_devinfo_config"}, cbi("luci_diag/smap_devinfo_config"), _("SIP Device Scan"))
e.leaf = true
e.i18n = "diag_devinfo"
e.dependent = true
e = entry({"admin", "status", "netdiscover_devinfo"}, cbi("luci_diag/netdiscover_devinfo"), _("Devices on Network"), 90)
e.i18n = "diag_devinfo"
e.dependent = true
e = entry({"admin", "network", "mactodevinfo"}, cbi("luci_diag/mactodevinfo"), _("MAC Device Info Overrides"), 190)
e.i18n = "diag_devinfo"
e.dependent = true
e = entry({"mini", "diag", "phone_scan"}, cbi("luci_diag/smap_devinfo_mini"), _("Phone Scan"), 100)
e.i18n = "diag_devinfo"
e.dependent = true
e = entry({"mini", "voice", "phones", "phone_scan_config"}, cbi("luci_diag/smap_devinfo_config_mini"), _("Config Phone Scan"), 90)
e.i18n = "diag_devinfo"
e.dependent = true
e = entry({"mini", "diag", "netdiscover_devinfo"}, cbi("luci_diag/netdiscover_devinfo_mini"), _("Network Device Scan"), 10)
e.i18n = "diag_devinfo"
e.dependent = true
e = entry({"mini", "network", "netdiscover_devinfo_config"}, cbi("luci_diag/netdiscover_devinfo_config_mini"), _("Device Scan Config"))
e.i18n = "diag_devinfo"
e.dependent = true
end

View file

@ -83,7 +83,6 @@ function command_function(outnets, i)
end
function action_links(netdiscovermap, mini)
luci.i18n.loadc("diag_devinfo")
s = netdiscovermap:section(SimpleSection, "", translate("Actions"))
b = s:option(DummyValue, "_config", translate("Configure Scans"))
b.value = ""

View file

@ -94,7 +94,6 @@ function command_function(outnets, i)
end
function action_links(smapmap, mini)
luci.i18n.loadc("diag_devinfo")
s = smapmap:section(SimpleSection, "", translate("Actions"))
b = s:option(DummyValue, "_config", translate("Configure Scans"))
b.value = ""

View file

@ -3,7 +3,7 @@ module("luci.controller.firewall", package.seeall)
function index()
entry({"admin", "network", "firewall"},
alias("admin", "network", "firewall", "zones"),
_("Firewall"), 60).i18n = "firewall"
_("Firewall"), 60)
entry({"admin", "network", "firewall", "zones"},
arcombine(cbi("firewall/zones"), cbi("firewall/zone-details")),

View file

@ -39,22 +39,6 @@ else
m.title = "%s - %s" %{ translate("Firewall - Port Forwards"), name }
end
local wan_zone = nil
m.uci:foreach("firewall", "zone",
function(s)
local n = s.network or s.name
if n then
local i
for i in n:gmatch("%S+") do
if i == "wan" then
wan_zone = s.name
return false
end
end
end
end)
s = m:section(NamedSection, arg[1], "redirect", "")
s.anonymous = true
s.addremove = false
@ -164,7 +148,6 @@ o.datatype = "portrange"
o = s:option(Flag, "reflection", translate("Enable NAT Loopback"))
o.rmempty = true
o.default = o.enabled
o:depends("src", wan_zone)
o.cfgvalue = function(...)
return Flag.cfgvalue(...) or "1"
end

View file

@ -0,0 +1,4 @@
#!/bin/sh
[ -n "${IPKG_INSTROOT}" ] || {
( . /etc/uci-defaults/luci-freifunk-diagnostics ) && rm -f /etc/uci-defaults/luci-freifunk-diagnostics
}

View file

@ -0,0 +1,82 @@
--[[
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2011 Jo-Philipp Wich <xm@subsignal.org>
Copyright 2013 Manuel Munz <freifunk@somakoma.de>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
]]--
module("luci.controller.freifunk.diag", package.seeall)
function index()
local uci = require("luci.model.uci").cursor()
local page
page = node("freifunk", "status", "diagnostics")
page.target = template("freifunk/diagnostics")
page.title = _("Diagnostics")
page.order = 60
page = entry({"freifunk", "status", "diag_ping"}, call("diag_ping"), nil)
page.leaf = true
page = entry({"freifunk", "status", "diag_nslookup"}, call("diag_nslookup"), nil)
page.leaf = true
page = entry({"freifunk", "status", "diag_traceroute"}, call("diag_traceroute"), nil)
page.leaf = true
page = entry({"freifunk", "status", "diag_ping6"}, call("diag_ping6"), nil)
page.leaf = true
page = entry({"freifunk", "status", "diag_traceroute6"}, call("diag_traceroute6"), nil)
page.leaf = true
end
function diag_command(cmd, addr)
if addr and addr:match("^[a-zA-Z0-9%-%.:_]+$") then
luci.http.prepare_content("text/plain")
local util = io.popen(cmd % addr)
if util then
while true do
local ln = util:read("*l")
if not ln then break end
luci.http.write(ln)
luci.http.write("\n")
end
util:close()
end
return
end
luci.http.status(500, "Bad address")
end
function diag_ping(addr)
diag_command("ping -c 5 -W 1 %q 2>&1", addr)
end
function diag_traceroute(addr)
diag_command("traceroute -q 1 -w 1 -n %q 2>&1", addr)
end
function diag_nslookup(addr)
diag_command("nslookup %q 2>&1", addr)
end
function diag_ping6(addr)
diag_command("ping6 -c 5 %q 2>&1", addr)
end
function diag_traceroute6(addr)
diag_command("traceroute6 -q 1 -w 2 -n %q 2>&1", addr)
end

View file

@ -0,0 +1,120 @@
<%#
LuCI - Lua Configuration Interface
Copyright 2010 Jo-Philipp Wich <xm@subsignal.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id$
-%>
<%+header%>
<%
local fs = require "nixio.fs"
local has_ping6 = fs.access("/bin/ping6") or fs.access("/usr/bin/ping6")
local has_traceroute6 = fs.access("/usr/bin/traceroute6")
%>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<script type="text/javascript">//<![CDATA[
var stxhr = new XHR();
function update_status(field, proto)
{
var tool = field.name;
var addr = field.value;
var protocol = proto ? "6" : "";
var legend = document.getElementById('diag-rc-legend');
var output = document.getElementById('diag-rc-output');
if (legend && output)
{
output.innerHTML =
'<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> ' +
'<%:Waiting for command to complete...%>'
;
legend.parentNode.style.display = 'block';
legend.style.display = 'inline';
stxhr.get('<%=luci.dispatcher.build_url("freifunk", "status")%>/diag_' + tool + protocol + '/' + addr, null,
function(x)
{
if (x.responseText)
{
legend.style.display = 'none';
output.innerHTML = String.format('<pre>%h</pre>', x.responseText);
}
else
{
legend.style.display = 'none';
output.innerHTML = '<span class="error"><%:Bad address specified!%></span>';
}
}
);
}
}
//]]></script>
<form method="post" action="<%=pcdata(luci.http.getenv("REQUEST_URI"))%>">
<div class="cbi-map">
<h2><a id="content" name="content"><%:Diagnostics%></a></h2>
<fieldset class="cbi-section">
<legend><%:Network Utilities%></legend>
<br />
<div style="width:30%; float:left">
<input style="margin: 5px 0" type="text" value="openwrt.org" name="ping" /><br />
<% if has_ping6 then %>
<select name="ping_proto" style="width:auto">
<option value="" selected="selected"><%:IPv4%></option>
<option value="6"><%:IPv6%></option>
</select>
<input type="button" value="<%:Ping%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.ping, this.form.ping_proto.selectedIndex)" />
<% else %>
<input type="button" value="<%:Ping%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.ping)" />
<% end %>
</div>
<div style="width:33%; float:left">
<input style="margin: 5px 0" type="text" value="openwrt.org" name="traceroute" /><br />
<% if has_traceroute6 then %>
<select name="traceroute_proto" style="width:auto">
<option value="" selected="selected"><%:IPv4%></option>
<option value="6"><%:IPv6%></option>
</select>
<input type="button" value="<%:Traceroute%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.traceroute, this.form.traceroute_proto.selectedIndex)" />
<% else %>
<input type="button" value="<%:Traceroute%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.traceroute)" />
<% end %>
<% if not has_traceroute6 then %>
<p>&#160;</p>
<p><%:Install iputils-traceroute6 for IPv6 traceroute%></p>
<% end %>
</div>
<div style="width:33%; float:left;">
<input style="margin: 5px 0" type="text" value="openwrt.org" name="nslookup" /><br />
<input type="button" value="<%:Nslookup%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.nslookup)" />
</div>
<br style="clear:both" /><br />
</fieldset>
</div>
<fieldset class="cbi-section" style="display:none">
<legend id="diag-rc-legend"><%:Collecting data...%></legend>
<span id="diag-rc-output"></span>
</fieldset>
</form>
<%+footer%>

View file

@ -0,0 +1,2 @@
#!/bin/sh
rm -f /tmp/luci-indexcache

View file

@ -14,5 +14,5 @@ module "luci.controller.freifunk.policy-routing"
function index()
entry({"admin", "freifunk", "policyrouting"}, cbi("freifunk/policyrouting"),
_("Policy Routing"), 60).i18n = "freifunk-policyrouting"
_("Policy Routing"), 60)
end

View file

@ -10,7 +10,6 @@ You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
]]--
luci.i18n.loadc("freifunk")
local uci = require "luci.model.uci".cursor()
m = Map("freifunk-policyrouting", translate("Policy Routing"), translate("These pages can be used to setup policy routing for certain firewall zones. "..

View file

@ -19,7 +19,7 @@ config widget 'example_search'
option enabled '0'
option title 'Search'
list engine 'Google|http://www.google.de/search?q='
list engine 'Freifunk Wiki|http://wiki.freifunk.net/index.php?search='
list engine 'Freifunk&#160;Wiki|http://wiki.freifunk.net/index.php?search='
option width '50%'
option paddingright '8%'

View file

@ -23,6 +23,5 @@ function index()
local page
page = entry({"admin", "services", "hd_idle"}, cbi("hd_idle"), _("hd-idle"), 60)
page.i18n = "hd_idle"
page.dependent = true
end

View file

@ -22,7 +22,6 @@ function index()
page.target = firstchild()
page.title = _("VoIP")
page.order = 90
page.i18n = "telephony"
entry({"admin", "telephony", "account"}, cbi("luci_ltqtapi/account") , _("Account"), 10)
entry({"admin", "telephony", "contact"}, cbi("luci_ltqtapi/contact") , _("Contacts"), 20)

View file

@ -142,7 +142,11 @@ uci:foreach("wireless", "wifi-device", function(section)
end
-- Enable VAP
if hwtype == "atheros" then
local supports_vap = 0
if sys.call("/usr/bin/meshwizard/helpers/supports_vap.sh " .. device .. " " .. hwtype) == 0 then
supports_vap = 1
end
if supports_vap == 1 then
local vap = n:taboption(device, Flag, device .. "_vap", translate("Virtual Access Point (VAP)"),
translate("This will setup a new virtual wireless interface in Access Point mode."))
vap:depends(device .. "_dhcp", "1")

View file

@ -22,7 +22,6 @@ function index()
local page
page = entry({"admin", "services", "minidlna"}, cbi("minidlna"), _("miniDLNA"))
page.i18n = "minidlna"
page.dependent = true
entry({"admin", "services", "minidlna_status"}, call("minidlna_status"))

View file

@ -1,5 +1,3 @@
<%- luci.i18n.loadc("minidlna") -%>
<script type="text/javascript">//<![CDATA[
XHR.poll(5, '<%=luci.dispatcher.build_url("admin/services/minidlna_status")%>', null,
function(x, st)

View file

@ -23,6 +23,5 @@ function index()
local page
page = entry({"admin", "system", "mmc_over_gpio"}, cbi("mmc_over_gpio"), _("MMC/SD driver configuration"), 60)
page.i18n = "mmc_over_gpio"
page.dependent = true
end

View file

@ -9,13 +9,11 @@ function index()
local page
page = entry({"admin", "network", "multiwan"}, cbi("multiwan/multiwan"), _("Multi-WAN"))
page.i18n = "multiwan"
page.dependent = true
entry({"admin", "network", "multiwan", "status"}, call("multiwan_status"))
page = entry({"mini", "network", "multiwan"}, cbi("multiwan/multiwanmini", {autoapply=true}), _("Multi-WAN"))
page.i18n = "multiwan"
page.dependent = true
end
function multiwan_status()

View file

@ -23,10 +23,8 @@ function index()
local page
page = entry({"admin", "system", "ntpc"}, cbi("ntpc/ntpc"), _("Time Synchronisation"), 50)
page.i18n = "ntpc"
page.dependent = true
page = entry({"mini", "system", "ntpc"}, cbi("ntpc/ntpcmini", {autoapply=true}), _("Time Synchronisation"), 50)
page.i18n = "ntpc"
page.dependent = true
end

View file

@ -20,14 +20,21 @@ s.addremove = false
s:option(DummyValue, "_time", translate("Current system time")).value = os.date("%c")
s:option(Value, "interval", translate("Update interval (in seconds)")).rmempty = true
s:option(Value, "count", translate("Count of time measurements"), translate("empty = infinite")).rmempty = true
interval = s:option(Value, "interval", translate("Update interval (in seconds)"))
interval.datatype = "and(uinteger,min(1))"
interval.rmempty = true
count = s:option(Value, "count", translate("Count of time measurements"), translate("empty = infinite"))
count.datatype = "and(uinteger,min(1))"
count.rmempty = true
s2 = m:section(TypedSection, "ntpdrift", translate("Clock Adjustment"))
s2.anonymous = true
s2.addremove = false
s2:option(Value, "freq", translate("Offset frequency")).rmempty = true
freq = s2:option(Value, "freq", translate("Offset frequency"))
freq.datatype = "integer"
freq.rmempty = true
s3 = m:section(TypedSection, "ntpserver", translate("Time Servers"))
s3.anonymous = true
@ -35,6 +42,8 @@ s3.addremove = true
s3.template = "cbi/tblsection"
s3:option(Value, "hostname", translate("Hostname"))
s3:option(Value, "port", translate("Port")).rmempty = true
port = s3:option(Value, "port", translate("Port"))
port.datatype = "port"
port.rmempty = true
return m

View file

@ -21,8 +21,9 @@ s.addremove = false
s:option(DummyValue, "_time", translate("Current system time")).value = os.date("%c")
s:option(Value, "interval", translate("Update interval (in seconds)")).rmempty = true
interval = s:option(Value, "interval", translate("Update interval (in seconds)"))
interval.datatype = "and(uinteger,min(1))"
interval.rmempty = true
s3 = m:section(TypedSection, "ntpserver", translate("Time Server"))
s3.anonymous = true
@ -30,6 +31,8 @@ s3.addremove = true
s3.template = "cbi/tblsection"
s3:option(Value, "hostname", translate("Hostname"))
s3:option(Value, "port", translate("Port")).rmempty = true
port = s3:option(Value, "port", translate("Port"))
port.datatype = "port"
port.rmempty = true
return m

View file

@ -8,7 +8,6 @@ function index()
local page = node("admin", "status", "olsr")
page.target = template("status-olsr/overview")
page.title = _("OLSR")
page.i18n = "olsr"
page.subindex = true
local page = node("admin", "status", "olsr", "neighbors")
@ -51,7 +50,6 @@ function index()
{"admin", "services", "olsrd"},
cbi("olsr/olsrd"), "OLSR"
)
ol.i18n = "olsr"
ol.subindex = true
entry(
@ -74,7 +72,6 @@ function index()
cbi("olsr/olsrddisplay"), _("Display")
)
oplg.i18n = "olsr"
oplg.leaf = true
oplg.subindex = true

View file

@ -16,11 +16,11 @@ function etx_color(etx)
local color = "#bb3333"
if etx == 0 then
color = "#bb3333"
elseif etx < 4 then
elseif etx < 2 then
color = "#00cc00"
elseif etx < 10 then
elseif etx < 4 then
color = "#ffcb05"
elseif etx < 100 then
elseif etx < 10 then
color = "#ff6600"
end
return color

View file

@ -147,6 +147,10 @@ end
<li><strong>LQ: </strong><%:Success rate of packages received from the neighbour%></li>
<li><strong>NLQ: </strong><%:Success rate of packages sent to the neighbour%></li>
<li><strong>ETX: </strong><%:Expected retransmission count%></li>
<li><strong><span style="color:#00cc00"><%:Green%></span></strong>:<%:Very good (ETX < 2)%></li>
<li><strong><span style="color:#ffcb05"><%:Yellow%></span></strong>:<%:Good (2 < ETX < 4)%></li>
<li><strong><span style="color:#ff6600"><%:Orange%></span></strong>:<%:Still usable (4 < ETX < 10)%></li>
<li><strong><span style="color:#bb3333"><%:Red%></span></strong>:<%:Bad (ETX > 10)%></li>
</ul>
</fieldset>
<%+footer%>

View file

@ -168,7 +168,7 @@ XHR.poll(30, '<%=REQUEST_URI%>', { status: 1 },
</div>
<div class="cbi-value-field">
<div style="width: 6em; float:left;">
<a href="<%=luci.dispatcher.build_url("freifunk", "olsr", "interfaces")%>">
<a href="<%=REQUEST_URI%>/interfaces">
<span id="nr_ifaces">
<%=nr_ifaces%>
<span>
@ -189,7 +189,7 @@ XHR.poll(30, '<%=REQUEST_URI%>', { status: 1 },
</div>
<div class="cbi-value-field">
<div style="width: 6em; float:left;">
<a href="<%=luci.dispatcher.build_url("freifunk", "olsr", "neighbors")%>">
<a href="<%=REQUEST_URI%>/neighbors">
<span id="nr_neigh">
<%=nr_neigh%>
</span>
@ -210,7 +210,7 @@ XHR.poll(30, '<%=REQUEST_URI%>', { status: 1 },
</div>
<div class="cbi-value-field">
<div style="width: 6em; float:left;">
<a href="<%=luci.dispatcher.build_url("freifunk", "olsr", "topology")%>">
<a href="<%=REQUEST_URI%>/topology">
<span id="nr_nodes">
<%=nr_nodes%>
</span>
@ -226,7 +226,7 @@ XHR.poll(30, '<%=REQUEST_URI%>', { status: 1 },
</div>
<div class="cbi-value-field">
<div style="width: 6em; float:left;">
<a href="<%=luci.dispatcher.build_url("freifunk", "olsr", "hna")%>">
<a href="<%=REQUEST_URI%>/hna">
<span id="nr_hna">
<%=nr_hna%>
</span>
@ -242,7 +242,7 @@ XHR.poll(30, '<%=REQUEST_URI%>', { status: 1 },
</div>
<div class="cbi-value-field">
<div style="width: 6em; float:left;">
<a href="<%=luci.dispatcher.build_url("freifunk", "olsr", "topology")%>">
<a href="<%=REQUEST_URI%>/topology">
<span id="nr_topo">
<%=nr_topo%>
</span>

View file

@ -16,7 +16,7 @@ $Id$
module("luci.controller.openvpn", package.seeall)
function index()
entry( {"admin", "services", "openvpn"}, cbi("openvpn"), _("OpenVPN") ).i18n = "openvpn"
entry( {"admin", "services", "openvpn"}, cbi("openvpn"), _("OpenVPN") )
entry( {"admin", "services", "openvpn", "basic"}, cbi("openvpn-basic"), nil ).leaf = true
entry( {"admin", "services", "openvpn", "advanced"}, cbi("openvpn-advanced"), nil ).leaf = true
end

View file

@ -16,5 +16,5 @@ module("luci.controller.ff_p2pblock", package.seeall)
function index()
entry({"admin", "network", "firewall", "p2pblock"}, cbi("luci_fw/p2pblock"),
_("P2P-Block"), 40).i18n = "p2pblock"
_("P2P-Block"), 40)
end

View file

@ -23,6 +23,5 @@ function index()
local page
page = entry({"admin", "services", "p910nd"}, cbi("p910nd"), _("p910nd - Printer server"), 60)
page.i18n = "p910nd"
page.dependent = true
end

View file

@ -2,6 +2,7 @@
LuCI p910nd
(c) 2008 Yanira <forum-2008@email.de>
(c) 2012 Jo-Philipp Wich <jow@openwrt.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -9,15 +10,17 @@ You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id$
]]--
local uci = luci.model.uci.cursor_state()
local net = require "luci.model.network"
local m, s, p, b
m = Map("p910nd", translate("p910nd - Printer server"),
translatef("First you have to install the packages to get support for USB (kmod-usb-printer) or parallel port (kmod-lp)."))
net = net.init(m.uci)
s = m:section(TypedSection, "p910nd", translate("Settings"))
s.addremove = true
s.anonymous = true
@ -26,6 +29,25 @@ s:option(Flag, "enabled", translate("enable"))
s:option(Value, "device", translate("Device")).rmempty = true
b = s:option(Value, "bind", translate("Interface"), translate("Specifies the interface to listen on."))
b.template = "cbi/network_netlist"
b.nocreate = true
b.unspecified = true
function b.cfgvalue(...)
local v = Value.cfgvalue(...)
if v then
return (net:get_status_by_address(v))
end
end
function b.write(self, section, value)
local n = net:get_network(value)
if n and n:ipaddr() then
Value.write(self, section, n:ipaddr())
end
end
p = s:option(ListValue, "port", translate("Port"), translate("TCP listener port."))
p.rmempty = true
for i=0,9 do

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with luci-pbx. If not, see <http://www.gnu.org/licenses/>.
. /etc/functions.sh
. /lib/functions.sh
START=60

View file

@ -19,7 +19,7 @@ function index()
return
end
entry({"admin", "services", "polipo"}, alias("admin", "services", "polipo", "config"), _("Polipo")).i18n = "polipo"
entry({"admin", "services", "polipo"}, alias("admin", "services", "polipo", "config"), _("Polipo"))
entry({"admin", "services", "polipo", "status"}, template("polipo_status"), _("Status"))
entry({"admin", "services", "polipo", "config"}, cbi("polipo"), _("Configuration"))
end

View file

@ -5,7 +5,7 @@ PIDFILE=`uci get polipo.daemon.pidFile`
CFGFILE=/var/etc/polipo.conf
[ -e "$PIDFILE" ] && {
PID=`cat $PID_FILE`
PID=`cat $PIDFILE`
# send Polipo USR1 signal to write its in-memory cache to disk
kill -USR1 $PID

View file

@ -22,10 +22,8 @@ function index()
local page
page = entry({"admin", "network", "qos"}, cbi("qos/qos"), _("QoS"))
page.i18n = "qos"
page.dependent = true
page = entry({"mini", "network", "qos"}, cbi("qos/qosmini", {autoapply=true}), _("QoS"))
page.i18n = "qos"
page.dependent = true
end

View file

@ -35,9 +35,11 @@ s:option(Flag, "overhead", translate("Calculate overhead"))
s:option(Flag, "halfduplex", translate("Half-duplex"))
s:option(Value, "download", translate("Download speed (kbit/s)"))
dl = s:option(Value, "download", translate("Download speed (kbit/s)"))
dl.datatype = "and(uinteger,min(1))"
s:option(Value, "upload", translate("Upload speed (kbit/s)"))
ul = s:option(Value, "upload", translate("Upload speed (kbit/s)"))
ul.datatype = "and(uinteger,min(1))"
s = m:section(TypedSection, "classify", translate("Classification Rules"))
s.template = "cbi/tblsection"

View file

@ -21,8 +21,12 @@ m = Map("qos")
s = m:section(NamedSection, "wan", "interface", translate("Internet Connection"))
s:option(Flag, "enabled", translate("Quality of Service"))
s:option(Value, "download", translate("Downlink"), "kbit/s")
s:option(Value, "upload", translate("Uplink"), "kbit/s")
dl = s:option(Value, "download", translate("Downlink"), "kbit/s")
dl.datatype = "and(uinteger,min(1))"
ul = s:option(Value, "upload", translate("Uplink"), "kbit/s")
ul.datatype = "and(uinteger,min(1))"
s = m:section(TypedSection, "classify")
s.template = "cbi/tblsection"

View file

@ -19,7 +19,7 @@ function index()
return
end
entry({"admin", "network", "radvd"}, cbi("radvd"), _("Radvd"), 61).i18n = "radvd"
entry({"admin", "network", "radvd"}, cbi("radvd"), _("Radvd"), 61)
entry({"admin", "network", "radvd", "interface"}, cbi("radvd/interface"), nil).leaf = true
entry({"admin", "network", "radvd", "prefix"}, cbi("radvd/prefix"), nil).leaf = true
entry({"admin", "network", "radvd", "route"}, cbi("radvd/route"), nil).leaf = true

View file

@ -23,6 +23,5 @@ function index()
local page
page = entry({"admin", "services", "samba"}, cbi("samba"), _("Network Shares"))
page.i18n = "samba"
page.dependent = true
end

View file

@ -1,28 +1,25 @@
module("luci.controller.splash.splash", package.seeall)
luci.i18n.loadc("splash")
local uci = luci.model.uci.cursor()
local util = require "luci.util"
function index()
entry({"admin", "services", "splash"}, cbi("splash/splash"), _("Client-Splash"), 90).i18n = "freifunk"
entry({"admin", "services", "splash"}, cbi("splash/splash"), _("Client-Splash"), 90)
entry({"admin", "services", "splash", "splashtext" }, form("splash/splashtext"), _("Splashtext"), 10)
local e
e = node("splash")
e.target = call("action_dispatch")
e.i18n = "freifunk"
node("splash", "activate").target = call("action_activate")
node("splash", "splash").target = template("splash_splash/splash")
node("splash", "blocked").target = template("splash/blocked")
entry({"admin", "status", "splash"}, call("action_status_admin"), _("Client-Splash")).i18n = "freifunk"
entry({"admin", "status", "splash"}, call("action_status_admin"), _("Client-Splash"))
local page = node("splash", "publicstatus")
page.target = call("action_status_public")
page.i18n = "freifunk"
page.leaf = true
end

View file

@ -9,7 +9,6 @@ You may obtain a copy of the License at
]]--
require("luci.model.uci")
luci.i18n.loadc("splash")
m = Map("luci_splash", translate("Client-Splash"), translate("Client-Splash is a hotspot authentification system for wireless mesh networks."))

View file

@ -13,7 +13,6 @@ You may obtain a copy of the License at
]]--
local fs = require "nixio.fs"
luci.i18n.loadc("splash")
local splashtextfile = "/usr/lib/luci-splash/splashtext.html"

View file

@ -19,7 +19,6 @@ local ipt = require "luci.sys.iptparser".IptParser()
local uci = require "luci.model.uci".cursor_state()
local wat = require "luci.tools.webadmin"
local fs = require "nixio.fs"
luci.i18n.loadc("splash")
local clients = { }
local leasetime = tonumber(uci:get("luci_splash", "general", "leasetime") or 1) * 60 * 60

View file

@ -2,6 +2,7 @@
Luci statistics - statistics controller module
(c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net>
(c) 2012 Jo-Philipp Wich <xm@subsignal.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -9,8 +10,6 @@ You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id$
]]--
module("luci.controller.luci_statistics.luci_statistics", package.seeall)
@ -50,6 +49,7 @@ function index()
memory = _("Memory"),
netlink = _("Netlink"),
network = _("Network"),
nut = _("UPS"),
olsrd = _("OLSRd"),
ping = _("Ping"),
processes = _("Processes"),
@ -61,13 +61,12 @@ function index()
-- our collectd menu
local collectd_menu = {
output = { "csv", "network", "rrdtool", "unixsock" },
system = { "cpu", "df", "disk", "email", "exec", "irq", "load", "memory", "processes" },
system = { "cpu", "df", "disk", "email", "exec", "irq", "load", "memory", "nut", "processes" },
network = { "conntrack", "dns", "interface", "iptables", "netlink", "olsrd", "ping", "tcpconns", "iwinfo" }
}
-- create toplevel menu nodes
local st = entry({"admin", "statistics"}, template("admin_statistics/index"), _("Statistics"), 80)
st.i18n = "statistics"
st.index = true
entry({"admin", "statistics", "collectd"}, cbi("luci_statistics/collectd"), _("Collectd"), 10).subindex = true
@ -82,7 +81,6 @@ function index()
)
e.index = true
e.i18n = "rrdtool"
for j, plugin in luci.util.vspairs( plugins ) do
_entry(
@ -97,7 +95,6 @@ function index()
-- output views
local page = entry( { "admin", "statistics", "graph" }, template("admin_statistics/index"), _("Graphs"), 80)
page.i18n = "statistics"
page.setuser = "nobody"
page.setgroup = "nogroup"
@ -108,7 +105,8 @@ function index()
-- get rrd data tree
local tree = luci.statistics.datatree.Instance(host)
for i, plugin in luci.util.vspairs( tree:plugins() ) do
local _, plugin, idx
for _, plugin, idx in luci.util.vspairs( tree:plugins() ) do
-- get plugin instances
local instances = tree:plugin_instances( plugin )
@ -116,16 +114,17 @@ function index()
-- plugin menu entry
entry(
{ "admin", "statistics", "graph", plugin },
call("statistics_render"), labels[plugin], i
call("statistics_render"), labels[plugin], idx
).query = { timespan = span , host = host }
-- if more then one instance is found then generate submenu
if #instances > 1 then
for j, inst in luci.util.vspairs(instances) do
local _, inst, idx2
for _, inst, idx2 in luci.util.vspairs(instances) do
-- instance menu entry
entry(
{ "admin", "statistics", "graph", plugin, inst },
call("statistics_render"), inst, j
call("statistics_render"), inst, idx2
).query = { timespan = span , host = host }
end
end
@ -150,6 +149,7 @@ function statistics_render()
local hosts = graph.tree:host_instances()
local is_index = false
local i, p, inst, idx
-- deliver image
if vars.img then
@ -188,8 +188,8 @@ function statistics_render()
-- render graphs
for i, inst in ipairs( instances ) do
for i, img in ipairs( graph:render( plugin, inst, is_index ) ) do
for i, inst in luci.util.vspairs( instances ) do
for i, img in luci.util.vspairs( graph:render( plugin, inst, is_index ) ) do
table.insert( images, graph:strippngpath( img ) )
images[images[#images]] = inst
end

View file

@ -19,7 +19,7 @@ require("luci.sys")
m = Map("luci_statistics",
translate("Collectd Settings"),
translate(
"Collectd is a small daeomon for collecting data from " ..
"Collectd is a small daemon for collecting data from " ..
"various sources through different plugins. On this page " ..
"you can change general settings for the collectd daemon."
))

View file

@ -0,0 +1,28 @@
--[[
LuCI - Lua Configuration Interface
Copyright © 2011 Manuel Munz <freifunk at somakoma dot de>
Copyright © 2012 David Woodhouse <dwmw2@infradead.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
]]--
m = Map("luci_statistics",
translate("UPS Plugin Configuration"),
translate("The NUT plugin reads information about Uninterruptible Power Supplies."))
s = m:section(NamedSection, "collectd_nut", "luci_statistics" )
enable = s:option(Flag, "enable", translate("Enable this plugin"))
enable.default = 0
host = s:option(Value, "UPS", translate("UPS"), translate("UPS name in NUT ups@host format"))
host.placeholder = "myupsname"
host.datatype = "string"
host.rmempty = true
return m

View file

@ -21,7 +21,7 @@ enable.default = 0
host = s:option(Value, "Host", translate("Host"), translate("IP or hostname where to get the txtinfo output from"))
host.placeholder = "127.0.0.1"
host.datatype = "hostname"
host.datatype = "host"
host.rmempty = true
port = s:option(Value, "Port", translate("Port"))

View file

@ -25,9 +25,6 @@ Instance = luci.util.class()
function Instance.__init__( self, graph )
self.i18n = luci.i18n
self.graph = graph
self.i18n.loadc("rrdtool")
self.i18n.loadc("statistics")
end
function Instance._subst( self, str, val )

View file

@ -156,11 +156,14 @@ function Graph._generic( self, opts, plugin, plugin_instance, dtype, index )
if not ds or ds:len() == 0 then ds = "value" end
_tif( _args, "DEF:%s_avg=%s:%s:AVERAGE", inst, rrd, ds )
_tif( _args, "DEF:%s_avg_raw=%s:%s:AVERAGE", inst, rrd, ds )
_tif( _args, "CDEF:%s_avg=%s_avg_raw,%s", inst, inst, source.transform_rpn )
if not self.opts.rrasingle then
_tif( _args, "DEF:%s_min=%s:%s:MIN", inst, rrd, ds )
_tif( _args, "DEF:%s_max=%s:%s:MAX", inst, rrd, ds )
_tif( _args, "DEF:%s_min_raw=%s:%s:MIN", inst, rrd, ds )
_tif( _args, "CDEF:%s_min=%s_min_raw,%s", inst, inst, source.transform_rpn )
_tif( _args, "DEF:%s_max_raw=%s:%s:MAX", inst, rrd, ds )
_tif( _args, "CDEF:%s_max=%s_max_raw,%s", inst, inst, source.transform_rpn )
end
_tif( _args, "CDEF:%s_nnl=%s_avg,UN,0,%s_avg,IF", inst, inst, inst )
@ -180,20 +183,23 @@ function Graph._generic( self, opts, plugin, plugin_instance, dtype, index )
-- is first source in stack or overlay source: source_stk = source_nnl
if not prev or source.overlay then
-- create cdef statement
-- create cdef statement for cumulative stack (no NaNs) and also
-- for display (preserving NaN where no points should be displayed)
_tif( _args, "CDEF:%s_stk=%s_nnl", source.sname, source.sname )
_tif( _args, "CDEF:%s_plot=%s_avg", source.sname, source.sname )
-- is subsequent source without overlay: source_stk = source_nnl + previous_stk
else
-- create cdef statement
_tif( _args, "CDEF:%s_stk=%s_nnl,%s_stk,+", source.sname, source.sname, prev )
_tif( _args, "CDEF:%s_plot=%s_avg,%s_stk,+", source.sname, source.sname, prev )
end
-- create multiply by minus one cdef if flip is enabled
if source.flip then
-- create cdef statement: source_stk = source_stk * -1
_tif( _args, "CDEF:%s_neg=%s_stk,-1,*", source.sname, source.sname )
_tif( _args, "CDEF:%s_neg=%s_plot,-1,*", source.sname, source.sname )
-- push to negative stack if overlay is disabled
if not source.overlay then
@ -253,11 +259,11 @@ function Graph._generic( self, opts, plugin, plugin_instance, dtype, index )
-- derive area background color from line color
area_color = self.colors:to_string( self.colors:faded( area_color ) )
-- choose source_stk or source_neg variable depending on flip state
-- choose source_plot or source_neg variable depending on flip state
if source.flip then
var = "neg"
else
var = "stk"
var = "plot"
end
-- create legend
@ -400,6 +406,7 @@ function Graph._generic( self, opts, plugin, plugin_instance, dtype, index )
flip = dopts.flip or false,
total = dopts.total or false,
overlay = dopts.overlay or false,
transform_rpn = dopts.transform_rpn or "0,+",
noarea = dopts.noarea or false,
title = dopts.title or nil,
ds = dsource,
@ -450,6 +457,18 @@ function Graph._generic( self, opts, plugin, plugin_instance, dtype, index )
_ti( _args, self.i18n:title( plugin, plugin_instance, _sources[1].type, instance, opts.title ) )
_ti( _args, "-v" )
_ti( _args, self.i18n:label( plugin, plugin_instance, _sources[1].type, instance, opts.vlabel ) )
if opts.y_max then
_ti ( _args, "-u" )
_ti ( _args, opts.y_max )
end
if opts.y_min then
_ti ( _args, "-l" )
_ti ( _args, opts.y_min )
end
if opts.units_exponent then
_ti ( _args, "-X" )
_ti ( _args, opts.units_exponent )
end
-- store additional rrd options
if opts.rrdopts then

View file

@ -19,6 +19,7 @@ function rrdargs( graph, plugin, plugin_instance, dtype )
return {
title = "%H: Processor usage on core #%pi",
y_min = "0",
vlabel = "Percent",
number_format = "%5.1lf%%",
data = {

View file

@ -19,6 +19,8 @@ function rrdargs( graph, plugin, plugin_instance, dtype )
return {
title = "%H: Load", vlabel = "Load",
y_min = "0",
units_exponent = "0",
number_format = "%5.2lf", data = {
sources = {
load = { "shortterm", "midterm", "longterm" }

View file

@ -0,0 +1,106 @@
--[[
Luci statistics - ups plugin diagram definition
Copyright © 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net>
Copyright © 2012 David Woodhouse <dwmw2@infradead.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
]]--
module("luci.statistics.rrdtool.definitions.nut",package.seeall)
function rrdargs( graph, plugin, plugin_instance, dtype )
local voltages = {
title = "%H: Voltages on UPS \"%pi\"",
vlabel = "V",
number_format = "%5.1lfV",
data = {
instances = {
voltage = { "battery", "input", "output" }
},
options = {
voltage_output = { color = "00e000", title = "Output voltage", noarea=true, overlay=true },
voltage_battery = { color = "0000ff", title = "Battery voltage", noarea=true, overlay=true },
voltage_input = { color = "ffb000", title = "Input voltage", noarea=true, overlay=true }
}
}
}
local currents = {
title = "%H: Current on UPS \"%pi\"",
vlabel = "A",
number_format = "%5.3lfA",
data = {
instances = {
current = { "battery", "output" }
},
options = {
current_output = { color = "00e000", title = "Output current", noarea=true, overlay=true },
current_battery = { color = "0000ff", title = "Battery current", noarea=true, overlay=true },
}
}
}
local percentage = {
title = "%H: Battery charge on UPS \"%pi\"",
vlabel = "Percent",
y_min = "0",
y_max = "100",
number_format = "%5.1lf%%",
data = {
sources = {
percent = { "percent" }
},
instances = {
percent = "charge"
},
options = {
percent_charge = { color = "00ff00", title = "Charge level" }
}
}
}
-- Note: This is in ISO8859-1 for rrdtool. Welcome to the 20th century.
local temperature = {
title = "%H: Battery temperature on UPS \"%pi\"",
vlabel = "\176C",
number_format = "%5.1lf\176C",
data = {
instances = {
temperature = "battery"
},
options = {
temperature_battery = { color = "ffb000", title = "Battery temperature" }
}
}
}
local timeleft = {
title = "%H: Time left on UPS \"%pi\"",
vlabel = "Minutes",
number_format = "%.1lfm",
data = {
sources = {
timeleft = { "timeleft" }
},
instances = {
timeleft = { "battery" }
},
options = {
timeleft_battery = { color = "0000ff", title = "Time left", transform_rpn = "60,/" }
}
}
}
return { voltages, currents, percentage, temperature, timeleft }
end

View file

@ -131,3 +131,7 @@ config 'statistics' 'collectd_olsrd'
config 'statistics' 'collectd_iwinfo'
option 'enable' '1'
config 'statistics' 'collectd_nut'
option 'enable' '0'
option 'UPS' 'myupsname'

View file

@ -357,6 +357,12 @@ plugins = {
network = config_network,
nut = {
{ "UPS" },
{ },
{ }
},
olsrd = {
{ "Host", "Port", "CollectLinks","CollectRoutes","CollectTopology"},
{ },

View file

@ -20,7 +20,7 @@ function index()
return
end
entry({"admin", "services", "tinyproxy"}, alias("admin", "services", "tinyproxy", "config"), _("Tinyproxy")).i18n = "tinyproxy"
entry({"admin", "services", "tinyproxy"}, alias("admin", "services", "tinyproxy", "config"), _("Tinyproxy"))
entry({"admin", "services", "tinyproxy", "status"}, template("tinyproxy_status"), _("Status"))
entry({"admin", "services", "tinyproxy", "config"}, cbi("tinyproxy"), _("Configuration"))
end

View file

@ -15,14 +15,11 @@ $Id$
module("luci.controller.transmission", package.seeall)
function index()
require("luci.i18n")
luci.i18n.loadc("transmission")
if not nixio.fs.access("/etc/config/transmission") then
return
end
local page = entry({"admin", "services", "transmission"}, cbi("transmission"), _("Transmission"))
page.i18n = "transmission"
page.dependent = true
end

View file

@ -22,7 +22,7 @@ local running = (luci.sys.call("pidof transmission-daemon > /dev/null") == 0)
local webinstalled = luci.model.ipkg.installed("transmission-web")
local button = ""
if running and webinstalled then
button = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"button\" value=\" " .. translate("Open Web Interface") .. " \" onclick=\"window.open('http://'+window.location.host+':" .. trport .. "')\"/>"
button = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"button\" value=\" " .. translate("Open Web Interface") .. " \" onclick=\"window.open('http://'+window.location.hostname+':" .. trport .. "')\"/>"
end
m = Map("transmission", "Transmission", translate("Transmission daemon is a simple bittorrent client, here you can configure the settings.") .. button)

View file

@ -10,7 +10,6 @@ You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id$
]]--
module("luci.controller.upnp", package.seeall)
@ -23,11 +22,6 @@ function index()
local page
page = entry({"admin", "services", "upnp"}, cbi("upnp/upnp"), _("UPNP"))
page.i18n = "upnp"
page.dependent = true
page = entry({"mini", "network", "upnp"}, cbi("upnp/upnpmini", {autoapply=true}), _("UPNP"))
page.i18n = "upnp"
page.dependent = true
entry({"admin", "services", "upnp", "status"}, call("act_status")).leaf = true
@ -69,13 +63,20 @@ function act_status()
end
end
function act_delete()
local path = luci.dispatcher.context.requestpath
local idx = tonumber(path[#path])
function act_delete(num)
local idx = tonumber(num)
local uci = luci.model.uci.cursor()
if idx and idx > 0 then
luci.sys.call("iptables -t filter -D MINIUPNPD %d 2>/dev/null" % idx)
luci.sys.call("iptables -t nat -D MINIUPNPD %d 2>/dev/null" % idx)
local lease_file = uci:get("upnpd", "config", "upnp_lease_file")
if lease_file and nixio.fs.access(lease_file) then
luci.sys.call("sed -i -e '%dd' %q" %{ idx, lease_file })
end
luci.http.status(200, "OK")
return
end

View file

@ -13,7 +13,7 @@ You may obtain a copy of the License at
$Id$
]]--
m = Map("upnpd", translate("Universal Plug & Play"),
m = Map("upnpd", luci.util.pcdata(translate("Universal Plug & Play")),
translate("UPnP allows clients in the local network to automatically configure the router."))
m:section(SimpleSection).template = "upnp_status"

View file

@ -1,26 +0,0 @@
--[[
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id$
]]--
m = Map("upnpd", translate("Universal Plug & Play"), translate("UPNP allows clients in the local network to automatically configure the router."))
s = m:section(NamedSection, "config", "upnpd", "")
s.addremove = false
e = s:option(Flag, "enabled", translate("enable"))
e.rmempty = false
s:option(Value, "download", translate("Downlink"), "kByte/s").rmempty = true
s:option(Value, "upload", translate("Uplink"), "kByte/s").rmempty = true
return m

View file

@ -1,5 +1,3 @@
<%- luci.i18n.loadc("upnp") -%>
<script type="text/javascript">//<![CDATA[
function upnp_delete_fwd(idx) {
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "upnp", "delete")%>/' + idx, null,

View file

@ -23,6 +23,5 @@ function index()
local page
page = entry({"admin", "services", "ushare"}, cbi("ushare"), _("uShare"), 60)
page.i18n = "ushare"
page.dependent = true
end

View file

@ -14,7 +14,7 @@ $Id$
]]--
m = Map("ushare", translate("uShare"),
translate("uShare is a UPnP (TM) A/V & DLNA Media Server. It implements the server component that provides UPnP media devices with information on available multimedia files."))
luci.util.pcdata(translate("uShare is a UPnP (TM) A/V & DLNA Media Server. It implements the server component that provides UPnP media devices with information on available multimedia files.")))
s = m:section(TypedSection, "ushare", translate("Settings"))
s.addremove = false

View file

@ -1,11 +1,11 @@
module("luci.controller.vnstat", package.seeall)
function index()
entry({"admin", "status", "vnstat"}, alias("admin", "status", "vnstat", "graphs"), _("VnStat Traffic Monitor"), 90).i18n = "vnstat"
entry({"admin", "status", "vnstat"}, alias("admin", "status", "vnstat", "graphs"), _("VnStat Traffic Monitor"), 90)
entry({"admin", "status", "vnstat", "graphs"}, template("vnstat"), _("Graphs"), 1)
entry({"admin", "status", "vnstat", "config"}, cbi("vnstat"), _("Configuration"), 2)
entry({"mini", "network", "vnstat"}, alias("mini", "network", "vnstat", "graphs"), _("VnStat Traffic Monitor"), 90).i18n = "vnstat"
entry({"mini", "network", "vnstat"}, alias("mini", "network", "vnstat", "graphs"), _("VnStat Traffic Monitor"), 90)
entry({"mini", "network", "vnstat", "graphs"}, template("vnstat"), _("Graphs"), 1)
entry({"mini", "network", "vnstat", "config"}, cbi("vnstat"), _("Configuration"), 2)
end

View file

@ -18,18 +18,14 @@ function index()
e = entry({"admin", "voice"}, template("luci_voice/index") , _("Voice"), 90)
e.index = true
e.i18n = "voice_core"
e = entry({"mini", "voice"}, template("luci_voice/index"), _("Voice"), 90)
e.index = true
e.i18n = "voice_core"
e = entry({"mini", "voice", "phones"}, template("luci_voice/phone_index"), _("Phones"), 90)
e.index = true
e.i18n = "voice_core"
e = entry({"admin", "voice", "phones"}, template("luci_voice/phone_index"), _("Phones"), 90)
e.index = true
e.i18n = "voice_core"
end

View file

@ -18,6 +18,5 @@ function index()
e = entry({"admin", "voice", "diag"}, template("luci_voice/diag_index"), _("Diagnostics"), 90)
e.index = true
e.i18n = "voice_diag"
e.dependent = true
end

View file

@ -1,6 +1,6 @@
module("luci.controller.wol", package.seeall)
function index()
entry({"admin", "network", "wol"}, cbi("wol"), _("Wake on LAN"), 90).i18n = "wol"
entry({"mini", "network", "wol"}, cbi("wol"), _("Wake on LAN"), 90).i18n = "wol"
entry({"admin", "network", "wol"}, cbi("wol"), _("Wake on LAN"), 90)
entry({"mini", "network", "wol"}, cbi("wol"), _("Wake on LAN"), 90)
end

View file

@ -1,133 +0,0 @@
#!/usr/bin/lua
--[[
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id: index.lua 3548 2008-10-09 20:28:07Z Cyrus $
]]--
local cbi = require "luci.cbi"
local i18n = require "luci.i18n"
local util = require "luci.util"
if not arg[1] then
util.perror("Usage %s path/to/cbi/model.lua [i18nfilename]" % arg[0])
os.exit(1)
end
i18n.load("base", "en")
if arg[2] then
i18n.load(arg[2], "en")
end
if arg[3] then
pcall(function()
require "uci"
require "luci.model.uci".cursor = function(config, save)
return uci.cursor(config or arg[3] .. "/etc/config", save or arg[3] .. "/tmp/.uci")
end
end)
end
local map = cbi.load(arg[1])[1]
assert(map)
print ("package "..map.config)
print ("\nconfig package")
if #map.title > 0 then
print (" option title '%s'" % util.striptags(map.title))
end
if #map.description > 0 then
print (" option description '%s'" % util.striptags(map.description))
end
for i, sec in pairs(map.children) do if util.instanceof(sec, cbi.AbstractSection) then
print ("\nconfig section")
print (" option name '%s'" % sec.sectiontype)
print (" option package '%s'" % map.config)
if #sec.title > 0 then
print (" option title '%s'" % util.striptags(sec.title))
end
if #sec.description > 0 then
print (" option description '%s'" % util.striptags(sec.description))
end
if not sec.addremove then
print (" option unique true")
print (" option required true")
end
if not sec.anonymous then
print (" option named true")
end
if sec.dynamic then
print (" option dynamic true")
end
for j, opt in ipairs(sec.children) do
if opt.option:sub(1,1) ~= "_" or util.instanceof(opt, cbi.Value) then
print ("\nconfig variable")
print (" option name '%s'" % opt.option)
print (" option section '%s.%s'" % {map.config, sec.sectiontype})
if #opt.title > 0 then
print (" option title '%s'" % util.striptags(opt.title))
end
if #opt.description > 0 then
print (" option description '%s'" % util.striptags(opt.description))
end
if not opt.rmempty and not opt.optional then
print (" option required true")
end
if util.instanceof(opt, cbi.Flag) then
print (" option datatype boolean")
elseif util.instanceof(opt, cbi.DynamicList) then
print (" option type list")
elseif util.instanceof(opt, cbi.ListValue) then
print (" option type enum")
util.perror("*** Warning: Please verify '%s.%s.%s' ***" %
{map.config, sec.sectiontype, opt.option} )
end
for i, dep in ipairs(opt.deps) do
if not dep.add or dep.add == "" then
local depstring
for k, v in pairs(dep.deps) do
depstring = (depstring and depstring .. "," or "") .. "%s=%s" % {k, v}
end
print (" list depends '%s'" % depstring)
else
util.perror("*** Warning: Unable to decode dependency '%s' in '%s.%s.%s[%s]' ***" %
{util.serialize_data(dep.deps), map.config, sec.sectiontype, opt.option, dep.add})
end
end
if util.instanceof(opt, cbi.ListValue) then
for k, key in ipairs(opt.keylist) do
print ("\nconfig enum")
print (" option variable '%s.%s.%s'" % {map.config, sec.sectiontype, opt.option})
print (" option value '%s'" % key)
if opt.vallist[k] and opt.vallist[k] ~= opt.keylist[k] then
print (" option title '%s'" % util.striptags(opt.vallist[k]))
end
end
end
end
end
end end

View file

@ -4,7 +4,8 @@ PATTERN=$1
SCM=
[ -d .svn ] && SCM="svn"
[ -d .git ] && SCM="git"
git=$( which git 2>/dev/null )
[ "$git" ] && "$git" status >/dev/null && SCM="git"
[ -z "$SCM" ] && {
echo "Unsupported SCM tool" >&2

View file

@ -1,120 +0,0 @@
#!/usr/bin/perl
@ARGV >= 2 || die "Usage: $0 <source-dir> <dest-dir> [<target-language>]\n";
my $source_dir = shift @ARGV;
my $target_dir = shift @ARGV;
my $target_lang = shift @ARGV;
my $master_lang = "en";
if( ! -d "$target_dir/" . ( $target_lang || 'templates' ) )
{
system('mkdir', '-p', "$target_dir/" . ( $target_lang || 'templates' ));
}
my %target_strings;
if( $target_lang && open F, "find $source_dir -path '*/luasrc/i18n/*' -name '*.$target_lang.lua' |" )
{
while( chomp( my $file = readline F ) )
{
if( open L, "< $file" )
{
my ( $basename ) = $file =~ m{.+/([^/]+)\.[\w\-]+\.lua$};
$target_strings{$basename} = { };
while( chomp( my $entry = readline L ) )
{
my ( $k, $v );
if( $entry =~ /^\s*(\w+)\s*=\s*\[\[(.+)\]\]/ )
{
( $k, $v ) = ( $1, $2 );
}
elsif( $entry =~ /^\s*(\w+)\s*=\s*'(.+)'/ )
{
( $k, $v ) = ( $1, $2 );
}
elsif( $entry =~ /^\s*(\w+)\s*=\s*"(.+)"/ )
{
( $k, $v ) = ( $1, $2 );
}
if( $k && $v )
{
$v =~ s/"/\\"/g;
$v =~ s/\\\\"/\\"/g;
$target_strings{$basename}{$k} = $v;
}
}
close L;
}
}
close F;
}
if( open F, "find . -path '*/luasrc/i18n/*' -name '*.$master_lang.lua' |" )
{
my $destfile = sprintf '%s/%s/%%s.%s',
$target_dir,
$target_lang || 'templates',
$target_lang ? 'po' : 'pot'
;
while( chomp( my $file = readline F ) )
{
if( open L, "< $file" )
{
my ( $basename ) = $file =~ m{.+/([^/]+)\.\w+\.lua$};
my $filename = sprintf $destfile, $basename;
if( open T, "> $filename" )
{
printf "Generating %-40s ", $filename;
printf T "# %s.%s\n# generated from %s\n\nmsgid \"\"\n" .
"msgstr \"Content-Type: text/plain; charset=UTF-8\"\n\n",
$basename, $target_lang ? 'po' : 'pot', $file;
while( chomp( my $entry = readline L ) )
{
my ( $k, $v );
if( $entry =~ /^\s*(\w+)\s*=\s*\[\[(.+)\]\]/ )
{
( $k, $v ) = ( $1, $2 );
}
elsif( $entry =~ /^\s*(\w+)\s*=\s*'(.+)'/ )
{
( $k, $v ) = ( $1, $2 );
}
elsif( $entry =~ /^\s*(\w+)\s*=\s*"(.+)"/ )
{
( $k, $v ) = ( $1, $2 );
}
if( $k && $v )
{
$v =~ s/"/\\"/g;
$v =~ s/\\\\"/\\"/g;
printf T "#: %s:%d\n#. %s\nmsgid \"%s\"\nmsgstr \"%s\"\n\n",
$file, $., $v, $k,
( $target_strings{$basename} && $target_strings{$basename}{$k} )
? $target_strings{$basename}{$k} : "";
}
}
close T;
print "done\n";
}
close L;
}
}
close F;
}

View file

@ -53,8 +53,8 @@ config widget 'search'
option enabled '1'
option width '50%'
list engine 'Google|http://www.google.de/search?q='
list engine 'Freifunk Augsburg|http://www.google.de/search?q=site:augsburg.freifunk.net&'
list engine 'Freifunk Wiki|http://wiki.freifunk.net/index.php?search='
list engine 'Freifunk&#160;Augsburg|http://www.google.de/search?q=site:augsburg.freifunk.net+'
list engine 'Freifunk&#160;Wiki|http://wiki.freifunk.net/index.php?search='
config widget 'clear1'
option template 'clear'

View file

@ -1,15 +0,0 @@
config 'community' 'profile'
option 'name' 'Freifunk Hamburg'
option 'homepage' 'http://hamburg.piratenpartei.de'
option 'ssid' 'hamburg.freifunk.net'
option 'mesh_network' '10.112.0.0/12'
option 'splash_network' '10.104.0.0/16'
option 'splash_prefix' '27'
option 'latitude' '53.56262'
option 'longitude' '10.01069'
config 'defaults' 'interface'
option 'netmask' '255.240.0.0'
config 'defaults' 'wifi_device'
option 'channel' '1'

View file

@ -4,7 +4,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=freifunk-gwcheck
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

View file

@ -1,4 +1,16 @@
#!/bin/sh
# Copyright 2013 Manuel Munz <freifunk at somakoma dot de>
# Licensed under the GNU General Public License (GPL) v3
# This script monitors the local internet gateway
. /lib/functions/network.sh
#Exit if this script is already running
pid="$(pidof ff_olsr_test_gw.sh)"
if [ ${#pid} -gt 5 ]; then
logger -t gwcheck "Gateway check script is already running, exit now"
exit 1
fi
#check if dyngw_plain is installed and enabled, else exit
dyngwplainlib=`uci show olsrd |grep dyn_gw_plain |awk {' FS="."; print $1"."$2 '}`
@ -7,13 +19,17 @@ if [ -n "$dyngwplainlib" ]; then
exit 1
fi
else
echo "dyngw_plain not found in olsrd config, exit"
exit 1
fi
#Exit if this script is already running
pid="$(pidof ff_olsr_test_gw.sh)"
if [ ${#pid} -gt 5 ]; then
logger -p debug -t gwcheck "Gateway check script is already running, exit now"
exit 1
fi
# check if we have a defaultroute with metric=0 in one of these tables: main table and gw-check table.
# If not exit here.
# exit if there is no defaultroute with metric=0 in main or gw-check table.
defroutemain="$(ip r s |grep default |grep -v metric)"
defroutegwcheck="$(ip r s t gw-check |grep default |grep -v metric)"
if [ -z "$defroutegwcheck" -a -z "$defroutemain" ]; then
@ -47,36 +63,73 @@ check_internet() {
echo 0
break
else
logger -t gw-check "Could not get test file from http://$t/conntest.html"
logger -p debug -t gw-check "Could not fetch http://$t/conntest.html"
fi
done
}
resolve() {
echo "$(nslookup $1 2>/dev/null |grep 'Address' |grep -v '127.0.0.1' |awk '{ print $3 }')"
}
get_dnsservers() {
# this gets all dns servers for the wan interface. If ubus is not present (like on older
# openwrt versions before Attitude fallback to get these from /var/state/network.
dns=""
if [ -x /bin/ubus ]; then
network_get_dnsserver dns wan
else
dns="$(grep network.wan.resolv_dns /var/state/network | cut -d "=" -f 2)"
fi
}
iw=$(check_internet)
if [ "$iw" == 0 ]; then
# check if we have a seperate routing table for our tests.
# If yes, move defaultroute to normal table and delete table gw-check
# Also delete ip rules to use table gw-check for our testhosts and wan dns servers
if [ -n "$defroutegwcheck" ]; then
ip r a $defroutegwcheck
ip r d $defroutegwcheck t gw-check
ip ru del fwmark 0x2 lookup gw-check
for host in $testserver; do
iptables -t mangle -D OUTPUT -d $host -p tcp --dport 80 -j MARK --set-mark 0x2
ips="$(resolve $host)"
for ip in $ips; do
[ -n "$(ip ru s | grep "to $ip lookup gw-check")" ] && ip rule del to $ip table gw-check
done
done
get_dnsservers
for d in $dns; do
[ -n "$(ip ru s | grep "to $d lookup gw-check")" ] && ip rule del to $d table gw-check
done
#ip r d default via 127.0.0.1 metric 100000
logger -t gw-check "Internet is available again, restoring default route ( $defroutegwcheck)"
fi
else
# Check failed. If we have a defaultroute with metric=0 and it is already in table gw-check then do nothing.
# If there is a defaultroute with metric=0 then remove it from the main routing table and add to table gw-check.
# Also setup ip rules to use table gw-check for our testhosts and wan dns servers
if [ -z "$(ip ru s | grep gw-check)" -a -n "$defroutemain" ]; then
ip rule add fwmark 0x2 lookup gw-check
for host in $testserver; do
iptables -t mangle -I OUTPUT -d $host -p tcp --dport 80 -j MARK --set-mark 0x2
done
ip r a $defroutemain table gw-check
ip r d $defroutemain
logger -t gw-check "Internet is not available, deactivating the default route ( $defroutemain)"
fi
for host in $testserver; do
ips="$(resolve $host)"
for ip in $ips; do
[ -z "$(ip ru s | grep "to $ip lookup gw-check")" ] && ip rule add to $ip table gw-check
done
done
get_dnsservers
for d in $dns; do
[ -z "$(ip ru s | grep "to $d lookup gw-check")" ] && ip rule add to $d table gw-check
done
#ip r a default via 127.0.0.1 metric 100000
logger -t gw-check "Internet is not available, deactivating the default route ( $defroutemain)"
fi

View file

@ -1,5 +1,6 @@
#
# Copyright (C) 2009 Andreas Seidler <tetzlav@subsignal.org>
# Copyright (C) 2012 Jo-Philipp Wich <xm@subsignal.org>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@ -8,7 +9,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=freifunk-p2pblock
PKG_RELEASE:=1
PKG_RELEASE:=3
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

View file

@ -26,6 +26,7 @@ start() {
config_get ipp2p p2pblock ipp2p
config_get portrange p2pblock portrange
config_get blocktime p2pblock blocktime
config_get whitelist p2pblock whitelist
# load modules
insmod ipt_ipp2p 2>&-
@ -34,7 +35,7 @@ start() {
# create new p2p-chain
iptables -N p2pblock
# pipe all incomming FORWARD with source-/destination-port 1024-65535 throu p2p-chain
# pipe all incoming FORWARD with source-/destination-port 1024-65535 throu p2p-chain
ipt_add "FORWARD -i $wan -p tcp --sport $portrange --dport $portrange -j p2pblock"
ipt_add "FORWARD -i $wan -p udp --sport $portrange --dport $portrange -j p2pblock"
@ -55,7 +56,7 @@ start() {
done
# insert whitelisted ips
for ip in $WHITELIST; do
for ip in $whitelist; do
ipt_add "p2pblock -d $ip -j RETURN"
done

View file

@ -1,5 +1,16 @@
[ "$INTERFACE" != "wan" ] && exit 0
[ -f /proc/net/ipv6_route ] && has_ipv6=1
olsrd_rmtables() {
# Remove custom routing tables from olsrd
if [ "`uci -q get olsrd.@olsrd[0].RtTable`" == "111" ] || [ "`uci -q get olsrd.@olsrd[0].RtTableDefault`" == "112" ]; then
uci delete olsrd.@olsrd[0].RtTable
uci delete olsrd.@olsrd[0].RtTableDefault
uci commit
/etc/init.d/olsrd restart
fi
}
case $ACTION in
ifup)
pr="`uci get freifunk-policyrouting.pr.enable`"
@ -77,18 +88,13 @@ case $ACTION in
[ "$fallback" = 1 ] && ip -6 rule add lookup olsr-default prio 16420
fi
else
# Remove custom routing tables from olsrd
if [ "`uci -q get olsrd.@olsrd[0].RtTable`" == "111" ] || [ "`uci -q get olsrd.@olsrd[0].RtTableDefault`" == "112" ]; then
uci delete olsrd.@olsrd[0].RtTable
uci delete olsrd.@olsrd[0].RtTableDefault
uci commit
/etc/init.d/olsrd restart
fi
olsrd_rmtables
fi
;;
ifdown)
logger -s -t policyrouting "Deleting ipv4 policy rules for $INTERFACE"
olsrd_rmtables
ip rule del fwmark 1 lookup olsr-default > /dev/null 2>&1
ip rule del lookup olsr-default > /dev/null 2>&1
ip rule del lookup olsr > /dev/null 2>&1

View file

@ -1,11 +1,11 @@
#!/bin/sh /etc/rc.common
START=60
. /lib/functions/network.sh
boot()
{
prenabled=$(uci get freifunk-policyrouting.pr.enable)
if [ ! "$prenabled" = "1" ]; then
if [ ! "$prenabled" = "1" ] || ! network_is_up wan; then
uci -q delete olsrd.@olsrd[0].RtTable
uci -q delete olsrd.@olsrd[0].RtTableDefault
uci commit olsrd

View file

@ -1,6 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_BRANCH:=trunk
PKG_BRANCH:=branches/luci-0.11
ifeq ($(DUMP),)
USELOCAL:=$(shell grep luci ../../../.project 2>/dev/null >/dev/null && echo 1)
@ -12,12 +12,12 @@ PKG_RELEASE:=1
PKG_BUILD_PARALLEL:=0
ifeq ($(USELOCAL),1)
PKG_VERSION:=trunk+svn
PKG_VERSION:=0.11+svn
else
PKG_SOURCE_URL:=http://svn.luci.subsignal.org/luci/$(PKG_BRANCH)
ifeq ($(DUMP),)
PKG_REV:=$(shell LC_ALL=C svn info $(CURDIR) | sed -ne's/^Revision: //p')
PKG_VERSION:=trunk+svn$(PKG_REV)
PKG_VERSION:=0.11+svn$(PKG_REV)
endif
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
@ -177,14 +177,13 @@ $(eval $(call library,fastindex,Fastindex indexing module,+PACKAGE_luci-lib-fast
$(eval $(call library,httpclient,HTTP(S) client library,+luci-lib-web +luci-lib-nixio))
$(eval $(call library,ipkg,LuCI IPKG/OPKG call abstraction library))
$(eval $(call library,json,LuCI JSON library))
$(eval $(call library,lmo,LuCI LMO I18N library))
$(eval $(call library,lucid,LuCId Full-Stack Webserver,+luci-lib-nixio +luci-lib-web +luci-lib-px5g))
$(eval $(call library,lucid-http,LuCId HTTP Backend,+luci-lib-lucid))
$(eval $(call library,lucid-rpc,LuCId RPC Backend,+luci-lib-lucid))
$(eval $(call library,nixio,NIXIO POSIX library,+PACKAGE_luci-lib-nixio_openssl:libopenssl +PACKAGE_luci-lib-nixio_cyassl:libcyassl))
$(eval $(call library,px5g,RSA/X.509 Key Generator (required for LuCId SSL support),+luci-lib-nixio))
$(eval $(call library,sys,LuCI Linux/POSIX system library))
$(eval $(call library,web,MVC Webframework,+luci-lib-sys +luci-lib-nixio +luci-lib-core +luci-sgi-cgi +luci-lib-lmo))
$(eval $(call library,web,MVC Webframework,+luci-lib-sys +luci-lib-nixio +luci-lib-core +luci-sgi-cgi))
### Protocols ###
@ -213,7 +212,7 @@ endef
$(eval $(call protocol,core,Support for static/dhcp/none))
$(eval $(call protocol,ppp,Support for PPP/PPPoE/PPPoA/PPtP))
$(eval $(call protocol,6x4,Support for 6in4/6to4/6rd,+PACKAGE_luci-proto-6x4:6in4 +PACKAGE_luci-proto-6x4:6to4 +PACKAGE_luci-proto-6x4:6rd))
$(eval $(call protocol,ipv6,Support for DHCPv6/6in4/6to4/6rd/DS-Lite))
$(eval $(call protocol,3g,Support for 3G,+PACKAGE_luci-proto-3g:comgt))
$(eval $(call protocol,relay,Support for relayd pseudo bridges,+PACKAGE_luci-proto-relay:relayd))
@ -327,7 +326,7 @@ endef
$(eval $(call application,siitwizard,SIIT IPv4-over-IPv6 configuration wizard,\
+PACKAGE_luci-app-siitwizard:kmod-siit))
$(eval $(call application,firewall,Firmware and Portforwarding application,\
$(eval $(call application,firewall,Firewall and Portforwarding application,\
+PACKAGE_luci-app-firewall:firewall))
$(eval $(call application,freifunk-policyrouting,Policy routing for mesh traffic,\
@ -345,6 +344,8 @@ $(eval $(call application,olsr,OLSR configuration and status module,\
$(eval $(call application,olsr-viz,OLSR Visualisation,\
luci-app-olsr +olsrd-mod-txtinfo))
$(eval $(call application,freifunk-diagnostics,Tools for network diagnosis like traceroute and ping))
$(eval $(call application,olsr-services,Show services announced with the nameservice plugin,\
luci-app-olsr +olsrd-mod-nameservice))
@ -380,6 +381,8 @@ $(eval $(call application,voice-core,LuCI Voice Software (Core)))
$(eval $(call application,voice-diag,LuCI Voice Software (Diagnostics),\
luci-app-diag-devinfo))
$(eval $(call application,commands,LuCI Shell Command Module))
$(eval $(call application,upnp,Universal Plug & Play configuration module,\
+PACKAGE_luci-app-upnp:miniupnpd))

View file

@ -4,7 +4,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=meshwizard
PKG_RELEASE:=0.0.8-1
PKG_RELEASE:=0.0.8-3
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

View file

@ -24,10 +24,10 @@ if [ -z "$bssid" ]; then
bssid="$(printf "%X\n" $channel)2:CA:FF:EE:BA:BE"
;;
[3-9][0-9])
bssid="00:$channel:CA:FF:EE:EE"
bssid="02:$channel:CA:FF:EE:EE"
;;
1[0-9][0-9])
bssid="${channel/1/01:}:CA:FF:EE:EE"
bssid="${channel/1/12:}:CA:FF:EE:EE"
;;
*) bssid="02:CA:FF:EE:BA:BE"
;;

View file

@ -45,7 +45,11 @@ network=$(echo $network) # Removes leading and trailing whitespaces
[ -n "$netrenamed" ] && [ -z "$(echo $network | grep $netrenamed)" ] && network="$network $netrenamed"
if [ "$type" == "atheros" -a "$vap" == 1 ]; then
# check if this hardware supports VAPs
supports_vap="0"
$dir/helpers/supports_vap.sh $net $type && supports_vap=1
if [ "$supports_vap" == "1" -a "$vap" == 1 ]; then
[ -n "$netrenamed" ] && [ "$network" == "${network/${netrenamed}dhcp/}" ] && network="$network ${netrenamed}dhcp"
fi

View file

@ -79,7 +79,16 @@ uci_commitverbose "Setup wifi interface for $netrenamed" wireless
## VAP
ip4addr="$(uci get meshwizard.netconfig.$net\_ip4addr)"
if [ "$type" == "atheros" -a "$vap" == 1 ]; then
# check if this hardware supports VAPs
# the interface needs to be up before the check can happen
/sbin/wifi
supports_vap="0"
$dir/helpers/supports_vap.sh $net $type && supports_vap=1
if [ "$supports_vap" == "1" -a "$vap" == 1 ]; then
uci batch <<- EOF
set wireless.$net\_iface_dhcp="wifi-iface"
set wireless.$net\_iface_dhcp.device="$net"

View file

@ -0,0 +1,35 @@
#!/bin/sh
# checks if a given device can be used for a VAP interface (1 adhoc + 1 ap)
dev="$1"
type="$2"
if [ -z "$dev" -o -z "$type" ]; then
exit 1
fi
if [ "$type" = "atheros" ]; then
exit 0
elif [ "$type" = "mac80211" ]; then
# not hostapd[-mini], no VAP
if [ ! -x /usr/sbin/hostapd ]; then
echo "WARNING: hostapd[-mini] is required to be able to use VAP with mac80211."
exit 1
fi
# get driver in use
netindex="$(echo $dev |sed 's/[a-zA-z]*//')"
if [ -d /sys/class/net/wlan${netindex}/device/driver/module ]; then
driver="$(basename $(ls -l /sys/class/net/wlan${netindex}/device/driver/module | sed -ne 's/.* -> //p'))"
if [ "$driver" = "ath9k" -o "$driver" = "ath5k" ]; then
exit 0
else
exit 1
fi
else
exit 1
fi
else
exit 1
fi

View file

@ -1,7 +1,7 @@
--- a/uhttpd-cgi.c
+++ b/uhttpd-cgi.c
@@ -204,7 +204,7 @@ void uh_cgi_request(struct client *cl, s
(pi->stat.st_mode & S_IXOTH)
@@ -216,7 +216,7 @@ void uh_cgi_request(
(pi->stat.st_mode & S_IXOTH)) || (ip != NULL)
) {
/* build environment */
- clearenv();

View file

@ -0,0 +1,11 @@
--- a/Makefile
+++ b/Makefile
@@ -70,7 +70,7 @@ endif
$(CC) $(CFLAGS) -c -o $@ $<
compile: $(OBJ) $(TLSLIB) $(LUALIB)
- $(CC) -o uhttpd $(LDFLAGS) $(LIB) $(OBJ)
+ $(CC) -o uhttpd $(LDFLAGS) $(OBJ) $(LIB)
clean:
rm -f *.o *.so uhttpd

View file

@ -1 +1,2 @@
001-pass-env.patch
002-link-order.patch

View file

@ -1,5 +1,5 @@
#!/bin/sh
uci batch <<-EOF
set luci.languages.pl='Język polski'
set luci.languages.pl='Polski'
commit luci
EOF

Some files were not shown because too many files have changed in this diff Show more