diff options
121 files changed, 3185 insertions, 543 deletions
diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 42cf706f39..0000000000 --- a/INSTALL +++ /dev/null @@ -1,27 +0,0 @@ -LuCI Installation Instructions - -TOC: -1. Kamikaze Feed -2. Kamikaze Packages - - -1. Kamikaze Feed - 1. Change to your OpenWrt buildroot - - 2. Add the following line to your OpenWrt feeds.conf: - src-svn luci http://svn.luci.subsignal.org/luci/trunk/contrib/package - - 3. Run ./scripts/feeds update - - 4. Run ./scripts/feeds install -a -p luci - - 5. Type make menuconfig and you will find luci in the menu "Administration" - - -2. Kamikaze Packages - 1. cd to the "package" directory of your kamikaze buildroot - - 3. Type: ln -s /path/to/luci/contrib/package/* ./ - - 4. cd to your kamikaze build root and type: make menuconfig - You will find luci in the menu "Administration" @@ -6,7 +6,12 @@ This is the OpenWrt "luci"-feed containing LuCI - OpenWrt Configuration Interfac ## Usage -This feed is enabled by default. To install all its package definitions, run: +This feed is enabled by default. Your feeds.conf.default (or feeds.conf) should contain a line like: +``` +src-git luci https://github.com/openwrt/luci.git +``` + +To install all its package definitions, run: ``` ./scripts/feeds update luci ./scripts/feeds install -a -p luci diff --git a/applications/luci-app-ddns/Makefile b/applications/luci-app-ddns/Makefile index a2d2ae9473..0e1e5df4c1 100644 --- a/applications/luci-app-ddns/Makefile +++ b/applications/luci-app-ddns/Makefile @@ -10,7 +10,7 @@ PKG_NAME:=luci-app-ddns # Version == major.minor.patch # increase on new functionality (minor) or patches (patch) -PKG_VERSION:=2.2.3 +PKG_VERSION:=2.2.4 # Release == build # increase on changes of translation files diff --git a/applications/luci-app-ddns/luasrc/tools/ddns.lua b/applications/luci-app-ddns/luasrc/tools/ddns.lua index 6d53931469..4466063cb3 100644 --- a/applications/luci-app-ddns/luasrc/tools/ddns.lua +++ b/applications/luci-app-ddns/luasrc/tools/ddns.lua @@ -98,8 +98,7 @@ end -- compare versions using "<=" "<" ">" ">=" "=" "<<" ">>" function ipkg_ver_compare(ver1, comp, ver2) - if not ver1 or not (#ver1 > 0) - or not ver2 or not (#ver2 > 0) + if not ver1 or not ver2 or not comp or not (#comp > 0) then return nil end -- correct compare string if comp == "<>" or comp == "><" or comp == "!=" or comp == "~=" then comp = "~=" @@ -116,33 +115,19 @@ function ipkg_ver_compare(ver1, comp, ver2) for i = 1, math.max(table.getn(av1),table.getn(av2)), 1 do local s1 = av1[i] or "" local s2 = av2[i] or "" - local n1 = tonumber(s1) - local n2 = tonumber(s2) - -- one numeric and other empty string then set other to 0 - if n1 and not n2 and (not s2 or #s2 == 0) then n2 = 0 end - if n2 and not n1 and (not s1 or #s1 == 0) then n1 = 0 end - - local nc = (n1 and n2) -- numeric compare - - if nc then - -- first "not equal" found return true - if comp == "~=" and (n1 ~= n2) then return true end - -- first "lower" found return true - if (comp == "<" or comp == "<=") and (n1 < n2) then return true end - -- first "greater" found return true - if (comp == ">" or comp == ">=") and (n1 > n2) then return true end - -- not equal then return false - if (n1 ~= n2) then return false end - else - if comp == "~=" and (s1 ~= s2) then return true end - if (comp == "<" or comp == "<=") and (s1 < s2) then return true end - if (comp == ">" or comp == ">=") and (s1 > s2) then return true end - if (s1 ~= s2) then return false end - end + -- first "not equal" found return true + if comp == "~=" and (s1 ~= s2) then return true end + -- first "lower" found return true + if (comp == "<" or comp == "<=") and (s1 < s2) then return true end + -- first "greater" found return true + if (comp == ">" or comp == ">=") and (s1 > s2) then return true end + -- not equal then return false + if (s1 ~= s2) then return false end end - -- all equal then true - return true + + -- all equal and not compare greater or lower then true + return not (comp == "<" or comp == ">") end -- read version information for given package if installed diff --git a/applications/luci-app-firewall/luasrc/model/cbi/firewall/zone-details.lua b/applications/luci-app-firewall/luasrc/model/cbi/firewall/zone-details.lua index 3eb95ebb57..46b3744403 100644 --- a/applications/luci-app-firewall/luasrc/model/cbi/firewall/zone-details.lua +++ b/applications/luci-app-firewall/luasrc/model/cbi/firewall/zone-details.lua @@ -76,6 +76,15 @@ function name.write(self, section, value) } end +function name.validate(self, value) + -- fw3 defines 14 as the maximum length of zone name + if #value > 14 then + return nil, translate("Zone name is too long") + else + return value + end +end + p = { s:taboption("general", ListValue, "input", translate("Input")), s:taboption("general", ListValue, "output", translate("Output")), diff --git a/applications/luci-app-fwknopd/luasrc/model/cbi/fwknopd.lua b/applications/luci-app-fwknopd/luasrc/model/cbi/fwknopd.lua index 84a1a23d86..096724f735 100644 --- a/applications/luci-app-fwknopd/luasrc/model/cbi/fwknopd.lua +++ b/applications/luci-app-fwknopd/luasrc/model/cbi/fwknopd.lua @@ -46,6 +46,8 @@ s = m:section(TypedSection, "config", translate("fwknopd.conf config options")) s.anonymous=true s.dynamic=true s:option(Value, "MAX_SPA_PACKET_AGE", "MAX_SPA_PACKET_AGE", translate("Maximum age in seconds that an SPA packet will be accepted. defaults to 120 seconds")) +s:option(Value, "PCAP_INTF", "PCAP_INTF", translate("Specify the ethernet interface on which fwknopd will sniff packets.")) +s:option(Value, "ENABLE_IPT_FORWARDING", "ENABLE_IPT_FORWARDING", translate("Allow SPA clients to request access to services through an iptables firewall instead of just to it.")) s:option(DummyValue, "note2", translate("Enter custom fwknopd.conf variables below:")) return m diff --git a/applications/luci-app-fwknopd/po/en/en.po b/applications/luci-app-fwknopd/po/en/fwknopd.po index 1abc6a8f95..d75c99d524 100644 --- a/applications/luci-app-fwknopd/po/en/en.po +++ b/applications/luci-app-fwknopd/po/en/fwknopd.po @@ -10,6 +10,13 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" +msgid "" +"Allow SPA clients to request access to services through an iptables firewall " +"instead of just to it." +msgstr "" +"Allow SPA clients to request access to services through an iptables firewall " +"instead of just to it." + msgid "Base 64 key" msgstr "Base 64 key" @@ -83,6 +90,9 @@ msgstr "" msgid "Normal Key" msgstr "Normal Key" +msgid "Specify the ethernet interface on which fwknopd will sniff packets." +msgstr "Specify the ethernet interface on which fwknopd will sniff packets." + msgid "The base64 hmac key" msgstr "The base64 hmac key" diff --git a/applications/luci-app-fwknopd/po/templates/fwknopd.pot b/applications/luci-app-fwknopd/po/templates/fwknopd.pot index ec15504627..4fb616f25e 100644 --- a/applications/luci-app-fwknopd/po/templates/fwknopd.pot +++ b/applications/luci-app-fwknopd/po/templates/fwknopd.pot @@ -1,6 +1,11 @@ msgid "" msgstr "Content-Type: text/plain; charset=UTF-8" +msgid "" +"Allow SPA clients to request access to services through an iptables firewall " +"instead of just to it." +msgstr "" + msgid "Base 64 key" msgstr "" @@ -57,6 +62,9 @@ msgstr "" msgid "Normal Key" msgstr "" +msgid "Specify the ethernet interface on which fwknopd will sniff packets." +msgstr "" + msgid "The base64 hmac key" msgstr "" diff --git a/applications/luci-app-fwknopd/root/etc/uci-defaults/luci-fwknopd b/applications/luci-app-fwknopd/root/etc/uci-defaults/luci-fwknopd index a7c433f2bc..01b85de25f 100644 --- a/applications/luci-app-fwknopd/root/etc/uci-defaults/luci-fwknopd +++ b/applications/luci-app-fwknopd/root/etc/uci-defaults/luci-fwknopd @@ -1,6 +1,7 @@ #!/bin/sh #-- Copyright 2015 Jonathan Bennett <jbennett@incomsystems.biz> #-- Licensed to the public under the GNU General Public License v2. +. /lib/functions/network.sh uci batch <<EOF add ucitrack fwknopd @@ -8,12 +9,14 @@ uci batch <<EOF commit ucitrack EOF -if [ -f /usr/bin/fwknop ]; then - uci set fwknopd.@access[0].keytype='Base 64 key' - uci set fwknopd.@access[0].hkeytype='Base 64 key' - uci set fwknopd.@access[0].KEY_BASE64=`fwknop --key-gen | awk '/^KEY/ {print $2;}'` - uci set fwknopd.@access[0].HMAC_KEY_BASE64=`fwknop --key-gen | awk '/^HMAC/ {print $2;}'` - uci commit fwknopd -fi +uci delete fwknopd.@access[0].KEY +uci delete fwknopd.@access[0].HMAC_KEY +uci set fwknopd.@access[0].keytype='Base 64 key' +uci set fwknopd.@access[0].hkeytype='Base 64 key' +uci set fwknopd.@access[0].KEY_BASE64=`fwknopd --key-gen | awk '/^KEY/ {print $2;}'` +uci set fwknopd.@access[0].HMAC_KEY_BASE64=`fwknopd --key-gen | awk '/^HMAC/ {print $2;}'` +uci set fwknopd.@config[0].ENABLE_IPT_FORWARDING='y' + +uci commit fwknopd rm -f /tmp/luci-indexcache exit 0 diff --git a/applications/luci-app-mjpg-streamer/luasrc/model/cbi/mjpg-streamer.lua b/applications/luci-app-mjpg-streamer/luasrc/model/cbi/mjpg-streamer.lua index 0e1c8bf9b6..d89ab27c29 100644 --- a/applications/luci-app-mjpg-streamer/luasrc/model/cbi/mjpg-streamer.lua +++ b/applications/luci-app-mjpg-streamer/luasrc/model/cbi/mjpg-streamer.lua @@ -5,19 +5,19 @@ m = Map("mjpg-streamer", "MJPG-streamer", translate("mjpg streamer is a streamin --- General settings --- -section_gen = m:section(TypedSection, "mjpg-streamer", "General") +section_gen = m:section(TypedSection, "mjpg-streamer", translate("General")) section_gen.addremove=false section_gen.anonymous=true -enabled = section_gen:option(Flag, "enabled", "Enabled", "Enable MJPG-streamer") +enabled = section_gen:option(Flag, "enabled", translate("Enabled"), translate("Enable MJPG-streamer")) -input = section_gen:option(ListValue, "input", "Input plugin") +input = section_gen:option(ListValue, "input", translate("Input plugin")) input:depends("enabled", "1") input:value("uvc", "UVC") ---input:value("file", "File") input.optional = false -output = section_gen:option(ListValue, "output", "Output plugin") +output = section_gen:option(ListValue, "output", translate("Output plugin")) output:depends("enabled", "1") output:value("http", "HTTP") output:value("file", "File") @@ -26,7 +26,7 @@ output = section_gen:option(ListValue, "output", "Output plugin") --- Plugin settings --- -s = m:section(TypedSection, "mjpg-streamer", "Plugin settings") +s = m:section(TypedSection, "mjpg-streamer", translate("Plugin settings")) s.addremove=false s.anonymous=true diff --git a/applications/luci-app-mjpg-streamer/po/zh-cn/mjpg-streamer.po b/applications/luci-app-mjpg-streamer/po/zh-cn/mjpg-streamer.po new file mode 100644 index 0000000000..3ad9a4a53b --- /dev/null +++ b/applications/luci-app-mjpg-streamer/po/zh-cn/mjpg-streamer.po @@ -0,0 +1,166 @@ +msgid "" +msgstr "" +"Project-Id-Version: luci-app-mjpg-streamer\n" +"POT-Creation-Date: 2015-06-11 21:11+0100\n" +"PO-Revision-Date: 2015-06-11 21:11+0100\n" +"Last-Translator: maz-1 <ohmygod19993 at gmail dotcom>\n" +"Language-Team: \n" +"Language: zh-cn\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.5.4\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Poedit-SourceCharset: UTF-8\n" + + +msgid "Enabled" +msgstr "启用" + +msgid "Enable MJPG-streamer" +msgstr "启用MJPG-streamer" + +msgid "General" +msgstr "一般设置" + +msgid "Plugin settings" +msgstr "插件设置" + +msgid "Input plugin" +msgstr "输入插件" + +msgid "Output plugin" +msgstr "输出插件" + +msgid "Allow ringbuffer to exceed limit by this amount" +msgstr "允许环形缓冲区最多超过这个数值" + +msgid "Ask for username and password on connect" +msgstr "连接时询问用户名和密码" + +msgid "Authentication required" +msgstr "需要验证" + +msgid "Auto" +msgstr "自动" + +msgid "Automatic disabling of MJPEG mode" +msgstr "自动禁用MJPEG模式" + +msgid "Blink" +msgstr "闪烁" + +msgid "Check to save the stream to an mjpeg file" +msgstr "勾选以保存视频流至一个mjpeg文件" + +msgid "Command to run" +msgstr "运行的命令" + +msgid "Device" +msgstr "设备" + +msgid "Do not initalize dynctrls of Linux-UVC driver" +msgstr "不要初始化Linux-UVC驱动的dynctrls" + +msgid "Don't initalize dynctrls" +msgstr "不要初始化dynctrls" + +msgid "Drop frames smaller then this limit" +msgstr "丢弃小于该尺寸限制的帧" + +msgid "Enable YUYV format" +msgstr "启用YUYV格式" + +msgid "Exceed" +msgstr "超出" + +msgid "" +"Execute command after saving picture. Mjpg-streamer parse the filename as " +"first parameter to your script." +msgstr "保存图片后执行命令。文件名将作为第一个参数传递给命令。" + +msgid "File input" +msgstr "文件输入" + +msgid "File output" +msgstr "文件输出" + +msgid "Folder" +msgstr "文件夹" + +msgid "Folder that contains webpages" +msgstr "保存网页的文件夹" + +msgid "Frames per second" +msgstr "帧每秒" + +msgid "HTTP output" +msgstr "HTTP输出" + +msgid "Interval between saving pictures" +msgstr "图片保存时间间隔" + +msgid "JPEG compression quality" +msgstr "JPEG压缩品质" + +msgid "Led control" +msgstr "LED控制" + +msgid "MJPG-streamer" +msgstr "MJPG-streamer" + +msgid "Max. number of pictures to hold" +msgstr "保存的图片数量上限" + +msgid "Mjpeg output" +msgstr "Mjpeg输出" + +msgid "Off" +msgstr "关" + +msgid "On" +msgstr "开" + +msgid "Password" +msgstr "密码" + +msgid "Port" +msgstr "端口" + +msgid "Resolution" +msgstr "分辨率" + +msgid "Ring buffer size" +msgstr "环形缓冲区大小" + +msgid "Set folder to save pictures" +msgstr "图片保存位置" + +msgid "Set the inteval in millisecond" +msgstr "设置时间间隔(毫秒)" + +msgid "" +"Set the minimum size if the webcam produces small-sized garbage frames. May " +"happen under low light conditions" +msgstr "设置无用帧的最小尺寸。当光照不足时可能出现无用帧。" + +msgid "" +"Set the quality in percent. This setting activates YUYV format, disables " +"MJPEG" +msgstr "设置品质(百分比)。此设置会开启YUYV格式输出,关闭MJPEG输出。" + +msgid "TCP port for this HTTP server" +msgstr "HTTP服务监听的TCP端口" + +msgid "UVC input" +msgstr "UVC输入" + +msgid "Username" +msgstr "用户名" + +msgid "WWW folder" +msgstr "WWW文件夹" + +msgid "" +"mjpg streamer is a streaming application for Linux-UVC compatible webcams" +msgstr "mjpg streamer是一个视频流程序,用于兼容Linux-UVC的摄像头。" diff --git a/applications/luci-app-multiwan/Makefile b/applications/luci-app-multiwan/Makefile index 20fba89b0d..c5b731abbe 100644 --- a/applications/luci-app-multiwan/Makefile +++ b/applications/luci-app-multiwan/Makefile @@ -6,8 +6,8 @@ include $(TOPDIR)/rules.mk -LUCI_TITLE:=LuCI Support for the OpenWrt MultiWAN agent -LUCI_DEPENDS:=+multiwan +LUCI_TITLE:=LuCI Support for the OpenWrt MultiWAN agent (obsoleted by mwan3) +LUCI_DEPENDS:=+multiwan @BROKEN include ../../luci.mk diff --git a/applications/luci-app-olsr/Makefile b/applications/luci-app-olsr/Makefile index f30c242d53..93815a55e2 100644 --- a/applications/luci-app-olsr/Makefile +++ b/applications/luci-app-olsr/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk LUCI_TITLE:=OLSR configuration and status module -LUCI_DEPENDS:=+olsrd +olsrd-mod-jsoninfo +luci-lib-luaneightbl +LUCI_DEPENDS:=+olsrd +olsrd-mod-jsoninfo +luci-lib-luaneightbl +luci-lib-json include ../../luci.mk diff --git a/applications/luci-app-olsr/luasrc/controller/olsr.lua b/applications/luci-app-olsr/luasrc/controller/olsr.lua index 74deb716c4..cfadd9b7c7 100644 --- a/applications/luci-app-olsr/luasrc/controller/olsr.lua +++ b/applications/luci-app-olsr/luasrc/controller/olsr.lua @@ -80,12 +80,15 @@ end function action_json() local http = require "luci.http" local utl = require "luci.util" - local uci = require "luci.model.uci".cursor_state() + local uci = require "luci.model.uci".cursor() local jsonreq4 local jsonreq6 - jsonreq4 = utl.exec("echo /status | nc 127.0.0.1 9090") - jsonreq6 = utl.exec("echo /status | nc ::1 9090") + local v4_port = uci:get("olsrd", "olsrd_jsoninfo", "port") or 9090 + local v6_port = uci:get("olsrd6", "olsrd_jsoninfo", "port") or 9090 + + jsonreq4 = utl.exec("(echo /status | nc 127.0.0.1 " .. v4_port .. ") 2>/dev/null" ) + jsonreq6 = utl.exec("(echo /status | nc ::1 " .. v6_port .. ") 2>/dev/null") http.prepare_content("application/json") if not jsonreq4 or jsonreq4 == "" then jsonreq4 = "{}" @@ -368,8 +371,11 @@ function fetch_jsoninfo(otable) local IpVersion = uci:get_first("olsrd", "olsrd","IpVersion") local jsonreq4 = "" local jsonreq6 = "" - jsonreq4 = utl.exec("echo /" .. otable .. " | nc 127.0.0.1 9090") - jsonreq6 = utl.exec("echo /" .. otable .. " | nc ::1 9090") + local v4_port = uci:get("olsrd", "olsrd_jsoninfo", "port") or 9090 + local v6_port = uci:get("olsrd6", "olsrd_jsoninfo", "port") or 9090 + + jsonreq4 = utl.exec("(echo /" .. otable .. " | nc 127.0.0.1 " .. v4_port .. ") 2>/dev/null") + jsonreq6 = utl.exec("(echo /" .. otable .. " | nc ::1 " .. v6_port .. ") 2>/dev/null") local jsondata4 = {} local jsondata6 = {} local data4 = {} diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/overview.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/overview.htm index 0a81d17b46..fa32315280 100644 --- a/applications/luci-app-olsr/luasrc/view/status-olsr/overview.htm +++ b/applications/luci-app-olsr/luasrc/view/status-olsr/overview.htm @@ -6,7 +6,9 @@ -%> <% -local ipv = luci.model.uci.cursor():get_first("olsrd", "olsrd", "IpVersion", "4") + +has_ipv4_conf = luci.model.uci.cursor():get_first("olsrd", "olsrd", "IpVersion") +has_ipv6_conf = luci.model.uci.cursor():get_first("olsrd6", "olsrd", "IpVersion") function write_conf(conf, file) local fs = require "nixio.fs" @@ -19,23 +21,23 @@ end conf = luci.http.formvalue() -if conf.openwrt then +if conf.openwrt_v4 then write_conf("/etc/config/olsrd", "olsrd") return false end -if conf.conf_v4 then - write_conf("/var/etc/olsrd.conf.ipv4", "olsrd.conf.ipv4") +if conf.openwrt_v6 then + write_conf("/etc/config/olsrd6", "olsrd6") return false end -if conf.conf_v6 then - write_conf("/var/etc/olsrd.conf.ipv6", "olsrd.conf.ipv6") +if conf.conf_v4 then + write_conf("/var/etc/olsrd.conf", "olsrd.conf") return false end -if conf.conf then - write_conf("/var/etc/olsrd.conf", "olsrd.conf") +if conf.conf_v6 then + write_conf("/var/etc/olsrd6.conf", "olsrd6.conf") return false end @@ -200,13 +202,18 @@ XHR.poll(10, '<%=REQUEST_URI%>/json', { }, <span id="version">-<span> </td></tr> <tr><td width="33%"><%:Download Config%></td><td> - <a href="<%=REQUEST_URI%>?openwrt">OpenWrt</a>, - <% if ipv == "6and4" then %> - <a href="<%=REQUEST_URI%>?conf_v4">OLSRD IPv4</a>, - <a href="<%=REQUEST_URI%>?conf_v6">OLSRD IPv6</a> - <% else %> - <a href="<%=REQUEST_URI%>?conf">OLSRD</a> - <% end %> + <% if has_ipv4_conf then %> + <a href="<%=REQUEST_URI%>?openwrt_v4">OpenWrt (IPv4)</a>, + <% end %> + <% if has_ipv6_conf then %> + <a href="<%=REQUEST_URI%>?openwrt_v6">OpenWrt (IPv6)</a>, + <% end %> + <% if has_ipv4_conf then %> + <a href="<%=REQUEST_URI%>?conf_v4">OLSRD (IPv4)</a>, + <% end %> + <% if has_ipv6_conf then %> + <a href="<%=REQUEST_URI%>?conf_v6">OLSRD (IPv6)</a> + <% end %> </td></tr> </table> </fieldset> diff --git a/applications/luci-app-openvpn/luasrc/model/cbi/openvpn-advanced.lua b/applications/luci-app-openvpn/luasrc/model/cbi/openvpn-advanced.lua index 7e39dad2eb..fa1530026a 100644 --- a/applications/luci-app-openvpn/luasrc/model/cbi/openvpn-advanced.lua +++ b/applications/luci-app-openvpn/luasrc/model/cbi/openvpn-advanced.lua @@ -48,7 +48,7 @@ local knownParams = { { Flag, "client_disconnect", 0, translate("Run script cmd on client disconnection") }, { Value, "learn_address", "/usr/bin/ovpn-learnaddress", translate("Executed in server mode whenever an IPv4 address/route or MAC address is added to OpenVPN's internal routing table") }, { Value, "auth_user_pass_verify", "/usr/bin/ovpn-userpass via-env", translate("Executed in server mode on new client connections, when the client is still untrusted") }, - { ListValue, "script_security", { 0, 1, 2, 3 }, translate("Policy level over usage of external programs and scripts"), {mode="server" } }, + { ListValue, "script_security", { 0, 1, 2, 3 }, translate("Policy level over usage of external programs and scripts") }, } }, { "Networking", { diff --git a/applications/luci-app-privoxy/Makefile b/applications/luci-app-privoxy/Makefile index bc2c57ee93..e16eb4176e 100644 --- a/applications/luci-app-privoxy/Makefile +++ b/applications/luci-app-privoxy/Makefile @@ -10,11 +10,11 @@ PKG_NAME:=luci-app-privoxy # Version == major.minor.patch # increase "minor" on new functionality and "patch" on patches/optimization -PKG_VERSION:=1.0.3 +PKG_VERSION:=1.0.4 # Release == build # increase on changes of translation files -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_LICENSE:=Apache-2.0 PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com> diff --git a/applications/luci-app-privoxy/luasrc/controller/privoxy.lua b/applications/luci-app-privoxy/luasrc/controller/privoxy.lua index 9ffc404ce9..58ba80724c 100755..100644 --- a/applications/luci-app-privoxy/luasrc/controller/privoxy.lua +++ b/applications/luci-app-privoxy/luasrc/controller/privoxy.lua @@ -72,8 +72,7 @@ end -- compare versions using "<=" "<" ">" ">=" "=" "<<" ">>" function ipkg_ver_compare(ver1, comp, ver2) - if not ver1 or not (#ver1 > 0) - or not ver2 or not (#ver2 > 0) + if not ver1 or not ver2 or not comp or not (#comp > 0) then return nil end -- correct compare string if comp == "<>" or comp == "><" or comp == "!=" or comp == "~=" then comp = "~=" @@ -90,33 +89,19 @@ function ipkg_ver_compare(ver1, comp, ver2) for i = 1, math.max(table.getn(av1),table.getn(av2)), 1 do local s1 = av1[i] or "" local s2 = av2[i] or "" - local n1 = tonumber(s1) - local n2 = tonumber(s2) - - -- one numeric and other empty string then set other to 0 - if n1 and not n2 and (not s2 or #s2 == 0) then n2 = 0 end - if n2 and not n1 and (not s1 or #s1 == 0) then n1 = 0 end - - local nc = (n1 and n2) -- numeric compare - - if nc then - -- first "not equal" found return true - if comp == "~=" and (n1 ~= n2) then return true end - -- first "lower" found return true - if (comp == "<" or comp == "<=") and (n1 < n2) then return true end - -- first "greater" found return true - if (comp == ">" or comp == ">=") and (n1 > n2) then return true end - -- not equal then return false - if (n1 ~= n2) then return false end - else - if comp == "~=" and (s1 ~= s2) then return true end - if (comp == "<" or comp == "<=") and (s1 < s2) then return true end - if (comp == ">" or comp == ">=") and (s1 > s2) then return true end - if (s1 ~= s2) then return false end - end + + -- first "not equal" found return true + if comp == "~=" and (s1 ~= s2) then return true end + -- first "lower" found return true + if (comp == "<" or comp == "<=") and (s1 < s2) then return true end + -- first "greater" found return true + if (comp == ">" or comp == ">=") and (s1 > s2) then return true end + -- not equal then return false + if (s1 ~= s2) then return false end end - -- all equal then true - return true + + -- all equal and not compare greater or lower then true + return not (comp == "<" or comp == ">") end -- read version information for given package if installed diff --git a/applications/luci-app-privoxy/luasrc/model/cbi/privoxy.lua b/applications/luci-app-privoxy/luasrc/model/cbi/privoxy.lua index c009313e3a..c415f8e064 100755..100644 --- a/applications/luci-app-privoxy/luasrc/model/cbi/privoxy.lua +++ b/applications/luci-app-privoxy/luasrc/model/cbi/privoxy.lua @@ -39,6 +39,7 @@ if not nixio.fs.access("/etc/config/privoxy") or not VEROK then local f = SimpleForm("_no_config") f.title = TITLE f.description = DESC + f.embedded = true f.submit = false f.reset = false diff --git a/applications/luci-app-privoxy/luasrc/view/privoxy/detail_logview.htm b/applications/luci-app-privoxy/luasrc/view/privoxy/detail_logview.htm index 3e190709fb..3e190709fb 100755..100644 --- a/applications/luci-app-privoxy/luasrc/view/privoxy/detail_logview.htm +++ b/applications/luci-app-privoxy/luasrc/view/privoxy/detail_logview.htm diff --git a/applications/luci-app-privoxy/po/zh-cn/privoxy.po b/applications/luci-app-privoxy/po/zh-cn/privoxy.po new file mode 100644 index 0000000000..f69a8f9280 --- /dev/null +++ b/applications/luci-app-privoxy/po/zh-cn/privoxy.po @@ -0,0 +1,468 @@ +msgid ""
+msgstr ""
+"Project-Id-Version: luci-app-privoxy\n"
+"POT-Creation-Date: 2015-06-10 20:16+0100\n"
+"PO-Revision-Date: 2015-06-10 20:16+0100\n"
+"Last-Translator: maz-1 <ohmygod19993 at gmail dotcom>\n"
+"Language-Team: \n"
+"Language: zh-cn\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.5.4\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Poedit-SourceCharset: UTF-8\n"
+
+msgid ""
+"A URL to be displayed in the error page that users will see if access to an "
+"untrusted page is denied."
+msgstr ""
+"当用户试图访问不受信任的页面时,错误页面所显示的URL。"
+
+
+msgid ""
+"A URL to documentation about the local Privoxy setup, configuration or "
+"policies."
+msgstr ""
+"指向Privoxy安装、设置和规则说明文档的URL"
+
+
+msgid "A directory where Privoxy can create temporary files."
+msgstr "Privoxy存放临时文件的目录。"
+
+msgid "Access Control"
+msgstr "访问控制"
+
+msgid "Actions that are applied to all sites and maybe overruled later on."
+msgstr ""
+"作用在所有站点上的规则,可能被后面的规则覆盖。"
+
+
+msgid "An alternative directory where the templates are loaded from."
+msgstr "可选的目录,放在里面的模板会被加载。"
+
+msgid "An email address to reach the Privoxy administrator."
+msgstr "用于联系privoxy管理员的邮箱地址。"
+
+msgid ""
+"Assumed server-side keep-alive timeout (in seconds) if not specified by the "
+"server."
+msgstr ""
+"当服务端没有指定超时时间时假定的超时时间(单位秒)。"
+
+msgid "CGI user interface"
+msgstr "CGI用户界面"
+
+msgid "Common Log Format"
+msgstr "通用日志格式"
+
+msgid ""
+"Configure here the routing of HTTP requests through a chain of multiple "
+"proxies. Note that parent proxies can severely decrease your privacy level. "
+"Also specified here are SOCKS proxies."
+msgstr ""
+"在这里设置http请求所经过的多重代理链。"
+"注意父级代理可能严重降低你的隐私安全度。"
+"在这里还可以设置SOCKS代理。"
+
+msgid "Debug GIF de-animation"
+msgstr "GIF动画日志"
+
+msgid "Debug force feature"
+msgstr "force feature日志"
+
+msgid "Debug redirects"
+msgstr "重定向日志"
+
+msgid "Debug regular expression filters"
+msgstr "正则表达式日志"
+
+msgid "Directory does not exist!"
+msgstr "目录不存在!"
+
+msgid "Disabled == Transparent Proxy Mode"
+msgstr "禁用 == 透明代理模式"
+
+msgid "Enable proxy authentication forwarding"
+msgstr "允许转发代理认证"
+
+msgid ""
+"Enable/Disable autostart of Privoxy on system startup and interface events"
+msgstr ""
+"开启/关闭Privoxy在系统启动或者设置界面更改时自动启动。"
+
+msgid "Enable/Disable filtering when Privoxy starts."
+msgstr "Privoxy启动时开启/关闭过滤。"
+
+msgid "Enabled"
+msgstr "已开启"
+
+msgid ""
+"Enabling this option is NOT recommended if there is no parent proxy that "
+"requires authentication!"
+msgstr ""
+"父级代理不需要认证时不推荐开启这个选项!"
+
+msgid "File '%s' not found inside Configuration Directory"
+msgstr "文件 '%s' 没有在设置目录中找到!"
+
+msgid "File not found or empty"
+msgstr "文件不存在或为空"
+
+msgid "Files and Directories"
+msgstr "文件和目录"
+
+msgid "For help use link at the relevant option"
+msgstr ""
+"在相应选项下的连接可获取帮助。"
+
+msgid "Forwarding"
+msgstr "转发"
+
+msgid ""
+"If enabled, Privoxy hides the 'go there anyway' link. The user obviously "
+"should not be able to bypass any blocks."
+msgstr ""
+"如果启用,Privoxy会隐藏'go there anyway'链接。用户显然不应能绕过屏蔽。"
+
+msgid ""
+"If you intend to operate Privoxy for more users than just yourself, it might "
+"be a good idea to let them know how to reach you, what you block and why you "
+"do that, your policies, etc."
+msgstr ""
+"如果除了你还有其他用户通过privoxy连接,让他们知道如何联系你、什么内容被屏蔽了、"
+"你为什么要这么做、你所制定的规范等等是一个好主意。"
+
+msgid "Invalid email address"
+msgstr "邮箱地址无效"
+
+msgid "It is NOT recommended for the casual user."
+msgstr "不推荐新手使用。"
+
+msgid "Local Set-up"
+msgstr "本地设置"
+
+msgid "Location of the Privoxy User Manual."
+msgstr "Privoxy用户手册位置"
+
+msgid "Log File Viewer"
+msgstr "日志查看器"
+
+msgid "Log all data read from the network"
+msgstr "记录所有从网络接收的数据"
+
+msgid "Log all data written to the network"
+msgstr "记录所有发送给网络的数据"
+
+msgid "Log the applying actions"
+msgstr "记录被应用的规则"
+
+msgid ""
+"Log the destination for each request Privoxy let through. See also 'Debug "
+"1024'."
+msgstr ""
+"记录Privoxy所允许的所有请求。另请参考'Debug 1024'。"
+
+msgid ""
+"Log the destination for requests Privoxy didn't let through, and the reason "
+"why."
+msgstr ""
+"记录被Privoxy拒绝的请求目标以及拒绝原因。"
+
+msgid "Logging"
+msgstr "日志"
+
+msgid "Main actions file"
+msgstr "主要规则文件"
+
+msgid "Mandatory Input: No Data given!"
+msgstr "必需选项: 没有设置数据!"
+
+msgid "Mandatory Input: No Directory given!"
+msgstr "必需选项: 没有设置目录!"
+
+msgid "Mandatory Input: No File given!"
+msgstr "必需选项: 没有设置文件!"
+
+msgid "Mandatory Input: No Port given!"
+msgstr "必需选项: 没有设置端口!"
+
+msgid "Mandatory Input: No files given!"
+msgstr "必需选项: 没有设置文件!"
+
+msgid "Mandatory Input: No valid IPv4 address or host given!"
+msgstr ""
+"必需选项: 没有设置有效的IPV4地址或者主机!"
+
+msgid "Mandatory Input: No valid IPv6 address given!"
+msgstr "必需选项: 没有设置有效的IPV6地址!"
+
+msgid "Mandatory Input: No valid Port given!"
+msgstr "必需选项: 没有设置有效的端口!"
+
+msgid "Maximum number of client connections that will be served."
+msgstr "客户端数量上限。"
+
+msgid "Maximum size (in KB) of the buffer for content filtering."
+msgstr "内容过滤的最大缓冲(单位KB)。"
+
+msgid "Miscellaneous"
+msgstr "杂项"
+
+msgid "No trailing '/', please."
+msgstr "路径结尾不要加'/' ."
+
+msgid "Non-fatal errors - *we highly recommended enabling this*"
+msgstr ""
+"非致命性错误 - * 建议开启 *"
+
+msgid ""
+"Number of seconds after which a socket times out if no data is received."
+msgstr ""
+"socket连接未收到数据的超时时间。"
+
+msgid ""
+"Number of seconds after which an open connection will no longer be reused."
+msgstr ""
+"一个开放的连接不再重复使用的超时时间。"
+
+msgid ""
+"Only when using 'external filters', Privoxy has to create temporary files."
+msgstr ""
+"只有使用外置规则时,privoxy才需要创建临时文件。"
+
+msgid "Please press [Read] button"
+msgstr "请点击[读取]按钮"
+
+msgid "Please read Privoxy manual for details!"
+msgstr "请阅读Privoxy手册以了解详情!"
+
+msgid "Please update to the current version!"
+msgstr "请升级到当前版本!"
+
+msgid "Privoxy WEB proxy"
+msgstr "Privoxy 网络代理"
+
+msgid ""
+"Privoxy can (and normally does) use a number of other files for additional "
+"configuration, help and logging. This section of the configuration file "
+"tells Privoxy where to find those other files."
+msgstr ""
+"Privoxy可以使用其他一些文件用于附加设置,帮助和日志。这个区域用来告诉Privoxy从哪里找到这些文件。"
+
+msgid ""
+"Privoxy is a non-caching web proxy with advanced filtering capabilities for "
+"enhancing privacy, modifying web page data and HTTP headers, controlling "
+"access, and removing ads and other obnoxious Internet junk."
+msgstr ""
+"Privoxy是一个无缓存的网络代理,具有高级过滤功能,能够修改网页数据和HTTP头,控制访问,移除广告等。"
+
+msgid "Read / Reread log file"
+msgstr "读取/刷新日志文件"
+
+msgid "Show I/O status"
+msgstr "显示 I/O 状态"
+
+msgid "Show each connection status"
+msgstr "显示每个连接的状态"
+
+msgid "Show header parsing"
+msgstr "Show header parsing"
+
+msgid "Software update required"
+msgstr "需要升级软件"
+
+msgid "Start"
+msgstr "启动"
+
+msgid "Start / Stop"
+msgstr "启动 / 停止"
+
+msgid "Start/Stop Privoxy WEB Proxy"
+msgstr "启动/停止 Privoxy 网络代理"
+
+msgid "Startup banner and warnings."
+msgstr "启动标语和警告。"
+
+msgid "Syntax:"
+msgstr "格式:"
+
+msgid "Syntax: Client header names delimited by spaces."
+msgstr "格式: Client header names delimited by spaces."
+
+msgid "Syntax: target_pattern http_parent[:port]"
+msgstr "格式: target_pattern http_parent[:port]"
+
+msgid "Syntax: target_pattern socks_proxy[:port] http_parent[:port]"
+msgstr "格式: target_pattern socks_proxy[:port] http_parent[:port]"
+
+msgid ""
+"The actions file(s) to use. Multiple actionsfile lines are permitted, and "
+"are in fact recommended!"
+msgstr ""
+"所使用的规则文件。允许并且推荐使用多个规则文件。"
+
+msgid ""
+"The address and TCP port on which Privoxy will listen for client requests."
+msgstr ""
+"Privoxy接收客户端请求时监听的地址和TCP端口。"
+
+msgid ""
+"The compression level that is passed to the zlib library when compressing "
+"buffered content."
+msgstr ""
+"使用zlib压缩缓冲内容时的压缩级别。"
+
+msgid ""
+"The currently installed 'privoxy' package is not supported by LuCI "
+"application."
+msgstr ""
+"目前安装的privoxy版本不被luci支持。"
+
+msgid ""
+"The directory where all logging takes place (i.e. where the logfile is "
+"located)."
+msgstr "所有日志所在的目录。"
+
+msgid "The directory where the other configuration files are located."
+msgstr "其他设置文件所在的目录。"
+
+msgid ""
+"The filter files contain content modification rules that use regular "
+"expressions."
+msgstr ""
+"过滤文件包含了使用正则表达式编写的内容修改规则"
+
+msgid "The hostname shown on the CGI pages."
+msgstr "CGI页面显示的主机名。"
+
+msgid "The log file to use. File name, relative to log directory."
+msgstr ""
+"日志文件名称,与日志路径相对。"
+
+msgid "The order in which client headers are sorted before forwarding them."
+msgstr ""
+"转发数据前,client headers的排序。"
+
+msgid ""
+"The status code Privoxy returns for pages blocked with +handle-as-empty-"
+"document."
+msgstr ""
+"当页面因为handle-as-empty-document规则被阻止时返回的状态码(选上为200 OK,不选上为403 Forbidden)"
+
+msgid ""
+"The trust mechanism is an experimental feature for building white-lists and "
+"should be used with care."
+msgstr ""
+"信任机制是一个实验性的白名单特性,使用时应小心。"
+
+msgid ""
+"The value of this option only matters if the experimental trust mechanism "
+"has been activated."
+msgstr ""
+"只有开启了信任机制时这个选项的值才有效"
+
+msgid ""
+"This option is only there for debugging purposes. It will drastically reduce "
+"performance."
+msgstr ""
+"这个选项仅用于调试,开启后会极大地降低性能。"
+
+msgid ""
+"This option will be removed in future releases as it has been obsoleted by "
+"the more general header taggers."
+msgstr "这个选项在以后的版本中将被移除,因为它被header taggers所取代了。"
+
+msgid ""
+"This tab controls the security-relevant aspects of Privoxy's configuration."
+msgstr ""
+"这个标签用于设置与安全相关的Privoxy选项。"
+
+msgid ""
+"Through which SOCKS proxy (and optionally to which parent HTTP proxy) "
+"specific requests should be routed."
+msgstr ""
+"指定的请求应该通过哪一个SOCKS代理(并且通过哪一个HTTP父代理,可选)"
+
+msgid "To which parent HTTP proxy specific requests should be routed."
+msgstr ""
+"请求应转发至哪一个父级HTTP代理。"
+
+msgid "User customizations"
+msgstr "用户自定义"
+
+msgid "Value is not a number"
+msgstr "输入值不是数字"
+
+msgid "Value not between 0 and 9"
+msgstr "输入值不在0和9之间。"
+
+msgid "Value not between 1 and 4096"
+msgstr "输入值不在1和4096之间"
+
+msgid "Value not greater 0 or empty"
+msgstr "输入值为空或者不是大于零。"
+
+msgid "Value range 1 to 4096, no entry defaults to 4096"
+msgstr "输入值为1到4096,默认为4096"
+
+msgid "Version"
+msgstr "版本"
+
+msgid "Version Information"
+msgstr "版本信息"
+
+msgid "Whether intercepted requests should be treated as valid."
+msgstr "被拦截的请求是否应被当作有效的。"
+
+msgid ""
+"Whether or not Privoxy recognizes special HTTP headers to change toggle "
+"state."
+msgstr ""
+"Privoxy是否识别特殊的HTTP头以切换状态。"
+
+msgid "Whether or not buffered content is compressed before delivery."
+msgstr ""
+"缓冲内容在传递之前是否压缩。"
+
+msgid ""
+"Whether or not outgoing connections that have been kept alive should be "
+"shared between different incoming connections."
+msgstr ""
+"持久出站连接是否应在不同的入站连接之间共享。"
+
+msgid "Whether or not pipelined requests should be served."
+msgstr "是否处理管道化的请求。"
+
+msgid "Whether or not proxy authentication through Privoxy should work."
+msgstr "是否可以通过Privoxy进行代理验证。"
+
+msgid "Whether or not the web-based actions file editor may be used."
+msgstr "是否使用基于网页的规则编辑器。"
+
+msgid "Whether or not the web-based toggle feature may be used."
+msgstr "是否启用基于网页的切换功能。"
+
+msgid "Whether requests to Privoxy's CGI pages can be blocked or redirected."
+msgstr "访问Privoxy CGI页面的请求是否可以被拦截或重定向。"
+
+
+msgid ""
+"Whether the CGI interface should stay compatible with broken HTTP clients."
+msgstr ""
+"CGI界面是否应兼容过时的HTTP客户端。"
+
+msgid "Whether to run only one server thread."
+msgstr "是否只运行一个服务线程。"
+
+msgid "Who can access what."
+msgstr "谁可以访问什么。"
+
+msgid "installed"
+msgstr "已安装"
+
+msgid "or higher"
+msgstr "或更高"
+
+msgid "required"
+msgstr "需要"
diff --git a/applications/luci-app-qos/luasrc/model/cbi/qos/qos.lua b/applications/luci-app-qos/luasrc/model/cbi/qos/qos.lua index 99a884f865..a8ea57e311 100644 --- a/applications/luci-app-qos/luasrc/model/cbi/qos/qos.lua +++ b/applications/luci-app-qos/luasrc/model/cbi/qos/qos.lua @@ -53,25 +53,6 @@ dsth.rmempty = true dsth:value("", translate("all")) wa.cbi_add_knownips(dsth) -l7 = s:option(ListValue, "layer7", translate("Service")) -l7.rmempty = true -l7:value("", translate("all")) - -local pats = io.popen("find /etc/l7-protocols/ -type f -name '*.pat'") -if pats then - local l - while true do - l = pats:read("*l") - if not l then break end - - l = l:match("([^/]+)%.pat$") - if l then - l7:value(l) - end - end - pats:close() -end - p = s:option(Value, "proto", translate("Protocol")) p:value("", translate("all")) p:value("tcp", "TCP") diff --git a/applications/luci-app-radicale/Makefile b/applications/luci-app-radicale/Makefile index 07998aee58..960618dbac 100644 --- a/applications/luci-app-radicale/Makefile +++ b/applications/luci-app-radicale/Makefile @@ -10,7 +10,7 @@ PKG_NAME:=luci-app-radicale # Version == major.minor.patch # increase "minor" on new functionality and "patch" on patches/optimization -PKG_VERSION:=1.0.0 +PKG_VERSION:=1.0.1 # Release == build # increase on changes of translation files diff --git a/applications/luci-app-radicale/luasrc/controller/radicale.lua b/applications/luci-app-radicale/luasrc/controller/radicale.lua index 662c60d5a6..d384b00d9e 100755..100644 --- a/applications/luci-app-radicale/luasrc/controller/radicale.lua +++ b/applications/luci-app-radicale/luasrc/controller/radicale.lua @@ -122,8 +122,7 @@ end -- compare versions using "<=" "<" ">" ">=" "=" "<<" ">>" function ipkg_ver_compare(ver1, comp, ver2) - if not ver1 or not (#ver1 > 0) - or not ver2 or not (#ver2 > 0) + if not ver1 or not ver2 or not comp or not (#comp > 0) then return nil end -- correct compare string if comp == "<>" or comp == "><" or comp == "!=" or comp == "~=" then comp = "~=" @@ -140,33 +139,19 @@ function ipkg_ver_compare(ver1, comp, ver2) for i = 1, math.max(table.getn(av1),table.getn(av2)), 1 do local s1 = av1[i] or "" local s2 = av2[i] or "" - local n1 = tonumber(s1) - local n2 = tonumber(s2) - - -- one numeric and other empty string then set other to 0 - if n1 and not n2 and (not s2 or #s2 == 0) then n2 = 0 end - if n2 and not n1 and (not s1 or #s1 == 0) then n1 = 0 end - - local nc = (n1 and n2) -- numeric compare - - if nc then - -- first "not equal" found return true - if comp == "~=" and (n1 ~= n2) then return true end - -- first "lower" found return true - if (comp == "<" or comp == "<=") and (n1 < n2) then return true end - -- first "greater" found return true - if (comp == ">" or comp == ">=") and (n1 > n2) then return true end - -- not equal then return false - if (n1 ~= n2) then return false end - else - if comp == "~=" and (s1 ~= s2) then return true end - if (comp == "<" or comp == "<=") and (s1 < s2) then return true end - if (comp == ">" or comp == ">=") and (s1 > s2) then return true end - if (s1 ~= s2) then return false end - end + + -- first "not equal" found return true + if comp == "~=" and (s1 ~= s2) then return true end + -- first "lower" found return true + if (comp == "<" or comp == "<=") and (s1 < s2) then return true end + -- first "greater" found return true + if (comp == ">" or comp == ">=") and (s1 > s2) then return true end + -- not equal then return false + if (s1 ~= s2) then return false end end - -- all equal then true - return true + + -- all equal and not compare greater or lower then true + return not (comp == "<" or comp == ">") end -- read version information for given package if installed diff --git a/applications/luci-app-radicale/luasrc/model/cbi/radicale.lua b/applications/luci-app-radicale/luasrc/model/cbi/radicale.lua index 8abb68869d..8abb68869d 100755..100644 --- a/applications/luci-app-radicale/luasrc/model/cbi/radicale.lua +++ b/applications/luci-app-radicale/luasrc/model/cbi/radicale.lua diff --git a/applications/luci-app-shadowsocks-libev/Makefile b/applications/luci-app-shadowsocks-libev/Makefile new file mode 100644 index 0000000000..848a5c8317 --- /dev/null +++ b/applications/luci-app-shadowsocks-libev/Makefile @@ -0,0 +1,14 @@ +# +# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org> +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI Support for Shadowsocks-libev +LUCI_DEPENDS:= + +include ../../luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/applications/luci-app-shadowsocks-libev/luasrc/controller/shadowsocks-libev.lua b/applications/luci-app-shadowsocks-libev/luasrc/controller/shadowsocks-libev.lua new file mode 100644 index 0000000000..ae968168f1 --- /dev/null +++ b/applications/luci-app-shadowsocks-libev/luasrc/controller/shadowsocks-libev.lua @@ -0,0 +1,12 @@ +-- Copyright 2015 Jian Chang <aa65535@live.com> +-- Licensed to the public under the Apache License 2.0. + +module("luci.controller.shadowsocks-libev", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/shadowsocks-libev") then + return + end + + entry({"admin", "services", "shadowsocks-libev"}, cbi("shadowsocks-libev"), _("ShadowSocks-libev"), 74).dependent = true +end diff --git a/applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev.lua b/applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev.lua new file mode 100644 index 0000000000..76435e2f14 --- /dev/null +++ b/applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev.lua @@ -0,0 +1,156 @@ +-- Copyright 2015 Jian Chang <aa65535@live.com> +-- Licensed to the public under the Apache License 2.0. + +local m, s, o, e, a + +if luci.sys.call("pidof ss-redir >/dev/null") == 0 then + m = Map("shadowsocks-libev", translate("ShadowSocks-libev"), translate("ShadowSocks-libev is running")) +else + m = Map("shadowsocks-libev", translate("ShadowSocks-libev"), translate("ShadowSocks-libev is not running")) +end + +e = { + "table", + "rc4", + "rc4-md5", + "aes-128-cfb", + "aes-192-cfb", + "aes-256-cfb", + "bf-cfb", + "camellia-128-cfb", + "camellia-192-cfb", + "camellia-256-cfb", + "cast5-cfb", + "des-cfb", + "idea-cfb", + "rc2-cfb", + "seed-cfb", + "salsa20", + "chacha20", +} + +-- Global Setting +s = m:section(TypedSection, "shadowsocks-libev", translate("Global Setting")) +s.anonymous = true + +o = s:option(Flag, "enable", translate("Enable")) +o.default = 1 +o.rmempty = false + +o = s:option(Value, "server", translate("Server Address")) +o.datatype = "ipaddr" +o.rmempty = false + +o = s:option(Value, "server_port", translate("Server Port")) +o.datatype = "port" +o.rmempty = false + +o = s:option(Value, "local_port", translate("Local Port")) +o.datatype = "port" +o.default = 1080 +o.rmempty = false + +o = s:option(Value, "timeout", translate("Connection Timeout")) +o.datatype = "uinteger" +o.default = 60 +o.rmempty = false + +o = s:option(Value, "password", translate("Password")) +o.password = true +o.rmempty = false + +o = s:option(ListValue, "encrypt_method", translate("Encrypt Method")) +for i,v in ipairs(e) do + o:value(v) +end +o.rmempty = false + +o = s:option(Value, "ignore_list", translate("Ignore List")) +o:value("/dev/null", translate("Disabled")) +o.default = "/dev/null" +o.rmempty = false + +-- UDP Relay +s = m:section(TypedSection, "shadowsocks-libev", translate("UDP Relay")) +s.anonymous = true + +o = s:option(ListValue, "udp_mode", translate("Relay Mode")) +o:value("0", translate("Disabled")) +o:value("1", translate("Enabled")) +o:value("2", translate("Custom")) +o.default = 0 +o.rmempty = false + +o = s:option(Value, "udp_server", translate("Server Address")) +o.datatype = "ipaddr" +o:depends("udp_mode", 2) + +o = s:option(Value, "udp_server_port", translate("Server Port")) +o.datatype = "port" +o:depends("udp_mode", 2) + +o = s:option(Value, "udp_local_port", translate("Local Port")) +o.datatype = "port" +o.default = 1081 +o:depends("udp_mode", 2) + +o = s:option(Value, "udp_timeout", translate("Connection Timeout")) +o.datatype = "uinteger" +o.default = 60 +o:depends("udp_mode", 2) + +o = s:option(Value, "udp_password", translate("Password")) +o.password = true +o:depends("udp_mode", 2) + +o = s:option(ListValue, "udp_encrypt_method", translate("Encrypt Method")) +for i,v in ipairs(e) do + o:value(v) +end +o:depends("udp_mode", 2) + +-- UDP Forward +s = m:section(TypedSection, "shadowsocks-libev", translate("UDP Forward")) +s.anonymous = true + +o = s:option(Flag, "tunnel_enable", translate("Enable")) +o.default = 1 +o.rmempty = false + +o = s:option(Value, "tunnel_port", translate("UDP Local Port")) +o.datatype = "port" +o.default = 5300 + +o = s:option(Value, "tunnel_forward", translate("Forwarding Tunnel")) +o.default = "8.8.4.4:53" + +-- Access Control +s = m:section(TypedSection, "shadowsocks-libev", translate("Access Control")) +s.anonymous = true + +s:tab("lan_ac", translate("LAN")) + +o = s:taboption("lan_ac", ListValue, "lan_ac_mode", translate("Access Control")) +o:value("0", translate("Disabled")) +o:value("1", translate("Allow listed only")) +o:value("2", translate("Allow all except listed")) +o.default = 0 +o.rmempty = false + +a = luci.sys.net.arptable() or {} + +o = s:taboption("lan_ac", DynamicList, "lan_ac_ip", translate("LAN IP List")) +o.datatype = "ipaddr" +for i,v in ipairs(a) do + o:value(v["IP address"]) +end + +s:tab("wan_ac", translate("WAN")) + +o = s:taboption("wan_ac", DynamicList, "wan_bp_ip", translate("Bypassed IP")) +o.datatype = "ip4addr" + +o = s:taboption("wan_ac", DynamicList, "wan_fw_ip", translate("Forwarded IP")) +o.datatype = "ip4addr" + +return m diff --git a/applications/luci-app-shadowsocks-libev/po/templates/shadowsocks-libev.pot b/applications/luci-app-shadowsocks-libev/po/templates/shadowsocks-libev.pot new file mode 100644 index 0000000000..c2bde961e0 --- /dev/null +++ b/applications/luci-app-shadowsocks-libev/po/templates/shadowsocks-libev.pot @@ -0,0 +1,80 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +msgid "ShadowSocks-libev" +msgstr "" + +msgid "ShadowSocks-libev is running" +msgstr "" + +msgid "ShadowSocks-libev is not running" +msgstr "" + +msgid "Global Setting" +msgstr "" + +msgid "Enable" +msgstr "" + +msgid "Enabled" +msgstr "" + +msgid "Disabled" +msgstr "" + +msgid "Custom" +msgstr "" + +msgid "Server Address" +msgstr "" + +msgid "Server Port" +msgstr "" + +msgid "Local Port" +msgstr "" + +msgid "Connection Timeout" +msgstr "" + +msgid "Password" +msgstr "" + +msgid "Encrypt Method" +msgstr "" + +msgid "Ignore List" +msgstr "" + +msgid "UDP Relay" +msgstr "" + +msgid "Relay Mode" +msgstr "" + +msgid "UDP Forward" +msgstr "" + +msgid "UDP Local Port" +msgstr "" + +msgid "Forwarding Tunnel" +msgstr "" + +msgid "Access Control" +msgstr "" + +msgid "Allow listed only" +msgstr "" + +msgid "Allow all except listed" +msgstr "" + +msgid "LAN IP List" +msgstr "" + +msgid "Bypassed IP" +msgstr "" + +msgid "Forwarded IP" +msgstr "" diff --git a/applications/luci-app-shadowsocks-libev/po/zh-cn/shadowsocks-libev.po b/applications/luci-app-shadowsocks-libev/po/zh-cn/shadowsocks-libev.po new file mode 100644 index 0000000000..90a0eff996 --- /dev/null +++ b/applications/luci-app-shadowsocks-libev/po/zh-cn/shadowsocks-libev.po @@ -0,0 +1,91 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-11-12 14:12+0800\n" +"PO-Revision-Date: 2015-07-02 14:26+0800\n" +"Last-Translator: Jian Chang <aa65535@live.com>\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Pootle 2.0.6\n" + +msgid "ShadowSocks-libev" +msgstr "ShadowSocks-libev" + +msgid "ShadowSocks-libev is running" +msgstr "ShadowSocks-libev 运行中" + +msgid "ShadowSocks-libev is not running" +msgstr "ShadowSocks-libev 未运行" + +msgid "Global Setting" +msgstr "全局设置" + +msgid "Enable" +msgstr "启用" + +msgid "Enabled" +msgstr "已启用" + +msgid "Disabled" +msgstr "已禁用" + +msgid "Custom" +msgstr "自定义" + +msgid "Server Address" +msgstr "服务器地址" + +msgid "Server Port" +msgstr "服务器端口" + +msgid "Local Port" +msgstr "本地端口" + +msgid "Connection Timeout" +msgstr "连接超时" + +msgid "Password" +msgstr "密码" + +msgid "Encrypt Method" +msgstr "加密方式" + +msgid "Ignore List" +msgstr "忽略列表" + +msgid "UDP Relay" +msgstr "UDP中继" + +msgid "Relay Mode" +msgstr "中继模式" + +msgid "UDP Forward" +msgstr "UDP转发" + +msgid "UDP Local Port" +msgstr "UDP本地端口" + +msgid "Forwarding Tunnel" +msgstr "UDP转发地址" + +msgid "Access Control" +msgstr "访问控制" + +msgid "Allow listed only" +msgstr "仅允许列表内" + +msgid "Allow all except listed" +msgstr "仅允许列表外" + +msgid "LAN IP List" +msgstr "内网IP列表" + +msgid "Bypassed IP" +msgstr "被忽略的IP" + +msgid "Forwarded IP" +msgstr "走代理的IP" diff --git a/applications/luci-app-shadowsocks-libev/root/etc/uci-defaults/luci-shadowsocks-libev b/applications/luci-app-shadowsocks-libev/root/etc/uci-defaults/luci-shadowsocks-libev new file mode 100644 index 0000000000..6f30fa77b7 --- /dev/null +++ b/applications/luci-app-shadowsocks-libev/root/etc/uci-defaults/luci-shadowsocks-libev @@ -0,0 +1,11 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@shadowsocks-libev[-1] + add ucitrack shadowsocks-libev + set ucitrack.@shadowsocks-libev[-1].init=shadowsocks-libev + commit ucitrack +EOF + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/applications/luci-app-splash/htdocs/cgi-bin/splash/splash.sh b/applications/luci-app-splash/htdocs/cgi-bin/splash/splash.sh index 76f6d4d3e4..da8370dafa 100755 --- a/applications/luci-app-splash/htdocs/cgi-bin/splash/splash.sh +++ b/applications/luci-app-splash/htdocs/cgi-bin/splash/splash.sh @@ -1,13 +1,11 @@ #!/bin/sh $(uci -q get luci_splash.general.redirect_url) || { - set -x touch /var/state/luci_splash_locations touch /etc/config/luci_splash_locations MAC=$(grep "$REMOTE_HOST" /proc/net/arp | awk '{print $4}') uci -P /var/state set luci_splash_locations.${MAC//:/}=redirect uci -P /var/state set luci_splash_locations.${MAC//:/}.location="http://${HTTP_HOST}${REQUEST_URI}" - set +x } echo -en "Cache-Control: no-cache, max-age=0, no-store, must-revalidate\r\n" diff --git a/applications/luci-app-statistics/luasrc/controller/luci_statistics/luci_statistics.lua b/applications/luci-app-statistics/luasrc/controller/luci_statistics/luci_statistics.lua index c532b4a6d3..49eab5acd4 100644 --- a/applications/luci-app-statistics/luasrc/controller/luci_statistics/luci_statistics.lua +++ b/applications/luci-app-statistics/luasrc/controller/luci_statistics/luci_statistics.lua @@ -30,6 +30,7 @@ function index() disk = _("Disk Usage"), dns = _("DNS"), email = _("Email"), + entropy = _("Entropy"), exec = _("Exec"), interface = _("Interfaces"), iptables = _("Firewall"), @@ -53,7 +54,7 @@ function index() -- our collectd menu local collectd_menu = { output = { "csv", "network", "rrdtool", "unixsock" }, - system = { "cpu", "df", "disk", "email", "exec", "irq", "load", "memory", "nut", "processes", "uptime" }, + system = { "cpu", "df", "disk", "email", "entropy", "exec", "irq", "load", "memory", "nut", "processes", "uptime" }, network = { "conntrack", "dns", "interface", "iptables", "netlink", "olsrd", "ping", "splash_leases", "tcpconns", "iwinfo" } } diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/entropy.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/entropy.lua new file mode 100644 index 0000000000..d18bf910f9 --- /dev/null +++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/entropy.lua @@ -0,0 +1,14 @@ +-- Copyright 2015 Hannu Nyman <hannu.nyman@iki.fi> +-- Licensed to the public under the Apache License 2.0. + +m = Map("luci_statistics", + translate("Entropy Plugin Configuration"), + translate("The entropy plugin collects statistics about the available entropy.")) + +s = m:section( NamedSection, "collectd_entropy", "luci_statistics" ) + +enable = s:option( Flag, "enable", translate("Enable this plugin") ) +enable.default = 0 + +return m + diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool.lua index 1f8f4ff88b..d8317a8177 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool.lua @@ -457,6 +457,12 @@ function Graph._generic( self, opts, plugin, plugin_instance, dtype, index ) _ti ( _args, "-X" ) _ti ( _args, opts.units_exponent ) end + if opts.alt_autoscale then + _ti ( _args, "-A" ) + end + if opts.alt_autoscale_max then + _ti ( _args, "-M" ) + end -- store additional rrd options if opts.rrdopts then diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/conntrack.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/conntrack.lua index ee3d68fe16..fbc47731ef 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/conntrack.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/conntrack.lua @@ -9,6 +9,10 @@ function rrdargs( graph, plugin, plugin_instance, dtype ) vlabel = "Count", number_format = "%5.0lf", data = { + -- collectd 5.5+: specify "" to exclude "max" instance + instances = { + conntrack = { "" } + }, sources = { conntrack = { "value" } }, diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpu.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpu.lua index 1ca8a23ee9..ae0c0ce778 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpu.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpu.lua @@ -8,22 +8,23 @@ function rrdargs( graph, plugin, plugin_instance, dtype ) return { title = "%H: Processor usage on core #%pi", y_min = "0", + alt_autoscale_max = true, vlabel = "Percent", number_format = "%5.1lf%%", data = { instances = { - cpu = { "idle", "user", "system", "nice" } + cpu = { "user", "nice", "system", "softirq", "interrupt" } }, options = { - cpu_idle = { color = "ffffff" }, - cpu_nice = { color = "00e000" }, - cpu_user = { color = "0000ff" }, - cpu_wait = { color = "ffb000" }, - cpu_system = { color = "ff0000" }, - cpu_softirq = { color = "ff00ff" }, - cpu_interrupt = { color = "a000a0" }, - cpu_steal = { color = "000000" } + cpu_idle = { color = "ffffff", title = "Idle" }, + cpu_nice = { color = "00e000", title = "Nice" }, + cpu_user = { color = "0000ff", title = "User" }, + cpu_wait = { color = "ffb000", title = "Wait" }, + cpu_system = { color = "ff0000", title = "System" }, + cpu_softirq = { color = "ff00ff", title = "Softirq" }, + cpu_interrupt = { color = "a000a0", title = "Interrupt" }, + cpu_steal = { color = "000000", title = "Steal" } } } } diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/entropy.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/entropy.lua new file mode 100644 index 0000000000..3d30a70afb --- /dev/null +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/entropy.lua @@ -0,0 +1,19 @@ +-- Copyright 2015 Hannu Nyman <hannu.nyman@iki.fi> +-- Licensed to the public under the Apache License 2.0. + +module("luci.statistics.rrdtool.definitions.entropy", package.seeall) + +function rrdargs( graph, plugin, plugin_instance, dtype ) + + return { + title = "%H: Available entropy", + vlabel = "bits", + number_format = "%4.0lf", + data = { + types = { "entropy" }, + options = { entropy = { title = "Entropy %di" } } + } + } + +end + diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/memory.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/memory.lua index a1c65f56d7..53d559c599 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/memory.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/memory.lua @@ -17,6 +17,8 @@ function rrdargs( graph, plugin, plugin_instance, dtype ) title = "%H: Memory usage", vlabel = "MB", number_format = "%5.1lf%s", + y_min = "0", + alt_autoscale_max = true, data = { instances = { memory = { "free", "buffered", "cached", "used" } diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/ping.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/ping.lua index 1a72caf227..347d756f7c 100644 --- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/ping.lua +++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/ping.lua @@ -9,7 +9,7 @@ function rrdargs( graph, plugin, plugin_instance, dtype ) { title = "%H: ICMP Round Trip Time", vlabel = "ms", number_format = "%5.1lf ms", data = { sources = { ping = { "value" } }, - options = { ping__ping = { noarea = true, title = "%di" } } + options = { ping__value = { noarea = true, title = "%di" } } } }, -- Ping droprate diff --git a/applications/luci-app-statistics/luasrc/view/admin_statistics/index.htm b/applications/luci-app-statistics/luasrc/view/admin_statistics/index.htm index 0000c1961e..0fb3d56375 100644 --- a/applications/luci-app-statistics/luasrc/view/admin_statistics/index.htm +++ b/applications/luci-app-statistics/luasrc/view/admin_statistics/index.htm @@ -8,7 +8,10 @@ <h2><a id="content" name="content"><%:Statistics%></a></h2> -<p><%_The statistics package is based on <a href="http://collectd.org/index.shtml">Collectd</a> -and uses <a href="http://oss.oetiker.ch/rrdtool/">RRD Tool</a> to render diagram images from collected data.%></p> +<p><%_The statistics package uses <a href="https://collectd.org/">Collectd</a> +to gather data and <a href="http://oss.oetiker.ch/rrdtool/">RRDtool</a> to +render diagram images.%></p> + +<p><%_You can install additional collectd-mod-* plugins to enable more statistics.%></p> <%+footer%> diff --git a/applications/luci-app-statistics/root/etc/config/luci_statistics b/applications/luci-app-statistics/root/etc/config/luci_statistics index e39db3513a..abcee3e938 100644 --- a/applications/luci-app-statistics/root/etc/config/luci_statistics +++ b/applications/luci-app-statistics/root/etc/config/luci_statistics @@ -1,143 +1,153 @@ -config 'statistics' 'rrdtool' - option 'default_timespan' '1hour' - option 'image_width' '600' - option 'image_path' '/tmp/rrdimg' - -config 'statistics' 'collectd' - option 'BaseDir' '/var/run/collectd' - option 'Include' '/etc/collectd/conf.d' - option 'PIDFile' '/var/run/collectd.pid' - option 'PluginDir' '/usr/lib/collectd' - option 'TypesDB' '/usr/share/collectd/types.db' - option 'Interval' '30' - option 'ReadThreads' '2' - -config 'statistics' 'collectd_ping' - option 'enable' '0' - option 'TTL' '127' - option 'Interval' '30' - option 'Hosts' '127.0.0.1' - -config 'statistics' 'collectd_csv' - option 'enable' '0' - option 'StoreRates' '0' - option 'DataDir' '/tmp' - -config 'statistics' 'collectd_df' - option 'enable' '0' - option 'Devices' '/dev/mtdblock/4' - option 'MountPoints' '/jffs' - option 'FSTypes' 'tmpfs' - option 'IgnoreSelected' '0' - -config 'statistics' 'collectd_disk' - option 'enable' '0' - option 'Disks' 'hda1 hdb' - option 'IgnoreSelected' '0' - -config 'statistics' 'collectd_dns' - option 'enable' '0' - option 'Interfaces' 'ffdhcp ff br-lan' - option 'IgnoreSources' '127.0.0.1' - -config 'statistics' 'collectd_email' - option 'enable' '0' - option 'SocketFile' '/var/run/collectd/email.sock' - option 'SocketGroup' 'nogroup' - -config 'statistics' 'collectd_exec' - option 'enable' '0' - -config 'statistics' 'collectd_interface' - option 'enable' '1' - option 'Interfaces' 'br-lan br-ff' - option 'IgnoreSelected' '0' - -config 'statistics' 'collectd_iptables' - option 'enable' '1' - -config 'collectd_iptables_match' - option 'table' 'nat' - option 'chain' 'luci_fw_postrouting' - option 'target' 'MASQUERADE' - option 'source' '192.168.1.0/24' - option 'outputif' 'br-ff' - option 'name' 'Verkehr LAN-Clients' - -config 'collectd_iptables_match' - option 'chain' 'luci_fw_postrouting' - option 'table' 'nat' - option 'target' 'MASQUERADE' - option 'source' '10.61.230.0/24' - option 'outputif' 'br-ff' - option 'name' 'Verkehr WLAN-Clients' - -config 'statistics' 'collectd_irq' - option 'enable' '0' - option 'Irqs' '2 3 4 7' - -config 'statistics' 'collectd_load' - option 'enable' '1' - -config 'statistics' 'collectd_logfile' - option 'enable' '0' - option 'LogLevel' 'notice' - option 'File' '/var/log/collectd.log' - option 'Timestamp' '1' - -config 'statistics' 'collectd_netlink' - option 'enable' '0' - option 'IgnoreSelected' '0' - option 'VerboseInterfaces' 'br-lan br-ff' - option 'QDiscs' 'br-lan br-ff' - -config 'statistics' 'collectd_network' - option 'enable' '0' - -config 'statistics' 'collectd_processes' - option 'enable' '1' - option 'Processes' 'uhttpd dnsmasq dropbear' - -config statistics 'collectd_splash_leases' - option enable '1' - -config 'statistics' 'collectd_tcpconns' - option 'enable' '1' - option 'ListeningPorts' '0' - option 'LocalPorts' '22 80' - -config 'statistics' 'collectd_unixsock' - option 'enable' '0' - option 'SocketFile' '/var/run/collectd/query.sock' - option 'SocketGroup' 'nogroup' - -config 'statistics' 'collectd_cpu' - option 'enable' '1' - -config 'statistics' 'collectd_rrdtool' - option 'enable' '1' - option 'DataDir' '/tmp/rrd' - option 'RRARows' '100' - option 'RRASingle' '1' - option 'RRATimespans' '1hour 1day 1week 1month 1year' - -config 'statistics' 'collectd_memory' - option 'enable' '1' - -config 'statistics' 'collectd_conntrack' - option 'enable' '1' - -config 'statistics' 'collectd_olsrd' - option 'enable' '1' - option 'Port' '2006' - option 'Host' '127.0.0.1' - -config 'statistics' 'collectd_iwinfo' - option 'enable' '1' - -config 'statistics' 'collectd_nut' - option 'enable' '0' - option 'UPS' 'myupsname' - -config 'statistics' 'collectd_uptime' - option 'enable' '1' +# general settings + +config statistics 'collectd' + option BaseDir '/var/run/collectd' + option Include '/etc/collectd/conf.d' + option PIDFile '/var/run/collectd.pid' + option PluginDir '/usr/lib/collectd' + option TypesDB '/usr/share/collectd/types.db' + option Interval '30' + option ReadThreads '2' + +config statistics 'rrdtool' + option default_timespan '1hour' + option image_width '600' + option image_path '/tmp/rrdimg' + +# output plugins + +config statistics 'collectd_rrdtool' + option enable '1' + option DataDir '/tmp/rrd' + option RRARows '100' + option RRASingle '1' + option RRATimespans '1hour 1day 1week 1month 1year' + +config statistics 'collectd_csv' + option enable '0' + option StoreRates '0' + option DataDir '/tmp' + +config statistics 'collectd_email' + option enable '0' + option SocketFile '/var/run/collectd/email.sock' + option SocketGroup 'nogroup' + +config statistics 'collectd_logfile' + option enable '0' + option LogLevel 'notice' + option File '/var/log/collectd.log' + option Timestamp '1' + +config statistics 'collectd_network' + option enable '0' + +config statistics 'collectd_unixsock' + option enable '0' + option SocketFile '/var/run/collectd/query.sock' + option SocketGroup 'nogroup' + +# input plugins + +config statistics 'collectd_conntrack' + option enable '0' + +config statistics 'collectd_cpu' + option enable '0' + +config statistics 'collectd_df' + option enable '0' + option Devices '/dev/mtdblock/4' + option MountPoints '/jffs' + option FSTypes 'tmpfs' + option IgnoreSelected '0' + +config statistics 'collectd_disk' + option enable '0' + option Disks 'hda1 hdb' + option IgnoreSelected '0' + +config statistics 'collectd_dns' + option enable '0' + option Interfaces 'br-lan' + option IgnoreSources '127.0.0.1' + +config statistics 'collectd_entropy' + option enable '0' + +config statistics 'collectd_exec' + option enable '0' + +config statistics 'collectd_interface' + option enable '1' + option Interfaces 'br-lan' + option IgnoreSelected '0' + +config statistics 'collectd_iptables' + option enable '0' + +config collectd_iptables_match + option table 'nat' + option chain 'luci_fw_postrouting' + option target 'MASQUERADE' + option source '192.168.1.0/24' + option outputif 'br-ff' + option name 'LAN-Clients traffic' + +config collectd_iptables_match + option chain 'luci_fw_postrouting' + option table 'nat' + option target 'MASQUERADE' + option source '10.61.230.0/24' + option outputif 'br-ff' + option name 'WLAN-Clients traffic' + +config statistics 'collectd_irq' + option enable '0' + option Irqs '2 3 4 7' + +config statistics 'collectd_iwinfo' + option enable '1' + +config statistics 'collectd_load' + option enable '1' + +config statistics 'collectd_memory' + option enable '0' + +config statistics 'collectd_netlink' + option enable '0' + option IgnoreSelected '0' + option VerboseInterfaces 'br-lan' + option QDiscs 'br-lan' + +config statistics 'collectd_nut' + option enable '0' + option UPS 'myupsname' + +config statistics 'collectd_olsrd' + option enable '0' + option Port '2006' + option Host '127.0.0.1' + +config statistics 'collectd_ping' + option enable '0' + option TTL '127' + option Interval '30' + option Hosts '127.0.0.1' + +config statistics 'collectd_processes' + option enable '0' + option Processes 'uhttpd dnsmasq dropbear' + +config statistics 'collectd_splash_leases' + option enable '0' + +config statistics 'collectd_tcpconns' + option enable '0' + option ListeningPorts '0' + option LocalPorts '22 80' + +config statistics 'collectd_uptime' + option enable '0' + diff --git a/applications/luci-app-statistics/root/etc/init.d/luci_statistics b/applications/luci-app-statistics/root/etc/init.d/luci_statistics index 936f3a63c3..ab75b69df0 100755 --- a/applications/luci-app-statistics/root/etc/init.d/luci_statistics +++ b/applications/luci-app-statistics/root/etc/init.d/luci_statistics @@ -3,23 +3,15 @@ START=79 start() { ### replace shipped config with symlink + mkdir -p /var/etc if [ ! -L /etc/collectd.conf ]; then test -f /etc/collectd.conf && mv /etc/collectd.conf /etc/collectd.conf.bak ln -s /var/etc/collectd.conf /etc/collectd.conf fi ### create config - mkdir -p /var/etc /usr/bin/stat-genconfig > /var/etc/collectd.conf - ### prepare rrdimg directory - if [ -f /etc/config/lucid ] && [ -x /etc/init.d/lucid ] && /etc/init.d/lucid enabled && \ - [ "$(uci get luci_statistics.rrdtool.image_path 2>/dev/null)" != "$(uci get lucid.statistics.physical 2>/dev/null)" ]; then - uci set lucid.statistics.physical=$(uci get luci_statistics.rrdtool.image_path) - uci commit lucid - /etc/init.d/lucid restart - fi - ### workaround broken permissions on /tmp chmod 1777 /tmp } diff --git a/applications/luci-app-statistics/root/etc/uci-defaults/luci-statistics b/applications/luci-app-statistics/root/etc/uci-defaults/luci-statistics index e94a8637c8..28e35298a2 100755 --- a/applications/luci-app-statistics/root/etc/uci-defaults/luci-statistics +++ b/applications/luci-app-statistics/root/etc/uci-defaults/luci-statistics @@ -8,29 +8,9 @@ uci -q batch <<-EOF >/dev/null commit ucitrack EOF -# register LuCId virtual path handler -[ -f /etc/config/lucid ] && \ -uci -q batch <<-EOF >/dev/null - delete lucid.statistics - - set lucid.statistics=DirectoryPublisher - set lucid.statistics.name='RRDTool Image Cache' - set lucid.statistics.physical=/tmp/rrdimg - set lucid.statistics.virtual=/rrdimg - set lucid.statistics.domain='' - - add_list lucid.http.publisher=statistics - add_list lucid.https.publisher=statistics - - commit lucid -EOF - # symlink for busybox httpd [ -x /usr/sbin/httpd ] && [ ! -h /www/rrdimg ] && \ ln -s /tmp/rrdimg /www/rrdimg -# restart LuCId service -[ -x /etc/init.d/lucid ] && /etc/init.d/lucid enabled && /etc/init.d/lucid restart - rm -f /tmp/luci-indexcache exit 0 diff --git a/applications/luci-app-statistics/root/usr/bin/stat-genconfig b/applications/luci-app-statistics/root/usr/bin/stat-genconfig index cb94e28118..8acae46c61 100755 --- a/applications/luci-app-statistics/root/usr/bin/stat-genconfig +++ b/applications/luci-app-statistics/root/usr/bin/stat-genconfig @@ -303,6 +303,12 @@ plugins = { { } }, + entropy = { + { }, + { }, + { } + }, + exec = config_exec, interface = { diff --git a/applications/luci-app-upnp/root/etc/uci-defaults/luci-upnp b/applications/luci-app-upnp/root/etc/uci-defaults/luci-upnp deleted file mode 100755 index fe22a3e3c1..0000000000 --- a/applications/luci-app-upnp/root/etc/uci-defaults/luci-upnp +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -/etc/init.d/miniupnpd enabled && { - /etc/init.d/miniupnpd stop - /etc/init.d/miniupnpd disable -} - -rm -f /tmp/luci-indexcache -exit 0 diff --git a/applications/luci-app-vnstat/luasrc/view/vnstat.htm b/applications/luci-app-vnstat/luasrc/view/vnstat.htm index cfa1a5de51..2b502559b8 100644 --- a/applications/luci-app-vnstat/luasrc/view/vnstat.htm +++ b/applications/luci-app-vnstat/luasrc/view/vnstat.htm @@ -22,7 +22,7 @@ style = (style and #style > 0) and style or "s" -- if iface then style = style:gsub("[^%w]", "") - iface = iface:gsub("[^%w%.%-]", "") + iface = iface:gsub("[^%w%.%-%_]", "") luci.http.prepare_content("image/png") diff --git a/contrib/package/community-profiles/files/etc/config/profile_augsburg b/contrib/package/community-profiles/files/etc/config/profile_augsburg index 4434b0fbad..4ab82cf5da 100644 --- a/contrib/package/community-profiles/files/etc/config/profile_augsburg +++ b/contrib/package/community-profiles/files/etc/config/profile_augsburg @@ -22,8 +22,9 @@ config 'defaults' 'bssidscheme' option '1' '02:CA:FF:EE:BA:BE' config 'defaults' 'luci_splash' - option 'limit_up' '20' - option 'limit_down' '50' + option 'limit_up' '40' + option 'limit_down' '120' + option 'leasetime' '8' config widget 'customindex' option enabled '1' diff --git a/contrib/package/community-profiles/files/etc/config/profile_hameln b/contrib/package/community-profiles/files/etc/config/profile_hameln new file mode 100644 index 0000000000..f305b597a1 --- /dev/null +++ b/contrib/package/community-profiles/files/etc/config/profile_hameln @@ -0,0 +1,15 @@ +config 'community' 'profile' + option 'name' 'Hameln' + option 'homepage' 'http://freifunk-hameln.de' + option 'ssid' 'hameln.freifunk.net' + option 'suffix' 'ffhm' + option 'latitude' '52.1030706' + option 'longitude' '9.3514778' + option 'mesh_network' '10.31.0.0/16' + option 'splash_network' '10.104.0.0/16' + option 'splash_prefix' '27' + option 'vap' '1' + option adhoc_dhcp_when_vap '1' + +config 'defaults' 'interface' + option 'netmask' '255.255.0.0' diff --git a/contrib/package/community-profiles/files/etc/config/profile_reihen b/contrib/package/community-profiles/files/etc/config/profile_reihen index e978d37501..a05d6a2964 100644 --- a/contrib/package/community-profiles/files/etc/config/profile_reihen +++ b/contrib/package/community-profiles/files/etc/config/profile_reihen @@ -17,4 +17,9 @@ config 'defaults' 'wifi_device' option 'bssid' '02:07:04:08:08:09' config 'defaults' 'bssidscheme' - option '13' '02:07:04:08:08:09' + option '13' '02:07:04:08:08:09' + option '36' '02:36:CA:FF:EE:EE' + +config 'defaults' 'ssidscheme' + option '13' 'ch13.freifunk.net' + option '36' 'ch36.freifunk.net' diff --git a/contrib/package/freifunk-watchdog/src/watchdog.h b/contrib/package/freifunk-watchdog/src/watchdog.h index 3aa8876400..6f2382de38 100644 --- a/contrib/package/freifunk-watchdog/src/watchdog.h +++ b/contrib/package/freifunk-watchdog/src/watchdog.h @@ -29,6 +29,7 @@ #include <math.h> #include <time.h> #include <signal.h> +#include <limits.h> #include <sys/wait.h> #include <sys/stat.h> #include <sys/ioctl.h> diff --git a/contrib/package/meshwizard/Makefile b/contrib/package/meshwizard/Makefile index 9d74fe5479..b4baab7fa4 100644 --- a/contrib/package/meshwizard/Makefile +++ b/contrib/package/meshwizard/Makefile @@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=meshwizard -PKG_RELEASE:=0.1.1 +PKG_RELEASE:=0.3.1 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/functions.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/functions.sh index 8abdf9f0e7..b0f6cb291e 100644 --- a/contrib/package/meshwizard/files/usr/bin/meshwizard/functions.sh +++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/functions.sh @@ -12,6 +12,21 @@ uci_remove_list_element() { done } +# string_contains(string, substring) +# +# Returns 0 if the specified string contains the specified substring, +# otherwise returns 1. +string_contains() { + string="$1" + substring="$2" + if test "${string#*$substring}" != "$string" + then + return 0 # $substring is in $string + else + return 1 # $substring is not in $string + fi +} + # Takes 2 arguments # $1 = text to be displayed in the output for this section # $2 = section (optional) @@ -29,11 +44,18 @@ set_defaults() { a="$(echo $option |cut -d '=' -f1)" b="$(echo $option |cut -d '=' -f2-)" b="${b//_/ }" - uci set $2.$a="$b" + string_contains "$a" "_LENGTH" && continue + string_contains "$a" "_ITEM" && { + # special threatment for lists. use add_list and remove the + # item index (_ITEMx). + uci add_list $2.${a//_ITEM[0-9]*/}="$b" + } || { + uci set $2.$a="$b" + } done } -# 3 arguements: 1=config name 2=oldname 3=newname +# 3 arguments: 1=config name 2=oldname 3=newname section_rename() { uci -q rename $1.$2=$3 && msg_rename $1.$2 $1.$3 || msg_rename_error $1.$2 $1.$3 } @@ -57,3 +79,40 @@ msg_rename() { msg_rename_error() { echo " \033[1mWarning:\033[0m Could not rename $1 to $2." } + + +restore_factory_defaults() { + echo "+ Restore default config as requested with cleanup=1" + cp -f /rom/etc/config/* /etc/config/ + rm /etc/config/wireless + wifi detect > /etc/config/wireless + rm /etc/config/network + if [ -f /etc/init.d/defconfig ]; then + # legacy (AA) + /etc/init.d/defconfig start + [ -f /rom/etc/uci-defaults/network ] && sh /rom/etc/uci-defaults/network + else + sh /rom/etc/uci-defaults/02_network + fi +} + +is_in_list() { + # checks if an item is in a list + local list="$1" + local item="$2" + for word in $list; do + [ $word = "$item" ] && return 0 + done + return 1 +} + +add_to_list() { + local list="$1" + local item="$2" + is_in_list "$list" "$item" && echo $list + if [ -z "$list" ]; then + echo "$item" + else + echo "$list $item" + fi +} diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/read_defaults.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/read_defaults.sh index cb0d319a2d..b6ffb62e4a 100755 --- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/read_defaults.sh +++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/read_defaults.sh @@ -1,35 +1,61 @@ #!/bin/sh -# This reads the settings we need to have to configure everything -# Argument $1: community +# These functions read the settings we need for configuration of the router -. /lib/functions.sh -community="$1" +read_defaults() { + # read default values from the 3 relevant config files and export them + # into the environment. Later loaded configs overwrite earlier ones. The + # The ordering here is from most generic to most specific: + # freifunk (most generic defaults) + # profile_* (community defaults) + # nodes custom config from meshwizard config file -# reads variables from uci files, parameter $1 is the section -get_var() { - uci -q show $1 | cut -d "." -f 2-100 |grep "\." | sed -e 's/^\([A-Za-z0-9_]*\)\./\1_/g' -e 's/=\(.*\)$/="\1"/g' -} - -handle_widgets() { - widgets="$widgets $1" -} -config_load freifunk -config_foreach handle_widgets widget -config_load profile_$community -config_foreach handle_widgets widget -echo "widgets=$widgets" + local community="$1" -# read default values from /etc/config/freifunk -for v in system wifi_device wifi_iface interface alias dhcp olsr_interface olsr_interfacedefaults zone_freifunk include $widgets; do - get_var freifunk.$v -done + config_cb() { + local type="$1" + local name="$2" + local allowed_section_types="widget" + local allowed_section_names=" + system + wifi_device + wifi_iface + interface + alias + dhcp + olsr_interface + olsr_interfacedefaults + profile + zone_freifunk + include + luci_splash + ipv6 + luci_main + contact + community + wan + lan + general + ipv6 + qos + " -# now read all values from the selected community profile, will override some values from the defaults before -for v in system wifi_device wifi_iface interface alias dhcp olsr_interface olsr_interfacedefaults profile zone_freifunk include luci_splash ipv6 $widgets; do - get_var profile_$community.$v -done + if [ "$type" = "widget" ]; then + widgets=$(add_to_list "$widgets" "$name") + fi -# read values from meshwizard -for v in system luci_main contact community wan lan general ipv6 qos; do - get_var meshwizard.$v -done + if ([ -n "$name" ] && is_in_list "$allowed_section_names" $name) \ + || is_in_list "$allowed_section_types" $type ; then + option_cb() { + local option="$1" + local value="$2" + export "${CONFIG_SECTION}_${option}"="$value" + } + else + option_cb() { return; } + fi + } + config_load freifunk + config_load profile_${community} + config_load meshwizard + export widgets="$widgets" +} diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/rename-wifi.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/rename-wifi.sh index ea200559e7..e9139ed510 100755 --- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/rename-wifi.sh +++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/rename-wifi.sh @@ -33,7 +33,7 @@ for i in `seq 0 $posIB`; do uci show meshwizard.netconfig | grep $IBwifi | while read line; do oldline=$(echo $line | cut -d "=" -f 1) uci set $oldline="" - newline=$(echo $line |sed "s/$IBwifi/$syswifi/g") + newline=$(echo $line |sed -e "s/$IBwifi/$syswifi/g" -e "s/'//g") uci set $newline done ;; diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/restore_default_config.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/restore_default_config.sh deleted file mode 100755 index 3f6ce3587d..0000000000 --- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/restore_default_config.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -# This will restore default "factory" settings before running the meshwizard -# and is used when cleanup=1 -# Warning: This will reset network settings for wan and lan to defaults too. - -echo "+ Restore default config as requested with cleanup=1" -cp -f /rom/etc/config/* /etc/config/ -rm /etc/config/wireless -wifi detect > /etc/config/wireless -rm /etc/config/network -/etc/init.d/defconfig start diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_dhcp.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_dhcp.sh index 707178d276..8cce8319a6 100755 --- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_dhcp.sh +++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_dhcp.sh @@ -23,15 +23,19 @@ config_foreach handle_dnsmasq dhcp if [ "$supports_vap" = 1 -a "$vap" = 1 ]; then uci batch <<- EOF set dhcp.${netrenamed}dhcp="dhcp" + set dhcp.${netrenamed}dhcp.ignore="0" set dhcp.${netrenamed}dhcp.interface="${netrenamed}dhcp" EOF set_defaults "dhcp_" dhcp.${netrenamed}dhcp fi ahdhcp_when_vap="$(uci get profile_$community.profile.adhoc_dhcp_when_vap)" -if [ "$supports_vap" = 0 ] || [ "$supports_vap" = 1 -a "$vap" = 1 -a "$ahdhcp_when_vap" = 1 ]; then +if [ "$supports_vap" = 0 ] || \ + [ "$supports_vap" = 1 -a "$vap" = 1 -a "$ahdhcp_when_vap" = 1 ] || \ + [ "$lan_is_olsr" = "1" -a "$lan_dhcp" = 1 ]; then uci batch <<- EOF set dhcp.${netrenamed}ahdhcp="dhcp" + set dhcp.${netrenamed}ahdhcp.ignore="0" set dhcp.${netrenamed}ahdhcp.interface="${netrenamed}ahdhcp" EOF fi diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall.sh index bf47241122..154b2b6913 100755 --- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall.sh +++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall.sh @@ -7,7 +7,6 @@ . $dir/functions.sh wan_is_olsr=$(uci -q get meshwizard.netconfig.wan_config) -lan_is_olsr=$(uci -q get meshwizard.netconfig.lan_config) config_load firewall @@ -34,7 +33,7 @@ handle_fwzone() { fi fi - if [ "$name" == "lan" ] && [ "$lan_is_olsr" == 1 ]; then + if [ "$name" == "lan" ] && [ "$lan_is_olsr" == "1" ]; then uci set firewall.$1.network=' ' && uci_commitverbose "LAN is used for olsr, removed the lan interface from zone lan" firewall fi } @@ -80,23 +79,30 @@ if [ ! "$no_masq_lan" == "1" ] && [ ! "$(uci -q get meshwizard.netconfig.lan_con fi -# Rules, Forwardings, advanced config and includes - -for config in freifunk profile_$community; do - - config_load $config +# Rules, Forwardings, advanced config and includes from freifunk and +# profile_$community config files. + +add_fw_rules() { + config_cb() { + local type="$1" + local name="$2" + local allowed_section_types="advanced include fw_rule fw_forwarding" + if is_in_list "$allowed_section_types" $type ; then + uci set firewall.${name}="${type/fw_/}" + option_cb() { + local option="$1" + local value="$2" + uci set firewall.${CONFIG_SECTION}.${option}="$value" + } + else + option_cb() { return; } + fi + } + config_load freifunk + config_load profile_${community} +} +add_fw_rules - for section in advanced include fw_rule fw_forwarding; do - handle_firewall() { - local options=$(uci show $config."$1") - options=$(echo "$options" | sed -e "s/fw_//g" -e "s/^$config/firewall/g") - for o in $options; do - uci set $o - done - } - config_foreach handle_firewall $section - done -done # If we use auto-ipv6-dhcp then allow 547/udp on the freifunk zone if [ "$ipv6_config" = "auto-ipv6-dhcpv6" ]; then diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh index d8aa8a095f..7035e7fb4b 100755 --- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh +++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh @@ -1,6 +1,6 @@ # setup entry in /etc/config/network for a interface # Argument $1: network interface - + net="$1" . /lib/functions.sh . $dir/functions.sh @@ -24,6 +24,13 @@ uci batch << EOF set network.$netrenamed.netmask="$netmask" EOF +if [ "$netrenamed" = "lan" ]; then + # remove the bridge if the interface is used for olsr + # since this script is only run in this case, no need + # to check for lan_proto = "olsr" currently. + uci -q delete network.lan.type +fi + # Setup IPv6 for the interface local ip6addr if [ "$ipv6_enabled" = 1 ]; then @@ -116,9 +123,16 @@ if [ "$net_dhcp" == 1 ]; then # Setup alias for $net adhoc interface - if [ "$supports_vap" = 0 ] || [ "$vap" = 0 ] || [ "$supports_vap" = 1 -a "$vap" = 1 -a "$ahdhcp_when_vap" = 1 ]; then - # vaps are either not supported or enabled or they are supported and enabled - # but we also want to use DHCP on the adhoc interface + if [ "$supports_vap" = 0 ] || \ + [ "$vap" = 0 ] || \ + [ "$supports_vap" = 1 -a "$vap" = 1 -a "$ahdhcp_when_vap" = 1 ] || \ + [ "$lan_is_olsr" = "1" ]; then + # setup an alias interface for the main interface to use as a network for clients + # when one of the following conditions is met + # * vaps are not supported + # * or not enabled + # * or they are supported and enabled but we also want to use DHCP on the adhoc interface + # * or this is the lan interface and it is used for olsrd (and dhcp is enabled) uci batch <<- EOF set network.${netrenamed}ahdhcp=interface set network.${netrenamed}ahdhcp.ifname="@${netrenamed}" @@ -126,6 +140,6 @@ if [ "$net_dhcp" == 1 ]; then set network.${netrenamed}ahdhcp.ipaddr="$STARTADHOC" set network.${netrenamed}ahdhcp.netmask="$NETMASKADHOC" EOF + uci_commitverbose "Setup interface for ${netrenamed}ahdhcp" network fi - uci_commitverbose "Setup interface for ${netrenamed}ahdhcp" network fi diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh index 9d18a582ac..d212ca4722 100755 --- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh +++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh @@ -115,14 +115,29 @@ setup_watchdog() { } setup_jsoninfo() { - # Setup jsoninfo + proto="$1" uci batch <<- EOF set $cfg.olsrd_jsoninfo=LoadPlugin set $cfg.olsrd_jsoninfo.library="olsrd_jsoninfo.so.0.0" EOF - uci_commitverbose "Setup olsr jsoninfo plugin" $cfg + if [ "$proto" = "6" ]; then + uci set $cfg.olsrd_jsoninfo.ipv6only='1' + fi + uci_commitverbose "Setup olsr jsoninfo plugin" $cfg } +setup_txtinfo() { + proto="$1" + uci batch <<- EOF + set $cfg.olsrd_txtinfo=LoadPlugin + set $cfg.olsrd_txtinfo.library="olsrd_txtinfo.so.0.1" + EOF + if [ "$proto" = "6" ]; then + uci set $cfg.olsrd_txtinfo.ipv6only='1' + fi + uci_commitverbose "Setup olsr txtinfo plugin" $cfg +} + for proto in $protocols; do cfg="olsrd" @@ -140,6 +155,6 @@ for proto in $protocols; do setup_nameservice setup_dyngw_plain setup_watchdog - setup_jsoninfo - + setup_jsoninfo $proto + setup_txtinfo $proto done diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_splash.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_splash.sh index 7cac3d6979..3c3e6a32e2 100755 --- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_splash.sh +++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_splash.sh @@ -25,7 +25,7 @@ splash_net_add() { EOF } -if [ "$(uci -q get meshwizard.netconfig.$net\_dhcp)" == 1 ] && [ -n "$dhcprange" ]; then +if [ "$(uci -q get meshwizard.netconfig.$net\_dhcp)" = 1 ] && [ -n "$dhcprange" ]; then handle_splash() { config_get network "$1" network if [ "$network" == "${netrenamed}dhcp" ]; then @@ -38,13 +38,15 @@ if [ "$(uci -q get meshwizard.netconfig.$net\_dhcp)" == 1 ] && [ -n "$dhcprange" config_foreach handle_splash iface if [ "$supports_vap" = 1 -a "$vap" = 1 ]; then - splash_net_add ${netrenamed}dhcp + splash_net_add ${netrenamed}dhcp uci_commitverbose "Setup dhcpsplash for ${netrenamed}dhcp" luci_splash fi ahdhcp_when_vap="$(uci get profile_$community.profile.adhoc_dhcp_when_vap)" - if [ "$supports_vap" = 0 ] || [ "$supports_vap" = 1 -a "$vap" = 1 -a "$ahdhcp_when_vap" = 1 ]; then - splash_net_add ${netrenamed}ahdhcp + if [ "$supports_vap" = 0 ] || \ + [ "$supports_vap" = 1 -a "$vap" = 1 -a "$ahdhcp_when_vap" = 1 ] || \ + [ "$lan_dhcp" = 1 ]; then + splash_net_add ${netrenamed}ahdhcp uci_commitverbose "Setup dhcpsplash for ${netrenamed}ahdhcp" luci_splash fi /etc/init.d/luci_splash enable diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh index 77c6cd95e9..372148997c 100755 --- a/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh +++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh @@ -9,15 +9,16 @@ # 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 -. /lib/functions.sh - echo " -/* Meshwizard 0.2.0 */ +/* Meshwizard 0.3.1 */ " # config export dir="/usr/bin/meshwizard" + +. /lib/functions.sh . $dir/functions.sh +. $dir/helpers/read_defaults.sh [ -f /proc/net/ipv6_route ] && export has_ipv6=1 # Check which packages we have installed @@ -28,30 +29,28 @@ opkg list_installed |grep luci-app-splash > /dev/null && export has_luci_splash= # Check whether we want to cleanup/restore uci config before setting new options cleanup=$(uci -q get meshwizard.general.cleanup) -[ "$cleanup" == 1 ] && $dir/helpers/restore_default_config.sh +[ "$cleanup" == 1 ] && restore_factory_defaults # Rename wifi interfaces $dir/helpers/rename-wifi.sh +export lan_is_olsr="$(uci -q get meshwizard.netconfig.lan_config)" + # Get community -community=$(uci -q get meshwizard.community.name || uci -q get freifunk.community.name) +community="$(uci -q get meshwizard.community.name || uci -q get freifunk.community.name)" [ -z "$community" ] && echo "Error: Community is not set in /etc/config/freifunk, aborting now." && exit 1 export community="$community" -echo $community + +# we need a list of widgets later on. It will be populated in read_defaults.sh +local widgets="" # Get a list of networks we need to setup networks=$(uci show meshwizard.netconfig | grep -v "netconfig=" | sed -e 's/meshwizard.netconfig\.\(.*\)\_.*/\1/' |sort|uniq) export networks [ -z "$networks" ] && echo "Error: No networks to setup could be found in /etc/config/meshwizard, aborting now." && exit 1 -# Read default values (first from /etc/config/freifunk, then from /etc/config/profile_$community -# then /etc/config/meshwizard -# last will overwrite first - -$dir/helpers/read_defaults.sh $community > /tmp/meshwizard.tmp -while read line; do - export "${line//\"/}" -done < /tmp/meshwizard.tmp +# Read defaults and node config +read_defaults $community # Do config $dir/helpers/initial_config.sh @@ -117,6 +116,13 @@ for net in $networks; do $dir/helpers/setup_olsrd_interface.sh $net net_dhcp=$(uci -q get meshwizard.netconfig.${net}_dhcp) + export ${net}_dhcp=$net_dhcp + + if [ "$net" = "lan" ] && [ "$lan_is_olsr" = "1" ]; then + uci -q set dhcp.lan.ignore="1" + uci_commitverbose "Disable DHCP on LAN because it is an olsr interface." dhcp + fi + if [ "$net_dhcp" == 1 ]; then $dir/helpers/setup_dhcp.sh $net fi diff --git a/documentation/CBI.md b/documentation/CBI.md new file mode 100644 index 0000000000..0b47c2248b --- /dev/null +++ b/documentation/CBI.md @@ -0,0 +1,248 @@ +CBI models are Lua files describing the structure of an UCI config file and the resulting HTML form to be evaluated by the CBI parser. +All CBI model files must return an object of type *luci.cbi.Map*. For a commented example of a CBI model, see the [[Documentation/ModulesHowTo#CBImodels|Writing Modules tutorial]]. + +The scope of a CBI model file is automatically extended by the contents of the module *luci.cbi_' and the '_translate* function from luci.i18n + +This Reference covers *the basics* of the CBI system. + + + +# class Map (_config'', ''title'', ''description_) +This is the root object of the model. +* *config*: configuration name to be mapped, see uci documentation and the files in /etc/config +* *title*: title shown in the UI +* *description*: description shown in the UI + +## :section (_sectionclass_, ...) +Creates a new section +* *sectionclass*: a class object of the section +* _additional parameters passed to the constructor of the section class_ + +---- + +# class NamedSection (_name'', ''type'', ''title'', ''description_) +An object describing an UCI section selected by the name. +Use [[#A.3Asection.28.27.27sectionclass.27.27.2C....29|Map:section(NamedSection, _name'', ''type'', ''title'', ''description_)]] to instantiate. +* *name*: section name +* *type*: section type +* *title*: The title shown in the UI +* *description*: description shown in the UI + +## .addremove = false +Allows the user to remove and recreate the configuration section + +## .dynamic = false +Marks this section as dynamic. Dynamic sections can contain an undefinded number of completely userdefined options. + +## .optional = true +Parse optional options + + +## :option (_optionclass_, ...) +Creates a new option +* *optionclass*: a class object of the section +* _additional parameters passed to the constructor of the option class_ + +---- + +# class TypedSection (_type'', ''title'', ''description_) +An object describing a group of UCI sections selected by their type. +Use [[#A.3Asection.28.27.27sectionclass.27.27.2C....29|Map:section(TypedSection, _type'', ''title'', ''description_)]] to instantiate. +* *type*: section type +* *title*: The title shown in the UI +* *description*: description shown in the UI + +## .addremove = false +Allows the user to remove and recreate the configuration section + +## .dynamic = false +Marks this section as dynamic. Dynamic sections can contain an undefinded number of completely userdefined options. + +## .optional = true +Parse optional options + +## .anonymous = false +Do not show section names + + +## :depends (_key'', ''value_) +Only select those sections where the option _key'' == ''value_<br /> +If you call this function several times the dependencies will be linked with *or* + +## .filter (_self'', ''section_) [abstract] +You can override this function to filter certain sections that will not be parsed. +The filter function will be called for every section that should be parsed and returns *nil* for sections that should be filtered. For all other sections it should return the section name as given in the second parameter. + +## :option (_optionclass_, ...) +Creates a new option + _optionclass_: a class object of the section + additional parameters passed to the constructor of the option class + +---- + +# class Value (_option'', ''title'', ''description_) +An object describing an option in a section of a UCI File. Creates a standard text field in the formular. +Use [[#A.3Aoption.28.27.27optionclass.27.27.2C....29|NamedSection:option(Value, _option'', ''title'', ''description'')]] or [[#A.3Aoption.28.27.27optionclass.27.27.2C....29-1|TypedSection:option(Value, ''option'', ''title'', ''description_)]] to instantiate. +* *option*: section name +* *title*: The title shown in the UI +* *description*: description shown in the UI + +## .default = nil +The default value + +## .maxlength = nil +The maximum length of the value + +## .optional = false +Marks this option as optional, implies .rmempty = true + +## .rmempty = true +Removes this option from the configuration file when the user enters an empty value + +## .size = nil +The size of the form field + +## :value (_key'', ''value'' = ''key_) +Convert this text field into a combobox if possible and add a selection option. + + +## :depends (_key'', ''value_) +Only show this option field if another option _key'' is set to ''value_ in the same section.<br /> +If you call this function several times the dependencies will be linked with *or* + +---- + +# class ListValue (_option'', ''title'', ''description_) +An object describing an option in a section of a UCI File. Creates a list box in the formular. +Use [[#A.3Aoption.28.27.27optionclass.27.27.2C....29|NamedSection:option(Value, _option'', ''title'', ''description'')]] or [[#A.3Aoption.28.27.27optionclass.27.27.2C....29-1|TypedSection:option(Value, ''option'', ''title'', ''description_)]] to instantiate. +* *option*: section name +* *title*: The title shown in the UI +* *description*: description shown in the UI + + +## .default = nil +The default value + +## .optional = false +Marks this option as optional, implies .rmempty = true + +## .rmempty = true +Removes this option from the configuration file when the user enters an empty value + +## .size = nil +The size of the form field + +## .widget = "select" +selects the form widget to be used + + +## :depends (_key'', ''value_) +Only show this option field if another option _key'' is set to ''value_ in the same section.<br /> +If you call this function several times the dependencies will be linked with *or* + +## :value (_key'', ''value'' = ''key_) +Adds an entry to the selection list + +---- + +# class Flag (_option'', ''title'', ''description_) +An object describing an option with two possible values in a section of a UCI File. Creates a checkbox field in the formular. +Use [[#A.3Aoption.28.27.27optionclass.27.27.2C....29|NamedSection:option(Value, _option'', ''title'', ''description'')]] or [[#A.3Aoption.28.27.27optionclass.27.27.2C....29-1|TypedSection:option(Value, ''option'', ''title'', ''description_)]] to instantiate. +* *option*: section name +* *title*: The title shown in the UI +* *description*: description shown in the UI + +## .default = nil +The default value + +## .disabled = 0 +the value that shoudl be set if the checkbox is unchecked + +## .enabled = 1 +the value that should be set if the checkbox is checked + +## .optional = false +Marks this option as optional, implies .rmempty = true + +## .rmempty = true +Removes this option from the configuration file when the user enters an empty value + +## .size = nil +The size of the form field + + +## :depends (_key'', ''value_) +Only show this option field if another option _key'' is set to ''value_ in the same section.<br /> +If you call this function several times the dependencies will be linked with *or* + +---- + +# class MultiValue (_option'', ''title'', ''description_) +An object describing an option in a section of a UCI File. Creates several checkboxed as form fields. +Use [[#A.3Aoption.28.27.27optionclass.27.27.2C....29|NamedSection:option(Value, _option'', ''title'', ''description'')]] or [[#A.3Aoption.28.27.27optionclass.27.27.2C....29-1|TypedSection:option(Value, ''option'', ''title'', ''description_)]] to instantiate. +* *option*: section name +* *title*: The title shown in the UI +* *description*: description shown in the UI + + +## .default = nil +The default value + +## .delimiter = " " +The string which will be used to delimit the values + +## .optional = false +Marks this option as optional, implies .rmempty = true + +## .rmempty = true +Removes this option from the configuration file when the user enters an empty value + +## .size = nil +The size of the form field + +## .widget = "checkbox" +selects the form widget to be used + + +## :depends (_key'', ''value_) +Only show this option field if another option _key'' is set to ''value_ in the same section.<br /> +If you call this function several times the dependencies will be linked with *or* + +## :value (_key'', ''value'' = ''key_) +Adds an entry to the checkbox list + +---- + +# class DummyValue (_option'', ''title'', ''description_) +An object describing an option in a section of a UCI File. Creates a readonly field in the form. +Use [[#A.3Aoption.28.27.27optionclass.27.27.2C....29|NamedSection:option(Value, _option'', ''title'', ''description'')]] or [[#A.3Aoption.28.27.27optionclass.27.27.2C....29-1|TypedSection:option(Value, ''option'', ''title'', ''description_)]] to instantiate. +* *option*: section name +* *title*: The title shown in the UI +* *description*: description shown in the UI + + + +## :depends (_key'', ''value_) +Only show this option field if another option _key'' is set to ''value_ in the same section.<br /> +If you call this function several times the dependencies will be linked with *or* + +---- + + +# class TextValue (_option'', ''title'', ''description_) +An object describing a multi-line textbox in a section in a non-UCI form. + +---- + +# class Button (_option'', ''title'', ''description_) +An object describing a Button in a section in a non-UCI form. + +---- + +# class StaticList (_option'', ''title'', ''description_) +Similar to the MultiValue, but stores selected Values into a UCI list instead of a space-separated string. + +---- + +# class DynamicList (_option'', ''title'', ''description_) +A list of user-defined values. diff --git a/documentation/JsonRpcHowTo.md b/documentation/JsonRpcHowTo.md new file mode 100644 index 0000000000..76d61f86e3 --- /dev/null +++ b/documentation/JsonRpcHowTo.md @@ -0,0 +1,66 @@ +LuCI provides some of its libraries to external applications through a JSON-RPC API. +This Howto shows how to use it and provides information about available functions. + + +# Basics +LuCI comes with an efficient JSON De-/Encoder together with a JSON-RPC-Server which implements the *JSON-RPC 1.0_' and 2.0 (partly) specifications. The LuCI JSON-RPC server offers several independent APIs. Therefore you have to use '_different URLs for every exported library*. +Assuming your LuCI-Installation can be reached through */cgi-bin/luci_' any exported library can be reached via '''/cgi-bin/luci/rpc/''LIBRARY_*. + + +# Authentication +Most exported libraries will require a valid authentication to be called with. If you get an *HTTP 403 Forbidden_' status code you are probably missing a valid authentication token. To get such a token you have to call the function '''login''' of the RPC-Library '''auth'''. Following our example from above this login function would be provided at '_/cgi-bin/luci/rpc/auth*. The function accepts 2 parameters: username and password (of a valid user account on the host system) and returns an authentication token. + +If you want to call any exported library which requires an authentication token you have to *append it as an URL parameter _auth''''' to the RPC-Server URL. So instead of calling '''/cgi-bin/luci/rpc/''LIBRARY''''' you have to call '''/cgi-bin/luci/rpc/''LIBRARY''?auth=''TOKEN_*. + +If your JSON-RPC client is Cookie-aware (like most browsers are) you will receive the authentication token also with a session cookie and probably don't have to append it to the RPC-Server URL. + + +# Exported Libraries +## uci +The UCI-Library */rpc/uci* offers functionality to interact with the Universal Configuration Interface. +*Exported Functions:* +* [(string) add(config, type)](http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.add) +* [(integer) apply(config)](http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.apply) +* [http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.changes (object) changes([config])] +* [(boolean) commit(config)](http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.commit) +* [http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.delete (boolean) delete(config, section[, option])] +* [http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.delete_all (boolean) delete_all(config[, type])] +* [http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.foreach (array) foreach(config[, type])] +* [http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.get (mixed) get(config, section[, option])] +* [http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.get_all (object) get_all(config[, section])] +* [http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.get (mixed) get_state(config, section[, option])] +* [(boolean) revert(config)](http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.revert) +* [(name) section(config, type, name, values)](http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.section) +* [(boolean) set(config, section, option, value)](http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.set) +* [(boolean) tset(config, section, values)](http://luci.subsignal.org/api/luci/modules/luci.model.uci.html#Cursor.tset) + +## uvl +The UVL-Library */rpc/uvl* offers functionality to validate UCI files and get schemes describing UCI files. +*Exported Functions:* +* [(array) get_scheme(scheme)](http://luci.subsignal.org/api/luci/modules/luci.uvl.html#UVL.get_scheme) +* [(array) validate(config, section, option)](http://luci.subsignal.org/api/luci/modules/luci.uvl.html#UVL.validate) +* [(array) validate_config(config)](http://luci.subsignal.org/api/luci/modules/luci.uvl.html#UVL.validate_config) +* [(array) validate_section(config, section)](http://luci.subsignal.org/api/luci/modules/luci.uvl.html#UVL.validate_section) +* [(array) validate(config, section, option)](http://luci.subsignal.org/api/luci/modules/luci.uvl.html#UVL.validate_option) + +## fs +The Filesystem library */rpc/fs* offers functionality to interact with the filesystem on the host machine. +*Exported Functions:* + +* [Complete luci.fs library](http://luci.subsignal.org/api/luci/modules/luci.fs.html) +*Note:* All functions are exported as they are except for _readfile'' which encodes its return value in base64 and ''writefile'' which only accepts base64 encoded data as second argument. Note that both functions will only be available when the ''luasocket_ packet is installed on the hostsystem. + +## sys +The System library */rpc/sys* offers functionality to interact with the operating system on the host machine. +*Exported Functions:* +* [Complete luci.sys library](http://luci.subsignal.org/api/luci/modules/luci.sys.html) +* [Complete luci.sys.group library](http://luci.subsignal.org/api/luci/modules/luci.sys.group.html) with prefix *group.* +* [Complete luci.sys.net library](http://luci.subsignal.org/api/luci/modules/luci.sys.net.html) with prefix *net.* +* [Complete luci.sys.process library](http://luci.subsignal.org/api/luci/modules/luci.sys.process.html) with prefix *process.* +* [Complete luci.sys.user library](http://luci.subsignal.org/api/luci/modules/luci.sys.user.html) with prefix *user.* +* [Complete luci.sys.wifi library](http://luci.subsignal.org/api/luci/modules/luci.sys.wifi.html) with prefix *wifi.* + +## ipkg +The IPKG library */rpc/ipkg* offers functionality to interact with the package manager (IPKG or OPKG) on the host machine. +*Exported Functions:* +* [Complete luci.model.ipkg library](http://luci.subsignal.org/api/luci/modules/luci.model.ipkg.html) diff --git a/documentation/LAR.md b/documentation/LAR.md new file mode 100644 index 0000000000..f44d8dc7df --- /dev/null +++ b/documentation/LAR.md @@ -0,0 +1,87 @@ +LAR is a simple archive format to pack multiple lua source files and arbitary other resources into a single file. + + +# Format Specification + +A LAR archive file is divided into two parts: the payload and the index lookup table. +All segments of the archive are 4 Byte aligned to ease reading and processing of the format. +All integers are stored in network byte order, so an implementation has to use htonl() and htons() to properly read them. + +Schema: + + <payload: + <member: + <N*4 bytes: path of file #1> + <N*4 bytes: data of file #1> + > + + <member: + <N*4 bytes: path of file #2> + <N*4 bytes: data of file #2> + > + + ... + + <member: + <N*4 bytes: path of file #N> + <N*4 bytes: data of file #N> + > + > + + <index table: + <entry: + <uint32: offset for path of file #1> <uint32: length for path of file #1> + <uint32: offset for data of file #1> <uint32: length for data of file #1> + <uint16: type of file #1> <uint16: flags of file #1> + > + + <entry: + <uint32: offset for path of file #2> <uint32: length for path of file #2> + <uint32: offset for data of file #2> <uint32: length for data of file #2> + <uint16: type of file #2> <uint16: flags of file #2> + > + + ... + + <entry: + <uint32: offset for path of file #N> <uint32: length for path of file #N> + <uint32: offset for data of file #N> <uint32: length for data of file #N> + <uint16: type of file #N> <uint16: flags of file #N> + > + > + + <uint32: offset for begin of index table> + + + +# Processing + +In order to process an LAR archive, an implementation would have to do the following steps: + +## Read Index + +1. Locate and open the archive file +1. Seek to end of file - 4 bytes +1. Read 32bit index offset and swap from network to native byte order +1. Seek to index offset, calculate index length: filesize - index offset - 4 +1. Initialize a linked list for index table entries +1. Read each index entry until the index length is reached, read and byteswap 4 * 32bit int and 2 * 16bit int +1. Seek to begin of file + +## Read Member + +1. Read the archive index +1. Iterate through the linked index list, perform the following steps for each entry +1. Seek to the specified file path offset +1. Read as much bytes as specified in the file path length into a buffer +1. Compare the contents of the buffer against the path of the searched member +1. If buffer and searched path are equal, seek to the specified file data offset +1. Read data until the file data length is reached, return +1. Select the next index table entry and repeat from step 3, if there is no next entry then return + +# Reference implementation + +A reference implementation can be found here: +http://luci.subsignal.org/trac/browser/luci/trunk/contrib/lar + +The lar.pl script is a simple packer for LAR archives and cli.c provides a utility to list and dump packed LAR archives. diff --git a/documentation/LMO.md b/documentation/LMO.md new file mode 100644 index 0000000000..961a45ba84 --- /dev/null +++ b/documentation/LMO.md @@ -0,0 +1,144 @@ +LMO is a simple binary format to pack language strings into a more efficient form. Although it's suitable to store any kind of key-value table, it's only used for the LuCI *.po based translation system at the moment. The abbreviation "LMO" stands for "Lua Machine Objects" in the style of the GNU gettext *.mo format. + + +# Format Specification + +A LMO file is divided into two parts: the payload and the index lookup table. +All segments of the file are 4 Byte aligned to ease reading and processing of the format. +Only unsigned 32bit integers are used and stored in network byte order, so an implementation has to use htonl() to properly read them. + +Schema: + + <file: + <payload: + <entry #1: 4 byte aligned data> + + <entry #2: 4 byte aligned data> + + ... + + <entry #N: 4 byte aligned data> + > + + <index table: + <entry #1: + <uint32_t: hash of the first key> + <uint32_t: hash of the first value> + <uint32_t: file offset of the first value> + <uint32_t: length of the first value> + > + + <entry #2: + <uint32_t: hash of the second key> + <uint32_t: hash of the second value> + <uint32_t: file offset of the second value> + <uint32_t: length of the second value> + > + + ... + + <entry #N: + <uint32_t: hash of the Nth key> + <uint32_t: hash of the Nth value> + <uint32_t: file offset of the Nth value> + <uint32_t: length of the Nth value> + > + > + + <uint32_t: offset of the begin of index table> + > + + + +# Processing + +In order to process a LMO file, an implementation would have to do the following steps: + +## Read Index + +1. Locate and open the archive file +1. Seek to end of file - 4 bytes (sizeof(uint32_t)) +1. Read 32bit index offset and swap from network to native byte order +1. Seek to index offset, calculate index length: filesize - index offset - 4 +1. Initialize a linked list for index table entries +1. Read each index entry until the index length is reached, read and byteswap 4 * uint32_t for each step +1. Seek to begin of file + +## Read Entry + +1. Calculate the unsigned 32bit hash of the entries key value (see "Hash Function" section below) +1. Obtain the archive index +1. Iterate through the linked index list, perform the following steps for each entry: + 1. Compare the entry hash value with the calculated hash from step 1 + 2. If the hash values are equal proceed with step 4 + 3. Select the next entry and repeat from step 3.1 +1. Seek to the file offset specified in the selected entry +1. Read as much bytes as specified in the entry length into a buffer +1. Return the buffer value + +# Hash Function + +The current LuCI-LMO implementation uses the "Super Fast Hash" function which was kindly put in the public domain by it's original author. See http://www.azillionmonkeys.com/qed/hash.html for details. Below is the C-Implementation of this function: + + + #if (defined(__GNUC__) && defined(__i386__)) + #define sfh_get16(d) (*((const uint16_t *) (d))) + #else + #define sfh_get16(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8)\ + +(uint32_t)(((const uint8_t *)(d))[0]) ) + #endif + + uint32_t sfh_hash(const char * data, int len) + { + uint32_t hash = len, tmp; + int rem; + + if (len <= NULL) return 0; + + rem = len & 3; + len >>= 2; + + /* Main loop */ + for (;len > 0; len--) { + hash += sfh_get16(data); + tmp = (sfh_get16(data+2) << 11) ^ hash; + hash = (hash << 16) ^ tmp; + data += 2*sizeof(uint16_t); + hash += hash >> 11; + } + + /* Handle end cases */ + switch (rem) { + case 3: hash += sfh_get16(data); + hash ^= hash << 16; + hash ^= data[sizeof(uint16_t)] << 18; + hash += hash >> 11; + break; + case 2: hash += sfh_get16(data); + hash ^= hash << 11; + hash += hash >> 17; + break; + case 1: hash += *data; + hash ^= hash << 10; + hash += hash >> 1; + } + + /* Force "avalanching" of final 127 bits */ + hash ^= hash << 3; + hash += hash >> 5; + hash ^= hash << 4; + hash += hash >> 17; + hash ^= hash << 25; + hash += hash >> 6; + + return hash; + } + + +# Reference Implementation + +A reference implementation can be found here: +http://luci.subsignal.org/trac/browser/luci/trunk/libs/lmo/src + +The lmo_po2lmo.c executable implements a *.po to *.lmo conversation utility and lmo_lookup.c is a simple *.lmo test utility. +Lua bindings for lmo are defined in lmo_lualib.c and associated headers. diff --git a/documentation/LuCI-0.10.md b/documentation/LuCI-0.10.md new file mode 100644 index 0000000000..5db9895e58 --- /dev/null +++ b/documentation/LuCI-0.10.md @@ -0,0 +1,202 @@ +[[PageOutline(2-5, Table of Contents, floated)]] + + +This document describes new features and incompatibilities to LuCI 0.9.x. +It is targeted at module authors developing external addons to LuCI. + +# I18N Changes + +## API + +The call conventions for the i18n api changed, there is no dedicated translation +key anymore and the english text is used for lookup instead. This was done to +ease the maintenance of language files. + +Code that uses _translate()'' or ''i18n()_ must be changed as follows: + + + -- old style: + translate("some_text", "Some Text") + translatef("some_format_text", "Some formatted Text: %d", 123) + + -- new style: + translate("Some Text") + translatef("Some formatted Text: %d", 123) + + +Likewise for templates: + + + <!-- old style: --> + <%:some_text Some Text%> + + <!-- new style: --> + <%:Some Text%> + + +If code must support both LuCI 0.9.x and 0.10.x versions, it is suggested to write the calls as follows: + + translate("Some Text", "Some Text") + + +An alternative is wrapping translate() calls into a helper function: + + function tr(key, alt) + return translate(key) or translate(alt) or alt + end + + +... which is used as follows: + + tr("some_key", "Some Text") + + +## Translation File Format + +Translation catalogs are now maintained in *.po format files. During build those get translated +into [*.lmo archives](http://luci.subsignal.org/trac/wiki/Documentation/LMO). + +LuCI ships a [utility script](http://luci.subsignal.org/trac/browser/luci/branches/luci-0.10/build/i18n-lua2po.pl) +in the build/ directory to convert old Lua translation files to the *.po format. The generated *.po files should +be placed in the appropriate subdirectories within the top po/ file in the LuCI source tree. + +### Components built within the LuCI tree + +If components using translations are built along with the LuCI tree, the newly added *.po file are automatically +compiled into *.lmo archives during the build process. In order to bundle the appropriate *.lmo files into the +corresponding *.ipk packages, component Makefiles must include a "PO" variable specifying the files to include. + +Given a module _applications/example/'' which uses ''po/en/example.po'' and ''po/en/example-extra.po_, +the _applications/example/Makefile_ must be changed as follows: + + + PO = example example-extra + + include ../../build/config.mk + include ../../build/module.mk + + +### Standalone components + +Authors who externally package LuCI components must prepare required *.lmo archives themselves. +To convert existing Lua based message catalogs to the *.po format, the build/i18n-lua2po.pl helper script can be used. +In order to convert *.po files into *.lmo files, the standalone "po2lmo" utility must be compiled as follows: + + + $ svn co http://svn.luci.subsignal.org/luci/branches/luci-0.10/libs/lmo + $ cd lmo/ + $ make + $ ./src/po2lmo translations.po translations.lmo + + +Note that at the time of writing, the utility program needs Lua headers installed on the system in order to compile properly. + +# CBI + +## Datatypes + +The server side UVL validation has been dropped to reduce space requirements on the target. +Instead it is possible to define datatypes for CBI widgets now: + + + opt = section:option(Value, "optname", "Title Text") + opt.datatype = "ip4addr" + + +User provided data is validated once on the frontend via JavaScript and on the server side prior to saving it. +A list of possible datatypes can be found in the [luci.cbi.datatypes](http://luci.subsignal.org/trac/browser/luci/branches/luci-0.10/libs/web/luasrc/cbi/datatypes.lua#L26) class. + +## Validation + +Server-sided validator function can now return custom error messages to provide better feedback on invalid input. + + + opt = section:option(Value, "optname", "Title Text") + + function opt.validate(self, value, section) + if input_is_valid(value) then + return value + else + return nil, "The value is invalid because ..." + end + end + + +## Tabs + +It is now possible to break up CBI sections into multiple tabs to better organize longer forms. +The TypedSection and NamedSection classes gained two new functions to define tabs, _tab()'' and ''taboption()_. + + + sct = map:section(TypedSection, "name", "type", "Title Text") + + sct:tab("general", "General Tab Title", "General Tab Description") + sct:tab("advanced", "Advanced Tab Title", "Advanced Tab Description") + + opt = sct:taboption("general", Value, "optname", "Title Text") + ... + + +The _tab()_ function is declares a new tab and takes up to three arguments: + * Internal name of the tab, must be unique within the section + * Title text of the tab + * Optional description text for the tab + +The _taboption()'' function wraps ''option()_ and assigns the option object to the given tab. +It takes up to five arguments: + + * Name of the tab to assign the option to + * Option type, e.g. Value or DynamicList + * Option name + * Title text of the option + * Optional description text of the option + +If tabs are used within a particular section, the _option()_ function must not be used, +doing so results in undefined behaviour. + +## Hooks + +The CBI gained support for _hooks_ which can be used to trigger additional actions during the +life-cycle of a map: + + + map = Map("config", "Title Text") + + function map.on_commit(self) + -- do something if the UCI configuration got committed + end + + +The following hooks are defined: + +|| on_cancel || The user pressed cancel within a multi-step Delegator or a SimpleForm instance || +|| on_init || The CBI is about to render the Map object || +|| on_parse || The CBI is about to read received HTTP form values || +|| on_save, on_before_save || The CBI is about to save modified UCI configuration files || +|| on_after_save || Modified UCI configuration files just got saved +|| on_before_commit || The CBI is about to commit the changes || +|| on_commit, on_after_commit, on_before_apply || Modified configurations got committed and the CBI is about to restart associated services || +|| on_apply, on_after_apply || All changes where completely applied (only works on Map instances with the apply_on_parse attribute set) || + +## Sortable Tables + +TypedSection instances which use the "cbi/tblsection" template may now use a new attribute _sortable_ to allow the user to reorder table rows. + + + sct = map:section(TypedSection, "name", "type", "Title Text") + sct.template = "cbi/tblsection" + sct.sortable = true + + ... + + +# JavaScript + +The LuCI 0.10 branch introduced a new JavaScript file _xhr.js_ which provides support routines for XMLHttpRequest operations. +Each theme must include this file in the <head> area of the document for forms to work correctly. + +It should be included like this: + + + <script type="text/javascript" src="<%=resource%>/xhr.js"></script> +
\ No newline at end of file diff --git a/documentation/Modules.md b/documentation/Modules.md new file mode 100644 index 0000000000..2897df9488 --- /dev/null +++ b/documentation/Modules.md @@ -0,0 +1,94 @@ +# Categories + +The LuCI modules are divided into several category directories, namely: +* applications (Single applications or plugins for other modules or applications) +* i18n (Translation files) +* libs (Independent libraries) +* modules (Collections of applications) +* themes (Frontend themes) + +Each module goes into a subdirectory of any of this category-directories. + +# Module directory +The contents of a module directory are as follows: + +## Makefile +This is the module's makefile. If the module just contains Lua sourcecode or resources then the following Makefile should suffice. + + include ../../build/config.mk + include ../../build/module.mk + + +If you have C(++) code in your module your Makefile should at least contain the following things. + + include ../../build/config.mk + include ../../build/gccconfig.mk + include ../../build/module.mk + + compile: + # Commands to compile and link your C-code + # and to install them under the dist/ hierarchy + + clean: luaclean + # Commands to clean your compiled objects + + + +## src +The *src* directory is reserved for C sourcecode. + +## luasrc +*luasrc* contains all Lua sourcecode files. These will automatically be stripped or compiled depending on the Make target and are installed in the LuCI installation directory. + +## lua +*lua* is equivalent to _luasrc_ but containing Lua files will be installed in the Lua document root. + +## htdocs +All files under *htdocs* will be copied to the document root of the target webserver. + +## root +All directories and files under *root* will be copied to the installation target as they are. + +## dist +*dist* is reserved for the builder to create a working installation tree that will represent the filesystem on the target machine. +*DO NOT* put any files there as they will get deleted. + +## ipkg +*ipkg* contains IPKG package control files, like _preinst'', ''posinst'', ''prerm'', ''postrm''. ''conffiles_. +See IPKG documentation for details. + + +# OpenWRT feed integration +If you want to add your module to the LuCI OpenWRT feed you have to add several sections to the contrib/package/luci/Makefile. + +For a Web UI applications this is: + +A package description: + + define Package/luci-app-YOURMODULE + $(call Package/luci/webtemplate) + DEPENDS+=+some-package +some-other-package + TITLE:=SHORT DESCRIPTION OF YOURMODULE + endef + + + +A package installation target: + + define Package/luci-app-YOURMODULE/install + $(call Package/luci/install/template,$(1),applications/YOURMODULE) + endef + + +A module build instruction: + + ifneq ($(CONFIG_PACKAGE_luci-app-YOURMODULE),) + PKG_SELECTED_MODULES+=applications/YOURMODULE + endif + + + +A build package call: + + $(eval $(call BuildPackage,luci-app-YOURMODULE)) + diff --git a/documentation/ModulesHowTo.md b/documentation/ModulesHowTo.md new file mode 100644 index 0000000000..3f70b788c5 --- /dev/null +++ b/documentation/ModulesHowTo.md @@ -0,0 +1,153 @@ +*Note:* If you plan to integrate your module into LuCI, you should read the [wiki:Documentation/Modules Module Reference] before. + +This tutorial describes how to write your own modules for the LuCI WebUI. +For this tutorial we refer to your LuCI installation direcotry as *lucidir_' (/usr/lib/lua/luci if you are working with an installed version) and assume your LuCI installation is reachable through your webserver via '_/cgi-bin/luci*. + +If you are working with the development environment replace *lucidir_' with '''''/path/to/your/luci/checkout''/applications/myapplication/luasrc''' (this is a default empty module you can use for your experiments) and your LuCI installation can probably be reached via http://localhost:8080/luci/ after you ran '_make runhttpd*. + + + +# Show me the way (The dispatching process) +To write a module you need to understand the basics of the dispatching process in LuCI. +LuCI uses a dispatching tree that will be built by executing the index-Function of every available controller. +The CGI-environment variable *PATH_INFO* will be used as the path in this dispatching tree, e.g.: /cgi-bin/luci/foo/bar/baz +will be resolved to foo.bar.baz + +To register a function in the dispatching tree, you can use the *entry*-function of _luci.dispatcher_. entry takes 4 arguments (2 are optional): + + entry(path, target, title=nil, order=nil) + + +* *path* is a table that describes the position in the dispatching tree: For example a path of {"foo", "bar", "baz"} would insert your node in foo.bar.baz. +* *target* describes the action that will be taken when a user requests the node. There are several predefined ones of which the 3 most important (call, template, cbi) are described later on on this page +* *title* defines the title that will be visible to the user in the menu (optional) +* *order* is a number with which nodes on the same level will be sorted in the menu (optional) + +You can assign more attributes by manipulating the node table returned by the entry-function. A few example attributes: + +* *i18n* defines which translation file should be automatically loaded when the page gets requested +* *dependent* protects plugins to be called out of their context if a parent node is missing +* *leaf* stops parsing the request at this node and goes no further in the dispatching tree +* *sysauth* requires the user to authenticate with a given system user account + + +# It's all about names (Naming and the module file) +Now that you know the basics about dispatching, we can start writing modules. But before you have to choose the category and name of your new digital child. + +We assume you want to create a new application "myapp" with a module "mymodule". + +So you have to create a new subdirectory *_lucidir''/controller/myapp''' with a file '_mymodule.lua* with the following content: + + module("luci.controller.myapp.mymodule", package.seeall) + + function index() + + end + + +The first line is required for Lua to correctly identify the module and create its scope. +The index-Function will be used to register actions in the dispatching tree. + + + +# Teaching your new child (Actions) +So it is there and has a name but it has no actions. + +We assume you want to reuse your module myapp.mymodule that you begun in the last step. + + +## Actions +Reopen *_lucidir_/controller/myapp/mymodule.lua* and just add a function to it so that its content looks like this example: + + + module("luci.controller.myapp.mymodule", package.seeall) + + function index() + entry({"click", "here", "now"}, call("action_tryme"), "Click here", 10).dependent=false + end + + function action_tryme() + luci.http.prepare_content("text/plain") + luci.http.write("Haha, rebooting now...") + luci.sys.reboot() + end + + +And now type */cgi-bin/luci/click/here/now_' ('_[http://localhost:8080/luci/click/here/now]* if you are using the development environment) in your browser. + +You see these action functions simple have to be added to a dispatching entry. + +As you might or might not know: CGI specification requires you to send a Content-Type header before you can send your content. You will find several shortcuts (like the one used above) as well as redirecting functions in the module *luci.http* + +## Views +If you only want to show the user a text or some interesting familiy photos it may be enough to use a HTML-template. These templates can also include some Lua code but be aware that writing whole office suites by only using these templates might be called "dirty" by other developers. + +Now let's create a little template *_lucidir_/view/myapp-mymodule/helloworld.htm* with the content: + + + <%+header%> + <h1><%:Hello World%></h1> + <%+footer%> + + + +and add the following line to the index-Function of your module file. + + entry({"my", "new", "template"}, template("myapp-mymodule/helloworld"), "Hello world", 20).dependent=false + + +Now type */cgi-bin/luci/my/new/template_' ('_[http://localhost:8080/luci/my/new/template]* if you are using the development environment) in your browser. + +You may notice those fancy <% %>-Tags, these are [wiki:Documentation/Templates|template markups] used by the LuCI template processor. +It is always good to include header and footer at the beginning and end of a template as those create the default design and menu. + +## CBI models +The CBI is one of the uber coolest features of LuCI. It creates a formular based user interface and saves its contents to a specific UCI config file. You only have to describe the structure of the configuration file in a CBI model file and Luci does the rest of the work. This includes generating, parsing and validating a XHTML form and reading and writing the UCI file. + +So let's be serious at least for this paragraph and create a real pratical example *_lucidir_/model/cbi/myapp-mymodule/netifaces.lua* with the following contents: + + + m = Map("network", "Network") -- We want to edit the uci config file /etc/config/network + + s = m:section(TypedSection, "interface", "Interfaces") -- Especially the "interface"-sections + s.addremove = true -- Allow the user to create and remove the interfaces + function s:filter(value) + return value ~= "loopback" and value -- Don't touch loopback + end + s:depends("proto", "static") -- Only show those with "static" + s:depends("proto", "dhcp") -- or "dhcp" as protocol and leave PPPoE and PPTP alone + + p = s:option(ListValue, "proto", "Protocol") -- Creates an element list (select box) + p:value("static", "static") -- Key and value pairs + p:value("dhcp", "DHCP") + p.default = "static" + + s:option(Value, "ifname", "interface", "the physical interface to be used") -- This will give a simple textbox + + s:option(Value, "ipaddr", translate("ip", "IP Address")) -- Ja, das ist eine i18n-Funktion ;-) + + s:option(Value, "netmask", "Netmask"):depends("proto", "static") -- You may remember this "depends" function from above + + mtu = s:option(Value, "mtu", "MTU") + mtu.optional = true -- This one is very optional + + dns = s:option(Value, "dns", "DNS-Server") + dns:depends("proto", "static") + dns.optional = true + function dns:validate(value) -- Now, that's nifty, eh? + return value:match("[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") -- Returns nil if it doesn't match otherwise returns match + end + + gw = s:option(Value, "gateway", "Gateway") + gw:depends("proto", "static") + gw.rmempty = true -- Remove entry if it is empty + + return m -- Returns the map + + +and of course don't forget to add something like this to your module's index-Function. + + entry({"admin", "network", "interfaces"}, cbi("myapp-mymodule/netifaces"), "Network interfaces", 30).dependent=false + + +There are many more features, see [wiki:Documentation/CBI the CBI reference] and the modules shipped with LuCI. diff --git a/documentation/SubmitPatchesHowTo:.md b/documentation/SubmitPatchesHowTo:.md new file mode 100644 index 0000000000..cdd15524a5 --- /dev/null +++ b/documentation/SubmitPatchesHowTo:.md @@ -0,0 +1,33 @@ +# Checkout svn + + svn co http://svn.luci.subsignal.org/luci/trunk + +and change to that directory: + + cd trunk + +# Make your changes + +Edit the files you want to change. If you add some new files you need to add them to the svn tree: + + svn add <dir/files> + +Where <dir/files> are the directories/files you have added. Its possible to specify multiple files/directories here. + +# Use svn diff to generate a patch with your changes + +To check if your changes look ok first do: + + svn diff <dir/files> + +and check the output. Again you can specify multiple dirs/directories here. + +If everything looks like expected save the patch: + + svn diff <dir/files> > ./mypatch.patch + + +# Submit patches + +Use the [Ticket system](http://luci.subsignal.org/trac/newticket) to submit your patch. + diff --git a/documentation/Templates.md b/documentation/Templates.md new file mode 100644 index 0000000000..dc42c28ab7 --- /dev/null +++ b/documentation/Templates.md @@ -0,0 +1,65 @@ +LuCI has a simple regex based template processor which parses HTML-files to Lua functions and allows to store precompiled template files. +The simplest form of a template is just an ordinary HTML-file. It will be printed out to the user as is. + +In LuCI every template is an object with an own scope. It can therefore be instanciated and each instance can has a different scope. As every template processor. LuCI supports several special markups. Those are enclosed in `<% %>`-Tags. + +By adding `-` (dash) right after the opening `<%` every whitespace before the markup will be stripped. Adding a `-` right before the closing `%>` will equivalently strip every whitespace behind the markup. + + +# Builtin functions and markups +## Including Lua code +*Markup:* + + <% code %> + + + +## Writing variables and function values +*Syntax:* + + <% write (value) %> + + +*Short-Markup:* + + <%=value%> + + +## Including templates +*Syntax:* + + <% include (templatename) %> + + +*Short-Markup:* + + <%+templatename%> + + + +## Translating +*Syntax:* + + <%= translate("Text to translate") %> + + + +*Short-Markup:* + + <%:Text to translate%> + + + +## Commenting +*Markup:* + + <%# comment %> + + +# Builtin constants +| Name | Value | +---------|--------- +|`REQUEST_URI`|The current URL (without server part)| +|`controller`|Path to the Luci main dispatcher| +|`resource`|Path to the resource directory| +|`media`|Path to the active theme directory| diff --git a/documentation/ThemesHowTo.md b/documentation/ThemesHowTo.md new file mode 100644 index 0000000000..32154c724c --- /dev/null +++ b/documentation/ThemesHowTo.md @@ -0,0 +1,76 @@ +# HowTo: Create Themes +*Note:* You should read the [Module Reference](Modules.md) and the [Template Reference](Templates.md) before. + +We assume you want to call your new theme _mytheme_. Make sure you replace this by your module name everytime this is mentionend in this Howto. + + + +# Creating the structure +At first create a new theme directory *themes/_mytheme_*. + +Create a _Makefile_ inside your theme directory with the following content: + + include ../../build/config.mk + include ../../build/module.mk + + +Create the following directory structure inside your theme directory. +* ipkg +* htdocs + * luci-static + * _mytheme_ +* luasrc + * view + * themes + * _mytheme_ +* root + * etc + * uci-defaults + + + +# Designing +Create two LuCI HTML-Templates named _header.htm'' and ''footer.htm'' under *luasrc/view/themes/''mytheme_*. +The _header.htm'' will be included at the beginning of each rendered page and the ''footer.htm_ at the end. +So your _header.htm'' will probably contain a DOCTYPE description, headers, the menu and layout of the page and the ''footer.htm_ will close all remaining open tags and may add a footer bar but hey that's your choice you are the designer ;-). + +Just make sure your _header.htm_ *begins* with the following lines: + + <% + require("luci.http").prepare_content("text/html") + -%> + + +This makes sure your content will be sent to the client with the right content type. Of course you can adapt _text/html_ to your needs. + + +Put any stylesheets, Javascripts, images, ... into *htdocs/luci-static/_mytheme_*. +You should refer to this directory in your header and footer templates as: _<%=media%>''. That means for a stylesheet *htdocs/luci-static/''mytheme_/cascade.css* you would write: + + <link rel="stylesheet" type="text/css" href="<%=media%>/cascade.css" /> + + + + +# Making the theme selectable +If you are done with your work there are two last steps to do. +To make your theme OpenWRT-capable and selectable on the settings page you should now create a file *root/etc/uci-defaults/luci-theme-_mytheme_* with the following contents: + + #!/bin/sh + uci batch <<-EOF + set luci.themes.MyTheme=/luci-static/mytheme + commit luci + EOF + + +and another file *ipkg/postinst* with the following content: + + #!/bin/sh + [ -n "${IPKG_INSTROOT}" ] || { + ( . /etc/uci-defaults/luci-theme-mytheme ) && rm -f /etc/uci-defaults/luci-theme-mytheme + } + + +This is some OpenWRT magic to correctly register the template with LuCI when it gets installed. + +That's all. Now send your theme to the LuCI developers to get it into the development repository - if you like. diff --git a/documentation/i18n.md b/documentation/i18n.md new file mode 100644 index 0000000000..fdacb0853a --- /dev/null +++ b/documentation/i18n.md @@ -0,0 +1,17 @@ +# General +Translations are saved in the folder po/. You find the reference in po/templates/<package>.pot. The actual translation files can be found at po/<lang>/<package>.po . + +In order to use the commands below you need to have the _gettext'' utilities (''msgcat'', ''msgfmt'', ''msgmerge_) installed on your system. + +# Rebuild po files +If you want to rebuild the translations after you made changes to a package this is an easy way: + + + ./build/i18n-scan.pl applications/[package] > po/templates/[application].pot + ./build/i18n-update.pl po [application].po + +*Note:* Some packages share translation files, in this case you need to scan through all their folders. The first command from above should then be: + + + ./build/i18n-scan.pl applications/[package-1] applications/[package-2] applications/[package-n] > po/templates/[application].pot + diff --git a/libs/luci-lib-json/luasrc/json.lua b/libs/luci-lib-json/luasrc/json.lua index 416b25faa5..f7b57f916c 100644 --- a/libs/luci-lib-json/luasrc/json.lua +++ b/libs/luci-lib-json/luasrc/json.lua @@ -149,11 +149,13 @@ function Encoder.parse_iter(self, obj) local first = true for key, entry in pairs(obj) do - first = first or self:put(",") - first = first and false - self:parse_string(tostring(key)) - self:put(":") - self:dispatch(entry) + if key ~= null then + first = first or self:put(",") + first = first and false + self:parse_string(tostring(key)) + self:put(":") + self:dispatch(entry) + end end self:put("}") diff --git a/libs/luci-lib-jsonc/src/jsonc.c b/libs/luci-lib-jsonc/src/jsonc.c index 49cb21f5bc..971fb122f7 100644 --- a/libs/luci-lib-jsonc/src/jsonc.c +++ b/libs/luci-lib-jsonc/src/jsonc.c @@ -222,7 +222,7 @@ static int _lua_test_array(lua_State *L, int index) out: lua_pop(L, 2); - return 0; + return -1; } /* check for holes */ @@ -254,7 +254,7 @@ static struct json_object * _lua_to_json(lua_State *L, int index) case LUA_TTABLE: max = _lua_test_array(L, index); - if (max > 0) + if (max >= 0) { obj = json_object_new_array(); @@ -286,8 +286,9 @@ static struct json_object * _lua_to_json(lua_State *L, int index) lua_pushvalue(L, -2); key = lua_tostring(L, -1); - json_object_object_add(obj, key, - _lua_to_json(L, lua_gettop(L) - 1)); + if (key) + json_object_object_add(obj, key, + _lua_to_json(L, lua_gettop(L) - 1)); lua_pop(L, 2); } diff --git a/libs/luci-lib-nixio/src/address.c b/libs/luci-lib-nixio/src/address.c index 4fd557d6a7..8ab4fa89c9 100644 --- a/libs/luci-lib-nixio/src/address.c +++ b/libs/luci-lib-nixio/src/address.c @@ -331,7 +331,9 @@ static int nixio_getnameinfo(lua_State *L) { nixio__addr_write(&addr, (struct sockaddr *)&saddr); - int res = getnameinfo((struct sockaddr *)&saddr, sizeof(saddr), + int res = getnameinfo((struct sockaddr *)&saddr, + (saddr.ss_family == AF_INET) + ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6), host, sizeof(host), NULL, 0, NI_NAMEREQD); #ifdef __linux__ diff --git a/modules/luci-base/luasrc/cbi.lua b/modules/luci-base/luasrc/cbi.lua index 34de44a5f0..f3d4618b65 100644 --- a/modules/luci-base/luasrc/cbi.lua +++ b/modules/luci-base/luasrc/cbi.lua @@ -12,6 +12,7 @@ require("luci.http") local fs = require("nixio.fs") local uci = require("luci.model.uci") local datatypes = require("luci.cbi.datatypes") +local dispatcher = require("luci.dispatcher") local class = util.class local instanceof = util.instanceof @@ -307,8 +308,30 @@ function Map.__init__(self, config, ...) self.changed = false - if not self.uci:load(self.config) then - error("Unable to read UCI data: " .. self.config) + local path = "%s/%s" %{ self.uci:get_confdir(), self.config } + if fs.stat(path, "type") ~= "reg" then + fs.writefile(path, "") + end + + local ok, err = self.uci:load(self.config) + if not ok then + local url = dispatcher.build_url(unpack(dispatcher.context.request)) + local source = self:formvalue("cbi.source") + if type(source) == "string" then + fs.writefile(path, source:gsub("\r\n", "\n")) + ok, err = self.uci:load(self.config) + if ok then + luci.http.redirect(url) + end + end + self.save = false + end + + if not ok then + self.template = "cbi/error" + self.error = err + self.source = fs.readfile(path) or "" + self.pageaction = false end end @@ -1510,13 +1533,16 @@ function Flag.parse(self, section) if fexists then local fvalue = self:formvalue(section) and self.enabled or self.disabled + local cvalue = self:cfgvalue(section) if fvalue ~= self.default or (not self.optional and not self.rmempty) then self:write(section, fvalue) else self:remove(section) end + if (fvalue ~= cvalue) then self.section.changed = true end else self:remove(section) + self.section.changed = true end end diff --git a/modules/luci-base/luasrc/http/protocol.lua b/modules/luci-base/luasrc/http/protocol.lua index 61d7b802fe..859272679f 100644 --- a/modules/luci-base/luasrc/http/protocol.lua +++ b/modules/luci-base/luasrc/http/protocol.lua @@ -559,14 +559,23 @@ function parse_message_body( src, msg, filecb ) -- If we have a file callback then feed it if type(filecb) == "function" then - sink = filecb - + local meta = { + name = "raw", + encoding = msg.env.CONTENT_TYPE + } + sink = function( chunk ) + if chunk then + return filecb(meta, chunk, false) + else + return filecb(meta, nil, true) + end + end -- ... else append to .content else msg.content = "" msg.content_length = 0 - sink = function( chunk, err ) + sink = function( chunk ) if chunk then if ( msg.content_length + #chunk ) <= HTTP_MAX_CONTENT then msg.content = msg.content .. chunk diff --git a/modules/luci-base/luasrc/model/ipkg.lua b/modules/luci-base/luasrc/model/ipkg.lua index 587637272d..2e26bd7a16 100644 --- a/modules/luci-base/luasrc/model/ipkg.lua +++ b/modules/luci-base/luasrc/model/ipkg.lua @@ -122,7 +122,7 @@ function upgrade() end -- List helper -function _list(action, pat, cb) +local function _list(action, pat, cb) local fd = io.popen(ipkg .. " " .. action .. (pat and (" '%s'" % pat:gsub("'", "")) or "")) @@ -189,3 +189,48 @@ function overlay_root() return od end + +function compare_versions(ver1, comp, ver2) + if not ver1 or not ver2 + or not comp or not (#comp > 0) then + error("Invalid parameters") + return nil + end + -- correct compare string + if comp == "<>" or comp == "><" or comp == "!=" or comp == "~=" then comp = "~=" + elseif comp == "<=" or comp == "<" or comp == "=<" then comp = "<=" + elseif comp == ">=" or comp == ">" or comp == "=>" then comp = ">=" + elseif comp == "=" or comp == "==" then comp = "==" + elseif comp == "<<" then comp = "<" + elseif comp == ">>" then comp = ">" + else + error("Invalid compare string") + return nil + end + + local av1 = util.split(ver1, "[%.%-]", nil, true) + local av2 = util.split(ver2, "[%.%-]", nil, true) + + local max = table.getn(av1) + if (table.getn(av1) < table.getn(av2)) then + max = table.getn(av2) + end + + for i = 1, max, 1 do + local s1 = av1[i] or "" + local s2 = av2[i] or "" + + -- first "not equal" found return true + if comp == "~=" and (s1 ~= s2) then return true end + -- first "lower" found return true + if (comp == "<" or comp == "<=") and (s1 < s2) then return true end + -- first "greater" found return true + if (comp == ">" or comp == ">=") and (s1 > s2) then return true end + -- not equal then return false + if (s1 ~= s2) then return false end + end + + -- all equal and not compare greater or lower then true + return not (comp == "<" or comp == ">") +end + diff --git a/modules/luci-base/luasrc/model/ipkg.luadoc b/modules/luci-base/luasrc/model/ipkg.luadoc index cf0985f94a..0dbab7a68f 100644 --- a/modules/luci-base/luasrc/model/ipkg.luadoc +++ b/modules/luci-base/luasrc/model/ipkg.luadoc @@ -107,3 +107,20 @@ Determines the overlay root used by opkg. @return String containing the directory path of the overlay root. ]] +---[[ +lua version of opkg compare-versions + +@class function +@name compare_versions +@param ver1 string version 1 +@param ver2 string version 2 +@param comp string compare versions using + "<=" or "<" lower-equal + ">" or ">=" greater-equal + "=" equal + "<<" lower + ">>" greater + "~=" not equal +@return Boolean indicating the status of the compare +]] + diff --git a/modules/luci-base/luasrc/model/network.lua b/modules/luci-base/luasrc/model/network.lua index b6e390e818..20e1032760 100644 --- a/modules/luci-base/luasrc/model/network.lua +++ b/modules/luci-base/luasrc/model/network.lua @@ -1421,7 +1421,7 @@ function wifinet.is_up(self) end function wifinet.active_mode(self) - local m = _stror(self.iwinfo.mode, self.iwdata.mode) or "ap" + local m = _stror(self.iwdata.mode, self.iwinfo.mode) or "ap" if m == "ap" then m = "Master" elseif m == "sta" then m = "Client" @@ -1438,11 +1438,11 @@ function wifinet.active_mode_i18n(self) end function wifinet.active_ssid(self) - return _stror(self.iwinfo.ssid, self.iwdata.ssid) + return _stror(self.iwdata.ssid, self.iwinfo.ssid) end function wifinet.active_bssid(self) - return _stror(self.iwinfo.bssid, self.iwdata.bssid) or "00:00:00:00:00:00" + return _stror(self.iwdata.bssid, self.iwinfo.bssid) or "00:00:00:00:00:00" end function wifinet.active_encryption(self) diff --git a/modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua b/modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua index 148bdcbfc5..b109c712ec 100644 --- a/modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua +++ b/modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua @@ -15,7 +15,7 @@ TZ = { { 'Africa/Blantyre', 'CAT-2' }, { 'Africa/Brazzaville', 'WAT-1' }, { 'Africa/Bujumbura', 'CAT-2' }, - { 'Africa/Cairo', 'EET-2EEST,M4.5.4/24,M9.5.4/24' }, + { 'Africa/Cairo', 'EET-2' }, { 'Africa/Casablanca', 'WET0WEST,M3.5.0,M10.5.0/3' }, { 'Africa/Ceuta', 'CET-1CEST,M3.5.0,M10.5.0/3' }, { 'Africa/Conakry', 'GMT0' }, @@ -55,7 +55,7 @@ TZ = { { 'Africa/Tripoli', 'EET-2' }, { 'Africa/Tunis', 'CET-1' }, { 'Africa/Windhoek', 'WAT-1WAST,M9.1.0,M4.1.0' }, - { 'America/Adak', 'HAST10HADT,M3.2.0,M11.1.0' }, + { 'America/Adak', 'HST10HDT,M3.2.0,M11.1.0' }, { 'America/Anchorage', 'AKST9AKDT,M3.2.0,M11.1.0' }, { 'America/Anguilla', 'AST4' }, { 'America/Antigua', 'AST4' }, @@ -89,7 +89,7 @@ TZ = { { 'America/Cancun', 'EST5' }, { 'America/Caracas', 'VET4:30' }, { 'America/Cayenne', 'GFT3' }, - { 'America/Cayman', 'EST5' }, + { 'America/Cayman', 'EST5EDT,M3.2.0,M11.1.0' }, { 'America/Chicago', 'CST6CDT,M3.2.0,M11.1.0' }, { 'America/Chihuahua', 'MST7MDT,M4.1.0,M10.5.0' }, { 'America/Costa Rica', 'CST6' }, @@ -151,7 +151,7 @@ TZ = { { 'America/Miquelon', 'PMST3PMDT,M3.2.0,M11.1.0' }, { 'America/Moncton', 'AST4ADT,M3.2.0,M11.1.0' }, { 'America/Monterrey', 'CST6CDT,M4.1.0,M10.5.0' }, - { 'America/Montevideo', 'UYT3UYST,M10.1.0,M3.2.0' }, + { 'America/Montevideo', 'UYT3' }, { 'America/Montserrat', 'AST4' }, { 'America/Nassau', 'EST5EDT,M3.2.0,M11.1.0' }, { 'America/New York', 'EST5EDT,M3.2.0,M11.1.0' }, @@ -266,7 +266,7 @@ TZ = { { 'Asia/Oral', 'ORAT-5' }, { 'Asia/Phnom Penh', 'ICT-7' }, { 'Asia/Pontianak', 'WIB-7' }, - { 'Asia/Pyongyang', 'KST-9' }, + { 'Asia/Pyongyang', 'KST-8:30' }, { 'Asia/Qatar', 'AST-3' }, { 'Asia/Qyzylorda', 'QYZT-6' }, { 'Asia/Rangoon', 'MMT-6:30' }, @@ -322,7 +322,7 @@ TZ = { { 'Europe/Bucharest', 'EET-2EEST,M3.5.0/3,M10.5.0/4' }, { 'Europe/Budapest', 'CET-1CEST,M3.5.0,M10.5.0/3' }, { 'Europe/Busingen', 'CET-1CEST,M3.5.0,M10.5.0/3' }, - { 'Europe/Chisinau', 'EET-2EEST,M3.5.0/3,M10.5.0/4' }, + { 'Europe/Chisinau', 'EET-2EEST,M3.5.0,M10.5.0/3' }, { 'Europe/Copenhagen', 'CET-1CEST,M3.5.0,M10.5.0/3' }, { 'Europe/Dublin', 'GMT0IST,M3.5.0/1,M10.5.0' }, { 'Europe/Gibraltar', 'CET-1CEST,M3.5.0,M10.5.0/3' }, diff --git a/modules/luci-base/luasrc/sys/zoneinfo/tzoffset.lua b/modules/luci-base/luasrc/sys/zoneinfo/tzoffset.lua index fe3f860977..f156f3663a 100644 --- a/modules/luci-base/luasrc/sys/zoneinfo/tzoffset.lua +++ b/modules/luci-base/luasrc/sys/zoneinfo/tzoffset.lua @@ -9,11 +9,10 @@ OFFSET = { wat = 3600, -- WAT cat = 7200, -- CAT eet = 7200, -- EET - eest = 10800, -- EEST wet = 0, -- WET sast = 7200, -- SAST - hast = -36000, -- HAST - hadt = -32400, -- HADT + hst = -36000, -- HST + hdt = -32400, -- HDT akst = -32400, -- AKST akdt = -28800, -- AKDT ast = -14400, -- AST @@ -42,7 +41,6 @@ OFFSET = { pmst = -10800, -- PMST pmdt = -7200, -- PMDT uyt = -10800, -- UYT - uyst = -7200, -- UYST fnt = -7200, -- FNT srt = -10800, -- SRT clt = -10800, -- CLT @@ -96,7 +94,7 @@ OFFSET = { novt = 21600, -- NOVT omst = 21600, -- OMST orat = 18000, -- ORAT - kst = 32400, -- KST + kst = 30600, -- KST qyzt = 21600, -- QYZT mmt = 23400, -- MMT sakt = 36000, -- SAKT @@ -147,7 +145,6 @@ OFFSET = { galt = -21600, -- GALT gamt = -32400, -- GAMT sbt = 39600, -- SBT - hst = -36000, -- HST lint = 50400, -- LINT kost = 39600, -- KOST mht = 43200, -- MHT diff --git a/modules/luci-base/luasrc/tools/status.lua b/modules/luci-base/luasrc/tools/status.lua index 6e588fe71d..0dd092c6df 100644 --- a/modules/luci-base/luasrc/tools/status.lua +++ b/modules/luci-base/luasrc/tools/status.lua @@ -120,7 +120,9 @@ function wifi_networks() assoclist = net:assoclist(), country = net:country(), txpower = net:txpower(), - txpoweroff = net:txpower_offset() + txpoweroff = net:txpower_offset(), + disabled = (dev:get("disabled") == "1" or + net:get("disabled") == "1") } end diff --git a/modules/luci-base/luasrc/view/cbi/error.htm b/modules/luci-base/luasrc/view/cbi/error.htm new file mode 100644 index 0000000000..2acb96924e --- /dev/null +++ b/modules/luci-base/luasrc/view/cbi/error.htm @@ -0,0 +1,19 @@ +<div class="cbi-map" id="cbi-<%=self.config%>"> + <% if self.title and #self.title > 0 then %><h2><a id="content" name="content"><%=self.title%></a></h2><% end %> + <% if self.description and #self.description > 0 then %><div class="cbi-map-descr"><%=self.description%></div><% end %> + + <p class="alert-message danger"> + <%: The configuration file could not be loaded due to the following error: %><br /> + <code><%=pcdata(self.error)%></code> + </p> + + <textarea name="cbi.source" style="width:100%; margin-bottom:1em" rows="<%=math.max(self.source:cmatch("\n"), 10)%>"><%=pcdata(self.source)%></textarea> + + <p class="alert-message"> + <%: Edit the raw configuration data above to fix any error and hit "Save" to reload the page. %> + </p> + + <div class="cbi-page-actions"> + <input class="cbi-button cbi-button-apply" type="submit" name="cbi.save" value="<%:Save%>" /> + </div> +</div> diff --git a/modules/luci-base/luasrc/view/cbi/network_netlist.htm b/modules/luci-base/luasrc/view/cbi/network_netlist.htm index 7e23d149a8..4f186ca8ea 100644 --- a/modules/luci-base/luasrc/view/cbi/network_netlist.htm +++ b/modules/luci-base/luasrc/view/cbi/network_netlist.htm @@ -59,6 +59,7 @@ <%- else -%> <%:unspecified -or- create:%> <%- end -%> </em></label> + <input style="display:none" type="password" /> <input style="width:6em" type="text"<%=attr("name", cbid .. ".newnet")%> onfocus="document.getElementById('<%=cbid%>_new').checked=true" /> </div> </li> diff --git a/modules/luci-base/po/ca/base.po b/modules/luci-base/po/ca/base.po index 4aa454e7bb..2252e7c951 100644 --- a/modules/luci-base/po/ca/base.po +++ b/modules/luci-base/po/ca/base.po @@ -775,6 +775,11 @@ msgstr "Mètode EAP" msgid "Edit" msgstr "Edita" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + msgid "Edit this interface" msgstr "Edita aquesta interfície" @@ -2474,6 +2479,9 @@ msgstr "" "Els caràcters permets són: <code>A-Z</code>, <code>a-z</code>, <code>0-9</" "code> i <code>_</code>" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" diff --git a/modules/luci-base/po/cs/base.po b/modules/luci-base/po/cs/base.po index 0d89b28aa1..373602070c 100644 --- a/modules/luci-base/po/cs/base.po +++ b/modules/luci-base/po/cs/base.po @@ -785,6 +785,11 @@ msgstr "Metoda EAP" msgid "Edit" msgstr "Upravit" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + msgid "Edit this interface" msgstr "Upravit toto rozhraní" @@ -2529,6 +2534,9 @@ msgstr "" "Povolené znaky jsou: <code>A-Z</code>, <code>a-z</code>, <code>0-9</code> a " "<code>_</code>" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" diff --git a/modules/luci-base/po/de/base.po b/modules/luci-base/po/de/base.po index 3ac0c52e2f..361abdead9 100644 --- a/modules/luci-base/po/de/base.po +++ b/modules/luci-base/po/de/base.po @@ -781,6 +781,11 @@ msgstr "EAP-Methode" msgid "Edit" msgstr "Bearbeiten" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + msgid "Edit this interface" msgstr "Diese Schnittstelle bearbeiten" @@ -2544,6 +2549,9 @@ msgstr "" "Erlaubte Buchstaben sind: <code>A-Z</code>, <code>a-z</code>, <code>0-9</" "code> and <code>_</code>" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" diff --git a/modules/luci-base/po/el/base.po b/modules/luci-base/po/el/base.po index 5451adb479..ed3a20737c 100644 --- a/modules/luci-base/po/el/base.po +++ b/modules/luci-base/po/el/base.po @@ -797,6 +797,11 @@ msgstr "Μέθοδος EAP" msgid "Edit" msgstr "Επεξεργασία" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + msgid "Edit this interface" msgstr "Επεξεργασία αυτής της διεπαφής" @@ -2506,6 +2511,9 @@ msgstr "" "Οι επιτρεπόμενοι χαρακτήρες είναι: <code>A-Z</code>, <code>a-z</code>, " "<code>0-9</code> και <code>_</code>" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" diff --git a/modules/luci-base/po/en/base.po b/modules/luci-base/po/en/base.po index c75b4cab3f..3ad4b140bb 100644 --- a/modules/luci-base/po/en/base.po +++ b/modules/luci-base/po/en/base.po @@ -776,6 +776,11 @@ msgstr "EAP-Method" msgid "Edit" msgstr "Edit" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + msgid "Edit this interface" msgstr "" @@ -2466,6 +2471,9 @@ msgid "" "code> and <code>_</code>" msgstr "" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" diff --git a/modules/luci-base/po/es/base.po b/modules/luci-base/po/es/base.po index d187fe7bdc..2c3ce94ad5 100644 --- a/modules/luci-base/po/es/base.po +++ b/modules/luci-base/po/es/base.po @@ -791,6 +791,11 @@ msgstr "Método EAP" msgid "Edit" msgstr "Editar" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + msgid "Edit this interface" msgstr "Editar esta interfaz" @@ -2549,6 +2554,9 @@ msgstr "" "Los caracteres permitidos son: <code>A-Z</code>, <code>a-z</code>, " "<code>0-9</code> y <code>_</code>" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" diff --git a/modules/luci-base/po/fr/base.po b/modules/luci-base/po/fr/base.po index 3b209b349b..1d8d224754 100644 --- a/modules/luci-base/po/fr/base.po +++ b/modules/luci-base/po/fr/base.po @@ -801,6 +801,11 @@ msgstr "Méthode EAP" msgid "Edit" msgstr "Éditer" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + msgid "Edit this interface" msgstr "Éditer cette interface" @@ -2561,6 +2566,9 @@ msgstr "" "Les caractères autorisés sont : <code>A-Z</code>, <code>a-z</code>, " "<code>0-9</code> et <code>_</code>" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" diff --git a/modules/luci-base/po/he/base.po b/modules/luci-base/po/he/base.po index cbc27d3160..237e8689ae 100644 --- a/modules/luci-base/po/he/base.po +++ b/modules/luci-base/po/he/base.po @@ -762,6 +762,11 @@ msgstr "" msgid "Edit" msgstr "ערוך" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + msgid "Edit this interface" msgstr "ערוך ממשק זה" @@ -2440,6 +2445,9 @@ msgid "" "code> and <code>_</code>" msgstr "" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" diff --git a/modules/luci-base/po/hu/base.po b/modules/luci-base/po/hu/base.po index 47f0dfedb0..975bf2dfce 100644 --- a/modules/luci-base/po/hu/base.po +++ b/modules/luci-base/po/hu/base.po @@ -794,6 +794,11 @@ msgstr "EAP metódus" msgid "Edit" msgstr "Szerkesztés" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + msgid "Edit this interface" msgstr "Interfész szerkesztése" @@ -2550,6 +2555,9 @@ msgstr "" "A következő karakterek használhatók: <code>A-Z</code>, <code>a-z</code>, " "<code>0-9</code> and <code>_</code>" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" diff --git a/modules/luci-base/po/it/base.po b/modules/luci-base/po/it/base.po index b6f94443e2..ffb1fdf0ca 100644 --- a/modules/luci-base/po/it/base.po +++ b/modules/luci-base/po/it/base.po @@ -327,7 +327,7 @@ msgid "Authorization Required" msgstr "Autorizzazione richiesta" msgid "Auto Refresh" -msgstr "Aggironamento Automatico" +msgstr "Aggiornamento Automatico" msgid "Automatic" msgstr "" @@ -795,6 +795,11 @@ msgstr "Metodo EAP" msgid "Edit" msgstr "Modifica" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + msgid "Edit this interface" msgstr "Modifica questa interfaccia" @@ -2532,6 +2537,9 @@ msgid "" "code> and <code>_</code>" msgstr "" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" diff --git a/modules/luci-base/po/ja/base.po b/modules/luci-base/po/ja/base.po index 69c384c508..8bea7644ea 100644 --- a/modules/luci-base/po/ja/base.po +++ b/modules/luci-base/po/ja/base.po @@ -783,6 +783,11 @@ msgstr "EAPメソッド" msgid "Edit" msgstr "編集" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + msgid "Edit this interface" msgstr "インターフェースを編集" @@ -2523,6 +2528,9 @@ msgstr "" "使用可能な文字は右記の通りです: <code>A-Z</code>, <code>a-z</code>, " "<code>0-9</code>, <code>_</code>" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" diff --git a/modules/luci-base/po/ms/base.po b/modules/luci-base/po/ms/base.po index aaa1bc4ca0..d2a34dfbe1 100644 --- a/modules/luci-base/po/ms/base.po +++ b/modules/luci-base/po/ms/base.po @@ -746,6 +746,11 @@ msgstr "EAP-Kaedah" msgid "Edit" msgstr "Sunting" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + msgid "Edit this interface" msgstr "" @@ -2441,6 +2446,9 @@ msgstr "" "Karakter yang diizinkan adalah: <code>A-Z</code>, <code>a-z</code>, " "<code>0-9</code> dan <code>_</code>" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" diff --git a/modules/luci-base/po/no/base.po b/modules/luci-base/po/no/base.po index f7429201f0..21176ed3f4 100644 --- a/modules/luci-base/po/no/base.po +++ b/modules/luci-base/po/no/base.po @@ -781,6 +781,11 @@ msgstr "EAP-metode" msgid "Edit" msgstr "Endre" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + msgid "Edit this interface" msgstr "Endre dette grensesnittet" @@ -2521,6 +2526,9 @@ msgstr "" "Gyldige tegn er: <code>A-Z</code>, <code>a-z</code>, <code>0-9</code> og " "<code>_</code>" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" diff --git a/modules/luci-base/po/pl/base.po b/modules/luci-base/po/pl/base.po index 908b6e601f..baa7ab8534 100644 --- a/modules/luci-base/po/pl/base.po +++ b/modules/luci-base/po/pl/base.po @@ -808,6 +808,11 @@ msgstr "Metoda EAP" msgid "Edit" msgstr "Edycja" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + msgid "Edit this interface" msgstr "Edytuj ten interfejs" @@ -2577,6 +2582,9 @@ msgstr "" "Dozwolone znaki to: <code>A-Z</code>, <code>a-z</code>, <code>0-9</code> " "oraz <code>_</code>" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" diff --git a/modules/luci-base/po/pt-br/base.po b/modules/luci-base/po/pt-br/base.po index e9c68b225b..ec4401bde9 100644 --- a/modules/luci-base/po/pt-br/base.po +++ b/modules/luci-base/po/pt-br/base.po @@ -804,6 +804,11 @@ msgstr "Método EAP" msgid "Edit" msgstr "Editar" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + msgid "Edit this interface" msgstr "Editar esta interface" @@ -2581,6 +2586,9 @@ msgstr "" "Os caracteres permitidos são: <code>A-Z</code>, <code>a-z</code>, <code>0-9</" "code> e <code>_</code>" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" diff --git a/modules/luci-base/po/pt/base.po b/modules/luci-base/po/pt/base.po index 2ba5ed7b4c..1acc852bbf 100644 --- a/modules/luci-base/po/pt/base.po +++ b/modules/luci-base/po/pt/base.po @@ -797,6 +797,11 @@ msgstr "Metodo-EAP" msgid "Edit" msgstr "Editar" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + msgid "Edit this interface" msgstr "Editar esta interface" @@ -2525,6 +2530,9 @@ msgstr "" "Os caracteres permitidos são: <code>A-Z</code>, <code>a-z</code>, <code>0-9</" "code> e <code>_</code>" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" diff --git a/modules/luci-base/po/ro/base.po b/modules/luci-base/po/ro/base.po index efc0bb450d..3692b7de55 100644 --- a/modules/luci-base/po/ro/base.po +++ b/modules/luci-base/po/ro/base.po @@ -753,6 +753,11 @@ msgstr "" msgid "Edit" msgstr "Editeaza" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + msgid "Edit this interface" msgstr "Editeaza aceasta interfata" @@ -2430,6 +2435,9 @@ msgid "" "code> and <code>_</code>" msgstr "" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" diff --git a/modules/luci-base/po/ru/base.po b/modules/luci-base/po/ru/base.po index ea5ccf163d..94fa6fb8ee 100644 --- a/modules/luci-base/po/ru/base.po +++ b/modules/luci-base/po/ru/base.po @@ -797,6 +797,11 @@ msgstr "Метод EAP" msgid "Edit" msgstr "Редактировать" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + #, fuzzy msgid "Edit this interface" msgstr "Редактировать этот интерфейс" @@ -2553,6 +2558,9 @@ msgstr "" "Допустимые символы: <code>A-Z</code>, <code>a-z</code>, <code>0-9</code> и " "<code>_</code>" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" diff --git a/modules/luci-base/po/sk/base.po b/modules/luci-base/po/sk/base.po index ff5b6dde06..d943ccb891 100644 --- a/modules/luci-base/po/sk/base.po +++ b/modules/luci-base/po/sk/base.po @@ -733,6 +733,11 @@ msgstr "" msgid "Edit" msgstr "" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + msgid "Edit this interface" msgstr "" @@ -2401,6 +2406,9 @@ msgid "" "code> and <code>_</code>" msgstr "" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" diff --git a/modules/luci-base/po/sv/base.po b/modules/luci-base/po/sv/base.po index 9e10acda3a..86fa224e79 100644 --- a/modules/luci-base/po/sv/base.po +++ b/modules/luci-base/po/sv/base.po @@ -739,6 +739,11 @@ msgstr "" msgid "Edit" msgstr "" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + msgid "Edit this interface" msgstr "" @@ -2407,6 +2412,9 @@ msgid "" "code> and <code>_</code>" msgstr "" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" diff --git a/modules/luci-base/po/tr/base.po b/modules/luci-base/po/tr/base.po index fa7d6d8006..1bf53aa576 100644 --- a/modules/luci-base/po/tr/base.po +++ b/modules/luci-base/po/tr/base.po @@ -746,6 +746,11 @@ msgstr "" msgid "Edit" msgstr "" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + msgid "Edit this interface" msgstr "" @@ -2414,6 +2419,9 @@ msgid "" "code> and <code>_</code>" msgstr "" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" diff --git a/modules/luci-base/po/uk/base.po b/modules/luci-base/po/uk/base.po index de1e461ab6..c5483221c2 100644 --- a/modules/luci-base/po/uk/base.po +++ b/modules/luci-base/po/uk/base.po @@ -807,6 +807,11 @@ msgstr "EAP-Метод" msgid "Edit" msgstr "Редагувати" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + msgid "Edit this interface" msgstr "Редагувати цей інтерфейс" @@ -2568,6 +2573,9 @@ msgstr "" "Дозволені символи: <code>A-Z</code>, <code>a-z</code>, <code>0-9</code> та " "<code>_</code>" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" diff --git a/modules/luci-base/po/vi/base.po b/modules/luci-base/po/vi/base.po index cdbabd4cf3..d81be16eb5 100644 --- a/modules/luci-base/po/vi/base.po +++ b/modules/luci-base/po/vi/base.po @@ -751,6 +751,11 @@ msgstr "EAP-Method" msgid "Edit" msgstr "Chỉnh sửa" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + msgid "Edit this interface" msgstr "" @@ -2441,6 +2446,9 @@ msgid "" "code> and <code>_</code>" msgstr "" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" diff --git a/modules/luci-base/po/zh-cn/base.po b/modules/luci-base/po/zh-cn/base.po index 47aa60f667..72bf937952 100644 --- a/modules/luci-base/po/zh-cn/base.po +++ b/modules/luci-base/po/zh-cn/base.po @@ -410,9 +410,6 @@ msgstr "CA证书.如果留空的话证书将在第一次连接时被保存." msgid "CPU" msgstr "CPU" -msgid "CPU frequency" -msgstr "CPU 频率" - msgid "CPU usage (%)" msgstr "CPU使用率(%)" @@ -443,9 +440,6 @@ msgstr "检查" msgid "Checksum" msgstr "校验值" -msgid "Chip Model" -msgstr "芯片型号" - msgid "" "Choose the firewall zone you want to assign to this interface. Select " "<em>unspecified</em> to remove the interface from the associated zone or " @@ -758,6 +752,11 @@ msgstr "EAP-Method" msgid "Edit" msgstr "修改" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + msgid "Edit this interface" msgstr "修改此接口" @@ -2453,6 +2452,9 @@ msgstr "" "合法字符:<code>A-Z</code>, <code>a-z</code>, <code>0-9</code> 和 <code>_</" "code>" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" @@ -3116,6 +3118,12 @@ msgstr "是" msgid "« Back" msgstr "« 后退" +#~ msgid "CPU frequency" +#~ msgstr "CPU 频率" + +#~ msgid "Chip Model" +#~ msgstr "芯片型号" + #~ msgid "" #~ "Always use 40MHz channels even if the secondary channel overlaps. Using " #~ "this option does not comply with IEEE 802.11n-2009!" diff --git a/modules/luci-base/po/zh-tw/base.po b/modules/luci-base/po/zh-tw/base.po index a2ec282dd8..ec901b8af2 100644 --- a/modules/luci-base/po/zh-tw/base.po +++ b/modules/luci-base/po/zh-tw/base.po @@ -763,6 +763,11 @@ msgstr "EAP協定驗證方式" msgid "Edit" msgstr "編輯" +msgid "" +"Edit the raw configuration data above to fix any error and hit \"Save\" to " +"reload the page." +msgstr "" + msgid "Edit this interface" msgstr "修改這個介面" @@ -2468,6 +2473,9 @@ msgstr "" "所允許的字元是: <code>A-Z</code>, <code>a-z</code>, <code>0-9</code> and " "<code>_</code>" +msgid "The configuration file could not be loaded due to the following error:" +msgstr "" + msgid "" "The device file of the memory or partition (<abbr title=\"for example\">e.g." "</abbr> <code>/dev/sda1</code>)" diff --git a/modules/luci-base/root/lib/uci/upload/.gitignore b/modules/luci-base/root/lib/uci/upload/.placeholder index e69de29bb2..e69de29bb2 100644 --- a/modules/luci-base/root/lib/uci/upload/.gitignore +++ b/modules/luci-base/root/lib/uci/upload/.placeholder diff --git a/modules/luci-mod-admin-full/luasrc/controller/admin/status.lua b/modules/luci-mod-admin-full/luasrc/controller/admin/status.lua index 2d81caf242..1ceb24d16a 100644 --- a/modules/luci-mod-admin-full/luasrc/controller/admin/status.lua +++ b/modules/luci-mod-admin-full/luasrc/controller/admin/status.lua @@ -51,7 +51,7 @@ function action_iptables() luci.dispatcher.build_url("admin", "status", "iptables") ) elseif luci.http.formvalue("restart") == "1" then - luci.util.exec("/etc/init.d/firewall reload") + luci.util.exec("/etc/init.d/firewall restart") luci.http.redirect( luci.dispatcher.build_url("admin", "status", "iptables") ) diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua index 997a9274d2..49103a8113 100644 --- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua +++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua @@ -89,6 +89,11 @@ s:taboption("advanced", Flag, "nonegcache", translate("No negative cache"), translate("Do not cache negative replies, e.g. for not existing domains")) +s:taboption("advanced", Value, "serversfile", + translate("Additional servers file"), + translate("This file may contain lines like 'server=/domain/1.2.3.4' or 'server=1.2.3.4' for".. + "domain-specific or full upstream <abbr title=\"Domain Name System\">DNS</abbr> servers.")) + s:taboption("advanced", Flag, "strictorder", translate("Strict order"), translate("<abbr title=\"Domain Name System\">DNS</abbr> servers will be queried in the " .. diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua index dd619b3143..9a2bd5d201 100644 --- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua +++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua @@ -143,7 +143,7 @@ local found_sta = nil local _, net if wnet:mode() ~= "sta" then for _, net in ipairs(wdev:get_wifinets()) do - if net:mode() == "sta" then + if net:mode() == "sta" and net:get("disabled") ~= "1" then if not found_sta then found_sta = {} found_sta.channel = net:channel() diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview.htm index b7c44f9073..4fc268e66c 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview.htm @@ -183,7 +183,7 @@ for( var i = 0; i < st.length; i++ ) { var iw = st[i]; - var is_assoc = (iw.bssid && iw.bssid != '00:00:00:00:00:00' && iw.channel && iw.mode != 'Unknown'); + var is_assoc = (iw.bssid && iw.bssid != '00:00:00:00:00:00' && iw.channel && iw.mode != 'Unknown' && !iw.disabled); var p = iw.quality; var q = is_assoc ? p : -1; diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_status.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_status.htm index 2484fd3c6b..fa0a97b707 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_status.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_status.htm @@ -6,7 +6,7 @@ { if (iw && (iw = iw[0])) { - var is_assoc = (iw.bssid && iw.bssid != '00:00:00:00:00:00' && iw.channel); + var is_assoc = (iw.bssid && iw.bssid != '00:00:00:00:00:00' && iw.channel && !iw.disabled); var p = iw.quality; var q = is_assoc ? p : -1; diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm index 548b22d167..07a96b2bf0 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm @@ -352,7 +352,7 @@ for (var nidx = 0; nidx < dev.networks.length; nidx++) { var net = dev.networks[nidx]; - var is_assoc = (net.bssid != '00:00:00:00:00:00' && net.channel); + var is_assoc = (net.bssid != '00:00:00:00:00:00' && net.channel && !net.disabled); var icon; if (!is_assoc) diff --git a/modules/luci-mod-freifunk/luasrc/model/cbi/freifunk/basics.lua b/modules/luci-mod-freifunk/luasrc/model/cbi/freifunk/basics.lua index 019e404efd..0d3d971c30 100644 --- a/modules/luci-mod-freifunk/luasrc/model/cbi/freifunk/basics.lua +++ b/modules/luci-mod-freifunk/luasrc/model/cbi/freifunk/basics.lua @@ -5,7 +5,7 @@ local fs = require "nixio.fs" local util = require "luci.util" local uci = require "luci.model.uci".cursor() -local profiles = "/etc/config/profile_" +local profiles = "/etc/config/profile_*" m = Map("freifunk", translate ("Community")) c = m:section(NamedSection, "community", "public", nil, translate("These are the basic settings for your local wireless community. These settings define the default values for the wizard and DO NOT affect the actual configuration of the router.")) @@ -14,7 +14,7 @@ community = c:option(ListValue, "name", translate ("Community")) community.rmempty = false local profile -for profile in fs.dir(profiles) do +for profile in fs.glob(profiles) do local name = uci:get_first(profile, "community", "name") or "?" community:value(profile, name) end diff --git a/modules/luci-mod-freifunk/luasrc/view/freifunk/public_status.htm b/modules/luci-mod-freifunk/luasrc/view/freifunk/public_status.htm index 42a58f9dd3..fc3948ecc1 100644 --- a/modules/luci-mod-freifunk/luasrc/view/freifunk/public_status.htm +++ b/modules/luci-mod-freifunk/luasrc/view/freifunk/public_status.htm @@ -49,6 +49,32 @@ for _, dev in ipairs(devices) do end local has_iwinfo = pcall(require, "iwinfo") + +-- Find default routes + +local _, r, def4, def6 + +for _, r in ipairs(ip.routes({ type = 1, dest_exact = "0.0.0.0/0" })) do + def4 = { + gateway = r.gw:string(), + dest = r.dest:string(), + dev = r.dev, + metr = r.metric or 0 + } + break +end + +for _, r in ipairs(ip.routes({ type = 1, dest_exact = "::/0" })) do + def6 = { + gateway = r.gw:string(), + dest = r.dest:string(), + dev = r.dev, + metr = r.metric or 0 + } + break +end + + if luci.http.formvalue("status") == "1" then local rv = { } for dev in pairs(netdevs) do @@ -67,30 +93,6 @@ if luci.http.formvalue("status") == "1" then end - -- Find default routes - - local _, r, def4, def6 - - for _, r in ipairs(ip.routes({ type = 1, dest_exact = "0.0.0.0/0" })) do - def4 = { - gateway = r.gw:string(), - dest = r.dest:string(), - dev = r.dev, - metr = r.metric or 0 - } - break - end - - for _, r in ipairs(ip.routes({ type = 1, dest_exact = "::/0" })) do - def6 = { - gateway = r.gw:string(), - dest = r.dest:string(), - dev = r.dev, - metr = r.metric or 0 - } - break - end - rv[#rv+1] = { time = time, uptime = uptime, @@ -297,7 +299,7 @@ end if bitrate ~= "N/A" then bitrate = ( bitrate / 1000 ).."Mb/s" end - local interface = net.iwdata.ifname or "N/A" + local interface = net.iwinfo.ifname or "N/A" %> <tr class="cbi-section-table-row cbi-rowstyle-1"> <td class="cbi-value-field" id="<%=net:ifname()%>-signal"><%=signal_string%></td> @@ -323,7 +325,7 @@ end <div class="cbi-section"> <div class="cbi-section-node"> -<% if not defroutev4 and not defroutev6 then %> +<% if not def4 and not def6 then %> <%:No default routes known.%> <%else%> <table class="cbi-section-table"> @@ -334,23 +336,22 @@ end <th class="cbi-section-table-cell"><%:Metric%></th> </tr> - <% if defroutev4 then %> - + <% if def4 then %> <tr class="cbi-section-table-row cbi-rowstyle-1"> - <td class="cbi-value-field" id="v4dst"><%=defroutev4.dest%></td> - <td class="cbi-value-field" id="v4dev"><%=defroutev4.device%></td> - <td class="cbi-value-field" id="v4gw"><%=defroutev4.gateway%></td> - <td class="cbi-value-field" id="v4metr"><%=defroutev4.metric%></td> + <td class="cbi-value-field" id="v4dst"><%=def4.dest%></td> + <td class="cbi-value-field" id="v4dev"><%=def4.dev%></td> + <td class="cbi-value-field" id="v4gw"><%=def4.gateway%></td> + <td class="cbi-value-field" id="v4metr"><%=def4.metr%></td> </tr> <% end - if defroutev6 then %> + if def6 then %> <tr class="cbi-section-table-row cbi-rowstyle-2"> - <td class="cbi-value-field" id="v6dst"><%=defroutev6.dest%></td> - <td class="cbi-value-field" id="v6dev"><%=defroutev6.device%></td> - <td class="cbi-value-field" id="v6gw"><%=defroutev6.nexthop%></td> - <td class="cbi-value-field" id="v6metr"><%=defroutev6.metric%></td> + <td class="cbi-value-field" id="v6dst"><%=def6.dest%></td> + <td class="cbi-value-field" id="v6dev"><%=def6.dev%></td> + <td class="cbi-value-field" id="v6gw"><%=def6.gateway%></td> + <td class="cbi-value-field" id="v6metr"><%=def6.metr%></td> </tr> <% end %> diff --git a/modules/luci-mod-rpc/luasrc/controller/rpc.lua b/modules/luci-mod-rpc/luasrc/controller/rpc.lua index 862e5839f2..129ca43b51 100644 --- a/modules/luci-mod-rpc/luasrc/controller/rpc.lua +++ b/modules/luci-mod-rpc/luasrc/controller/rpc.lua @@ -49,6 +49,8 @@ function rpc_auth() server.challenge = function(user, pass) local sid, token, secret + require "luci.config" + if sys.user.checkpasswd(user, pass) then local sdat = util.ubus("session", "create", { timeout = luci.config.sauth.sessiontime }) if sdat then |