diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2013-01-13 18:33:27 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2013-01-13 18:33:27 +0000 |
commit | ffb6ca49d28231af1394cca2c06d0110b2dcac5a (patch) | |
tree | d6af4c4ad72d2cc8b3ae7ae25df60fdb6013a3f7 /applications/luci-upnp/luasrc/controller/upnp.lua | |
parent | 237aa91089837dcbe5d46ecdb5c5d94f9af6da05 (diff) |
applications/luci-upnp: also purge entry from lease file when deleting leases, remove mini support
Diffstat (limited to 'applications/luci-upnp/luasrc/controller/upnp.lua')
-rw-r--r-- | applications/luci-upnp/luasrc/controller/upnp.lua | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/applications/luci-upnp/luasrc/controller/upnp.lua b/applications/luci-upnp/luasrc/controller/upnp.lua index 7acd029a5f..83fa94154b 100644 --- a/applications/luci-upnp/luasrc/controller/upnp.lua +++ b/applications/luci-upnp/luasrc/controller/upnp.lua @@ -10,7 +10,6 @@ You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -$Id$ ]]-- module("luci.controller.upnp", package.seeall) @@ -25,9 +24,6 @@ function index() page = entry({"admin", "services", "upnp"}, cbi("upnp/upnp"), _("UPNP")) page.dependent = true - page = entry({"mini", "network", "upnp"}, cbi("upnp/upnpmini", {autoapply=true}), _("UPNP")) - page.dependent = true - entry({"admin", "services", "upnp", "status"}, call("act_status")).leaf = true entry({"admin", "services", "upnp", "delete"}, call("act_delete")).leaf = true end @@ -67,11 +63,20 @@ function act_status() end end -function act_delete(idx) - idx = tonumber(idx) +function act_delete(num) + local idx = tonumber(num) + local uci = luci.model.uci.cursor() + if idx and idx > 0 then luci.sys.call("iptables -t filter -D MINIUPNPD %d 2>/dev/null" % idx) luci.sys.call("iptables -t nat -D MINIUPNPD %d 2>/dev/null" % idx) + + local lease_file = uci:get("upnpd", "config", "upnp_lease_file") + if lease_file and nixio.fs.access(lease_file) then + luci.sys.call("sed -i -e '%dd' %q" %{ idx, lease_file }) + end + + luci.http.status(200, "OK") return end |