diff options
author | Hannu Nyman <hannu.nyman@iki.fi> | 2019-12-31 09:14:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-31 09:14:08 +0200 |
commit | d5597e37873c086ec42d9e68e099cd672bd5ed35 (patch) | |
tree | 4797e870b37cc1fb98177a41920b335b2f36fc77 /applications/luci-app-vpn-policy-routing/luasrc/controller/vpn-policy-routing.lua | |
parent | d1f86a00745f9436d407bb245eee6239c8e3c49e (diff) | |
parent | 25c884a479c4ce7bbb337be67433555a34e63bf9 (diff) |
Merge pull request #3446 from stangri/master-luci-app-vpn-policy-routing
luci-app-vpn-policy-routing: initial release
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.lua | 25 |
1 files changed, 25 insertions, 0 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 new file mode 100644 index 0000000000..0c8c31e7b7 --- /dev/null +++ b/applications/luci-app-vpn-policy-routing/luasrc/controller/vpn-policy-routing.lua @@ -0,0 +1,25 @@ +module("luci.controller.vpn-policy-routing", package.seeall) +function index() + if nixio.fs.access("/etc/config/vpn-policy-routing") then + entry({"admin", "vpn"}, firstchild(), _("VPN"), 60).dependent=false + 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" + if name == "start" then + luci.sys.init.start(packageName) + elseif name == "action" then + luci.util.exec("/etc/init.d/" .. packageName .. " reload >/dev/null 2>&1") + elseif name == "stop" then + luci.sys.init.stop(packageName) + elseif name == "enable" then + luci.util.exec("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) + end + luci.http.prepare_content("text/plain") + luci.http.write("0") +end |