applications/luci-qos: Smaller enhancements, support for luci-mini

applications/luci-fw: Fixed support for luci-mini
libs/web: Removed luci.dispatcher.registered
This commit is contained in:
Steven Barth 2008-07-17 16:02:29 +00:00
parent 8d1aff78b1
commit 52d49762ed
10 changed files with 134 additions and 38 deletions

View File

@ -3,14 +3,17 @@ module("luci.controller.luci_fw.luci_fw", package.seeall)
function index()
require("luci.i18n").loadc("luci-fw")
local i18n = luci.i18n.translate
if registered("admin") then
entry({"admin", "network", "portfw"}, cbi("luci_fw/portfw"), i18n("fw_portfw", "Portweiterleitung"), 70).i18n = "luci-fw"
entry({"admin", "network", "routing"}, cbi("luci_fw/routing"), i18n("fw_routing", "Routing"), 73).i18n = "luci-fw"
entry({"admin", "network", "firewall"}, cbi("luci_fw/firewall"), i18n("fw_fw", "Firewall"), 76).i18n = "luci-fw"
end
if registered("mini") then
entry({"mini", "network", "portfw"}, cbi("luci_fw/miniportfw"), i18n("fw_portfw", "Portweiterleitung"), 70).i18n = "luci-fw"
end
local nodes = {}
table.insert(nodes, entry({"admin", "network", "portfw"}, cbi("luci_fw/portfw"), i18n("fw_portfw", "Portweiterleitung"), 70))
table.insert(nodes, entry({"admin", "network", "routing"}, cbi("luci_fw/routing"), i18n("fw_routing", "Routing"), 73))
table.insert(nodes, entry({"admin", "network", "firewall"}, cbi("luci_fw/firewall"), i18n("fw_fw", "Firewall"), 76))
table.insert(nodes, entry({"mini", "network", "portfw"}, cbi("luci_fw/miniportfw"), i18n("fw_portfw", "Portweiterleitung"), 70))
for i,n in ipairs(nodes) do
n.i18n = "luci-fw"
n.dependent = true
end
end

View File

@ -18,5 +18,12 @@ function index()
return
end
entry({"admin", "network", "qos"}, cbi("qos/qos"), "QoS").i18n = "qos"
local page = entry({"admin", "network", "qos"}, cbi("qos/qos"), "QoS")
page.i18n = "qos"
page.dependent = true
local page = entry({"mini", "network", "qos"}, cbi("qos/qosmini"), "QoS")
page.i18n = "qos"
page.dependent = true
end

View File

@ -5,10 +5,14 @@ qos_interface_classgroup = "Klassifizierung"
qos_interface_overhead = "Overheadberechnung"
qos_interface_download = "Downlink"
qos_interface_upload = "Uplink"
qos_classify = "Klassifizierung"
qos_classify_target = "Klasse"
qos_classify = "Priorisierung"
qos_classify_target = "Priorität"
qos_classify_srchost = "Quelladresse"
qos_classify_srchost_dest = "Quellnetz / Quellhost"
qos_classify_dsthost = "Zieladresse"
qos_classify_dsthost_dest = "Zielnetz / Zielhost"
qos_classify_portrange = "Portbereich"
qos_classify_portrange = "Portbereich"
qos_bulk = "niedrig"
qos_normal = "normal"
qos_express = "express"
qos_priority = "priorisiert"

View File

@ -4,10 +4,14 @@ qos_interface_classgroup = "Classification"
qos_interface_overhead = "Calculate Overhead"
qos_interface_download = "Downlink"
qos_interface_upload = "Uplink"
qos_classify = "Classification"
qos_classify_target = "Class"
qos_classify = "Prioritization"
qos_classify_target = "Priority"
qos_classify_srchost = "Source address"
qos_classify_srchost_dest = "source network / source host"
qos_classify_dsthost = "Target address"
qos_classify_dsthost_dest = "target network / target host"
qos_classify_portrange = "portrange"
qos_classify_portrange = "portrange"
qos_bulk = "low"
qos_normal = "normal"
qos_express = "express"
qos_priority = "priority"

View File

