From 1937aad8967f224f78920667045a4b5bcbb1e040 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 23 Jul 2009 03:32:30 +0000 Subject: [PATCH] luci-0.9: merge r5027 - r5112 --- Makefile | 2 + .../luci-ddns/luasrc/controller/ddns.lua | 4 +- .../luasrc/controller/hd_idle.lua | 2 +- .../luci-hd_idle/luasrc/model/cbi/hd_idle.lua | 6 +- .../luci-initmgr/luasrc/controller/init.lua | 2 +- .../luasrc/controller/mmc_over_gpio.lua | 2 +- .../luci-ntpc/luasrc/controller/ntpc.lua | 2 +- .../luci-olsr/luasrc/controller/olsr.lua | 4 +- .../luasrc/model/cbi/olsr/olsrdplugins.lua | 13 +- .../luasrc/model/cbi/openvpn-advanced.lua | 1 - .../luasrc/model/cbi/openvpn-basic.lua | 1 - .../luci-openvpn/luasrc/model/cbi/openvpn.lua | 22 +- .../luci-p910nd/luasrc/controller/p910nd.lua | 2 +- .../luci-polipo/luasrc/controller/polipo.lua | 2 +- .../luci-qos/luasrc/controller/qos.lua | 4 +- .../luci-qos/luasrc/model/cbi/qos/qos.lua | 13 +- .../luci-qos/luasrc/model/cbi/qos/qosmini.lua | 13 +- .../luci-samba/luasrc/controller/samba.lua | 2 +- .../luasrc/controller/splash/splash.lua | 13 +- .../luasrc/view/admin_status/splash.htm | 4 +- .../luci-splash/root/usr/sbin/luci-splash | 7 +- .../luasrc/statistics/rrdtool.lua | 9 +- .../luasrc/statistics/rrdtool/definitions.lua | 1 - .../view/admin_statistics/networkplugins.htm | 2 +- .../view/admin_statistics/outputplugins.htm | 2 +- .../view/admin_statistics/systemplugins.htm | 2 +- .../luasrc/controller/tinyproxy.lua | 4 +- .../luci-upnp/luasrc/controller/upnp.lua | 2 +- .../luci-ushare/luasrc/controller/ushare.lua | 2 +- .../luasrc/controller/uvc_streamer.lua | 2 +- applications/luci-voice-core/Makefile | 4 + .../luasrc/controller/luci_voice.lua | 37 + .../luasrc/view/luci_voice/index.htm | 24 + .../luasrc/view/luci_voice/phone_index.htm | 20 + build/i18n-po2lua.pl | 62 +- build/module.mk | 2 +- contrib/package/luci/Makefile | 75 +- libs/cbi/luasrc/cbi.lua | 17 +- libs/cbi/luasrc/view/cbi/filebrowser.htm | 13 +- libs/cbi/luasrc/view/cbi/upload.htm | 3 +- libs/core/luasrc/debug.lua | 19 +- libs/core/luasrc/util.lua | 24 +- libs/lmo/Makefile | 46 + libs/lmo/src/lmo.h | 72 ++ libs/lmo/src/lmo_core.c | 231 +++++ libs/lmo/src/lmo_hash.c | 53 ++ libs/lmo/src/lmo_lookup.c | 58 ++ libs/lmo/src/lmo_lualib.c | 152 +++ libs/lmo/src/lmo_lualib.h | 33 + libs/lmo/src/lmo_po2lmo.c | 199 ++++ libs/lmo/standalone.mk | 56 ++ libs/lucid-http/luasrc/lucid/http/server.lua | 6 + libs/lucid/luasrc/lucid.lua | 80 +- libs/lucid/luasrc/lucid/tcpserver.lua | 3 + libs/lucid/root/etc/config/lucid | 2 + libs/nixio/Makefile | 12 + libs/nixio/docsrc/CHANGELOG.lua | 29 + libs/nixio/docsrc/README.lua | 13 +- libs/nixio/docsrc/nixio.UnifiedIO.lua | 1 - libs/nixio/docsrc/nixio.bit.lua | 12 +- libs/nixio/lua/nixio/util.lua | 12 +- libs/nixio/nixio-0.3-1.rockspec | 37 + libs/nixio/src/address.c | 4 + libs/nixio/src/bit.c | 9 + libs/nixio/src/file.c | 20 +- libs/nixio/standalone.mk | 3 +- libs/sys/luasrc/sys.lua | 176 ++-- libs/sys/luasrc/sys/zoneinfo.lua | 573 +----------- libs/sys/luasrc/sys/zoneinfo/tzdata.lua | 408 ++++++++ libs/sys/luasrc/sys/zoneinfo/tzoffset.lua | 177 ++++ libs/uvl/luasrc/uvl.lua | 9 +- libs/uvl/luasrc/uvl/datatypes.lua | 2 +- libs/uvl/luasrc/uvl/validation.lua | 2 +- libs/uvldoc/luasrc/uvldoc/renderer.lua | 4 +- libs/web/Makefile | 26 + libs/web/luasrc/dispatcher.lua | 15 +- libs/web/luasrc/i18n.lua | 22 +- libs/web/luasrc/sauth.lua | 21 +- libs/web/luasrc/template.lua | 26 +- libs/web/src/template_lualib.c | 62 ++ libs/web/src/template_lualib.h | 28 + libs/web/src/template_parser.c | 463 +++++++++ libs/web/src/template_parser.h | 81 ++ .../luasrc/controller/admin/services.lua | 6 +- .../luasrc/controller/admin/status.lua | 4 +- .../luasrc/controller/admin/system.lua | 20 +- .../luasrc/model/cbi/admin_index/luci.lua | 6 +- .../model/cbi/admin_network/dhcpleases.lua | 28 +- .../luasrc/model/cbi/admin_network/ifaces.lua | 18 +- .../model/cbi/admin_network/network.lua | 21 +- .../luasrc/model/cbi/admin_network/wifi.lua | 13 +- .../model/cbi/admin_services/crontab.lua | 6 +- .../luasrc/model/cbi/admin_system/fstab.lua | 14 +- .../luasrc/model/cbi/admin_system/ipkg.lua | 4 +- .../luasrc/model/cbi/admin_system/leds.lua | 15 +- .../luasrc/model/cbi/admin_system/sshkeys.lua | 4 +- .../luasrc/view/admin_status/conntrack.htm | 75 ++ .../luasrc/view/admin_status/interfaces.htm | 14 +- .../luasrc/view/admin_status/routes.htm | 89 ++ .../luasrc/controller/mini/system.lua | 16 +- .../admin-mini/luasrc/model/cbi/mini/dhcp.lua | 32 +- .../admin-mini/luasrc/model/cbi/mini/luci.lua | 11 +- .../luasrc/model/cbi/mini/network.lua | 20 +- .../admin-mini/luasrc/model/cbi/mini/wifi.lua | 13 +- .../luasrc/controller/freifunk/freifunk.lua | 4 +- modules/rpc/luasrc/controller/rpc.lua | 2 +- po/es/admin-core.po | 876 +++++++++++------- po/es/default.po | 119 +-- po/es/freifunk.po | 61 +- po/es/luci-fw.po | 127 +-- po/es/olsr.po | 261 +++--- 111 files changed, 3978 insertions(+), 1586 deletions(-) create mode 100644 applications/luci-voice-core/Makefile create mode 100644 applications/luci-voice-core/luasrc/controller/luci_voice.lua create mode 100644 applications/luci-voice-core/luasrc/view/luci_voice/index.htm create mode 100644 applications/luci-voice-core/luasrc/view/luci_voice/phone_index.htm create mode 100644 libs/lmo/Makefile create mode 100644 libs/lmo/src/lmo.h create mode 100644 libs/lmo/src/lmo_core.c create mode 100644 libs/lmo/src/lmo_hash.c create mode 100644 libs/lmo/src/lmo_lookup.c create mode 100644 libs/lmo/src/lmo_lualib.c create mode 100644 libs/lmo/src/lmo_lualib.h create mode 100644 libs/lmo/src/lmo_po2lmo.c create mode 100644 libs/lmo/standalone.mk create mode 100644 libs/nixio/docsrc/CHANGELOG.lua create mode 100644 libs/nixio/nixio-0.3-1.rockspec create mode 100644 libs/sys/luasrc/sys/zoneinfo/tzdata.lua create mode 100644 libs/sys/luasrc/sys/zoneinfo/tzoffset.lua create mode 100644 libs/web/src/template_lualib.c create mode 100644 libs/web/src/template_lualib.h create mode 100644 libs/web/src/template_parser.c create mode 100644 libs/web/src/template_parser.h create mode 100644 modules/admin-full/luasrc/view/admin_status/conntrack.htm create mode 100644 modules/admin-full/luasrc/view/admin_status/routes.htm diff --git a/Makefile b/Makefile index 13438848ed..905206701d 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,7 @@ all: build build: gccbuild luabuild gccbuild: + make -C libs/lmo CC="cc" CFLAGS="" LDFLAGS="" host-install for i in $(MODULES); do \ make -C$$i compile || { \ echo "*** Compilation of $$i failed!"; \ @@ -28,6 +29,7 @@ i18nbuild: clean: rm -rf docs + make -C libs/lmo host-clean for i in $(MODULES); do make -C$$i clean; done diff --git a/applications/luci-ddns/luasrc/controller/ddns.lua b/applications/luci-ddns/luasrc/controller/ddns.lua index 6adbbb0cae..7a81d9adfd 100644 --- a/applications/luci-ddns/luasrc/controller/ddns.lua +++ b/applications/luci-ddns/luasrc/controller/ddns.lua @@ -17,7 +17,7 @@ module("luci.controller.ddns", package.seeall) function index() require("luci.i18n") luci.i18n.loadc("ddns") - if not luci.fs.access("/etc/config/ddns") then + if not nixio.fs.access("/etc/config/ddns") then return end @@ -29,4 +29,4 @@ function index() local page = entry({"mini", "network", "ddns"}, cbi("ddns/ddnsmini", {autoapply=true}), luci.i18n.translate("ddns"), 60) page.i18n = "ddns" page.dependent = true -end \ No newline at end of file +end diff --git a/applications/luci-hd_idle/luasrc/controller/hd_idle.lua b/applications/luci-hd_idle/luasrc/controller/hd_idle.lua index 5dfbe16ea0..57ff10d7c6 100644 --- a/applications/luci-hd_idle/luasrc/controller/hd_idle.lua +++ b/applications/luci-hd_idle/luasrc/controller/hd_idle.lua @@ -18,7 +18,7 @@ module("luci.controller.hd_idle", package.seeall) function index() require("luci.i18n") luci.i18n.loadc("hd_idle") - if not luci.fs.access("/etc/config/hd-idle") then + if not nixio.fs.access("/etc/config/hd-idle") then return end diff --git a/applications/luci-hd_idle/luasrc/model/cbi/hd_idle.lua b/applications/luci-hd_idle/luasrc/model/cbi/hd_idle.lua index b59df829f7..60817db832 100644 --- a/applications/luci-hd_idle/luasrc/model/cbi/hd_idle.lua +++ b/applications/luci-hd_idle/luasrc/model/cbi/hd_idle.lua @@ -13,7 +13,7 @@ $Id$ ]]-- -require("luci.fs") +require("nixio.fs") m = Map("hd-idle", translate("hd_idle"), translate("hd_idle_desc")) @@ -24,8 +24,8 @@ s:option(Flag, "enabled", translate("enable", "Enable")) disk = s:option(Value, "disk", translate("disk")) disk.rmempty = true -for _, dev in ipairs(luci.fs.glob("/dev/[sh]d[a-z]")) do - disk:value(luci.fs.basename(dev)) +for _, dev in nixio.fs.glob("/dev/[sh]d[a-z]") do + disk:value(nixio.fs.basename(dev)) end s:option(Value, "idle_time_interval", translate("idle_time_interval")).default = 10 diff --git a/applications/luci-initmgr/luasrc/controller/init.lua b/applications/luci-initmgr/luasrc/controller/init.lua index fbbc7270f9..c7ef43f83e 100644 --- a/applications/luci-initmgr/luasrc/controller/init.lua +++ b/applications/luci-initmgr/luasrc/controller/init.lua @@ -15,7 +15,7 @@ $Id$ module("luci.controller.init", package.seeall) function index() - if not luci.fs.access("/etc/rc.common") then + if not nixio.fs.access("/etc/rc.common") then return end diff --git a/applications/luci-mmc_over_gpio/luasrc/controller/mmc_over_gpio.lua b/applications/luci-mmc_over_gpio/luasrc/controller/mmc_over_gpio.lua index 7beaa144f0..57fe5ee389 100644 --- a/applications/luci-mmc_over_gpio/luasrc/controller/mmc_over_gpio.lua +++ b/applications/luci-mmc_over_gpio/luasrc/controller/mmc_over_gpio.lua @@ -18,7 +18,7 @@ module("luci.controller.mmc_over_gpio", package.seeall) function index() require("luci.i18n") luci.i18n.loadc("mmc_over_gpio") - if not luci.fs.access("/etc/config/mmc_over_gpio") then + if not nixio.fs.access("/etc/config/mmc_over_gpio") then return end diff --git a/applications/luci-ntpc/luasrc/controller/ntpc.lua b/applications/luci-ntpc/luasrc/controller/ntpc.lua index 9290644680..0d656a48fa 100644 --- a/applications/luci-ntpc/luasrc/controller/ntpc.lua +++ b/applications/luci-ntpc/luasrc/controller/ntpc.lua @@ -17,7 +17,7 @@ module("luci.controller.ntpc", package.seeall) function index() require("luci.i18n") luci.i18n.loadc("ntpc") - if not luci.fs.access("/etc/config/ntpclient") then + if not nixio.fs.access("/etc/config/ntpclient") then return end diff --git a/applications/luci-olsr/luasrc/controller/olsr.lua b/applications/luci-olsr/luasrc/controller/olsr.lua index 652f6b9d2c..837873adfb 100644 --- a/applications/luci-olsr/luasrc/controller/olsr.lua +++ b/applications/luci-olsr/luasrc/controller/olsr.lua @@ -1,7 +1,7 @@ module("luci.controller.olsr", package.seeall) function index() - if not luci.fs.access("/etc/config/olsrd") then + if not nixio.fs.access("/etc/config/olsrd") then return end @@ -182,7 +182,7 @@ function fetch_txtinfo(otable) local rawdata = luci.sys.httpget("http://127.0.0.1:2006/"..otable) if #rawdata == 0 then - if luci.fs.access("/proc/net/ipv6_route", "r") then + if nixio.fs.access("/proc/net/ipv6_route", "r") then rawdata = luci.sys.httpget("http://[::1]:2006/"..otable) if #rawdata == 0 then return nil diff --git a/applications/luci-olsr/luasrc/model/cbi/olsr/olsrdplugins.lua b/applications/luci-olsr/luasrc/model/cbi/olsr/olsrdplugins.lua index 03f18a8180..f81a4a4b41 100644 --- a/applications/luci-olsr/luasrc/model/cbi/olsr/olsrdplugins.lua +++ b/applications/luci-olsr/luasrc/model/cbi/olsr/olsrdplugins.lua @@ -13,9 +13,8 @@ You may obtain a copy of the License at $Id$ ]]-- -require("luci.fs") -require("luci.ip") - +local ip = require "luci.ip" +local fs = require "nixio.fs" if arg[1] then mp = Map("olsrd", translate("olsrd_plugins", "OLSR - Plugins")) @@ -44,7 +43,7 @@ if arg[1] then local function Cidr2IpMask(val) if val then for i = 1, #val do - local cidr = luci.ip.IPv4(val[i]) or luci.ip.IPv6(val[i]) + local cidr = ip.IPv4(val[i]) or ip.IPv6(val[i]) if cidr then val[i] = cidr:network():string() .. " " .. cidr:mask():string() end @@ -59,9 +58,9 @@ if arg[1] then local ip, mask = val[i]:gmatch("([^%s]+)%s+([^%s]+)")() local cidr if ip and mask and ip:match(":") then - cidr = luci.ip.IPv6(ip, mask) + cidr = ip.IPv6(ip, mask) elseif ip and mask then - cidr = luci.ip.IPv4(ip, mask) + cidr = ip.IPv4(ip, mask) end if cidr then @@ -220,7 +219,7 @@ else ) -- create a loadplugin section for each found plugin - for k, v in pairs(luci.fs.dir("/usr/lib")) do + for v in fs.dir("/usr/lib") do if v:sub(1, 6) == "olsrd_" then if not plugins[v] then mpi.uci:section( diff --git a/applications/luci-openvpn/luasrc/model/cbi/openvpn-advanced.lua b/applications/luci-openvpn/luasrc/model/cbi/openvpn-advanced.lua index 834dceb244..13dfd12978 100644 --- a/applications/luci-openvpn/luasrc/model/cbi/openvpn-advanced.lua +++ b/applications/luci-openvpn/luasrc/model/cbi/openvpn-advanced.lua @@ -12,7 +12,6 @@ You may obtain a copy of the License at $Id$ ]]-- -require("luci.fs") require("luci.ip") diff --git a/applications/luci-openvpn/luasrc/model/cbi/openvpn-basic.lua b/applications/luci-openvpn/luasrc/model/cbi/openvpn-basic.lua index 1d4cc4d7ac..b3e22d4800 100644 --- a/applications/luci-openvpn/luasrc/model/cbi/openvpn-basic.lua +++ b/applications/luci-openvpn/luasrc/model/cbi/openvpn-basic.lua @@ -12,7 +12,6 @@ You may obtain a copy of the License at $Id$ ]]-- -require("luci.fs") require("luci.ip") require("luci.model.uci") diff --git a/applications/luci-openvpn/luasrc/model/cbi/openvpn.lua b/applications/luci-openvpn/luasrc/model/cbi/openvpn.lua index 863be2f13c..e71becd06c 100644 --- a/applications/luci-openvpn/luasrc/model/cbi/openvpn.lua +++ b/applications/luci-openvpn/luasrc/model/cbi/openvpn.lua @@ -12,13 +12,9 @@ You may obtain a copy of the License at $Id$ ]]-- -require("luci.fs") -require("luci.ip") -require("luci.sys") -require("luci.model.uci") - - -local uci = luci.model.uci.cursor() +local fs = require "nixio.fs" +local sys = require "luci.sys" +local uci = require "luci.model.uci".cursor() local m = Map("openvpn", translate("openvpn")) local s = m:section( TypedSection, "openvpn", translate("openvpn_overview"), translate("openvpn_overview_desc") ) @@ -74,13 +70,11 @@ s:option( Flag, "enable", translate("openvpn_enable") ) local active = s:option( DummyValue, "_active", translate("openvpn_active") ) function active.cfgvalue(self, section) - if luci.fs.isfile("/var/run/openvpn_%s.pid" % section) then - local pid = io.lines("/var/run/openvpn_%s.pid" % section)() - if pid and #pid > 0 and tonumber(pid) ~= nil then - return (luci.sys.process.signal(pid, 0)) - and translatef("openvpn_active_yes", pid) - or translate("openvpn_active_no") - end + local pid = fs.readfile("/var/run/openvpn_%s.pid" % section) + if pid and #pid > 0 and tonumber(pid) ~= nil then + return (sys.process.signal(pid, 0)) + and translatef("openvpn_active_yes", pid) + or translate("openvpn_active_no") end return translate("openvpn_active_no") end diff --git a/applications/luci-p910nd/luasrc/controller/p910nd.lua b/applications/luci-p910nd/luasrc/controller/p910nd.lua index 75b2693d40..13167013cf 100644 --- a/applications/luci-p910nd/luasrc/controller/p910nd.lua +++ b/applications/luci-p910nd/luasrc/controller/p910nd.lua @@ -18,7 +18,7 @@ module("luci.controller.p910nd", package.seeall) function index() require("luci.i18n") luci.i18n.loadc("p910nd") - if not luci.fs.access("/etc/config/p910nd") then + if not nixio.fs.access("/etc/config/p910nd") then return end diff --git a/applications/luci-polipo/luasrc/controller/polipo.lua b/applications/luci-polipo/luasrc/controller/polipo.lua index 949f80a621..3d9f7d1ffb 100644 --- a/applications/luci-polipo/luasrc/controller/polipo.lua +++ b/applications/luci-polipo/luasrc/controller/polipo.lua @@ -14,7 +14,7 @@ $Id$ module("luci.controller.polipo", package.seeall) function index() - if not luci.fs.access("/etc/config/polipo") then + if not nixio.fs.access("/etc/config/polipo") then return end diff --git a/applications/luci-qos/luasrc/controller/qos.lua b/applications/luci-qos/luasrc/controller/qos.lua index 970dd3d601..af9b11499a 100644 --- a/applications/luci-qos/luasrc/controller/qos.lua +++ b/applications/luci-qos/luasrc/controller/qos.lua @@ -14,7 +14,7 @@ $Id$ module("luci.controller.qos", package.seeall) function index() - if not luci.fs.access("/etc/config/qos") then + if not nixio.fs.access("/etc/config/qos") then return end @@ -26,4 +26,4 @@ function index() local page = entry({"mini", "network", "qos"}, cbi("qos/qosmini", {autoapply=true}), "QoS") page.i18n = "qos" page.dependent = true -end \ No newline at end of file +end diff --git a/applications/luci-qos/luasrc/model/cbi/qos/qos.lua b/applications/luci-qos/luasrc/model/cbi/qos/qos.lua index 22dfbea5ff..ec450cf6ea 100644 --- a/applications/luci-qos/luasrc/model/cbi/qos/qos.lua +++ b/applications/luci-qos/luasrc/model/cbi/qos/qos.lua @@ -11,7 +11,10 @@ You may obtain a copy of the License at $Id$ ]]-- -require("luci.tools.webadmin") + +local wa = require "luci.tools.webadmin" +local fs = require "nixio.fs" + m = Map("qos") s = m:section(TypedSection, "interface", translate("interfaces")) @@ -46,19 +49,19 @@ t.default = "Normal" srch = s:option(Value, "srchost") srch.rmempty = true srch:value("", translate("all")) -luci.tools.webadmin.cbi_add_knownips(srch) +wa.cbi_add_knownips(srch) dsth = s:option(Value, "dsthost") dsth.rmempty = true dsth:value("", translate("all")) -luci.tools.webadmin.cbi_add_knownips(dsth) +wa.cbi_add_knownips(dsth) l7 = s:option(ListValue, "layer7", translate("service")) l7.rmempty = true l7:value("", translate("all")) -local pats = luci.fs.dir("/etc/l7-protocols") +local pats = fs.dir("/etc/l7-protocols") if pats then - for i,f in ipairs(pats) do + for f in pats do if f:sub(-4) == ".pat" then l7:value(f:sub(1, #f-4)) end diff --git a/applications/luci-qos/luasrc/model/cbi/qos/qosmini.lua b/applications/luci-qos/luasrc/model/cbi/qos/qosmini.lua index ec93694c2e..cb79682644 100644 --- a/applications/luci-qos/luasrc/model/cbi/qos/qosmini.lua +++ b/applications/luci-qos/luasrc/model/cbi/qos/qosmini.lua @@ -12,7 +12,10 @@ You may obtain a copy of the License at $Id$ ]]-- -require("luci.tools.webadmin") + +local wa = require "luci.tools.webadmin" +local fs = require "nixio.fs" + m = Map("qos") s = m:section(NamedSection, "wan", "interface", translate("m_n_inet")) @@ -37,19 +40,19 @@ t.default = "Normal" srch = s:option(Value, "srchost") srch.rmempty = true srch:value("", translate("all")) -luci.tools.webadmin.cbi_add_knownips(srch) +wa.cbi_add_knownips(srch) dsth = s:option(Value, "dsthost") dsth.rmempty = true dsth:value("", translate("all")) -luci.tools.webadmin.cbi_add_knownips(dsth) +wa.cbi_add_knownips(dsth) l7 = s:option(ListValue, "layer7", translate("service")) l7.rmempty = true l7:value("", translate("all")) -local pats = luci.fs.dir("/etc/l7-protocols") +local pats = fs.dir("/etc/l7-protocols") if pats then - for i,f in ipairs(pats) do + for f in pats do if f:sub(-4) == ".pat" then l7:value(f:sub(1, #f-4)) end diff --git a/applications/luci-samba/luasrc/controller/samba.lua b/applications/luci-samba/luasrc/controller/samba.lua index 75cb65a0b2..c2d5d849af 100644 --- a/applications/luci-samba/luasrc/controller/samba.lua +++ b/applications/luci-samba/luasrc/controller/samba.lua @@ -15,7 +15,7 @@ $Id$ module("luci.controller.samba", package.seeall) function index() - if not luci.fs.access("/etc/config/samba") then + if not nixio.fs.access("/etc/config/samba") then return end require("luci.i18n") diff --git a/applications/luci-splash/luasrc/controller/splash/splash.lua b/applications/luci-splash/luasrc/controller/splash/splash.lua index 13f9f4121a..362ad9def4 100644 --- a/applications/luci-splash/luasrc/controller/splash/splash.lua +++ b/applications/luci-splash/luasrc/controller/splash/splash.lua @@ -11,9 +11,18 @@ function index() end function action_dispatch() + local uci = luci.model.uci.cursor_state() local mac = luci.sys.net.ip4mac(luci.http.getenv("REMOTE_ADDR")) or "" - local status = luci.util.execl("luci-splash status "..mac)[1] - if #mac > 0 and ( status == "whitelisted" or status == "lease" ) then + local access = false + + uci:foreach("luci_splash", "lease", function(s) + if s.mac and s.mac:lower() == mac then access = true end + end) + uci:foreach("luci_splash", "whitelist", function(s) + if s.mac and s.mac:lower() == mac then access = true end + end) + + if #mac > 0 and access then luci.http.redirect(luci.dispatcher.build_url()) else luci.http.redirect(luci.dispatcher.build_url("splash", "splash")) diff --git a/applications/luci-splash/luasrc/view/admin_status/splash.htm b/applications/luci-splash/luasrc/view/admin_status/splash.htm index 99395200d3..4151c66c38 100644 --- a/applications/luci-splash/luasrc/view/admin_status/splash.htm +++ b/applications/luci-splash/luasrc/view/admin_status/splash.htm @@ -18,6 +18,8 @@ local utl = require "luci.util" local ipt = require "luci.sys.iptparser".IptParser() local uci = require "luci.model.uci".cursor_state() local wat = require "luci.tools.webadmin" +local fs = require "nixio.fs" + local clients = { } local leasetime = tonumber(uci:get("luci_splash", "general", "leasetime") or 1) * 60 * 60 local leasefile = "/tmp/dhcp.leases" @@ -94,7 +96,7 @@ uci:foreach("luci_splash", "blacklist", end end) -if luci.fs.access(leasefile) then +if fs.access(leasefile) then for l in io.lines(leasefile) do local time, mac, ip, name = l:match("^(%d+) (%S+) (%S+) (%S+)") if time and mac and ip then diff --git a/applications/luci-splash/root/usr/sbin/luci-splash b/applications/luci-splash/root/usr/sbin/luci-splash index 017cfebfca..1adcb0932d 100755 --- a/applications/luci-splash/root/usr/sbin/luci-splash +++ b/applications/luci-splash/root/usr/sbin/luci-splash @@ -29,7 +29,7 @@ function main(argv) limit_down = tonumber(uci:get("luci_splash", "general", "limit_down")) or 0 if ( cmd == "lease" or cmd == "add-rules" or cmd == "remove" or - cmd == "whitelist" or cmd == "blacklist" ) and #argv > 0 + cmd == "whitelist" or cmd == "blacklist" or cmd == "status" ) and #argv > 0 then lock() @@ -59,6 +59,11 @@ function main(argv) elseif whitelist_macs[mac] then add_whitelist_rule(mac) end + elseif mac and cmd == "status" then + print(leased_macs[mac] and "lease" + or whitelist_macs[mac] and "whitelist" + or blacklist_macs[mac] and "blacklist" + or "new") elseif mac and ( cmd == "whitelist" or cmd == "blacklist" or cmd == "lease" ) then if cmd ~= "lease" and leased_macs[mac] then print("Removing %s from leases" % mac) diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool.lua b/applications/luci-statistics/luasrc/statistics/rrdtool.lua index 911b38bff1..eb5c266b0e 100644 --- a/applications/luci-statistics/luasrc/statistics/rrdtool.lua +++ b/applications/luci-statistics/luasrc/statistics/rrdtool.lua @@ -22,7 +22,8 @@ require("luci.statistics.i18n") require("luci.model.uci") require("luci.util") require("luci.sys") -require("luci.fs") + +local fs = require "nixio.fs" Graph = luci.util.class() @@ -96,7 +97,7 @@ function Graph._rrdtool( self, def, rrd ) -- prepare directory local dir = def[1]:gsub("/[^/]+$","") - luci.fs.mkdir( dir, true ) + fs.mkdirr( dir ) -- construct commandline local cmdline = "rrdtool graph" @@ -500,7 +501,7 @@ function Graph.render( self, plugin, plugin_instance ) -- check for a whole graph handler local plugin_def = "luci.statistics.rrdtool.definitions." .. plugin - local stat, def = luci.util.copcall( require, plugin_def ) + local stat, def = pcall( require, plugin_def ) if stat and def and type(def.rrdargs) == "function" then @@ -539,7 +540,7 @@ function Graph.render( self, plugin, plugin_instance ) -- check for data type handler local dtype_def = plugin_def .. "." .. dtype - local stat, def = luci.util.copcall( require, dtype_def ) + local stat, def = pcall( require, dtype_def ) if stat and def and type(def.rrdargs) == "function" then diff --git a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions.lua b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions.lua index 7e0b605340..8832613513 100644 --- a/applications/luci-statistics/luasrc/statistics/rrdtool/definitions.lua +++ b/applications/luci-statistics/luasrc/statistics/rrdtool/definitions.lua @@ -16,7 +16,6 @@ $Id$ module("luci.statistics.rrdtool.definitions", package.seeall) require("luci.util") -require("luci.fs") Instance = luci.util.class() diff --git a/applications/luci-statistics/luasrc/view/admin_statistics/networkplugins.htm b/applications/luci-statistics/luasrc/view/admin_statistics/networkplugins.htm index 54ba2b0e26..13e52257ef 100644 --- a/applications/luci-statistics/luasrc/view/admin_statistics/networkplugins.htm +++ b/applications/luci-statistics/luasrc/view/admin_statistics/networkplugins.htm @@ -22,7 +22,7 @@ about open tcp connections, interface traffic, iptables rules etc.%>

<%:stat_networkplugins_installed Installed network plugins:%>