summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-shadowsocks-libev/luasrc/controller/shadowsocks-libev.lua
diff options
context:
space:
mode:
authorHannu Nyman <hannu.nyman@iki.fi>2017-07-24 14:57:07 +0300
committerGitHub <noreply@github.com>2017-07-24 14:57:07 +0300
commit844a741e7ea29dc460249774c35c34b20c463877 (patch)
treec59926b38796b9b85e5ea060fd358b65fa81531f /applications/luci-app-shadowsocks-libev/luasrc/controller/shadowsocks-libev.lua
parent3f0aead2eab34254e6688d49c69d6b9c63dcfecd (diff)
parent06ad394dde572878c2a573e8ef81b94ae706b5d5 (diff)
Merge pull request #1249 from yousong/shadowsocks-libev
luci-app-shadowsocks-libev: auto update instance running state
Diffstat (limited to 'applications/luci-app-shadowsocks-libev/luasrc/controller/shadowsocks-libev.lua')
-rw-r--r--applications/luci-app-shadowsocks-libev/luasrc/controller/shadowsocks-libev.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/applications/luci-app-shadowsocks-libev/luasrc/controller/shadowsocks-libev.lua b/applications/luci-app-shadowsocks-libev/luasrc/controller/shadowsocks-libev.lua
index e191e59bb1..05d12e38b2 100644
--- a/applications/luci-app-shadowsocks-libev/luasrc/controller/shadowsocks-libev.lua
+++ b/applications/luci-app-shadowsocks-libev/luasrc/controller/shadowsocks-libev.lua
@@ -19,4 +19,15 @@ function index()
entry({"admin", "services", "shadowsocks-libev", "rules"},
cbi("shadowsocks-libev/rules"),
_("Redir Rules"), 30).leaf = true
+
+ entry({"admin", "services", "shadowsocks-libev", "status"}, call("ss_status"), nil).leaf = true
+
+end
+
+function ss_status()
+ local ut = require "luci.util"
+ local rv = ut.ubus("service", "list", {name = "shadowsocks-libev"})["shadowsocks-libev"] or {_=0}
+
+ luci.http.prepare_content("application/json")
+ luci.http.write_json(rv)
end