@ -34,15 +34,26 @@ s.anonymous = true
s.addremove = true
t = s:option(ListValue, "target")
t:value("Priority")
t:value("Express")
t:value("Normal")
t:value("Bulk")
t:value("Priority", translate("qos_priority"))
t:value("Express", translate("qos_express"))
t:value("Normal", translate("qos_normal"))
t:value("Bulk", translate("qos_bulk"))
t.default = "Normal"
s:option(Value, "srchost").optional = true
s:option(Value, "dsthost").optional = true
s:option(Value, "layer7", "Layer 7").optional = true
l7 = s:option(ListValue, "layer7", translate("service"))
l7.optional = true
l7:value("")
local pats = luci.fs.dir("/etc/l7-protocols")
if pats then
for i,f in ipairs(pats) do
if f:sub(-4) == ".pat" then
l7:value(f:sub(1, #f-4))
end
end
end
p2p = s:option(ListValue, "ipp2p", "P2P")
p2p:value("")

View File

@ -0,0 +1,70 @@
--[[
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id$
]]--
m = Map("qos")
s = m:section(NamedSection, "wan", "interface", translate("m_n_inet"))
s:option(Flag, "enabled", translate("qos"))
s:option(Value, "download", translate("qos_interface_download"), "kb/s")
s:option(Value, "upload", translate("qos_interface_upload"), "kb/s")
s = m:section(TypedSection, "classify")
s.anonymous = true
s.addremove = true
t = s:option(ListValue, "target")
t:value("Priority", translate("qos_priority"))
t:value("Express", translate("qos_express"))
t:value("Normal", translate("qos_normal"))
t:value("Bulk", translate("qos_bulk"))
t.default = "Normal"
s:option(Value, "srchost").optional = true
s:option(Value, "dsthost").optional = true
l7 = s:option(ListValue, "layer7", translate("service"))
l7.optional = true
l7:value("")
local pats = luci.fs.dir("/etc/l7-protocols")
if pats then
for i,f in ipairs(pats) do
if f:sub(-4) == ".pat" then
l7:value(f:sub(1, #f-4))
end
end
end
p2p = s:option(ListValue, "ipp2p", "P2P")
p2p:value("")
p2p:value("all", translate("all"))
p2p:value("bit", "BitTorrent")
p2p:value("dc", "DirectConnect")
p2p:value("edk", "eDonkey")
p2p:value("gnu", "Gnutella")
p2p:value("kazaa", "Kazaa")
p2p.optional = true
p = s:option(ListValue, "proto", translate("protocol"))
p:value("")
p:value("tcp", "TCP")
p:value("udp", "UDP")
p:value("icmp", "ICMP")
p.optional = true
s:option(Value, "ports", translate("port")).optional = true
s:option(Value, "portrange").optional = true
return m

View File

@ -347,7 +347,7 @@ endef
define Package/luci-app-firewall
$(call Package/luci/webtemplate)
DEPENDS+=+luci-mod-admin-full
DEPENDS+=+luci-mod-admin-core
TITLE:=Firewall and Portforwarding application
endef
@ -373,7 +373,7 @@ endef
define Package/luci-app-qos
$(call Package/luci/webtemplate)
DEPENDS+=+luci-mod-admin-full +qos-scripts
DEPENDS+=+luci-mod-admin-core +qos-scripts
TITLE:=Quality of Service configuration module
endef

View File

@ -77,6 +77,7 @@ reset = "Reset"
revert = "Revert"
save = "Save"
service = "Service"
services = "Services"
settings = "Settings"
start = "Start"

View File

@ -78,6 +78,7 @@ reset = "Zurücksetzen"
revert = "Verwerfen"
save = "Speichern"
service = "Dienst"
services = "Dienste"
settings = "Einstellungen"
start = "Start"

View File

@ -141,6 +141,14 @@ function dispatch(request)
viewns.resource = luci.config.main.resourcebase
viewns.REQUEST_URI = luci.http.getenv("SCRIPT_NAME") .. (luci.http.getenv("PATH_INFO") or "")
if track.dependent then
local stat, err = pcall(assert, not track.auto)
if not stat then
error500(err)
return
end
end
if track.sysauth then
require("luci.sauth")
local def = (type(track.sysauth) == "string") and track.sysauth
@ -324,20 +332,6 @@ function entry(path, target, title, order)
return c
end
-- Checks whether a node exists
function registered(...)
local c = context.tree
for k,v in ipairs(arg) do
if not c.nodes[v] then
return false
end
c = c.nodes[v]
end
return true
end
-- Fetch a dispatching node
function node(...)
local c = context.tree
@ -345,7 +339,7 @@ function node(...)
for k,v in ipairs(arg) do
if not c.nodes[v] then
c.nodes[v] = {nodes={}}
c.nodes[v] = {nodes={}, auto=true}
end
c = c.nodes[v]
@ -353,6 +347,7 @@ function node(...)
c.module = getfenv(2)._NAME
c.path = arg
c.auto = nil
return c
end