summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-vpn-policy-routing/luasrc/controller/vpn-policy-routing.lua
diff options
context:
space:
mode:
authorStan <stangri@melmac.net>2020-09-21 11:41:14 -0700
committerGitHub <noreply@github.com>2020-09-21 11:41:14 -0700
commit482e367e022bf4de8dbe866661d2220de1f2a28c (patch)
tree9d6137d760ccc85b93c91e4ddbcb28afe3a7258b /applications/luci-app-vpn-policy-routing/luasrc/controller/vpn-policy-routing.lua
parent073b9ba3bdc932d28dbc49fb005e13bea494e610 (diff)
parentb0fe4bf371b21e05b03e8c4a875d80a198dd3d45 (diff)
Merge pull request #4460 from stangri/master-luci-app-vpn-policy-routing
luci-app-vpn-policy-routing: ACL-related update
Diffstat (limited to 'applications/luci-app-vpn-policy-routing/luasrc/controller/vpn-policy-routing.lua')
-rw-r--r--applications/luci-app-vpn-policy-routing/luasrc/controller/vpn-policy-routing.lua24
1 files changed, 15 insertions, 9 deletions
diff --git a/applications/luci-app-vpn-policy-routing/luasrc/controller/vpn-policy-routing.lua b/applications/luci-app-vpn-policy-routing/luasrc/controller/vpn-policy-routing.lua
index 2daac795dd..53c0991c6d 100644
--- a/applications/luci-app-vpn-policy-routing/luasrc/controller/vpn-policy-routing.lua
+++ b/applications/luci-app-vpn-policy-routing/luasrc/controller/vpn-policy-routing.lua
@@ -3,25 +3,31 @@ function index()
if nixio.fs.access("/etc/config/vpn-policy-routing") then
local e = entry({"admin", "vpn"}, firstchild(), _("VPN"), 60)
e.dependent = false
-
- entry({"admin", "vpn", "vpn-policy-routing"}, cbi("vpn-policy-routing"), _("VPN Policy Routing")).acl_depends = { "luci-app-vpn-policy-routing" }
+ e.acl_depends = { "luci-app-vpn-policy-routing" }
+ entry({"admin", "vpn", "vpn-policy-routing"}, cbi("vpn-policy-routing"), _("VPN Policy Routing"))
entry({"admin", "vpn", "vpn-policy-routing", "action"}, call("vpn_policy_routing_action"), nil).leaf = true
end
end
function vpn_policy_routing_action(name)
local packageName = "vpn-policy-routing"
+ local http = require "luci.http"
+ local sys = require "luci.sys"
+ local uci = require "luci.model.uci".cursor()
+ local util = require "luci.util"
if name == "start" then
- luci.sys.init.start(packageName)
+ sys.init.start(packageName)
elseif name == "action" then
- luci.util.exec("/etc/init.d/" .. packageName .. " restart >/dev/null 2>&1")
+ util.exec("/etc/init.d/" .. packageName .. " restart >/dev/null 2>&1")
elseif name == "stop" then
- luci.sys.init.stop(packageName)
+ sys.init.stop(packageName)
elseif name == "enable" then
- luci.util.exec("uci set " .. packageName .. ".config.enabled=1; uci commit " .. packageName)
+ uci:set(packageName, "config", "enabled", "1")
+ uci:commit(packageName)
elseif name == "disable" then
- luci.util.exec("uci set " .. packageName .. ".config.enabled=0; uci commit " .. packageName)
+ uci:set(packageName, "config", "enabled", "0")
+ uci:commit(packageName)
end
- luci.http.prepare_content("text/plain")
- luci.http.write("0")
+ http.prepare_content("text/plain")
+ http.write("0")
end