From 4081526ba7d0594c3ef120df5ee223c4eb55fb18 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 23 Dec 2008 21:39:38 +0000 Subject: [PATCH] luci-0.8: merge complete trunk --- .cproject | 221 +++++++++++++++ .project | 66 +++++ Makefile | 14 +- .../luasrc/controller/ffwizard.lua | 2 +- .../luasrc/model/cbi/ffwizard.lua | 183 ++++++++----- .../luasrc/tools/ffwizard.lua | 35 +-- .../luci-olsr/luasrc/controller/olsr.lua | 9 +- .../luci-polipo/luasrc/i18n/polipo.en.xml | 49 ++++ applications/luci-qos/luasrc/i18n/qos.fr.lua | 17 ++ applications/luci-qos/luasrc/i18n/qos.fr.xml | 23 ++ .../luasrc/i18n/tinyproxy.fr.lua | 34 +++ .../luasrc/i18n/tinyproxy.fr.xml | 40 +++ .../luasrc/i18n/uvc_streamer.fr.lua | 5 + .../luasrc/i18n/uvc_streamer.fr.xml | 11 + build/cbi2uvl.lua | 13 +- build/hostenv.sh | 1 + build/uvl2cbi.lua | 88 ++++++ build/uvl2i18n.lua | 33 +++ build/uvldoc | 24 ++ build/zoneinfo2lua.pl | 70 +++++ contrib/bitlib/Makefile | 4 +- contrib/luacurses/Makefile | 4 +- contrib/luadoc/lua/luadoc/config.lua | 2 +- contrib/luadoc/lua/luadoc/doclet/debug.lua | 2 +- .../luadoc/lua/luadoc/doclet/formatter.lua | 2 +- contrib/luadoc/lua/luadoc/doclet/html.lua | 2 +- contrib/luadoc/lua/luadoc/doclet/raw.lua | 2 +- contrib/luadoc/lua/luadoc/init.lua | 2 +- contrib/luadoc/lua/luadoc/lp.lua | 2 +- contrib/luadoc/lua/luadoc/taglet/standard.lua | 2 +- .../lua/luadoc/taglet/standard/tags.lua | 2 +- contrib/luadoc/lua/luadoc/util.lua | 2 +- contrib/package/luci/Makefile | 250 ++++++++++++++++- contrib/uci/Makefile | 4 +- i18n/english/luasrc/i18n/admin-core.en.lua | 6 +- i18n/english/luasrc/i18n/admin-core.en.xml | 4 +- i18n/german/luasrc/i18n/admin-core.de.lua | 4 + libs/cbi/htdocs/luci-static/resources/cbi.js | 36 +++ libs/cbi/luasrc/cbi.lua | 5 +- libs/cbi/luasrc/view/cbi/browser.htm | 23 ++ libs/cbi/luasrc/view/cbi/filebrowser.htm | 122 +++++++++ libs/cbi/luasrc/view/cbi/footer.htm | 3 +- libs/cbi/luasrc/view/cbi/header.htm | 2 +- libs/cbi/luasrc/view/cbi/simpleform.htm | 2 +- libs/core/luasrc/fs.lua | 9 +- libs/core/luasrc/init.lua | 2 +- libs/core/luasrc/util.lua | 16 +- libs/http/luasrc/http/protocol.lua | 3 + libs/http/luasrc/http/protocol/date.lua | 112 +------- libs/httpd/host/runluci | 5 + libs/httpd/luasrc/httpd/server.lua | 4 +- .../boa-patches/220-ipv6-vs-ipv4.patch | 257 ++++++++++++++++++ libs/sys/luasrc/sys/zoneinfo.lua | 196 +++++++++++-- libs/web/luasrc/dispatcher.lua | 111 ++++++-- libs/web/luasrc/sauth.lua | 16 ++ libs/web/root/etc/config/luci | 2 +- modules/admin-core/luasrc/view/indexer.htm | 15 + modules/admin-core/luasrc/view/sysauth.htm | 2 +- .../admin-core/root/etc/config/luci_ethers | 1 + modules/admin-core/root/etc/config/luci_hosts | 4 +- .../root/lib/uci/schema/default/network | 1 - .../luasrc/controller/admin/filebrowser.lua | 20 ++ .../luasrc/controller/admin/index.lua | 9 +- .../luasrc/controller/admin/services.lua | 17 +- .../luasrc/controller/admin/system.lua | 6 +- .../luasrc/model/cbi/admin_network/ifaces.lua | 1 + .../luasrc/model/cbi/admin_network/wifi.lua | 1 + .../model/cbi/admin_network/wireless.lua | 6 +- .../model/cbi/admin_services/lucittpd.lua | 25 ++ .../luasrc/controller/mini/index.lua | 9 +- .../luasrc/controller/freifunk/freifunk.lua | 17 +- .../luasrc/model/cbi/freifunk/contact.lua | 24 +- .../luasrc/model/cbi/freifunk/freifunk.lua | 11 +- .../model/cbi/freifunk/public_status.lua | 213 +++++++++++++++ .../freifunk/luasrc/view/freifunk/index.htm | 2 +- modules/freifunk/root/etc/config/freifunk | 100 ++++--- .../root/etc/config/freifunk_augsburg | 2 + .../freifunk/root/etc/config/freifunk_berlin | 2 + .../root/etc/config/freifunk_hannover | 5 + modules/rpc/luasrc/controller/rpc.lua | 26 +- .../luci-static/openwrt.org/cascade.css | 7 - 81 files changed, 2328 insertions(+), 358 deletions(-) create mode 100644 .cproject create mode 100644 applications/luci-polipo/luasrc/i18n/polipo.en.xml create mode 100644 applications/luci-qos/luasrc/i18n/qos.fr.lua create mode 100644 applications/luci-qos/luasrc/i18n/qos.fr.xml create mode 100644 applications/luci-tinyproxy/luasrc/i18n/tinyproxy.fr.lua create mode 100644 applications/luci-tinyproxy/luasrc/i18n/tinyproxy.fr.xml create mode 100644 applications/luci-uvc_streamer/luasrc/i18n/uvc_streamer.fr.lua create mode 100644 applications/luci-uvc_streamer/luasrc/i18n/uvc_streamer.fr.xml create mode 100644 build/uvl2cbi.lua create mode 100755 build/uvl2i18n.lua create mode 100755 build/uvldoc create mode 100644 libs/cbi/luasrc/view/cbi/browser.htm create mode 100644 libs/cbi/luasrc/view/cbi/filebrowser.htm create mode 100644 libs/sgi-webuci/boa-patches/220-ipv6-vs-ipv4.patch create mode 100644 modules/admin-core/luasrc/view/indexer.htm create mode 100644 modules/admin-full/luasrc/controller/admin/filebrowser.lua create mode 100644 modules/admin-full/luasrc/model/cbi/admin_services/lucittpd.lua create mode 100644 modules/freifunk/luasrc/model/cbi/freifunk/public_status.lua create mode 100644 modules/freifunk/root/etc/config/freifunk_augsburg create mode 100644 modules/freifunk/root/etc/config/freifunk_berlin create mode 100644 modules/freifunk/root/etc/config/freifunk_hannover diff --git a/.cproject b/.cproject new file mode 100644 index 000000000..e1a477410 --- /dev/null +++ b/.cproject @@ -0,0 +1,221 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project index 4c60d6eb4..11b398b26 100644 --- a/.project +++ b/.project @@ -5,8 +5,74 @@ + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.autoBuildTarget + all + + + org.eclipse.cdt.make.core.buildArguments + + + + org.eclipse.cdt.make.core.buildCommand + make + + + org.eclipse.cdt.make.core.cleanBuildTarget + clean + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + false + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.fullBuildTarget + all + + + org.eclipse.cdt.make.core.stopOnError + true + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + true + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.cnature org.eclipse.dltk.lua.core.nature diff --git a/Makefile b/Makefile index 581e5c900..cbebd4535 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ include build/config.mk -MODULES = applications/* libs/* modules/* themes/* i18n/* contrib/* +MODULES = contrib/* applications/* libs/* modules/* themes/* i18n/* OS:=$(shell uname) export OS @@ -12,7 +12,7 @@ all: build build: gccbuild luabuild gccbuild: - for i in $(MODULES); do make -C$$i compile; done + for i in $(MODULES); do make -C$$i compile; done luabuild: for i in $(MODULES); do make -C$$i luabuild; done @@ -39,14 +39,14 @@ hostcopy: hostenv: host ucidefaults ucidefaults: - build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "$(realpath host)/bin/uci-defaults --exclude luci-community-*" + build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "$(realpath host)/bin/uci-defaults --exclude luci-freifunk-*" runboa: hostenv libs/sgi-webuci/host/buildconfig.sh $(realpath host) > host/etc/boa/boa.conf build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "$(realpath host/usr/bin/boa) -c $(realpath host/etc/boa) -d" runhttpd: hostenv - build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "$(realpath libs/httpd/host/runluci) $(realpath host) $(HTDOCS)" + build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "$(realpath host/usr/bin/lucittpd) $(realpath host)/usr/lib/lucittpd/plugins" runluci: luahost build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "$(realpath libs/httpd/host/runluci) $(realpath host) $(HTDOCS)" @@ -63,11 +63,15 @@ hostclean: clean apidocs: hostenv build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "build/makedocs.sh host/luci/ docs" +uvldocs: hostenv + build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) \ + "build/uvldoc $(realpath host) $(UVL_SCHEMEDIR) uvldocs $(DOCS)" + run: # make run is deprecated # # Please use: # # # - # To run LuCI WebUI using LuCI HTTPD # + # To run LuCI WebUI using LuCIttpd # # make runhttpd # # # # To run LuCI WebUI using Boa/Webuci # diff --git a/applications/luci-ffwizard-leipzig/luasrc/controller/ffwizard.lua b/applications/luci-ffwizard-leipzig/luasrc/controller/ffwizard.lua index 9e7c0deca..9a9f883ef 100644 --- a/applications/luci-ffwizard-leipzig/luasrc/controller/ffwizard.lua +++ b/applications/luci-ffwizard-leipzig/luasrc/controller/ffwizard.lua @@ -17,5 +17,5 @@ $Id$ module "luci.controller.ffwizard" function index() - entry({"admin", "index", "ffwizard"}, form("ffwizard"), "Freifunkassistent", 50) + entry({"admin", "freifunk", "ffwizard"}, form("ffwizard"), "Freifunkassistent", 50) end \ No newline at end of file diff --git a/applications/luci-ffwizard-leipzig/luasrc/model/cbi/ffwizard.lua b/applications/luci-ffwizard-leipzig/luasrc/model/cbi/ffwizard.lua index 5245a92f1..87bbe4d1f 100644 --- a/applications/luci-ffwizard-leipzig/luasrc/model/cbi/ffwizard.lua +++ b/applications/luci-ffwizard-leipzig/luasrc/model/cbi/ffwizard.lua @@ -17,6 +17,7 @@ $Id$ local uci = require "luci.model.uci".cursor() local tools = require "luci.tools.ffwizard" +local util = require "luci.util" -------------------- View -------------------- @@ -33,11 +34,13 @@ uci:foreach("wireless", "wifi-device", main = f:field(Flag, "wifi", "Freifunkzugang einrichten") -net = f:field(Value, "net", "Freifunknetz") +net = f:field(Value, "net", "Freifunknetz", "1. Teil der IP-Adresse") net.rmempty = true net:depends("wifi", "1") -net:value("104.61", "Leipzig (104.61)") -net:value("104.62", "Halle (104.62)") +uci:foreach("freifunk", "community", function(s) + net:value(s[".name"], "%s (%s)" % {s.name, s.prefix}) +end) + function net.cfgvalue(self, section) return uci:get("freifunk", "wizard", "net") end @@ -47,12 +50,9 @@ function net.write(self, section, value) end -subnet = f:field(ListValue, "subnet", "Subnetz (Projekt)") +subnet = f:field(Value, "subnet", "Subnetz (Projekt)", "2. Teil der IP-Adresse") subnet.rmempty = true subnet:depends("wifi", "1") -for i=0, 255 do - subnet:value(i) -end function subnet.cfgvalue(self, section) return uci:get("freifunk", "wizard", "subnet") end @@ -61,7 +61,7 @@ function subnet.write(self, section, value) uci:save("freifunk") end -node = f:field(Value, "node", "Knoten") +node = f:field(Value, "node", "Knoten", "3. Teil der IP-Adresse") node.rmempty = true node:depends("wifi", "1") for i=1, 51 do @@ -77,14 +77,14 @@ end client = f:field(Flag, "client", "WLAN-DHCP anbieten") client:depends("wifi", "1") +client.rmempty = true olsr = f:field(Flag, "olsr", "OLSR einrichten") +olsr.rmempty = true -share = f:field(ListValue, "sharenet", "Eigenen Internetzugang freigeben") -share:value("maybe", "-- keine Aktion --") -share:value("yes", "einschalten") -share:value("no", "ausschalten") +share = f:field(Flag, "sharenet", "Eigenen Internetzugang freigeben") +share.rmempty = true @@ -114,17 +114,22 @@ function main.write(self, section, value) if value == "0" then return end - + local device = dev:formvalue(section) + local community, external -- Collect IP-Address local inet = net:formvalue(section) local isubnet = subnet:formvalue(section) local inode = node:formvalue(section) - + -- Invalidate fields if not inet then net.tag_missing[section] = true + else + community = inet + external = uci:get("freifunk", community, "external") or "" + inet = uci:get("freifunk", community, "prefix") or inet end if not isubnet then subnet.tag_missing[section] = true @@ -132,57 +137,70 @@ function main.write(self, section, value) if not inode then node.tag_missing[section] = true end - + if not inet or not isubnet or not inode then return end - + local ip = "%s.%s.%s" % {inet, isubnet, inode} - - + + -- Cleanup - luci.util.perror("1") tools.wifi_delete_ifaces(device) - luci.util.perror("2") tools.network_remove_interface(device) - luci.util.perror("3") tools.firewall_zone_remove_interface("freifunk", device) - - + + -- Tune community settings + if community and uci:get("freifunk", community) then + uci:tset("freifunk", "community", uci:get_all("freifunk", community)) + end + -- Tune wifi device - local devconfig = _strip_internals(uci:get_all("freifunk", "wifi_device")) + local devconfig = uci:get_all("freifunk", "wifi_device") + util.update(devconfig, uci:get_all(external, "wifi_device") or {}) uci:tset("wireless", device, devconfig) - + -- Create wifi iface - local ifconfig = _strip_internals(uci:get_all("freifunk", "wifi_iface")) + local ifconfig = uci:get_all("freifunk", "wifi_iface") + util.update(ifconfig, uci:get_all(external, "wifi_iface") or {}) ifconfig.device = device + ifconfig.network = device + ifconfig.ssid = uci:get("freifunk", community, "ssid") uci:section("wireless", "wifi-iface", nil, ifconfig) - + -- Save wifi - uci:save("wireless") - + uci:save("wireless") + -- Create firewall zone and add default rules (first time) local newzone = tools.firewall_create_zone("freifunk", "DROP", "ACCEPT", "DROP", true) if newzone then uci:foreach("freifunk", "fw_forwarding", function(section) - uci:section("firewall", "forwarding", nil, _strip_internals(section)) + uci:section("firewall", "forwarding", nil, section) + end) + uci:foreach(external, "fw_forwarding", function(section) + uci:section("firewall", "forwarding", nil, section) end) - + uci:foreach("freifunk", "fw_rule", function(section) - uci:section("firewall", "rule", nil, _strip_internals(section)) + uci:section("firewall", "rule", nil, section) + end) + uci:foreach(external, "fw_rule", function(section) + uci:section("firewall", "rule", nil, section) end) - + uci:save("firewall") end - - + + -- Crate network interface - local netconfig = _strip_internals(uci:get_all("freifunk", "interface")) + local netconfig = uci:get_all("freifunk", "interface") + util.update(netconfig, uci:get_all(external, "interface") or {}) + netconfig.proto = "static" netconfig.ipaddr = ip uci:section("network", "interface", device, netconfig) - + uci:save("network") - + tools.firewall_zone_add_interface("freifunk", device) end @@ -191,28 +209,30 @@ function olsr.write(self, section, value) if value == "0" then return end - + + local device = dev:formvalue(section) - + + local community = net:formvalue(section) + local external = community and uci:get("freifunk", community, "external") or "" + -- Delete old interface - uci:delete_all("freifunk", "Interface", {Interface=device}) - + uci:delete_all("olsrd", "Interface", {interface=device}) + -- Write new interface - local olsrbase = _strip_internals(uci:get_all("freifunk", "olsr_interface")) - olsrbase.Interface = device - uci:section("olsr", "Interface", nil, olsrbase) - uci:save("olsr") + local olsrbase = uci:get_all("freifunk", "olsr_interface") + util.update(olsrbase, uci:get_all(external, "olsr_interface") or {}) + olsrbase.interface = device + olsrbase.ignore = "0" + uci:section("olsrd", "Interface", nil, olsrbase) + uci:save("olsrd") end function share.write(self, section, value) - if value == "maybe" then - return - end - uci:delete_all("firewall", "forwarding", {src="freifunk", dest="wan"}) - - if value == "yes" then + + if value == "1" then uci:section("firewall", "forwarding", nil, {src="freifunk", dest="wan"}) end uci:save("firewall") @@ -223,50 +243,81 @@ function client.write(self, section, value) if value == "0" then return end - + local device = dev:formvalue(section) -- Collect IP-Address local inet = net:formvalue(section) local isubnet = subnet:formvalue(section) local inode = node:formvalue(section) - + if not inet or not isubnet or not inode then return end - - local dhcpbeg = 48 + tonumber(inode) * 4 + local community = inet + local external = community and uci:get("freifunk", community, "external") or "" + inet = uci:get("freifunk", community, "prefix") or inet + + local dhcpbeg = 48 + tonumber(inode) * 4 local dclient = "%s.%s.%s" % {inet:gsub("^[0-9]+", "10"), isubnet, dhcpbeg} local limit = dhcpbeg < 252 and 3 or 2 - + -- Delete old alias uci:delete("network", device .. "dhcp") - + -- Create alias - local aliasbase = _strip_internals(uci:get_all("freifunk", "alias")) + local aliasbase = uci:get_all("freifunk", "alias") + util.update(aliasbase, uci:get_all(external, "alias") or {}) aliasbase.interface = device aliasbase.ipaddr = dclient aliasbase.proto = "static" uci:section("network", "alias", device .. "dhcp", aliasbase) uci:save("network") - - + + -- Create dhcp - local dhcpbase = _strip_internals(uci:get_all("freifunk", "dhcp")) + local dhcpbase = uci:get_all("freifunk", "dhcp") + util.update(dhcpbase, uci:get_all(external, "dhcp") or {}) dhcpbase.interface = device .. "dhcp" dhcpbase.start = dhcpbeg dhcpbase.limit = limit uci:section("dhcp", "dhcp", device .. "dhcp", dhcpbase) uci:save("dhcp") - - + + uci:delete_all("firewall", "rule", { + src="freifunk", + proto="udp", + src_port="68", + dest_port="67" + }) + uci:section("firewall", "rule", nil, { + src="freifunk", + proto="udp", + src_port="68", + dest_port="67", + target="ACCEPT" + }) + uci:delete_all("firewall", "rule", { + src="freifunk", + proto="tcp", + dest_port="8082", + }) + uci:section("firewall", "rule", nil, { + src="freifunk", + proto="tcp", + dest_port="8082", + target="ACCEPT" + }) + + + -- Delete old splash uci:delete_all("luci_splash", "iface", {net=device, zone="freifunk"}) - + -- Register splash uci:section("luci_splash", "iface", nil, {net=device, zone="freifunk"}) uci:save("luci_splash") end -return f \ No newline at end of file +return f diff --git a/applications/luci-ffwizard-leipzig/luasrc/tools/ffwizard.lua b/applications/luci-ffwizard-leipzig/luasrc/tools/ffwizard.lua index bb7cbb834..217cd44bb 100644 --- a/applications/luci-ffwizard-leipzig/luasrc/tools/ffwizard.lua +++ b/applications/luci-ffwizard-leipzig/luasrc/tools/ffwizard.lua @@ -32,35 +32,35 @@ end -- Deletes a network interface and all occurences of it in firewall zones and dhcp function network_remove_interface(iface) local cursor = uci.cursor() - + if not cursor:delete("network", iface) then return false end local aliases = {iface} - cursor:foreach("network", "alias", + cursor:foreach("network", "alias", function(section) if section.interface == iface then table.insert(aliases, section[".name"]) end end) - + -- Delete Aliases and Routes cursor:delete_all("network", "route", {interface=iface}) cursor:delete_all("network", "alias", {interface=iface}) - + -- Delete DHCP sections cursor:delete_all("dhcp", "dhcp", function(section) return util.contains(aliases, section.interface) end) - + -- Remove OLSR sections - cursor:delete_all("olsr", "Interface", {Interface=iface}) - + cursor:delete_all("olsrd", "Interface", {Interface=iface}) + -- Remove Splash sections cursor:delete_all("luci-splash", "iface", {network=iface}) - + cursor:save("network") cursor:save("olsr") cursor:save("dhcp") @@ -88,7 +88,8 @@ function firewall_zone_add_interface(name, interface) local cursor = uci.cursor() local zone = firewall_find_zone(name) local net = cursor:get("firewall", zone, "network") - cursor:set("firewall", zone, "network", (net or name .. " ") .. interface) + local old = net or (cursor:get("network", name) and name) + cursor:set("firewall", zone, "network", (old and old .. " " or "") .. interface) cursor:save("firewall") end @@ -114,14 +115,14 @@ end -- Finds the firewall zone with given name function firewall_find_zone(name) local find - - uci.cursor():foreach("firewall", "zone", + + uci.cursor():foreach("firewall", "zone", function (section) if section.name == name then find = section[".name"] end end) - + return find end @@ -134,15 +135,15 @@ function remove_list_entry(value, entry) if type(value) == "nil" then return nil end - + local result = type(value) == "table" and value or util.split(value, " ") local key = util.contains(result, entry) - + while key do table.remove(result, key) key = util.contains(result, entry) end - + result = type(value) == "table" and result or table.concat(result, " ") - return result ~= value and result -end \ No newline at end of file + return result ~= value and result +end diff --git a/applications/luci-olsr/luasrc/controller/olsr.lua b/applications/luci-olsr/luasrc/controller/olsr.lua index 97e5061b9..766107ee9 100644 --- a/applications/luci-olsr/luasrc/controller/olsr.lua +++ b/applications/luci-olsr/luasrc/controller/olsr.lua @@ -182,7 +182,14 @@ function fetch_txtinfo(otable) local rawdata = luci.sys.httpget("http://127.0.0.1:2006/"..otable) if #rawdata == 0 then - return nil + if luci.fs.access("/proc/net/ipv6_route", "r") then + rawdata = luci.sys.httpget("http://[::1]:2006/"..otable) + if #rawdata == 0 then + return nil + end + else + return nil + end end local data = {} diff --git a/applications/luci-polipo/luasrc/i18n/polipo.en.xml b/applications/luci-polipo/luasrc/i18n/polipo.en.xml new file mode 100644 index 000000000..b4e8df899 --- /dev/null +++ b/applications/luci-polipo/luasrc/i18n/polipo.en.xml @@ -0,0 +1,49 @@ + + + + +Polipo +On-Disk Cache +Shared cache +Enable if cache (proxy) is shared by multiple users. +To enable polipo on-disk cache cleaning (highly recommended), you should add a cron job in Scheduled Tasks services that will execute /usr/sbin/polipo_purge script. For example to perform disk cache cleanup every day at 6:00 in the morning you should add the following line in Scheduled Tasks "0 6 * * * /usr/sbin/polipo_purge" (without quotes). +Disk cache location +Location where polipo will cache files permanently. Use of external storage devices is recommended, because the cache can grow considerably. Leave it empty to disable on-disk cache. +Truncate cache files size (in bytes) +Size to which cached files should be truncated. (default value: 1048576) +Truncate cache files time +Time after which cached files will be truncated. (default value: 4d12h) +Delete cache files time +Time after which cached files will be deleted. (default value: 32d) +Polipo is a small and fast caching web proxy. +General +Allowed clients +When listen address is set to 0.0.0.0 or :: (IPv6), you must list clients that are allowed to connect. The format is IP address or network address (192.168.1.123, 192.168.1.0/24, 2001:660:116::/48 (IPv6)). +In RAM cache size (in bytes) +How much RAM should Polipo use for its cache. +DNS server address +Set the DNS server address to use, if you want Polipo to use different DNS server than the host system. +Query DNS for IPv6 +false = Do not query IPv6; reluctantly = Query both, prefer IPv4; happily = Query both, prefer IPv6; true = Query only IPv6 +Query DNS by hostname +false = Never use system DNS resolver; reluctantly = Query DNS directly, if DNS server is unavailable fail to system DNS resolver; happily = Query DNS directly, if host could not be found fallback to system DNS resolver; true = Always use system DNS resolver +Syslog facility +Log file location +Use of external storage device is recommended, because the log file is written frequently and can grow considerably. +Log to syslog +Parent proxy authentication +Basic HTTP authentication supported. Provide username and password in username:password format. +Parent proxy address +Parent proxy address (in host:port format), to which Polipo will forward the requests. +Listen address +The interface on which Polipo will listen. To listen on all interfaces use 0.0.0.0 or :: (IPv6). +Listen port +Port on which Polipo will listen. (default value: 8123) +Poor Man's Multiplexing +Poor Man's Multiplexing (PMM) is a technique that simulates multiplexing by requesting an instance in multiple segments. It tries to lower the latency caused by the weakness of HTTP protocol. NOTE: some sites may not work with PMM enabled. +First PMM segment size (in bytes) +Size of the first PMM segment. If not defined, it defaults to twice the PMM segment size. +PMM segments size (in bytes) +To enable PMM, PMM segment size must be set to some positive value. + + diff --git a/applications/luci-qos/luasrc/i18n/qos.fr.lua b/applications/luci-qos/luasrc/i18n/qos.fr.lua new file mode 100644 index 000000000..73c54dccf --- /dev/null +++ b/applications/luci-qos/luasrc/i18n/qos.fr.lua @@ -0,0 +1,17 @@ +qos = 'Qualité de service' +qos_bulk = 'lent' +qos_classify = 'Priorité' +qos_classify_dsthost = 'Adresse de destination' +qos_classify_dsthost_dest = 'Réseau de destination / Hôte de destination' +qos_classify_portrange = 'ports' +qos_classify_srchost = 'Adresse source' +qos_classify_srchost_dest = 'Réseau source / Hôte source' +qos_classify_target = 'Priorité' +qos_desc = 'Avec la QOS, vous pouvez donner des priorités au trafic de votre réseau en fonction des adresses, des ports ou des services présents.' +qos_express = 'express' +qos_interface_classgroup = 'Classification' +qos_interface_download = 'Liaison descendante' +qos_interface_overhead = 'calcul de la surcharge' +qos_interface_upload = 'Liaison montante' +qos_normal = 'normal' +qos_priority = 'prioritaire' diff --git a/applications/luci-qos/luasrc/i18n/qos.fr.xml b/applications/luci-qos/luasrc/i18n/qos.fr.xml new file mode 100644 index 000000000..b2703a08e --- /dev/null +++ b/applications/luci-qos/luasrc/i18n/qos.fr.xml @@ -0,0 +1,23 @@ + + + + +Qualité de service +lent +Priorité +Adresse de destination +Réseau de destination / Hôte de destination +ports +Adresse source +Réseau source / Hôte source +Priorité +Avec la QOS, vous pouvez donner des priorités au trafic de votre réseau en fonction des adresses, des ports ou des services présents. +express +Classification +Liaison descendante +calcul de la surcharge +Liaison montante +normal +prioritaire + + diff --git a/applications/luci-tinyproxy/luasrc/i18n/tinyproxy.fr.lua b/applications/luci-tinyproxy/luasrc/i18n/tinyproxy.fr.lua new file mode 100644 index 000000000..af7a134bc --- /dev/null +++ b/applications/luci-tinyproxy/luasrc/i18n/tinyproxy.fr.lua @@ -0,0 +1,34 @@ +tinyproxy = 'Tinyproxy' +tinyproxy_desc = 'Tinyproxy is a small and fast non-caching HTTP(S)-Proxy' +tinyproxy_tinyproxy_allow = 'Allow access from' +tinyproxy_tinyproxy_anonymous = 'Allowed headers for anonymous proxy' +tinyproxy_tinyproxy_bind = 'Lier le trafic sortant à l'adresse ip' +tinyproxy_tinyproxy_connectport = 'Ports allowed for CONNECT method' +tinyproxy_tinyproxy_connectport_desc = '0 = disabled, empty = all' +tinyproxy_tinyproxy_defaulterrorfile = 'Fichier d'erreur' +tinyproxy_tinyproxy_filter = 'Liste de filtres' +tinyproxy_tinyproxy_filtercasesensitive = 'Case sensitive filters' +tinyproxy_tinyproxy_filterdefaultdeny = 'Filter list is a whitelist' +tinyproxy_tinyproxy_filterextended = 'Extended regular expression filters' +tinyproxy_tinyproxy_filterurls = 'Filter URLs instead of domains' +tinyproxy_tinyproxy_group = 'Groupe' +tinyproxy_tinyproxy_listen = 'Listen on address' +tinyproxy_tinyproxy_logfile = 'Chemin du fichier de log' +tinyproxy_tinyproxy_loglevel = 'Niveau de log' +tinyproxy_tinyproxy_maxclients = 'Nombre maximum de clients' +tinyproxy_tinyproxy_maxrequestsperchild = 'Maximum de connexion par processus' +tinyproxy_tinyproxy_maxspareservers = 'Nombre Maximum de processus serveur' +tinyproxy_tinyproxy_minspareservers = 'Nombre Minimum de processus serveur' +tinyproxy_tinyproxy_startservers = 'Nombre de processus serveur lancés au demarrage' +tinyproxy_tinyproxy_statfile = 'Fichier de statistiques' +tinyproxy_tinyproxy_syslog = 'Écrire dans le journal système (Syslog)' +tinyproxy_tinyproxy_timeout = 'Délai de connexion' +tinyproxy_tinyproxy_user = 'Utilisateur' +tinyproxy_tinyproxy_viaproxyname = 'Valeur de l'entête "VIA" utilisée comme nom d'hôte' +tinyproxy_tinyproxy_xtinyproxy = 'Inclure l'ip du client' +tinyproxy_type_proxy = 'Via proxy' +tinyproxy_type_reject = 'Refuser l'accès' +tinyproxy_upstream = 'Upstream Control' +tinyproxy_upstream_target = 'Hôte de destination' +tinyproxy_upstream_type = 'Type' +tinyproxy_upstream_via = 'Proxy' diff --git a/applications/luci-tinyproxy/luasrc/i18n/tinyproxy.fr.xml b/applications/luci-tinyproxy/luasrc/i18n/tinyproxy.fr.xml new file mode 100644 index 000000000..77470ecca --- /dev/null +++ b/applications/luci-tinyproxy/luasrc/i18n/tinyproxy.fr.xml @@ -0,0 +1,40 @@ + + + + +Tinyproxy +Tinyproxy is a small and fast non-caching HTTP(S)-Proxy +Allow access from +Allowed headers for anonymous proxy +Lier le trafic sortant à l'adresse ip +Ports allowed for CONNECT method +0 = disabled, empty = all +Fichier d'erreur +Liste de filtres +Case sensitive filters +Filter list is a whitelist +Extended regular expression filters +Filter URLs instead of domains +Groupe +Listen on address +Chemin du fichier de log +Niveau de log +Nombre maximum de clients +Maximum de connexion par processus +Nombre Maximum de processus serveur +Nombre Minimum de processus serveur +Nombre de processus serveur lancés au demarrage +Fichier de statistiques +Écrire dans le journal système (Syslog) +Délai de connexion +Utilisateur +Valeur de l'entête "VIA" utilisée comme nom d'hôte +Inclure l'ip du client +Via proxy +Refuser l'accès +Upstream Control +Hôte de destination +Type +Proxy + + diff --git a/applications/luci-uvc_streamer/luasrc/i18n/uvc_streamer.fr.lua b/applications/luci-uvc_streamer/luasrc/i18n/uvc_streamer.fr.lua new file mode 100644 index 000000000..97523af41 --- /dev/null +++ b/applications/luci-uvc_streamer/luasrc/i18n/uvc_streamer.fr.lua @@ -0,0 +1,5 @@ +framespersecond = 'Images par seconde' +resolution = 'Résolution' +settings = 'Paramètres' +uvc_streamer = 'Webcam streaming' +uvc_streamer_desc = 'Configurez le pilote linux UVC-webcam pour votre webcam. Pointez votre navigateur par exemple surhttp://%s:%i/' diff --git a/applications/luci-uvc_streamer/luasrc/i18n/uvc_streamer.fr.xml b/applications/luci-uvc_streamer/luasrc/i18n/uvc_streamer.fr.xml new file mode 100644 index 000000000..ab3ecf333 --- /dev/null +++ b/applications/luci-uvc_streamer/luasrc/i18n/uvc_streamer.fr.xml @@ -0,0 +1,11 @@ + + + + +Images par seconde +Résolution +Paramètres +Webcam streaming +Configurez le pilote linux UVC-webcam pour votre webcam. Pointez votre navigateur par exemple surhttp://%s:%i/ + + diff --git a/build/cbi2uvl.lua b/build/cbi2uvl.lua index 10d956738..a78dde328 100755 --- a/build/cbi2uvl.lua +++ b/build/cbi2uvl.lua @@ -11,7 +11,7 @@ You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -$Id: index.lua 3548 2008-10-09 20:28:07Z Cyrus $ +$Id$ ]]-- local cbi = require "luci.cbi" @@ -31,6 +31,15 @@ if arg[2] then i18n.load(arg[2], "en") end +if arg[3] then + pcall(function() + require "uci" + require "luci.model.uci".cursor = function(config, save) + return uci.cursor(config or arg[3] .. "/etc/config", save or arg[3] .. "/tmp/.uci") + end + end) +end + local map = cbi.load(arg[1])[1] assert(map) @@ -45,7 +54,7 @@ if #map.description > 0 then print (" option description '%s'" % util.striptags(map.description)) end -for i, sec in pairs(map.children) do if util.instanceof(sec, cbi.TypedSection) then +for i, sec in pairs(map.children) do if util.instanceof(sec, cbi.AbstractSection) then print ("\nconfig section") print (" option name '%s'" % sec.sectiontype) print (" option package '%s'" % map.config) diff --git a/build/hostenv.sh b/build/hostenv.sh index ee906b001..fbf7ca1b7 100755 --- a/build/hostenv.sh +++ b/build/hostenv.sh @@ -3,4 +3,5 @@ export LD_LIBRARY_PATH="$1/usr/lib:$LD_LIBRARY_PATH" export PATH="$1/bin:$1/usr/bin:$PATH" export LUA_PATH="$1/$2/?.lua;$1/$2/?/init.lua;;" export LUA_CPATH="$1/$3/?.so;;" +export LUCI_SYSROOT="$1" $4 diff --git a/build/uvl2cbi.lua b/build/uvl2cbi.lua new file mode 100644 index 000000000..36cf6b736 --- /dev/null +++ b/build/uvl2cbi.lua @@ -0,0 +1,88 @@ +#!/usr/bin/lua +--[[ +LuCI - Lua Configuration Interface + +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ +]]-- + +local uvl = require "luci.uvl" +local util = require "luci.util" + +if not arg[1] then + util.perror("Usage %s scheme_name" % arg[0]) + os.exit(1) +end + + + +local scheme, error = uvl.UVL():get_scheme(arg[1]) + +if not scheme then + print( error:string() ) + os.exit(1) +end + + +print('cbimap = Map(%q, %q, %q)\n' + % { scheme.name, scheme.title or scheme.name, scheme.description or "" } ) + + +for sn, sv in util.kspairs(scheme.sections) do + print('%s = cbimap:section(TypedSection, %q, %q, %q)' + % { sn, sn, sv.title or "", sv.description or "" } ) + + if not sv.named then print('%s.anonymous = true' % sn) end + if not sv.unique then print('%s.addremove = true' % sn) end + if sv.dynamic then print('%s.dynamic = true' % sn) end + + if sv.depends then + for _, dep in ipairs(sv.depends) do + print('%s:depends(%s)' % { sn, util.serialize_data(dep) } ) + end + end + + print('') + + for vn, vv in util.kspairs(scheme.variables[sn]) do + if not vv.type or vv.type == "variable" then + print('%s = %s:option(%s, %q, %q, %q)' + % { vn, sn, vv.datatype == "boolean" and "Flag" or "Value", + vn, vv.title or "", vv.description or "" } ) + elseif vv.type == "enum" then + print('%s = %s:option(%s, %q, %q, %q)' + % { vn, sn, vv.multival and "MultiValue" or "ListValue", + vn, vv.title or "", vv.description or "" } ) + + for _, val in ipairs(vv.valuelist or {}) do + print('%s:value(%q, %q)' + % { vn, val.value, val.title or val.value } ) + end + elseif vv.type == "list" or vv.type == "lazylist" then + print('%s = %s:option(DynamicList, %q, %q, %q)' + % { vn, sn, vn, vv.title or "", vv.description or "" } ) + else + print('-- option: type(%s) ?' % { vv.type or "" } ) + end + + if vv.default then print('%s.default = %q' % { vn, vv.default } ) end + if vv.required then print('%s.optional = false' % vn ) end + if not vv.required then print('%s.rmempty = true' % vn ) end + + for _, dep in ipairs(vv.depends or {}) do + print('%s:depends(%s)' % { vn, util.serialize_data(dep) } ) + end + + print('') + end + + print('\nreturn cbimap') +end diff --git a/build/uvl2i18n.lua b/build/uvl2i18n.lua new file mode 100755 index 000000000..ee57c83ea --- /dev/null +++ b/build/uvl2i18n.lua @@ -0,0 +1,33 @@ +#!/usr/bin/lua +-- uvl2i18n.lua - Convert uvl schemes to i18n files +-- $Id$ + +require("luci.util") +require("luci.uvl") + +local shm = luci.uvl.UVL():get_scheme(arg[1]) + +for s, o in luci.util.kspairs(shm.sections) do + print( string.format( '%s_%s = %q', shm.name, s:gsub("_",""), o.title or s ) ) + + if o.description and #o.description > 0 then + print( string.format( + '%s_%s_desc = %q', shm.name, s:gsub("_",""), o.description + ) ) + end + + for v, o in luci.util.kspairs(shm.variables[s]) do + print( string.format( + '%s_%s_%s = %q', shm.name, s:gsub("_",""), v:gsub("_",""), o.title or v + ) ) + + if o.description and #o.description > 0 then + print( string.format( + '%s_%s_%s_desc = %q', shm.name, s:gsub("_",""), + v:gsub("_",""), o.description + ) ) + end + end + + print() +end diff --git a/build/uvldoc b/build/uvldoc new file mode 100755 index 000000000..a6e9cc8e6 --- /dev/null +++ b/build/uvldoc @@ -0,0 +1,24 @@ +#!/usr/bin/env lua +local fs = require "luci.fs" +local util = require "luci.util" +local uvldoc = require "luci.uvldoc.renderer" + +pcall(function() + require "uci" + require "luci.model.uci".cursor = function(config, save) + return uci.cursor(config or arg[1] .. "/etc/config", save or arg[1] .. "/tmp/.uci") + end +end) + +local schemes = {} +if not arg[4] or #arg[4] == 0 then + for i, name in ipairs(fs.dir(arg[2].."/default/")) do + if name ~= "." and name ~= ".." then + schemes[#schemes+1] = name + end + end +else + schemes = util.split(arg[4], "[,;%s]+", nil, true) +end + +uvldoc.Generator(schemes, arg[3], arg[2]):make() diff --git a/build/zoneinfo2lua.pl b/build/zoneinfo2lua.pl index fdcc3d60e..7e772c0af 100644 --- a/build/zoneinfo2lua.pl +++ b/build/zoneinfo2lua.pl @@ -65,4 +65,74 @@ foreach my $zone ( sort keys %TZ ) { printf "\t{ '%s', '%s' },\n", $zone, $TZ{$zone} } +print < -- -- --- @release $Id: html.lua,v 1.29 2007/12/21 17:50:48 tomas Exp $ +-- @release $Id$ ------------------------------------------------------------------------------- local assert, getfenv, ipairs, loadstring, pairs, setfenv, tostring, tonumber, type = assert, getfenv, ipairs, loadstring, pairs, setfenv, tostring, tonumber, type diff --git a/contrib/luadoc/lua/luadoc/doclet/raw.lua b/contrib/luadoc/lua/luadoc/doclet/raw.lua index 1e880b883..e2ba14f7b 100644 --- a/contrib/luadoc/lua/luadoc/doclet/raw.lua +++ b/contrib/luadoc/lua/luadoc/doclet/raw.lua @@ -1,5 +1,5 @@ ----------------------------------------------------------------- --- @release $Id: raw.lua,v 1.5 2007/04/18 14:28:39 tomas Exp $ +-- @release $Id$ ----------------------------------------------------------------- module "luadoc.doclet.raw" diff --git a/contrib/luadoc/lua/luadoc/init.lua b/contrib/luadoc/lua/luadoc/init.lua index 649515de6..f72a75ab7 100644 --- a/contrib/luadoc/lua/luadoc/init.lua +++ b/contrib/luadoc/lua/luadoc/init.lua @@ -1,6 +1,6 @@ ------------------------------------------------------------------------------- -- LuaDoc main function. --- @release $Id: init.lua,v 1.4 2008/02/17 06:42:51 jasonsantos Exp $ +-- @release $Id$ ------------------------------------------------------------------------------- local require = require diff --git a/contrib/luadoc/lua/luadoc/lp.lua b/contrib/luadoc/lua/luadoc/lp.lua index adf84f9f0..2a1f43742 100644 --- a/contrib/luadoc/lua/luadoc/lp.lua +++ b/contrib/luadoc/lua/luadoc/lp.lua @@ -1,7 +1,7 @@ ---------------------------------------------------------------------------- -- Lua Pages Template Preprocessor. -- --- @release $Id: lp.lua,v 1.7 2007/04/18 14:28:39 tomas Exp $ +-- @release $Id$ ---------------------------------------------------------------------------- local assert, error, getfenv, loadstring, setfenv = assert, error, getfenv, loadstring, setfenv diff --git a/contrib/luadoc/lua/luadoc/taglet/standard.lua b/contrib/luadoc/lua/luadoc/taglet/standard.lua index f55ea7204..f12ebd7e5 100644 --- a/contrib/luadoc/lua/luadoc/taglet/standard.lua +++ b/contrib/luadoc/lua/luadoc/taglet/standard.lua @@ -1,5 +1,5 @@ ------------------------------------------------------------------------------- --- @release $Id: standard.lua,v 1.39 2007/12/21 17:50:48 tomas Exp $ +-- @release $Id$ ------------------------------------------------------------------------------- local assert, pairs, tostring, type = assert, pairs, tostring, type diff --git a/contrib/luadoc/lua/luadoc/taglet/standard/tags.lua b/contrib/luadoc/lua/luadoc/taglet/standard/tags.lua index d03df82df..517055243 100644 --- a/contrib/luadoc/lua/luadoc/taglet/standard/tags.lua +++ b/contrib/luadoc/lua/luadoc/taglet/standard/tags.lua @@ -1,6 +1,6 @@ ------------------------------------------------------------------------------- -- Handlers for several tags --- @release $Id: tags.lua,v 1.8 2007/09/05 12:39:09 tomas Exp $ +-- @release $Id$ ------------------------------------------------------------------------------- local luadoc = require "luadoc" diff --git a/contrib/luadoc/lua/luadoc/util.lua b/contrib/luadoc/lua/luadoc/util.lua index 3a48e7418..35a068375 100644 --- a/contrib/luadoc/lua/luadoc/util.lua +++ b/contrib/luadoc/lua/luadoc/util.lua @@ -1,6 +1,6 @@ ------------------------------------------------------------------------------- -- General utilities. --- @release $Id: util.lua,v 1.16 2008/02/17 06:42:51 jasonsantos Exp $ +-- @release $Id$ ------------------------------------------------------------------------------- local posix = require "posix" diff --git a/contrib/package/luci/Makefile b/contrib/package/luci/Makefile index b169dd9a1..9060fd5e4 100644 --- a/contrib/package/luci/Makefile +++ b/contrib/package/luci/Makefile @@ -1,6 +1,6 @@ include $(TOPDIR)/rules.mk -PKG_BRANCH:=branches/luci-0.8 +PKG_BRANCH:=trunk ifeq ($(DUMP),) USELOCAL:=$(shell grep luci ../../../.project 2>/dev/null >/dev/null && echo 1) @@ -10,12 +10,12 @@ PKG_NAME:=luci PKG_RELEASE:=1 ifeq ($(USELOCAL),1) - PKG_VERSION:=0.8+svn + PKG_VERSION:=0.9+svn else PKG_SOURCE_URL:=http://svn.luci.subsignal.org/luci/$(PKG_BRANCH) ifeq ($(DUMP),) - PKG_REV:=HEAD - PKG_VERSION:=0.8.2 + PKG_REV:=$(shell LC_ALL=C svn info ${PKG_SOURCE_URL} | sed -ne's/^Last Changed Rev: //p') + PKG_VERSION:=0.9+svn$(PKG_REV) endif PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz @@ -59,6 +59,18 @@ define Package/luci/libtemplate DEPENDS:=+luci-core endef +define Package/luci/fftemplate + $(call Package/luci/libtemplate) + SUBMENU:=LuCI Freifunk Support + DEPENDS:=+luci-mod-freifunk +endef + +define Package/luci/httpdtemplate + $(call Package/luci/libtemplate) + SUBMENU:=LuCIttpd + DEPENDS:=+luci-httpd +endef + define Package/luci/i18ntemplate $(call Package/luci/libtemplate) SUBMENU:=LuCI Translations @@ -221,6 +233,39 @@ define Package/luci-uvl/install endef + +### HTTPD ### + +define Package/luci-httpd + $(call Package/luci/httpdtemplate) + DEPENDS:=+luci-http +libuci + TITLE:=Server Core +endef + +define Package/luci-httpd/install + $(call Package/luci/install/template,$(1),libs/lucittpd) +endef + + + +### Community Packages ### + +define Package/luci-freifunk-community + $(call Package/luci/fftemplate) + DEPENDS+= \ + +luci-sgi-cgi +luci-app-splash +luci-app-olsr \ + +luci-app-ffwizard-leipzig \ + +luci-theme-fledermaus \ + +luci-i18n-german \ + +olsrd-luci +olsrd-luci-mod-dyn-gw +olsrd-luci-mod-txtinfo +olsrd-luci-mod-nameservice \ + +kmod-tun +ip + TITLE:=Freifunk Community Meta-Package +endef + +define Package/luci-freifunk-community/install + $(call Package/luci/install/template,$(1),applications/freifunk-community) +endef + ### Modules ### define Package/luci-admin-core @@ -272,8 +317,45 @@ define Package/luci-admin-rpc/install endef +define Package/luci-mod-freifunk + $(call Package/luci/fftemplate) + DEPENDS:=+luci-admin-full + TITLE:=LuCI Freifunk module +endef + +define Package/luci-mod-freifunk/conffiles +/etc/config/freifunk +endef + +define Package/luci-mod-freifunk/install + $(call Package/luci/install/template,$(1),modules/freifunk) +endef + + + ### Applications ### +define Package/luci-app-ffwizard-leipzig + $(call Package/luci/fftemplate) + TITLE:=Freifunk Leipzig configuration wizard +endef + +define Package/luci-app-ffwizard-leipzig/install + $(call Package/luci/install/template,$(1),applications/luci-ffwizard-leipzig) +endef + + +define Package/luci-app-siitwizard + $(call Package/luci/fftemplate) + TITLE:=SIIT IPv4-over-IPv6 configuration wizard + DEPENDS:=+luci-admin-core +kmod-siit +endef + +define Package/luci-app-siitwizard/install + $(call Package/luci/install/template,$(1),applications/luci-siitwizard) +endef + + define Package/luci-app-firewall $(call Package/luci/webtemplate) DEPENDS+=+luci-admin-core @@ -307,6 +389,21 @@ define Package/luci-app-qos/install endef +define Package/luci-app-splash + $(call Package/luci/fftemplate) + DEPENDS+=+luasocket + TITLE:=Freifunk DHCP-Splash application +endef + +define Package/luci-app-splash/conffiles +/etc/config/luci_splash +endef + +define Package/luci-app-splash/install + $(call Package/luci/install/template,$(1),applications/luci-splash) +endef + + define Package/luci-app-statistics $(call Package/luci/webtemplate) DEPENDS+=+luci-admin-full +collectd +collectd-mod-rrdtool1 +rrdtool1 @@ -377,6 +474,17 @@ define Package/luci-app-uvc_streamer/install endef +define Package/luci-app-mmc_over_gpio + $(call Package/luci/webtemplate) + DEPENDS+=+luci-admin-full +kmod-mmc-over-gpio + TITLE:=mmc_over_gpio +endef + +define Package/luci-app-mmc_over_gpio/install + $(call Package/luci/install/template,$(1),applications/luci-mmc_over_gpio) +endef + + define Package/luci-app-p910nd $(call Package/luci/webtemplate) DEPENDS+=+luci-admin-full +p910nd @@ -438,6 +546,16 @@ define Package/luci-app-livestats/install $(call Package/luci/install/template,$(1),applications/luci-livestats) endef +define Package/luci-app-asterisk + $(call Package/luci/webtemplate) + TITLE:=LuCI Support for Asterisk PBX + DEPENDS+=@BROKEN +luci-admin-core +asterisk14 +endef + +define Package/luci-app-asterisk/install + $(call Package/luci/install/template,$(1),applications/luci-asterisk) +endef + define Package/luci-app-polipo $(call Package/luci/webtemplate) TITLE:=LuCI Support for the Polipo Proxy @@ -448,6 +566,16 @@ define Package/luci-app-polipo/install $(call Package/luci/install/template,$(1),applications/luci-polipo) endef +define Package/luci-app-openvpn + $(call Package/luci/webtemplate) + TITLE:=LuCI Support for OpenVPN + DEPENDS+=@BROKEN +luci-admin-core +openvpn +endef + +define Package/luci-app-openvpn/install + $(call Package/luci/install/template,$(1),applications/luci-openvpn) +endef + ### Server Gateway Interfaces ### @@ -460,6 +588,24 @@ define Package/luci-sgi-cgi/install $(call Package/luci/install/template,$(1),libs/sgi-cgi) endef +define Package/luci-sgi-luci + $(call Package/luci/libtemplate) + DEPENDS+=+luci-httpd + TITLE:=SGI for LuCIttpd +endef + +define Package/luci-sgi-luci/install + $(call Package/luci/install/template,$(1),libs/sgi-luci) +endef + +define Package/luci-sgi-webuci + $(call Package/luci/libtemplate) + TITLE:=SGI for Webuci +endef + +define Package/luci-sgi-webuci/install + $(call Package/luci/install/template,$(1),libs/sgi-webuci) +endef ### Themes ### define Package/luci-theme-base @@ -472,6 +618,38 @@ define Package/luci-theme-base/install $(call Package/luci/install/template,$(1),themes/base) endef +define Package/luci-theme-fledermaus + $(call Package/luci/fftemplate) + DEPENDS:=+luci-web + TITLE:=Fledermaus Theme +endef + +define Package/luci-theme-fledermaus/install + $(call Package/luci/install/template,$(1),themes/fledermaus) +endef + +define Package/luci-theme-freifunk + $(call Package/luci/thtemplate) + DEPENDS:=+luci-web + MAINTAINER:=Stefan Pirwitz + TITLE:=alternative Freifunk Theme +endef + +define Package/luci-theme-freifunk/install + $(call Package/luci/install/template,$(1),themes/freifunk) +endef + +define Package/luci-theme-freifunk-bno + $(call Package/luci/thtemplate) + DEPENDS:=+luci-web + MAINTAINER:=Stefan Pirwitz + TITLE:=Freifunk Berlin Nordost Theme +endef + +define Package/luci-theme-freifunk-bno/install + $(call Package/luci/install/template,$(1),themes/freifunk-bno) +endef + define Package/luci-theme-openwrt $(call Package/luci/thtemplate) TITLE:=OpenWrt.org (default) @@ -554,7 +732,6 @@ define Package/luci-i18n-portuguese_brazilian/install endef - ### Compile ### ifneq ($(CONFIG_PACKAGE_luci-core),) PKG_SELECTED_MODULES+=libs/core @@ -587,6 +764,10 @@ ifneq ($(CONFIG_PACKAGE_luci-uvl),) PKG_SELECTED_MODULES+=libs/uvl endif +ifneq ($(CONFIG_PACKAGE_luci-httpd),) + PKG_SELECTED_MODULES+=libs/lucittpd +endif + ifneq ($(CONFIG_PACKAGE_luci-admin-core),) PKG_SELECTED_MODULES+=modules/admin-core endif @@ -599,7 +780,20 @@ endif ifneq ($(CONFIG_PACKAGE_luci-admin-rpc),) PKG_SELECTED_MODULES+=modules/rpc endif +ifneq ($(CONFIG_PACKAGE_luci-mod-freifunk),) + PKG_SELECTED_MODULES+=modules/freifunk +endif +ifneq ($(CONFIG_PACKAGE_luci-freifunk-community),) + PKG_SELECTED_MODULES+=applications/freifunk-community +endif + +ifneq ($(CONFIG_PACKAGE_luci-app-ffwizard-leipzig),) + PKG_SELECTED_MODULES+=applications/luci-ffwizard-leipzig +endif +ifneq ($(CONFIG_PACKAGE_luci-app-siitwizard),) + PKG_SELECTED_MODULES+=applications/luci-siitwizard +endif ifneq ($(CONFIG_PACKAGE_luci-app-firewall),) PKG_SELECTED_MODULES+=applications/luci-fw endif @@ -609,6 +803,9 @@ endif ifneq ($(CONFIG_PACKAGE_luci-app-qos),) PKG_SELECTED_MODULES+=applications/luci-qos endif +ifneq ($(CONFIG_PACKAGE_luci-app-splash),) + PKG_SELECTED_MODULES+=applications/luci-splash +endif ifneq ($(CONFIG_PACKAGE_luci-app-statistics),) PKG_SELECTED_MODULES+=applications/luci-statistics endif @@ -627,6 +824,9 @@ endif ifneq ($(CONFIG_PACKAGE_luci-app-uvc_streamer),) PKG_SELECTED_MODULES+=applications/luci-uvc_streamer endif +ifneq ($(CONFIG_PACKAGE_luci-app-mmc_over_gpio),) + PKG_SELECTED_MODULES+=applications/luci-mmc_over_gpio +endif ifneq ($(CONFIG_PACKAGE_luci-app-p910nd),) PKG_SELECTED_MODULES+=applications/luci-p910nd endif @@ -645,19 +845,39 @@ endif ifneq ($(CONFIG_PACKAGE_luci-app-livestats),) PKG_SELECTED_MODULES+=applications/luci-livestats endif +ifneq ($(CONFIG_PACKAGE_luci-app-asterisk),) + PKG_SELECTED_MODULES+=applications/luci-asterisk +endif ifneq ($(CONFIG_PACKAGE_luci-app-polipo),) PKG_SELECTED_MODULES+=applications/luci-polipo endif +ifneq ($(CONFIG_PACKAGE_luci-app-openvpn),) + PKG_SELECTED_MODULES+=applications/luci-openvpn +endif ifneq ($(CONFIG_PACKAGE_luci-sgi-cgi),) PKG_SELECTED_MODULES+=libs/sgi-cgi endif - +ifneq ($(CONFIG_PACKAGE_luci-sgi-luci),) + PKG_SELECTED_MODULES+=libs/sgi-luci +endif +ifneq ($(CONFIG_PACKAGE_luci-sgi-webuci),) + PKG_SELECTED_MODULES+=libs/sgi-webuci +endif ifneq ($(CONFIG_PACKAGE_luci-theme-base),) PKG_SELECTED_MODULES+=themes/base endif +ifneq ($(CONFIG_PACKAGE_luci-theme-fledermaus),) + PKG_SELECTED_MODULES+=themes/fledermaus +endif +ifneq ($(CONFIG_PACKAGE_luci-theme-freifunk-bno),) + PKG_SELECTED_MODULES+=themes/freifunk-bno +endif +ifneq ($(CONFIG_PACKAGE_luci-theme-freifunk),) + PKG_SELECTED_MODULES+=themes/freifunk +endif ifneq ($(CONFIG_PACKAGE_luci-theme-openwrt),) PKG_SELECTED_MODULES+=themes/openwrt.org endif @@ -688,7 +908,7 @@ endif MAKE_FLAGS += \ MODULES="$(PKG_SELECTED_MODULES)" \ LUA_TARGET="$(LUA_TARGET)" \ - LUA_SHLIBS="-llua -lm" \ + LUA_SHLIBS="-llua -lm -ldl -lcrypt" \ CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \ LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib" \ OS="Linux" @@ -705,31 +925,47 @@ $(eval $(call BuildPackage,luci-sys)) $(eval $(call BuildPackage,luci-web)) $(eval $(call BuildPackage,luci-uvl)) +$(eval $(call BuildPackage,luci-httpd)) + $(eval $(call BuildPackage,luci-admin-core)) $(eval $(call BuildPackage,luci-admin-mini)) $(eval $(call BuildPackage,luci-admin-full)) $(eval $(call BuildPackage,luci-admin-rpc)) +$(eval $(call BuildPackage,luci-mod-freifunk)) + +$(eval $(call BuildPackage,luci-freifunk-community)) +$(eval $(call BuildPackage,luci-app-ffwizard-leipzig)) +$(eval $(call BuildPackage,luci-app-siitwizard)) $(eval $(call BuildPackage,luci-app-firewall)) $(eval $(call BuildPackage,luci-app-olsr)) $(eval $(call BuildPackage,luci-app-qos)) +$(eval $(call BuildPackage,luci-app-splash)) $(eval $(call BuildPackage,luci-app-statistics)) $(eval $(call BuildPackage,luci-app-upnp)) $(eval $(call BuildPackage,luci-app-ntpc)) $(eval $(call BuildPackage,luci-app-ddns)) $(eval $(call BuildPackage,luci-app-samba)) $(eval $(call BuildPackage,luci-app-uvc_streamer)) +$(eval $(call BuildPackage,luci-app-mmc_over_gpio)) $(eval $(call BuildPackage,luci-app-p910nd)) $(eval $(call BuildPackage,luci-app-ushare)) $(eval $(call BuildPackage,luci-app-hd_idle)) $(eval $(call BuildPackage,luci-app-tinyproxy)) $(eval $(call BuildPackage,luci-app-initmgr)) $(eval $(call BuildPackage,luci-app-livestats)) +$(eval $(call BuildPackage,luci-app-asterisk)) $(eval $(call BuildPackage,luci-app-polipo)) +$(eval $(call BuildPackage,luci-app-openvpn)) $(eval $(call BuildPackage,luci-sgi-cgi)) +$(eval $(call BuildPackage,luci-sgi-luci)) +$(eval $(call BuildPackage,luci-sgi-webuci)) $(eval $(call BuildPackage,luci-theme-base)) +$(eval $(call BuildPackage,luci-theme-fledermaus)) +$(eval $(call BuildPackage,luci-theme-freifunk)) +$(eval $(call BuildPackage,luci-theme-freifunk-bno)) $(eval $(call BuildPackage,luci-theme-openwrt)) $(eval $(call BuildPackage,luci-theme-openwrtlight)) diff --git a/contrib/uci/Makefile b/contrib/uci/Makefile index 71e28864f..1b9151952 100644 --- a/contrib/uci/Makefile +++ b/contrib/uci/Makefile @@ -1,12 +1,12 @@ include ../../build/config.mk include ../../build/gccconfig.mk -UCI_VERSION = 0.6.4 +UCI_VERSION = 0.7.0 UCI_SITE = http://mirror2.openwrt.org/sources UCI_DIR = uci-$(UCI_VERSION) UCI_FILE = $(UCI_DIR).tar.gz UCI_URL = $(UCI_SITE)/$(UCI_FILE) -#UCI_GITREV = 43124956bc9c1083e476f6cadaedf27b7788d004 +#UCI_GITREV = c79cc497e7b0caa0f9f6a2c978fa9a5f0f097463 #UCI_SITE = http://nbd.name #UCI_DIR = uci.git #UCI_FILE = uci-$(UCI_VERSION)$(UCI_APPEND).tar.gz diff --git a/i18n/english/luasrc/i18n/admin-core.en.lua b/i18n/english/luasrc/i18n/admin-core.en.lua index 64729f8fc..d7ec3823b 100644 --- a/i18n/english/luasrc/i18n/admin-core.en.lua +++ b/i18n/english/luasrc/i18n/admin-core.en.lua @@ -45,7 +45,7 @@ a_s_packages_do = 'Perform Actions' a_s_packages_install = 'Install' a_s_packages_installurl = 'Download and install package' a_s_packages_ipkg = 'Edit package lists and installation targets' -a_s_packages_name = 'Paketname' +a_s_packages_name = 'Package name' a_s_packages_remove = 'Remove' a_s_packages_search = 'Find package' a_s_packages_update = 'Package lists updated' @@ -96,6 +96,10 @@ a_srv_http_authrealm = 'Authentication Realm' a_srv_http_authrealm1 = 'The realm which will be displayed at the authentication prompt for protected pages.' a_srv_http_config1 = 'defaults to /etc/httpd.conf' a_srv_http_root = 'Document root' +a_srv_http_keepalive = 'Enable Keep-Alive' +a_srv_http_timeout = 'Connection timeout' +a_srv_http_path = 'Plugin path' +a_srv_lucittpd = 'A lightweight HTTP/1.1 webserver written in C and Lua designed to serve LuCI' a_srv_dropbear1 = 'Dropbear offers SSH network shell access and an integrated SCP server' a_srv_d_pwauth = 'Password authentication' a_srv_d_pwauth1 = 'Allow SSH password authentication' diff --git a/i18n/english/luasrc/i18n/admin-core.en.xml b/i18n/english/luasrc/i18n/admin-core.en.xml index 0bd7177aa..16c4bdbd2 100644 --- a/i18n/english/luasrc/i18n/admin-core.en.xml +++ b/i18n/english/luasrc/i18n/admin-core.en.xml @@ -49,7 +49,7 @@ Install Download and install package Edit package lists and installation targets -Paketname +Package name Remove Find package Package lists updated @@ -104,7 +104,7 @@ Password authentication Allow SSH password authentication Channel -On this pages you find confiugration options for WLAN based wireless networks. +On this pages you can find configuration options for WLAN based wireless networks. You can easily integrate your 802.11a/b/g/n-devices into your physical network and use the virtual adapter support to build wireless repeaters or offer several networks with one device. There is support for Managed, Client, Ad-Hoc and WDS operating modes as well as WPA and WPA2 encryption for secure communnication. Here you can configure installed wifi devices. diff --git a/i18n/german/luasrc/i18n/admin-core.de.lua b/i18n/german/luasrc/i18n/admin-core.de.lua index a5280cc38..c0acee8b6 100644 --- a/i18n/german/luasrc/i18n/admin-core.de.lua +++ b/i18n/german/luasrc/i18n/admin-core.de.lua @@ -94,6 +94,10 @@ a_srv_http_authrealm = 'Anmeldeaufforderung' a_srv_http_authrealm1 = 'Aufforderungstext zum Anmelden im Administrationsbereich' a_srv_http_config1 = '/etc/httpd.conf wenn leer' a_srv_http_root = 'Wurzelverzeichnis' +a_srv_http_keepalive = 'Keep-Alive aktivieren' +a_srv_http_timeout = 'Verbindungszeitlimit' +a_srv_http_path = 'Pluginpfad' +a_srv_lucittpd = 'Ein schlanker HTTP/1.1 webserver in C und Lua geschrieben um LuCI zu betreiben.' a_srv_services1 = 'Dienste und Dämonen stellen bestimmte Funktionalitäten auf dem Router zur Verfügung.' a_srv_services2 = 'Es handelt sich hierbei meist um Netzwerkserver, die verschiedene Aufgaben auf dem Router erfüllen, beispielsweise Shell-Zugang ermöglichen oder diese Weboberfläche per HTTP anbieten.' a_st_i_status1 = 'Hier finden sich Informationen über den aktuellen Status des Systems, beispielsweise Prozessortakt, Speicherauslastung und Netzwerkschnittstellen.' diff --git a/libs/cbi/htdocs/luci-static/resources/cbi.js b/libs/cbi/htdocs/luci-static/resources/cbi.js index 4b1849bea..abeba345b 100644 --- a/libs/cbi/htdocs/luci-static/resources/cbi.js +++ b/libs/cbi/htdocs/luci-static/resources/cbi.js @@ -1,3 +1,18 @@ +/* + LuCI - Lua Configuration Interface + + Copyright 2008 Steven Barth + Copyright 2008 Jo-Philipp Wich + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + $Id$ +*/ + var cbi_d = []; function cbi_d_add(field, dep, next) { @@ -177,3 +192,24 @@ function cbi_filebrowser(id, url, defpath) { browser.focus(); } + +//Hijacks the CBI form to send via XHR (requires Prototype) +function cbi_hijack_forms(layer, win, fail, load) { + var forms = layer.getElementsByTagName('form'); + for (var i=0; i +Copyright 2008 Jo-Philipp Wich + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id: browser.htm 3555 2008-10-10 21:52:22Z jow $ + +-%> + +<% + local t = require("luci.tools.webadmin") + local v = self:cfgvalue(section) +-%> +<%+cbi/valueheader%> + /> + '<%=self.default_path and ", '"..self.default_path.."'"%>);return false" alt="<%:cbi_browser%>" title="<%:cbi_browser%>" src="<%=resource%>/cbi/folder.png" style="vertical-align:bottom" /> +<%+cbi/valuefooter%> diff --git a/libs/cbi/luasrc/view/cbi/filebrowser.htm b/libs/cbi/luasrc/view/cbi/filebrowser.htm new file mode 100644 index 000000000..b106d6bdf --- /dev/null +++ b/libs/cbi/luasrc/view/cbi/filebrowser.htm @@ -0,0 +1,122 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id: filebrowser.htm 3555 2008-10-10 21:52:22Z jow $ + +-%> + + + + + + Filebrowser - LuCI + + + + + + <% + require("luci.fs") + require("luci.http") + require("luci.dispatcher") + + local field = luci.http.formvalue('field') + local request = luci.dispatcher.context.path + local path = { '' } + + for i = 3, #request do + if request[i] ~= '..' and #request[i] > 0 then + path[#path+1] = request[i] + end + end + + local filepath = table.concat( path, '/' ) + local filestat = luci.fs.stat( filepath ) + local baseurl = luci.dispatcher.build_url('admin', 'filebrowser') + + if filestat and filestat.type == "regular" then + table.remove( path, #path ) + filepath = table.concat( path, '/' ) .. '/' + elseif not ( filestat and filestat.type == "directory" ) then + path = { '' } + filepath = '/' + else + filepath = filepath .. '/' + end + + local entries = luci.fs.dir(filepath) + -%> +
+ Location: + <% for i, dir in ipairs(path) do %> + <% if i == 1 then %> + (root) + <% elseif next(path, i) then %> + <% baseurl = baseurl .. '/' .. dir %> + / <%=dir%> + <% else %> + <% baseurl = baseurl .. '/' .. dir %> + / <%=dir%> + <% end %> + <% end %> +
+ +
+ +
+
    + <% for _, e in luci.util.vspairs(entries) do + local stat = luci.fs.stat(filepath..e) + if e ~= '.' and e ~= '..' and stat and stat.type == 'directory' then + -%> +
  • + Directory + <%=e%>/ +
  • + <% end end -%> + + <% for _, e in luci.util.vspairs(entries) do + local stat = luci.fs.stat(filepath..e) + if stat and stat.type ~= 'directory' then + -%> +
  • + File + <%=e%> +
  • + <% end end -%> +
+
+ + diff --git a/libs/cbi/luasrc/view/cbi/footer.htm b/libs/cbi/luasrc/view/cbi/footer.htm index 6f90bb9cf..4f94a05b0 100644 --- a/libs/cbi/luasrc/view/cbi/footer.htm +++ b/libs/cbi/luasrc/view/cbi/footer.htm @@ -12,7 +12,7 @@ You may obtain a copy of the License at $Id$ -%> - + <%- if pageaction then -%>
<% if not autoapply then%> @@ -21,5 +21,6 @@ $Id$
+ <%- end -%> <%+footer%> diff --git a/libs/cbi/luasrc/view/cbi/header.htm b/libs/cbi/luasrc/view/cbi/header.htm index 3f60baf52..90b6f659a 100644 --- a/libs/cbi/luasrc/view/cbi/header.htm +++ b/libs/cbi/luasrc/view/cbi/header.htm @@ -14,7 +14,7 @@ $Id$ -%> <%+header%> -
" enctype="multipart/form-data"> +
diff --git a/libs/cbi/luasrc/view/cbi/simpleform.htm b/libs/cbi/luasrc/view/cbi/simpleform.htm index 2a80723cb..66810a071 100644 --- a/libs/cbi/luasrc/view/cbi/simpleform.htm +++ b/libs/cbi/luasrc/view/cbi/simpleform.htm @@ -13,7 +13,7 @@ $Id$ -%> -"> +
diff --git a/libs/core/luasrc/fs.lua b/libs/core/luasrc/fs.lua index abea5b5e8..830536cbe 100644 --- a/libs/core/luasrc/fs.lua +++ b/libs/core/luasrc/fs.lua @@ -54,12 +54,19 @@ access = posix.access glob = posix.glob --- Checks wheather the given path exists and points to a regular file. --- @param filename String containing the path of the file to read +-- @param filename String containing the path of the file to test -- @return Boolean indicating wheather given path points to regular file function isfile(filename) return posix.stat(filename, "type") == "regular" end +--- Checks wheather the given path exists and points to a directory. +-- @param dirname String containing the path of the directory to test +-- @return Boolean indicating wheather given path points to directory +function isdirectory(dirname) + return posix.stat(dirname, "type") == "directory" +end + --- Read the whole content of the given file into memory. -- @param filename String containing the path of the file to read -- @return String containing the file contents or nil on error diff --git a/libs/core/luasrc/init.lua b/libs/core/luasrc/init.lua index 1861e9283..2eacc6ca9 100644 --- a/libs/core/luasrc/init.lua +++ b/libs/core/luasrc/init.lua @@ -25,5 +25,5 @@ limitations under the License. ]]-- module "luci" -__version__ = "0.8" +__version__ = "0.9" __appname__ = "LuCI" diff --git a/libs/core/luasrc/util.lua b/libs/core/luasrc/util.lua index ea1fccbc1..10606e825 100644 --- a/libs/core/luasrc/util.lua +++ b/libs/core/luasrc/util.lua @@ -193,14 +193,16 @@ end --- Create valid XML PCDATA from given string. -- @param value String value containing the data to escape -- @return String value containing the escaped data +local _pcdata_repl = { + ["&"] = "&", + ['"'] = """, + ["'"] = "'", + ["<"] = "<", + [">"] = ">" +} + function pcdata(value) - return value and tostring(value):gsub("[&\"'<>]", { - ["&"] = "&", - ['"'] = """, - ["'"] = "'", - ["<"] = "<", - [">"] = ">" - }) + return value and tostring(value):gsub("[&\"'<>]", _pcdata_repl) end --- Strip HTML tags from given string. diff --git a/libs/http/luasrc/http/protocol.lua b/libs/http/luasrc/http/protocol.lua index cd482a94f..d8ef09f7a 100644 --- a/libs/http/luasrc/http/protocol.lua +++ b/libs/http/luasrc/http/protocol.lua @@ -673,6 +673,7 @@ end -- @class table statusmsg = { [200] = "OK", + [206] = "Partial Content", [301] = "Moved Permanently", [302] = "Found", [304] = "Not Modified", @@ -680,8 +681,10 @@ statusmsg = { [403] = "Forbidden", [404] = "Not Found", [405] = "Method Not Allowed", + [408] = "Request Time-out", [411] = "Length Required", [412] = "Precondition Failed", + [416] = "Requested range not satisfiable", [500] = "Internal Server Error", [503] = "Server Unavailable", } diff --git a/libs/http/luasrc/http/protocol/date.lua b/libs/http/luasrc/http/protocol/date.lua index 24da1bafb..83d11e2c2 100644 --- a/libs/http/luasrc/http/protocol/date.lua +++ b/libs/http/luasrc/http/protocol/date.lua @@ -17,116 +17,14 @@ $Id$ -- This class contains functions to parse, compare and format http dates. module("luci.http.protocol.date", package.seeall) +require("luci.sys.zoneinfo") + + MONTHS = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" } ---- The "TZ" table contains lowercased timezone names associated with their --- corresponding time offsets sepcified in seconds. --- @class table -TZ = { - -- DST zones - ["brst"] = -2*3600; -- Brazil Summer Time (East Daylight) - ["adt"] = -3*3600; -- Atlantic Daylight - ["edt"] = -4*3600; -- Eastern Daylight - ["cdt"] = -5*3600; -- Central Daylight - ["mdt"] = -6*3600; -- Mountain Daylight - ["pdt"] = -7*3600; -- Pacific Daylight - ["ydt"] = -8*3600; -- Yukon Daylight - ["hdt"] = -9*3600; -- Hawaii Daylight - ["bst"] = 1*3600; -- British Summer - ["mest"] = 2*3600; -- Middle European Summer - ["sst"] = 2*3600; -- Swedish Summer - ["fst"] = 2*3600; -- French Summer - ["eest"] = 3*3600; -- Eastern European Summer - ["cest"] = 2*3600; -- Central European Daylight - ["wadt"] = 8*3600; -- West Australian Daylight - ["kdt"] = 10*3600; -- Korean Daylight - ["eadt"] = 11*3600; -- Eastern Australian Daylight - ["nzdt"] = 13*3600; -- New Zealand Daylight - - -- zones - ["gmt"] = 0; -- Greenwich Mean - ["ut"] = 0; -- Universal (Coordinated) - ["utc"] = 0; - ["wet"] = 0; -- Western European - ["wat"] = -1*3600; -- West Africa - ["azost"] = -1*3600; -- Azores Standard Time - ["cvt"] = -1*3600; -- Cape Verde Time - ["at"] = -2*3600; -- Azores - ["fnt"] = -2*3600; -- Brazil Time (Extreme East - Fernando Noronha) - ["ndt"] = -2*3600+1800;-- Newfoundland Daylight - ["art"] = -3*3600; -- Argentina Time - ["nft"] = -3*3600+1800;-- Newfoundland - ["mnt"] = -4*3600; -- Brazil Time (West Standard - Manaus) - ["ewt"] = -4*3600; -- U.S. Eastern War Time - ["ast"] = -4*3600; -- Atlantic Standard - ["bot"] = -4*3600; -- Bolivia Time - ["vet"] = -4*3600; -- Venezuela Time - ["est"] = -5*3600; -- Eastern Standard - ["cot"] = -5*3600; -- Colombia Time - ["act"] = -5*3600; -- Brazil Time (Extreme West - Acre) - ["pet"] = -5*3600; -- Peru Time - ["cst"] = -6*3600; -- Central Standard - ["cest"] = 2*3600; -- Central European Summer - ["mst"] = -7*3600; -- Mountain Standard - ["pst"] = -8*3600; -- Pacific Standard - ["yst"] = -9*3600; -- Yukon Standard - ["hst"] = -10*3600; -- Hawaii Standard - ["cat"] = -10*3600; -- Central Alaska - ["ahst"] = -10*3600; -- Alaska-Hawaii Standard - ["taht"] = -10*3600; -- Tahiti Time - ["nt"] = -11*3600; -- Nome - ["idlw"] = -12*3600; -- International Date Line West - ["cet"] = 1*3600; -- Central European - ["mez"] = 1*3600; -- Central European (German) - ["met"] = 1*3600; -- Middle European - ["mewt"] = 1*3600; -- Middle European Winter - ["swt"] = 1*3600; -- Swedish Winter - ["set"] = 1*3600; -- Seychelles - ["fwt"] = 1*3600; -- French Winter - ["west"] = 1*3600; -- Western Europe Summer Time - ["eet"] = 2*3600; -- Eastern Europe; USSR Zone 1 - ["ukr"] = 2*3600; -- Ukraine - ["sast"] = 2*3600; -- South Africa Standard Time - ["bt"] = 3*3600; -- Baghdad; USSR Zone 2 - ["eat"] = 3*3600; -- East Africa Time - ["irst"] = 3*3600+1800;-- Iran Standard Time - ["zp4"] = 4*3600; -- USSR Zone 3 - ["msd"] = 4*3600; -- Moscow Daylight Time - ["sct"] = 4*3600; -- Seychelles Time - ["zp5"] = 5*3600; -- USSR Zone 4 - ["azst"] = 5*3600; -- Azerbaijan Summer Time - ["mvt"] = 5*3600; -- Maldives Time - ["uzt"] = 5*3600; -- Uzbekistan Time - ["ist"] = 5*3600+1800;-- Indian Standard - ["zp6"] = 6*3600; -- USSR Zone 5 - ["lkt"] = 6*3600; -- Sri Lanka Time - ["pkst"] = 6*3600; -- Pakistan Summer Time - ["yekst"] = 6*3600; -- Yekaterinburg Summer Time - ["wast"] = 7*3600; -- West Australian Standard - ["ict"] = 7*3600; -- Indochina Time - ["wit"] = 7*3600; -- Western Indonesia Time - ["cct"] = 8*3600; -- China Coast; USSR Zone 7 - ["wst"] = 8*3600; -- West Australian Standard - ["hkt"] = 8*3600; -- Hong Kong - ["bnt"] = 8*3600; -- Brunei Darussalam Time - ["cit"] = 8*3600; -- Central Indonesia Time - ["myt"] = 8*3600; -- Malaysia Time - ["pht"] = 8*3600; -- Philippines Time - ["sgt"] = 8*3600; -- Singapore Time - ["jst"] = 9*3600; -- Japan Standard; USSR Zone 8 - ["kst"] = 9*3600; -- Korean Standard - ["east"] = 10*3600; -- Eastern Australian Standard - ["gst"] = 10*3600; -- Guam Standard; USSR Zone 9 - ["nct"] = 11*3600; -- New Caledonia Time - ["nzt"] = 12*3600; -- New Zealand - ["nzst"] = 12*3600; -- New Zealand Standard - ["fjt"] = 12*3600; -- Fiji Time - ["idle"] = 12*3600; -- International Date Line East -} - --- Return the time offset in seconds between the UTC and given time zone. -- @param tz Symbolic or numeric timezone specifier -- @return Time offset to UTC in seconds @@ -143,8 +41,8 @@ function tz_offset(tz) return s * 60 * ( math.floor( v / 100 ) * 60 + ( v % 100 ) ) -- lookup symbolic tz - elseif TZ[tz:lower()] then - return TZ[tz:lower()] + elseif luci.sys.zoneinfo.OFFSET[tz:lower()] then + return luci.sys.zoneinfo.OFFSET[tz:lower()] end end diff --git a/libs/httpd/host/runluci b/libs/httpd/host/runluci index 65c6b6cf1..bc56f15c1 100755 --- a/libs/httpd/host/runluci +++ b/libs/httpd/host/runluci @@ -22,6 +22,11 @@ pcall(function() require "luci.model.uci".cursor = function(config, save) return uci.cursor(config or SYSROOT .. "/etc/config", save or SYSROOT .. "/tmp/.uci") end + + local x = require "luci.uvl".UVL.__init__ + require "luci.uvl".UVL.__init__ = function(self, schemedir) + x(self, schemedir or SYSROOT .. "/lib/uci/schema") + end end) require("luci.sys") diff --git a/libs/httpd/luasrc/httpd/server.lua b/libs/httpd/luasrc/httpd/server.lua index 6cbffa188..fd4db1484 100644 --- a/libs/httpd/luasrc/httpd/server.lua +++ b/libs/httpd/luasrc/httpd/server.lua @@ -168,7 +168,9 @@ function Server.process( self, client ) self:error( thread, 411, luci.http.protocol.statusmsg[411] ) break; end - + + -- FIXME: Close for POST requests + close = true else self:error( thread, 405, luci.http.protocol.statusmsg[405] ) break; diff --git a/libs/sgi-webuci/boa-patches/220-ipv6-vs-ipv4.patch b/libs/sgi-webuci/boa-patches/220-ipv6-vs-ipv4.patch new file mode 100644 index 000000000..5d0eb6a03 --- /dev/null +++ b/libs/sgi-webuci/boa-patches/220-ipv6-vs-ipv4.patch @@ -0,0 +1,257 @@ +diff -urN boa-0.94.13.orig/src/boa.c boa-0.94.13/src/boa.c +--- boa-0.94.13.orig/src/boa.c 2008-10-28 16:15:45.000000000 +0100 ++++ boa-0.94.13/src/boa.c 2008-10-28 15:56:27.000000000 +0100 +@@ -27,6 +27,12 @@ + #include + + /* globals */ ++ ++#ifdef INET6 ++int server_addr_family; ++socklen_t server_addr_len; ++#endif ++ + int backlog = SO_MAXCONN; + time_t start_time; + +@@ -164,14 +170,36 @@ + return 0; + } + ++#ifdef INET6 ++sa_family_t *get_addr_family(struct sockaddr *address) ++{ ++ if(server_addr_family == AF_INET6) { ++ return &(((struct sockaddr_in6 *) address)->sin6_family); ++ } ++ ++ return &(((struct sockaddr_in *) address)->sin_family); ++} ++#endif ++ + static int create_server_socket(void) + { + int server_s; + +- server_s = socket(SERVER_AF, SOCK_STREAM, IPPROTO_TCP); ++#ifdef INET6 ++ server_addr_family = AF_INET6; ++ server_addr_len = sizeof(struct sockaddr_in6); ++ server_s = socket(server_addr_family, SOCK_STREAM, IPPROTO_TCP); + if (server_s == -1) { +- DIE("unable to create socket"); ++ server_addr_family = AF_INET; ++ server_addr_len = sizeof(struct sockaddr_in); ++#endif ++ server_s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); ++ if (server_s == -1) { ++ DIE("unable to create socket"); ++ } ++#ifdef INET6 + } ++#endif + + /* server socket is nonblocking */ + if (set_nonblock_fd(server_s) == -1) { +diff -urN boa-0.94.13.orig/src/boa.h boa-0.94.13/src/boa.h +--- boa-0.94.13.orig/src/boa.h 2008-10-28 16:15:58.000000000 +0100 ++++ boa-0.94.13/src/boa.h 2008-10-28 14:45:52.000000000 +0100 +@@ -199,4 +199,12 @@ + int plugin_handle(request * req); + struct httpd_plugin *plugin_lookup(request *req); + ++/* IPv6 */ ++ ++#ifdef INET6 ++extern int server_addr_family; ++extern socklen_t server_addr_len; ++sa_family_t *get_addr_family(struct sockaddr *address); ++#endif ++ + #endif +diff -urN boa-0.94.13.orig/src/compat.h boa-0.94.13/src/compat.h +--- boa-0.94.13.orig/src/compat.h 2002-06-06 07:02:28.000000000 +0200 ++++ boa-0.94.13/src/compat.h 2008-10-28 15:31:16.000000000 +0100 +@@ -71,11 +71,13 @@ + + #ifdef INET6 + #define SOCKADDR sockaddr_storage +-#define S_FAMILY __s_family +-#define SERVER_AF AF_INET6 ++#define SOCKADDR_LEN server_addr_len ++#define S_FAMILY(address) (*get_addr_family((struct sockaddr *) (address))) ++#define SERVER_AF server_addr_family + #else + #define SOCKADDR sockaddr_in +-#define S_FAMILY sin_family ++#define SOCKADDR_LEN sizeof(struct sockaddr_in) ++#define S_FAMILY(address) ((*address).sin_family) + #define SERVER_AF AF_INET + #endif + +diff -urN boa-0.94.13.orig/src/ip.c boa-0.94.13/src/ip.c +--- boa-0.94.13.orig/src/ip.c 2002-01-21 03:19:16.000000000 +0100 ++++ boa-0.94.13/src/ip.c 2008-10-28 15:52:05.000000000 +0100 +@@ -44,52 +44,64 @@ + + #include "boa.h" + #include /* inet_ntoa */ ++#include + + /* Binds to the existing server_s, based on the configuration string + in server_ip. IPv6 version doesn't pay attention to server_ip yet. */ + int bind_server(int server_s, char *server_ip) + { ++ struct sockaddr *server_sockaddr; ++ struct sockaddr_in server_sockaddr4; ++ + #ifdef INET6 +- struct sockaddr_in6 server_sockaddr; +- server_sockaddr.sin6_family = AF_INET6; +- memcpy(&server_sockaddr.sin6_addr, &in6addr_any, sizeof (in6addr_any)); +- server_sockaddr.sin6_port = htons(server_port); +-#else +- struct sockaddr_in server_sockaddr; +- memset(&server_sockaddr, 0, sizeof server_sockaddr); ++ struct sockaddr_in6 server_sockaddr6; ++ if(SERVER_AF == AF_INET6) { ++ server_sockaddr6.sin6_family = AF_INET6; ++ memcpy(&server_sockaddr6.sin6_addr, &in6addr_any, sizeof (in6addr_any)); ++ server_sockaddr6.sin6_port = htons(server_port); ++ server_sockaddr = (struct sockaddr *) &server_sockaddr6; ++ } else { ++#endif ++ memset(&server_sockaddr4, 0, SOCKADDR_LEN); + #ifdef HAVE_SIN_LEN /* uncomment for BSDs */ +- server_sockaddr.sin_len = sizeof server_sockaddr; ++ server_sockaddr4.sin_len = SOCKADDR_LEN; + #endif +- server_sockaddr.sin_family = AF_INET; +- if (server_ip != NULL) { +- inet_aton(server_ip, &server_sockaddr.sin_addr); +- } else { +- server_sockaddr.sin_addr.s_addr = htonl(INADDR_ANY); ++ server_sockaddr4.sin_family = AF_INET; ++ if (server_ip != NULL) { ++ inet_aton(server_ip, &server_sockaddr4.sin_addr); ++ } else { ++ server_sockaddr4.sin_addr.s_addr = htonl(INADDR_ANY); ++ } ++ server_sockaddr4.sin_port = htons(server_port); ++ server_sockaddr = (struct sockaddr *) &server_sockaddr4; ++#ifdef INET6 + } +- server_sockaddr.sin_port = htons(server_port); + #endif + +- return bind(server_s, (struct sockaddr *) &server_sockaddr, +- sizeof (server_sockaddr)); ++ return bind(server_s, server_sockaddr, SOCKADDR_LEN); + } + + char *ascii_sockaddr(struct SOCKADDR *s, char *dest, int len) + { + #ifdef INET6 +- if (getnameinfo((struct sockaddr *) s, +- sizeof(struct SOCKADDR), +- dest, len, NULL, 0, NI_NUMERICHOST)) { +- fprintf(stderr, "[IPv6] getnameinfo failed\n"); +- *dest = '\0'; +- } ++ if(SERVER_AF == AF_INET6) { ++ if (getnameinfo((struct sockaddr *) s, ++ SOCKADDR_LEN, ++ dest, len, NULL, 0, NI_NUMERICHOST)) { ++ fprintf(stderr, "[IPv6] getnameinfo failed\n"); ++ *dest = '\0'; ++ } + #ifdef WHEN_DOES_THIS_APPLY +- if ((s->__ss_family == AF_INET6) && +- IN6_IS_ADDR_V4MAPPED(&(((struct sockaddr_in6 *) s)->sin6_addr))) { +- memmove(dest, dest+7, NI_MAXHOST); +- } ++ if (((((struct sockaddr_in6 *) s)->sin6_family) == AF_INET6) && ++ IN6_IS_ADDR_V4MAPPED(&(((struct sockaddr_in6 *) s)->sin6_addr))) { ++ memmove(dest, dest+7, NI_MAXHOST); ++ } + #endif +-#else +- memmove(dest, inet_ntoa(s->sin_addr), len); ++ } else { ++#endif ++ memmove(dest, inet_ntoa(((struct sockaddr_in *) s)->sin_addr), len); ++#ifdef INET6 ++ } + #endif + return dest; + } +@@ -98,17 +110,21 @@ + { + int p = -1; + #ifdef INET6 +- char serv[NI_MAXSERV]; ++ if(SERVER_AF == AF_INET6) { ++ char serv[NI_MAXSERV]; + +- if (getnameinfo((struct sockaddr *) s, +- sizeof(struct SOCKADDR), +- NULL, 0, serv, sizeof(serv), NI_NUMERICSERV)) { +- fprintf(stderr, "[IPv6] getnameinfo failed\n"); ++ if (getnameinfo((struct sockaddr *) s, ++ SOCKADDR_LEN, ++ NULL, 0, serv, sizeof(serv), NI_NUMERICSERV)) { ++ fprintf(stderr, "[IPv6] getnameinfo failed\n"); ++ } else { ++ p = atoi(serv); ++ } + } else { +- p = atoi(serv); ++#endif ++ p = ntohs(((struct sockaddr_in *) s)->sin_port); ++#ifdef INET6 + } +-#else +- p = ntohs(s->sin_port); + #endif + return p; + } +diff -urN boa-0.94.13.orig/src/mmap_cache.c boa-0.94.13/src/mmap_cache.c +--- boa-0.94.13.orig/src/mmap_cache.c 2002-03-24 23:35:34.000000000 +0100 ++++ boa-0.94.13/src/mmap_cache.c 2008-10-28 14:55:16.000000000 +0100 +@@ -67,7 +67,7 @@ + + m = mmap(0, s->st_size, PROT_READ, MAP_OPTIONS, data_fd, 0); + +- if ((int) m == -1) { ++ if ((ssize_t) m == -1) { + /* boa_perror(req,"mmap"); */ + return NULL; + } +diff -urN boa-0.94.13.orig/src/request.c boa-0.94.13/src/request.c +--- boa-0.94.13.orig/src/request.c 2008-10-28 16:16:03.000000000 +0100 ++++ boa-0.94.13/src/request.c 2008-10-28 15:17:20.000000000 +0100 +@@ -75,12 +75,12 @@ + int fd; /* socket */ + struct SOCKADDR remote_addr; /* address */ + struct SOCKADDR salocal; +- int remote_addrlen = sizeof (struct SOCKADDR); ++ int remote_addrlen = SOCKADDR_LEN; + request *conn; /* connection */ +- size_t len; ++ socklen_t len; + static int system_bufsize = 0; /* Default size of SNDBUF given by system */ + +- remote_addr.S_FAMILY = 0xdead; ++ S_FAMILY(&remote_addr) = 0xdead; + fd = accept(server_s, (struct sockaddr *) &remote_addr, + &remote_addrlen); + +@@ -133,7 +133,7 @@ + } + #endif + +- len = sizeof(salocal); ++ len = SOCKADDR_LEN; + + if (getsockname(fd, (struct sockaddr *) &salocal, &len) != 0) { + WARN("getsockname"); diff --git a/libs/sys/luasrc/sys/zoneinfo.lua b/libs/sys/luasrc/sys/zoneinfo.lua index 7bd02d934..d6de70425 100644 --- a/libs/sys/luasrc/sys/zoneinfo.lua +++ b/libs/sys/luasrc/sys/zoneinfo.lua @@ -67,17 +67,18 @@ TZ = { { 'America/Anguilla', 'AST4' }, { 'America/Antigua', 'AST4' }, { 'America/Araguaina', 'BRT3' }, - { 'America/Argentina/Buenos Aires', 'ART3ARST,M10.1.0/0,M3.3.0/0' }, - { 'America/Argentina/Catamarca', 'ART3ARST,M10.1.0/0,M3.3.0/0' }, - { 'America/Argentina/Cordoba', 'ART3ARST,M10.1.0/0,M3.3.0/0' }, - { 'America/Argentina/Jujuy', 'ART3ARST,M10.1.0/0,M3.3.0/0' }, - { 'America/Argentina/La Rioja', 'ART3ARST,M10.1.0/0,M3.3.0/0' }, - { 'America/Argentina/Mendoza', 'ART3ARST,M10.1.0/0,M3.3.0/0' }, - { 'America/Argentina/Rio Gallegos', 'ART3ARST,M10.1.0/0,M3.3.0/0' }, - { 'America/Argentina/San Juan', 'ART3ARST,M10.1.0/0,M3.3.0/0' }, + { 'America/Argentina/Buenos Aires', 'ART3ARST,M10.3.0/0,M3.3.0/0' }, + { 'America/Argentina/Catamarca', 'ART3' }, + { 'America/Argentina/Cordoba', 'ART3ARST,M10.3.0/0,M3.3.0/0' }, + { 'America/Argentina/Jujuy', 'ART3' }, + { 'America/Argentina/La Rioja', 'ART3' }, + { 'America/Argentina/Mendoza', 'ART3' }, + { 'America/Argentina/Rio Gallegos', 'ART3' }, + { 'America/Argentina/Salta', 'ART3' }, + { 'America/Argentina/San Juan', 'ART3' }, { 'America/Argentina/San Luis', 'ART3' }, - { 'America/Argentina/Tucuman', 'ART3ARST,M10.1.0/0,M3.3.0/0' }, - { 'America/Argentina/Ushuaia', 'ART3ARST,M10.1.0/0,M3.3.0/0' }, + { 'America/Argentina/Tucuman', 'ART3ARST,M10.3.0/0,M3.3.0/0' }, + { 'America/Argentina/Ushuaia', 'ART3' }, { 'America/Aruba', 'AST4' }, { 'America/Asuncion', 'PYT4PYST,M10.3.0/0,M3.2.0/0' }, { 'America/Atikokan', 'EST5' }, @@ -90,7 +91,7 @@ TZ = { { 'America/Bogota', 'COT5' }, { 'America/Boise', 'MST7MDT,M3.2.0,M11.1.0' }, { 'America/Cambridge Bay', 'MST7MDT,M3.2.0,M11.1.0' }, - { 'America/Campo Grande', 'AMT4AMST,M10.2.0/0,M2.3.0/0' }, + { 'America/Campo Grande', 'AMT4AMST,M10.3.0/0,M2.3.0/0' }, { 'America/Cancun', 'CST6CDT,M4.1.0,M10.5.0' }, { 'America/Caracas', 'VET4:30' }, { 'America/Cayenne', 'GFT3' }, @@ -98,7 +99,7 @@ TZ = { { 'America/Chicago', 'CST6CDT,M3.2.0,M11.1.0' }, { 'America/Chihuahua', 'MST7MDT,M4.1.0,M10.5.0' }, { 'America/Costa Rica', 'CST6' }, - { 'America/Cuiaba', 'AMT4AMST,M10.2.0/0,M2.3.0/0' }, + { 'America/Cuiaba', 'AMT4AMST,M10.3.0/0,M2.3.0/0' }, { 'America/Curacao', 'AST4' }, { 'America/Danmarkshavn', 'GMT0' }, { 'America/Dawson', 'PST8PDT,M3.2.0,M11.1.0' }, @@ -176,7 +177,7 @@ TZ = { { 'America/Rio Branco', 'AMT4' }, { 'America/Santarem', 'BRT3' }, { 'America/Santo Domingo', 'AST4' }, - { 'America/Sao Paulo', 'BRT3BRST,M10.2.0/0,M2.3.0/0' }, + { 'America/Sao Paulo', 'BRT3BRST,M10.3.0/0,M2.3.0/0' }, { 'America/Scoresbysund', 'EGT1EGST,M3.5.0/0,M10.5.0/1' }, { 'America/Shiprock', 'MST7MDT,M3.2.0,M11.1.0' }, { 'America/St Barthelemy', 'AST4' }, @@ -224,12 +225,12 @@ TZ = { { 'Asia/Choibalsan', 'CHOT-8' }, { 'Asia/Chongqing', 'CST-8' }, { 'Asia/Colombo', 'IST-5:30' }, - { 'Asia/Damascus', 'EET-2EEST,M4.1.5/0,J274/0' }, + { 'Asia/Damascus', 'EET-2EEST,M4.1.5/0,J305/0' }, { 'Asia/Dhaka', 'BDT-6' }, { 'Asia/Dili', 'TLT-9' }, { 'Asia/Dubai', 'GST-4' }, { 'Asia/Dushanbe', 'TJT-5' }, - { 'Asia/Gaza', 'EET-2EEST,J91/0,M9.2.4' }, + { 'Asia/Gaza', 'EET-2EEST,J91/0,M8.5.4' }, { 'Asia/Harbin', 'CST-8' }, { 'Asia/Ho Chi Minh', 'ICT-7' }, { 'Asia/Hong Kong', 'HKT-8' }, @@ -365,7 +366,7 @@ TZ = { { 'Indian/Kerguelen', 'TFT-5' }, { 'Indian/Mahe', 'SCT-4' }, { 'Indian/Maldives', 'MVT-5' }, - { 'Indian/Mauritius', 'MUT-4' }, + { 'Indian/Mauritius', 'MUT-4MUST,M10.5.0,M3.5.0/3' }, { 'Indian/Mayotte', 'EAT-3' }, { 'Indian/Reunion', 'RET-4' }, { 'Pacific/Apia', 'WST11' }, @@ -406,3 +407,166 @@ TZ = { { 'Pacific/Wake', 'WAKT-12' }, { 'Pacific/Wallis', 'WFT-12' }, } + +OFFSET = { + gmt = 0, -- GMT + eat = 10800, -- EAT + cet = 3600, -- CET + wat = 3600, -- WAT + cat = 7200, -- CAT + wet = 0, -- WET + sast = 7200, -- SAST + eet = 7200, -- EET + hast = -36000, -- HAST + hadt = -32400, -- HADT + akst = -32400, -- AKST + akdt = -28800, -- AKDT + ast = -14400, -- AST + brt = -10800, -- BRT + art = -10800, -- ART + arst = -7200, -- ARST + pyt = -14400, -- PYT + pyst = -10800, -- PYST + est = -18000, -- EST + cst = -21600, -- CST + amt = -14400, -- AMT + cot = -18000, -- COT + mst = -25200, -- MST + mdt = -21600, -- MDT + vet = -16200, -- VET + gft = -10800, -- GFT + pst = -28800, -- PST + pdt = -25200, -- PDT + ect = -18000, -- ECT + gyt = -14400, -- GYT + bot = -14400, -- BOT + pet = -18000, -- PET + pmst = -10800, -- PMST + pmdt = -7200, -- PMDT + uyt = -10800, -- UYT + uyst = -7200, -- UYST + fnt = -7200, -- FNT + srt = -10800, -- SRT + egt = -3600, -- EGT + egst = 0, -- EGST + nst = -12600, -- NST + ndt = -9000, -- NDT + wst = 28800, -- WST + davt = 25200, -- DAVT + ddut = 36000, -- DDUT + mawt = 21600, -- MAWT + nzst = 43200, -- NZST + nzdt = 46800, -- NZDT + rott = -10800, -- ROTT + syot = 10800, -- SYOT + vost = 21600, -- VOST + almt = 21600, -- ALMT + anat = 43200, -- ANAT + anast = 46800, -- ANAST + aqtt = 18000, -- AQTT + tmt = 18000, -- TMT + azt = 14400, -- AZT + azst = 18000, -- AZST + ict = 25200, -- ICT + kgt = 21600, -- KGT + bnt = 28800, -- BNT + chot = 28800, -- CHOT + ist = 19800, -- IST + bdt = 21600, -- BDT + tlt = 32400, -- TLT + gst = 14400, -- GST + tjt = 18000, -- TJT + hkt = 28800, -- HKT + hovt = 25200, -- HOVT + irkt = 28800, -- IRKT + irkst = 32400, -- IRKST + wit = 25200, -- WIT + eit = 32400, -- EIT + aft = 16200, -- AFT + pett = 43200, -- PETT + petst = 46800, -- PETST + pkt = 18000, -- PKT + npt = 20700, -- NPT + krat = 25200, -- KRAT + krast = 28800, -- KRAST + myt = 28800, -- MYT + magt = 39600, -- MAGT + magst = 43200, -- MAGST + cit = 28800, -- CIT + pht = 28800, -- PHT + novt = 21600, -- NOVT + novst = 25200, -- NOVST + omst = 21600, -- OMST + omsst = 25200, -- OMSST + orat = 18000, -- ORAT + kst = 32400, -- KST + qyzt = 21600, -- QYZT + mmt = 23400, -- MMT + sakt = 36000, -- SAKT + sakst = 39600, -- SAKST + uzt = 18000, -- UZT + sgt = 28800, -- SGT + get = 14400, -- GET + btt = 21600, -- BTT + jst = 32400, -- JST + ulat = 28800, -- ULAT + vlat = 36000, -- VLAT + vlast = 39600, -- VLAST + yakt = 32400, -- YAKT + yakst = 36000, -- YAKST + yekt = 18000, -- YEKT + yekst = 21600, -- YEKST + azot = -3600, -- AZOT + azost = 0, -- AZOST + cvt = -3600, -- CVT + fkt = -14400, -- FKT + fkst = -10800, -- FKST + cwst = 31500, -- CWST + lhst = 37800, -- LHST + lhst = 39600, -- LHST + msk = 10800, -- MSK + msd = 14400, -- MSD + samt = 14400, -- SAMT + samst = 18000, -- SAMST + volt = 10800, -- VOLT + volst = 14400, -- VOLST + iot = 21600, -- IOT + cxt = 25200, -- CXT + cct = 23400, -- CCT + tft = 18000, -- TFT + sct = 14400, -- SCT + mvt = 18000, -- MVT + mut = 14400, -- MUT + must = 18000, -- MUST + ret = 14400, -- RET + chast = 45900, -- CHAST + chadt = 49500, -- CHADT + vut = 39600, -- VUT + phot = 46800, -- PHOT + tkt = -36000, -- TKT + fjt = 43200, -- FJT + tvt = 43200, -- TVT + galt = -21600, -- GALT + gamt = -32400, -- GAMT + sbt = 39600, -- SBT + hst = -36000, -- HST + lint = 50400, -- LINT + kost = 39600, -- KOST + mht = 43200, -- MHT + mart = -34200, -- MART + sst = -39600, -- SST + nrt = 43200, -- NRT + nut = -39600, -- NUT + nft = 41400, -- NFT + nct = 39600, -- NCT + pwt = 32400, -- PWT + pont = 39600, -- PONT + pgt = 36000, -- PGT + ckt = -36000, -- CKT + taht = -36000, -- TAHT + gilt = 43200, -- GILT + tot = 46800, -- TOT + trut = 36000, -- TRUT + wakt = 43200, -- WAKT + wft = 43200, -- WFT +} diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua index 8773974cf..f69713a91 100644 --- a/libs/web/luasrc/dispatcher.lua +++ b/libs/web/luasrc/dispatcher.lua @@ -47,7 +47,12 @@ local fi -- @param ... Virtual path -- @return Relative URL function build_url(...) - return luci.http.getenv("SCRIPT_NAME") .. "/" .. table.concat(arg, "/") + local path = {...} + local sn = http.getenv("SCRIPT_NAME") or "" + for k, v in pairs(context.urltoken) do + sn = sn .. "/;" .. k .. "=" .. http.urlencode(v) + end + return sn .. ((#path > 0) and "/" .. table.concat(path, "/") or "") end --- Send a 404 error code and render the "error404" template if available. @@ -123,6 +128,7 @@ function dispatch(request) --context._disable_memtrace = require "luci.debug".trap_memtrace() local ctx = context ctx.path = request + ctx.urltoken = ctx.urltoken or {} require "luci.i18n".setlanguage(require "luci.config".main.lang) @@ -137,18 +143,32 @@ function dispatch(request) ctx.args = args ctx.requestargs = ctx.requestargs or args local n + local t = true + local token = ctx.urltoken + local preq = {} for i, s in ipairs(request) do - c = c.nodes[s] - n = i - if not c then - break + local tkey, tval + if t then + tkey, tval = s:match(";(%w+)=(.*)") end - util.update(track, c) + if tkey then + token[tkey] = tval + else + t = false + preq[#preq+1] = s + c = c.nodes[s] + n = i + if not c then + break + end + + util.update(track, c) - if c.leaf then - break + if c.leaf then + break + end end end @@ -158,6 +178,8 @@ function dispatch(request) end end + ctx.path = preq + if track.i18n then require("luci.i18n").loadc(track.i18n) end @@ -177,17 +199,23 @@ function dispatch(request) assert(media, "No valid theme found") end - local viewns = setmetatable({}, {__index=_G}) + local viewns = setmetatable({}, {__index=function(table, key) + if key == "controller" then + return build_url() + elseif key == "REQUEST_URI" then + return build_url(unpack(ctx.requested.path)) + else + return rawget(table, key) or _G[key] + end + end}) tpl.context.viewns = viewns viewns.write = luci.http.write viewns.include = function(name) tpl.Template(name):render(getfenv(2)) end viewns.translate = function(...) return require("luci.i18n").translate(...) end viewns.striptags = util.striptags - viewns.controller = luci.http.getenv("SCRIPT_NAME") viewns.media = media viewns.theme = fs.basename(media) viewns.resource = luci.config.main.resourcebase - viewns.REQUEST_URI = (luci.http.getenv("SCRIPT_NAME") or "") .. (luci.http.getenv("PATH_INFO") or "") end track.dependent = (track.dependent ~= false) @@ -202,27 +230,50 @@ function dispatch(request) local def = (type(track.sysauth) == "string") and track.sysauth local accs = def and {track.sysauth} or track.sysauth - local sess = ctx.authsession or luci.http.getcookie("sysauth") - sess = sess and sess:match("^[A-F0-9]+$") - local user = sauth.read(sess) + local sess = ctx.authsession + local verifytoken = false + if not sess then + sess = luci.http.getcookie("sysauth") + sess = sess and sess:match("^[A-F0-9]+$") + verifytoken = true + end + + local sdat = sauth.read(sess) + local user + + if sdat then + sdat = loadstring(sdat)() + if not verifytoken or ctx.urltoken.stok == sdat.token then + user = sdat.user + end + end if not util.contains(accs, user) then if authen then + ctx.urltoken.stok = nil local user, sess = authen(luci.sys.user.checkpasswd, accs, def) if not user or not util.contains(accs, user) then return else local sid = sess or luci.sys.uniqueid(16) - luci.http.header("Set-Cookie", "sysauth=" .. sid.."; path=/") if not sess then - sauth.write(sid, user) + local token = luci.sys.uniqueid(16) + sauth.write(sid, util.get_bytecode({ + user=user, + token=token, + secret=luci.sys.uniqueid(16) + })) + ctx.urltoken.stok = token end + luci.http.header("Set-Cookie", "sysauth=" .. sid.."; path="..build_url()) ctx.authsession = sid end else luci.http.status(403, "Forbidden") return end + else + ctx.authsession = sess end end @@ -354,9 +405,11 @@ function createtree() local ctx = context local tree = {nodes={}} + local modi = {} ctx.treecache = setmetatable({}, {__mode="v"}) ctx.tree = tree + ctx.modifiers = modi -- Load default translation require "luci.i18n".loadc("default") @@ -369,9 +422,31 @@ function createtree() v() end + local function modisort(a,b) + return modi[a].order < modi[b].order + end + + for _, v in util.spairs(modi, modisort) do + scope._NAME = v.module + setfenv(v.func, scope) + v.func() + end + return tree end +--- Register a tree modifier. +-- @param func Modifier function +-- @param order Modifier order value (optional) +function modifier(func, order) + context.modifiers[#context.modifiers+1] = { + func = func, + order = order or 0, + module + = getfenv(2)._NAME + } +end + --- Clone a node of the dispatching tree to another position. -- @param path Virtual path destination -- @param clone Virtual path source @@ -415,7 +490,6 @@ function node(...) local c = _create_node({...}) c.module = getfenv(2)._NAME - c.path = arg c.auto = nil return c @@ -431,10 +505,11 @@ function _create_node(path, cache) local c = cache[name] if not c then + local new = {nodes={}, auto=true, path=util.clone(path)} local last = table.remove(path) + c = _create_node(path, cache) - local new = {nodes={}, auto=true} c.nodes[last] = new cache[name] = new diff --git a/libs/web/luasrc/sauth.lua b/libs/web/luasrc/sauth.lua index 894732dfa..5d3dc95ca 100644 --- a/libs/web/luasrc/sauth.lua +++ b/libs/web/luasrc/sauth.lua @@ -60,6 +60,9 @@ function read(id) if not id then return end + if not id:match("^%w+$") then + error("Session ID is not sane!") + end clean() if not sane(sessionpath .. "/" .. id) then return @@ -85,6 +88,19 @@ function write(id, data) if not sane() then prepare() end + if not id:match("^%w+$") then + error("Session ID is not sane!") + end luci.fs.writefile(sessionpath .. "/" .. id, data) luci.fs.chmod(sessionpath .. "/" .. id, "a-rwx,u+rw") +end + + +--- Kills a session +-- @param id Session identifier +function kill(id) + if not id:match("^%w+$") then + error("Session ID is not sane!") + end + luci.fs.unlink(sessionpath .. "/" .. id) end \ No newline at end of file diff --git a/libs/web/root/etc/config/luci b/libs/web/root/etc/config/luci index e3e07beda..0178f6c28 100644 --- a/libs/web/root/etc/config/luci +++ b/libs/web/root/etc/config/luci @@ -7,7 +7,7 @@ config core brand option title "OpenWrt Kamikaze" option subtitle "Lua Configuration Interface" option firmware "OpenWrt Kamikaze" - option distro "" + option distro "Development Snapshot" config extern flash_keep option uci "/etc/config/" diff --git a/modules/admin-core/luasrc/view/indexer.htm b/modules/admin-core/luasrc/view/indexer.htm new file mode 100644 index 000000000..363802bbc --- /dev/null +++ b/modules/admin-core/luasrc/view/indexer.htm @@ -0,0 +1,15 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id: indexer.htm 3552 2008-10-10 14:37:53Z Cyrus $ + +-%> +<% include("themes/" .. theme .. "/indexer") %> \ No newline at end of file diff --git a/modules/admin-core/luasrc/view/sysauth.htm b/modules/admin-core/luasrc/view/sysauth.htm index a49d80786..42f13fa1f 100644 --- a/modules/admin-core/luasrc/view/sysauth.htm +++ b/modules/admin-core/luasrc/view/sysauth.htm @@ -41,7 +41,7 @@ $Id$
-
+
diff --git a/modules/admin-core/root/etc/config/luci_ethers b/modules/admin-core/root/etc/config/luci_ethers index e69de29bb..8b1378917 100644 --- a/modules/admin-core/root/etc/config/luci_ethers +++ b/modules/admin-core/root/etc/config/luci_ethers @@ -0,0 +1 @@ + diff --git a/modules/admin-core/root/etc/config/luci_hosts b/modules/admin-core/root/etc/config/luci_hosts index 6221df72d..8b1378917 100644 --- a/modules/admin-core/root/etc/config/luci_hosts +++ b/modules/admin-core/root/etc/config/luci_hosts @@ -1,3 +1 @@ -config 'host' - option 'ipaddr' '10.11.12.13' - option 'hostname' 'sample-host' + diff --git a/modules/admin-core/root/lib/uci/schema/default/network b/modules/admin-core/root/lib/uci/schema/default/network index 8bf8dd197..5a5866f46 100644 --- a/modules/admin-core/root/lib/uci/schema/default/network +++ b/modules/admin-core/root/lib/uci/schema/default/network @@ -384,7 +384,6 @@ config variable option title 'IPv4 gateway' option section 'network.route' option datatype 'ip4addr' - option required 'true' config variable option name 'metric' diff --git a/modules/admin-full/luasrc/controller/admin/filebrowser.lua b/modules/admin-full/luasrc/controller/admin/filebrowser.lua new file mode 100644 index 000000000..d83139fd7 --- /dev/null +++ b/modules/admin-full/luasrc/controller/admin/filebrowser.lua @@ -0,0 +1,20 @@ +--[[ +LuCI - Lua Configuration Interface + +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ +]]-- + +module("luci.controller.admin.filebrowser", package.seeall) + +function index() + entry( {"admin", "filebrowser"}, template("cbi/filebrowser") ).leaf = true +end diff --git a/modules/admin-full/luasrc/controller/admin/index.lua b/modules/admin-full/luasrc/controller/admin/index.lua index 071dd595d..e2b812e8c 100644 --- a/modules/admin-full/luasrc/controller/admin/index.lua +++ b/modules/admin-full/luasrc/controller/admin/index.lua @@ -49,6 +49,13 @@ function index() end function action_logout() - luci.http.header("Set-Cookie", "sysauth=; path=/") + local dsp = require "luci.dispatcher" + local sauth = require "luci.sauth" + if dsp.context.authsession then + sauth.kill(dsp.context.authsession) + dsp.context.urltoken.stok = nil + end + + luci.http.header("Set-Cookie", "sysauth=; path=" .. dsp.build_url()) luci.http.redirect(luci.dispatcher.build_url()) end \ No newline at end of file diff --git a/modules/admin-full/luasrc/controller/admin/services.lua b/modules/admin-full/luasrc/controller/admin/services.lua index f7bdb02d5..a137377b3 100644 --- a/modules/admin-full/luasrc/controller/admin/services.lua +++ b/modules/admin-full/luasrc/controller/admin/services.lua @@ -28,10 +28,19 @@ function index() page.order = 40 page.index = true - local page = node("admin", "services", "httpd") - page.target = cbi("admin_services/httpd") - page.title = "Busybox HTTPd" - page.order = 10 + if luci.fs.access("/etc/config/lucittpd") then + local page = node("admin", "services", "lucittpd") + page.target = cbi("admin_services/lucittpd") + page.title = "LuCIttpd" + page.order = 10 + end + + if luci.fs.access("/etc/config/httpd") then + local page = node("admin", "services", "httpd") + page.target = cbi("admin_services/httpd") + page.title = "Busybox HTTPd" + page.order = 11 + end local page = node("admin", "services", "dropbear") page.target = cbi("admin_services/dropbear") diff --git a/modules/admin-full/luasrc/controller/admin/system.lua b/modules/admin-full/luasrc/controller/admin/system.lua index b6de14884..9071bfdfe 100644 --- a/modules/admin-full/luasrc/controller/admin/system.lua +++ b/modules/admin-full/luasrc/controller/admin/system.lua @@ -25,7 +25,11 @@ function index() entry({"admin", "system", "sshkeys"}, form("admin_system/sshkeys"), i18n("a_s_sshkeys"), 30) entry({"admin", "system", "processes"}, form("admin_system/processes"), i18n("process_head"), 45) entry({"admin", "system", "fstab"}, cbi("admin_system/fstab"), i18n("a_s_fstab"), 50) - entry({"admin", "system", "leds"}, cbi("admin_system/leds"), i18n("leds", "LEDs"), 60) + + if luci.fs.isdirectory("/sys/class/leds") then + entry({"admin", "system", "leds"}, cbi("admin_system/leds"), i18n("leds", "LEDs"), 60) + end + entry({"admin", "system", "backup"}, call("action_backup"), i18n("a_s_backup"), 70) entry({"admin", "system", "upgrade"}, call("action_upgrade"), i18n("a_s_flash"), 80) entry({"admin", "system", "reboot"}, call("action_reboot"), i18n("reboot"), 90) diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua b/modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua index 4ab32693e..267c41c9d 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua @@ -41,6 +41,7 @@ if has_pppoe then p:value("pppoe", "PPPoE") end if has_pppoa then p:value("pppoa", "PPPoA") end if has_3g then p:value("3g", "UMTS/3G") end if has_pptp then p:value("pptp", "PPTP") end +p:value("none", translate("none")) if not ( has_pppd and has_pppoe and has_pppoa and has_3g and has_pptp ) then p.description = translate("network_interface_prereq") diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua index 3a52ef317..6d46a541f 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua @@ -161,6 +161,7 @@ bssid = s:option(Value, "bssid", translate("wifi_bssid")) -------------------- MAC80211 Interface ---------------------- if hwtype == "mac80211" then + mode:value("ahdemo", translate("a_w_ahdemo")) mode:value("monitor", translate("a_w_monitor")) bssid:depends({mode="adhoc"}) diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/wireless.lua b/modules/admin-full/luasrc/model/cbi/admin_network/wireless.lua index 4f19f4e2c..ef46cb4a3 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/wireless.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/wireless.lua @@ -32,7 +32,7 @@ s = m:section(Table, ifaces, translate("networks")) function s.extedit(self, section) local device = self.map:get(section, "device") or "" - return luci.http.getenv("REQUEST_URI") .. "/" .. device + return luci.dispatcher.build_url(unpack(luci.dispatcher.context.requested.path)) .. "/" .. device end link = s:option(DummyValue, "_link", translate("link")) @@ -124,11 +124,11 @@ function create.write(self, section, value) uci:load("wireless") uci:section("wireless", "wifi-iface", nil, {device=value}) uci:save("wireless") - luci.http.redirect(luci.http.getenv("REQUEST_URI") .. "/" .. value) + luci.http.redirect(luci.dispatcher.build_url(unpack(luci.dispatcher.context.requested.path)) .. "/" .. value) end function create.cbid(self, section) return "priv.cbid.create" end -return m \ No newline at end of file +return m diff --git a/modules/admin-full/luasrc/model/cbi/admin_services/lucittpd.lua b/modules/admin-full/luasrc/model/cbi/admin_services/lucittpd.lua new file mode 100644 index 000000000..35d8650bf --- /dev/null +++ b/modules/admin-full/luasrc/model/cbi/admin_services/lucittpd.lua @@ -0,0 +1,25 @@ +--[[ +LuCI - Lua Configuration Interface + +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ +]]-- +m = Map("lucittpd", "LuCIttpd", translate("a_srv_lucittpd")) + +s = m:section(NamedSection, "lucittpd", "lucittpd", "") + +s:option(Value, "port", translate("port")) +s:option(Value, "root", translate("a_srv_http_root")) +s:option(Value, "path", translate("a_srv_http_path")) +s:option(Flag, "keepalive", translate("a_srv_http_keepalive")) +s:option(Value, "timeout", translate("a_srv_http_timeout")) + +return m diff --git a/modules/admin-mini/luasrc/controller/mini/index.lua b/modules/admin-mini/luasrc/controller/mini/index.lua index b538310aa..acff55aab 100644 --- a/modules/admin-mini/luasrc/controller/mini/index.lua +++ b/modules/admin-mini/luasrc/controller/mini/index.lua @@ -40,6 +40,13 @@ function index() end function action_logout() - luci.http.header("Set-Cookie", "sysauth=; path=/") + local dsp = require "luci.dispatcher" + local sauth = require "luci.sauth" + if dsp.context.authsession then + sauth.kill(dsp.context.authsession) + dsp.context.urltoken.stok = nil + end + + luci.http.header("Set-Cookie", "sysauth=; path=" .. dsp.build_url()) luci.http.redirect(luci.dispatcher.build_url()) end \ No newline at end of file diff --git a/modules/freifunk/luasrc/controller/freifunk/freifunk.lua b/modules/freifunk/luasrc/controller/freifunk/freifunk.lua index 460ebbec5..533211b00 100644 --- a/modules/freifunk/luasrc/controller/freifunk/freifunk.lua +++ b/modules/freifunk/luasrc/controller/freifunk/freifunk.lua @@ -19,6 +19,8 @@ function index() local page = node() page.lock = true page.target = alias("freifunk") + page.subindex = true + page.index = false local page = node("freifunk") page.title = "Freifunk" @@ -27,11 +29,13 @@ function index() page.setuser = "nobody" page.setgroup = "nogroup" page.i18n = "freifunk" + page.index = true local page = node("freifunk", "index") page.target = template("freifunk/index") page.title = "Übersicht" page.order = 10 + page.indexignore = true local page = node("freifunk", "index", "contact") page.target = template("freifunk/contact") @@ -39,26 +43,27 @@ function index() local page = node("freifunk", "status") - page.target = call("action_status") + page.target = form("freifunk/public_status") page.title = "Status" page.order = 20 + page.i18n = "admin-core" page.setuser = false page.setgroup = false - assign({"freifunk", "status", "iwscan"}, {"admin", "status", "iwscan"}, "WLAN-Scan", 20) - assign({"freifunk", "olsr"}, {"admin", "status", "olsr"}, "OLSR", 30) if luci.fs.isfile("/etc/config/luci_statistics") then - assign({"freifunk", "statistics"}, {"admin", "statistics", "graph"}, i18n("stat_statistics", "Statistiken"), 40) + assign({"freifunk", "graph"}, {"admin", "statistics", "graph"}, i18n("stat_statistics", "Statistiken"), 40) end - local page = node("admin", "index", "freifunk") + assign({"mini", "freifunk"}, {"admin", "freifunk"}, "Freifunk", 15) + entry({"admin", "freifunk"}, alias("admin", "freifunk", "index"), "Freifunk", 15) + local page = node("admin", "freifunk", "index") page.target = cbi("freifunk/freifunk") page.title = "Freifunk" page.order = 30 - local page = node("admin", "index", "contact") + local page = node("admin", "freifunk", "contact") page.target = cbi("freifunk/contact") page.title = "Kontakt" page.order = 40 diff --git a/modules/freifunk/luasrc/model/cbi/freifunk/contact.lua b/modules/freifunk/luasrc/model/cbi/freifunk/contact.lua index 203b1ce6d..2bb34a14a 100644 --- a/modules/freifunk/luasrc/model/cbi/freifunk/contact.lua +++ b/modules/freifunk/luasrc/model/cbi/freifunk/contact.lua @@ -11,16 +11,24 @@ You may obtain a copy of the License at $Id$ ]]-- + +luci.i18n.loadc("freifunk") + m = Map("freifunk", translate("contact"), translate("contact1")) c = m:section(NamedSection, "contact", "public", "") -c:option(Value, "nickname", translate("nickname")) -c:option(Value, "name", translate("name")) -c:option(Value, "mail", translate("mail"), translate("mail1")) -c:option(Value, "phone", translate("phone")) -c:option(Value, "location", translate("location")) -c:option(Value, "geo", translate("coord"), translate("coord1")) -c:option(Value, "note", translate("note")) +c:option(Value, "nickname", translate("ff_nickname")) +c:option(Value, "name", translate("ff_name")) +c:option(Value, "mail", translate("ff_mail"), translate("ff_mail1")) +c:option(Value, "phone", translate("ff_phone")) +c:option(Value, "location", translate("ff_location")) +c:option(Value, "note", translate("ff_note")) + +m2 = Map("system", translate("geo")) + +s = m2:section(TypedSection, "system", "") +s:option(Value, "latitude", translate("latitude", "Breite")).rmempty = true +s:option(Value, "longitude", translate("longitude", "Länge")).rmempty = true -return m \ No newline at end of file +return m, m2 diff --git a/modules/freifunk/luasrc/model/cbi/freifunk/freifunk.lua b/modules/freifunk/luasrc/model/cbi/freifunk/freifunk.lua index 54d984988..1a147460b 100644 --- a/modules/freifunk/luasrc/model/cbi/freifunk/freifunk.lua +++ b/modules/freifunk/luasrc/model/cbi/freifunk/freifunk.lua @@ -18,14 +18,7 @@ für die lokale Freifunkgemeinschaft. Diese Werte wirken sich NICHT auf die Konf des Routers aus, sondern definieren nur die Vorgaben für den Freifunkassistenten.]]) c:option(Value, "name", "Gemeinschaft") c:option(Value, "homepage", "Webseite") -c:option(Value, "essid", "ESSID") -c:option(Value, "bssid", "BSSID") -c:option(Value, "channel", "Funkkanal") -c:option(Value, "realm", "Realm") -c:option(Value, "net", "Adressbereich") -c:option(Value, "mask", "Netzmaske") -c:option(Value, "dns", "DNS-Server") -c:option(Value, "dhcp", "DHCP-Bereich") -c:option(Value, "dhcpmask", "DHCP-Maske") +c:option(Value, "ssid", "ESSID") +c:option(Value, "prefix", "Netzprefix") return m \ No newline at end of file diff --git a/modules/freifunk/luasrc/model/cbi/freifunk/public_status.lua b/modules/freifunk/luasrc/model/cbi/freifunk/public_status.lua new file mode 100644 index 000000000..14e6d5664 --- /dev/null +++ b/modules/freifunk/luasrc/model/cbi/freifunk/public_status.lua @@ -0,0 +1,213 @@ +require "luci.sys" +require "luci.tools.webadmin" + +local bit = require "bit" +local uci = luci.model.uci.cursor_state() + +local ffzone = luci.tools.webadmin.firewall_find_zone("freifunk") +local ffznet = ffzone and uci:get("firewall", ffzone, "network") +local ffwifs = ffznet and luci.util.split(ffznet, " ") or {} + +-- System -- + +f = SimpleForm("system", "System") +f.submit = false +f.reset = false +local system, model, memtotal, memcached, membuffers, memfree = luci.sys.sysinfo() +local uptime = luci.sys.uptime() + +f:field(DummyValue, "_system", translate("system")).value = system +f:field(DummyValue, "_cpu", translate("m_i_processor")).value = model + +local load1, load5, load15 = luci.sys.loadavg() +f:field(DummyValue, "_la", translate("load")).value = +string.format("%.2f, %.2f, %.2f", load1, load5, load15) + +f:field(DummyValue, "_memtotal", translate("m_i_memory")).value = +string.format("%.2f MB (%.0f%% %s, %.0f%% %s, %.0f%% %s)", + tonumber(memtotal) / 1024, + 100 * memcached / memtotal, + translate("mem_cached") or "", + 100 * membuffers / memtotal, + translate("mem_buffered") or "", + 100 * memfree / memtotal, + translate("mem_free") or "") + +f:field(DummyValue, "_systime", translate("m_i_systemtime")).value = +os.date("%c") + +f:field(DummyValue, "_uptime", translate("m_i_uptime")).value = +luci.tools.webadmin.date_format(tonumber(uptime)) + + +-- Wireless -- + +local wireless = uci:get_all("wireless") +local wifidata = luci.sys.wifi.getiwconfig() +local ifaces = {} + +for k, v in pairs(wireless) do + if v[".type"] == "wifi-iface" and luci.util.contains(ffwifs, v.device) then + table.insert(ifaces, v) + end +end + + +m = SimpleForm("wireless", "Freifunk WLAN") +m.submit = false +m.reset = false + +s = m:section(Table, ifaces, translate("networks")) + +link = s:option(DummyValue, "_link", translate("link")) +function link.cfgvalue(self, section) + local ifname = self.map:get(section, "ifname") + return wifidata[ifname] and wifidata[ifname]["Link Quality"] or "-" +end + +essid = s:option(DummyValue, "ssid", "ESSID") + +bssid = s:option(DummyValue, "_bsiid", "BSSID") +function bssid.cfgvalue(self, section) + local ifname = self.map:get(section, "ifname") + return (wifidata[ifname] and (wifidata[ifname].Cell + or wifidata[ifname]["Access Point"])) or "-" +end + +channel = s:option(DummyValue, "channel", translate("channel")) + function channel.cfgvalue(self, section) + return wireless[self.map:get(section, "device")].channel +end + +protocol = s:option(DummyValue, "_mode", translate("protocol")) +function protocol.cfgvalue(self, section) + local mode = wireless[self.map:get(section, "device")].mode + return mode and "802." .. mode +end + +mode = s:option(DummyValue, "mode", translate("mode")) +encryption = s:option(DummyValue, "encryption", translate("iwscan_encr")) + +power = s:option(DummyValue, "_power", translate("power")) +function power.cfgvalue(self, section) + local ifname = self.map:get(section, "ifname") + return wifidata[ifname] and wifidata[ifname]["Tx-Power"] or "-" +end + +scan = s:option(Button, "_scan", translate("scan")) +scan.inputstyle = "find" + +function scan.cfgvalue(self, section) + return self.map:get(section, "ifname") or false +end + +t2 = m:section(Table, {}, translate("iwscan"), translate("iwscan1")) + +function scan.write(self, section) + t2.render = t2._render + local ifname = self.map:get(section, "ifname") + luci.util.update(t2.data, luci.sys.wifi.iwscan(ifname)) +end + +t2._render = t2.render +t2.render = function() end + +t2:option(DummyValue, "Quality", translate("iwscan_link")) +essid = t2:option(DummyValue, "ESSID", "ESSID") +function essid.cfgvalue(self, section) + return luci.util.pcdata(self.map:get(section, "ESSID")) +end + +t2:option(DummyValue, "Address", "BSSID") +t2:option(DummyValue, "Mode", translate("mode")) +chan = t2:option(DummyValue, "channel", translate("channel")) +function chan.cfgvalue(self, section) + return self.map:get(section, "Channel") + or self.map:get(section, "Frequency") + or "-" +end + +t2:option(DummyValue, "Encryption key", translate("iwscan_encr")) + +t2:option(DummyValue, "Signal level", translate("iwscan_signal")) + +t2:option(DummyValue, "Noise level", translate("iwscan_noise")) + + +-- Routes -- +r = SimpleForm("routes", "Standardrouten") +r.submit = false +r.reset = false + +local routes = {} +for i, route in ipairs(luci.sys.net.routes()) do + if route.dest:prefix() == 0 then + routes[#routes+1] = route + end +end + +v = r:section(Table, routes) + +net = v:option(DummyValue, "iface", translate("network")) +function net.cfgvalue(self, section) + return luci.tools.webadmin.iface_get_network(routes[section].device) + or routes[section].device +end + +target = v:option(DummyValue, "target", translate("target")) +function target.cfgvalue(self, section) + return routes[section].dest:network():string() +end + +netmask = v:option(DummyValue, "netmask", translate("netmask")) +function netmask.cfgvalue(self, section) + return routes[section].dest:mask():string() +end + +gateway = v:option(DummyValue, "gateway", translate("gateway")) +function gateway.cfgvalue(self, section) + return routes[section].gateway:string() +end + +metric = v:option(DummyValue, "metric", translate("metric")) +function metric.cfgvalue(self, section) + return routes[section].metric +end + + +local routes6 = {} +for i, route in ipairs(luci.sys.net.routes6() or {}) do + if route.dest:prefix() == 0 then + routes6[#routes6+1] = route + end +end + +if #routes6 > 0 then + v6 = r:section(Table, routes6) + + net = v6:option(DummyValue, "iface", translate("network")) + function net.cfgvalue(self, section) + return luci.tools.webadmin.iface_get_network(routes[section].device) + or routes6[section].device + end + + target = v6:option(DummyValue, "target", translate("target")) + function target.cfgvalue(self, section) + return routes6[section].dest:string() + end + + gateway = v6:option(DummyValue, "gateway6", translate("gateway6")) + function gateway.cfgvalue(self, section) + return routes6[section].source:string() + end + + metric = v6:option(DummyValue, "metric", translate("metric")) + function metric.cfgvalue(self, section) + local metr = routes6[section].metric + local lower = bit.band(metr, 0xffff) + local higher = bit.rshift(bit.band(metr, 0xffff0000), 16) + return "%04X%04X" % {higher, lower} + end +end + +return f, m, r diff --git a/modules/freifunk/luasrc/view/freifunk/index.htm b/modules/freifunk/luasrc/view/freifunk/index.htm index 49e8cd035..0b4d69771 100644 --- a/modules/freifunk/luasrc/view/freifunk/index.htm +++ b/modules/freifunk/luasrc/view/freifunk/index.htm @@ -17,7 +17,7 @@ $Id$

<%:ff_hellonet%> <%=ff.community.name or 'Freifunk Deutschland'%>!

<%:ff_public1%>
<%:ff_public2%> <%=luci.sys.hostname()%>. <%:ff_public3%> - <%=ff.contact.nickname%>.

+"> <%=ff.contact.nickname%>.

<%:ff_public4%> Freifunk.net.
<%:ff_public5%> <%=ff.community.name or 'Freifunk'%>.

<%:ff_note%>: <%:ff_public6%>

diff --git a/modules/freifunk/root/etc/config/freifunk b/modules/freifunk/root/etc/config/freifunk index 99521225c..0391e6076 100644 --- a/modules/freifunk/root/etc/config/freifunk +++ b/modules/freifunk/root/etc/config/freifunk @@ -1,32 +1,28 @@ +config settings wizard config public contact - option nickname - option name - option mail - option phone - option location - option geo - option note + option nickname '' + option name '' + option mail '' + option phone '' + option location '' + option note '' config public community - option name "Freifunk Halle" - option homepage http://halle.freifunk.net - option realm netz.freifunk-halle.net - -config settings wizard - + option name 'Freifunk' + option homepage 'http://freifunk.net' config fw_rule http option src freifunk option target ACCEPT option proto tcp option dest_port 80 - + config fw_rule https option src freifunk option target ACCEPT option proto tcp option dest_port 443 - + config fw_rule ssh option src freifunk option target ACCEPT @@ -38,31 +34,33 @@ config fw_rule olsr option target ACCEPT option proto udp option dest_port 698 - + config fw_forwarding lan option src lan option dest freifunk - +config fw_forwarding fffwd + option src freifunk + option dest freifunk + config defaults wifi_device option channel 1 option txantenna 1 option rxantenna 1 - option txant 1 - option rxant 1 option diversity 0 - + option disabled 0 + config defaults wifi_iface - option type adhoc - option essid halle.freifunk.net + option mode adhoc option bssid 02:CA:FF:EE:BA:BE option txpower 10 - option rts 0 - option frag 0 - - + option rts 2346 + option frag 512 + option sw_merge 1 + + config defaults interface option netmask 255.0.0.0 option dns "88.198.178.18 141.54.1.1 212.204.49.83 208.67.220.220 208.67.222.222" @@ -70,12 +68,12 @@ config defaults interface config defaults alias option netmask 255.255.255.0 - - + + config defaults dhcp option leasetime 30m - - + + config defaults olsr_interface option HelloInterval 6.0 option HelloValidityTime 108.0 @@ -84,4 +82,44 @@ config defaults olsr_interface option MidInterval 18.0 option MidValidityTime 324.0 option HnaInterval 18.0 - option HnaValidityTime 108.0 \ No newline at end of file + option HnaValidityTime 108.0 + + +config community leipzig + option name "Freifunk Leipzig" + option homepage http://leipzig.freifunk.net + option ssid "leipzig.freifunk.net" + option prefix "104.61" + +config community halle + option name "Freifunk Halle" + option homepage http://halle.freifunk.net + option ssid "halle.freifunk.net" + option prefix "104.62" + +config community l59 + option name "Freifunk L59" + option homepage http://freifunk.net + option ssid "start.freifunk.net" + option prefix "104.59" + +config community berlin + option name "Freifunk Berlin" + option homepage http://berlin.freifunk.net + option ssid "olsr.freifunk.net" + option prefix "104" + option external freifunk_berlin + +config community hannover + option name "Freifunk Hannover" + option homepage http://hannover.freifunk.net + option ssid "hannover.freifunk.net" + option prefix "10.2" + option external freifunk_hannover + +config community augsburg + option name "Freifunk Augsburg" + option homepage http://augsburg.freifunk.net + option ssid "augsburg.freifunk.net" + option prefix "191.161" + option external freifunk_augsburg diff --git a/modules/freifunk/root/etc/config/freifunk_augsburg b/modules/freifunk/root/etc/config/freifunk_augsburg new file mode 100644 index 000000000..f68600c26 --- /dev/null +++ b/modules/freifunk/root/etc/config/freifunk_augsburg @@ -0,0 +1,2 @@ +config defaults interface + option netmask 255.255.0.0 \ No newline at end of file diff --git a/modules/freifunk/root/etc/config/freifunk_berlin b/modules/freifunk/root/etc/config/freifunk_berlin new file mode 100644 index 000000000..65bde7666 --- /dev/null +++ b/modules/freifunk/root/etc/config/freifunk_berlin @@ -0,0 +1,2 @@ +config defaults wifi_device + option channel 10 \ No newline at end of file diff --git a/modules/freifunk/root/etc/config/freifunk_hannover b/modules/freifunk/root/etc/config/freifunk_hannover new file mode 100644 index 000000000..f797a938f --- /dev/null +++ b/modules/freifunk/root/etc/config/freifunk_hannover @@ -0,0 +1,5 @@ +config defaults wifi_iface + option bssid CA:FF:EE:CA:FF:EE + +config defaults interface + option netmask 255.255.0.0 \ No newline at end of file diff --git a/modules/rpc/luasrc/controller/rpc.lua b/modules/rpc/luasrc/controller/rpc.lua index 2eef7a0eb..e0aeb3bf0 100644 --- a/modules/rpc/luasrc/controller/rpc.lua +++ b/modules/rpc/luasrc/controller/rpc.lua @@ -25,7 +25,8 @@ function index() local function authenticator(validator, accs) local auth = luci.http.formvalue("auth", true) if auth then - local user = luci.sauth.read(auth) + local sdat = luci.sauth.read(auth) + user = loadstring(sdat)().user if user and luci.util.contains(accs, user) then return user, auth end @@ -52,20 +53,33 @@ function rpc_auth() local http = require "luci.http" local sys = require "luci.sys" local ltn12 = require "luci.ltn12" + local util = require "luci.util" local loginstat local server = {} - server.login = function(user, pass) - local sid - + server.challenge = function(user, pass) + local sid, token, secret + if sys.user.checkpasswd(user, pass) then sid = sys.uniqueid(16) + token = sys.uniqueid(16) + secret = sys.uniqueid(16) + http.header("Set-Cookie", "sysauth=" .. sid.."; path=/") - sauth.write(sid, user) + sauth.write(sid, util.get_bytecode({ + user=user, + token=token, + secret=secret + })) end - return sid + return sid and {sid=sid, token=token, secret=secret} + end + + server.login = function(...) + local challenge = server.challenge(...) + return challenge and challenge.sid end http.prepare_content("application/json") diff --git a/themes/openwrt.org/htdocs/luci-static/openwrt.org/cascade.css b/themes/openwrt.org/htdocs/luci-static/openwrt.org/cascade.css index 9940b09ac..8aea90999 100644 --- a/themes/openwrt.org/htdocs/luci-static/openwrt.org/cascade.css +++ b/themes/openwrt.org/htdocs/luci-static/openwrt.org/cascade.css @@ -371,19 +371,12 @@ textarea#syslog { font-style: italic; font-family: Trebuchet MS, Verdana, sans-serif; color: #27408B; - background: url('../resources/cbi/arrow.gif') left no-repeat; - padding-left: 17px; } #maincontent p { margin-bottom: 1em; } -#auth_buttons { - float: right; - padding-top: 0.5em; -} - .cbi-section { margin-bottom: 0.5em; padding: 0.5em 1em; -- 2.25.1