summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-vpnbypass/luasrc/controller
diff options
context:
space:
mode:
authorStan Grishin <stangri@melmac.net>2019-10-20 15:42:08 -0700
committerStan Grishin <stangri@melmac.net>2019-10-20 15:42:08 -0700
commitcaade389a879dccd8f84886c77fcdea98718db12 (patch)
treee24972f6c9bd48d26ef840285c3e06970ab9623b /applications/luci-app-vpnbypass/luasrc/controller
parentf7120fb43a0e7ac840a815d0409240d557c47732 (diff)
luci-app-vpnbypass: better service control buttons
Signed-off-by: Stan Grishin <stangri@melmac.net>
Diffstat (limited to 'applications/luci-app-vpnbypass/luasrc/controller')
-rw-r--r--applications/luci-app-vpnbypass/luasrc/controller/vpnbypass.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/applications/luci-app-vpnbypass/luasrc/controller/vpnbypass.lua b/applications/luci-app-vpnbypass/luasrc/controller/vpnbypass.lua
index 56221e043..d034fce32 100644
--- a/applications/luci-app-vpnbypass/luasrc/controller/vpnbypass.lua
+++ b/applications/luci-app-vpnbypass/luasrc/controller/vpnbypass.lua
@@ -6,5 +6,24 @@ function index()
else
entry({"admin", "services", "vpnbypass"}, cbi("vpnbypass"), _("VPN Bypass"))
end
+ entry({"admin", "services", "vpnbypass", "action"}, call("vpnbypass_action"), nil).leaf = true
end
end
+
+function vpnbypass_action(name)
+ local packageName = "vpnbypass"
+ 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")
+ luci.util.exec("/etc/init.d/dnsmasq restart >/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