mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-19 03:43:29 +00:00
using new style for luci ssr pro
This commit is contained in:
parent
715088d014
commit
9340615d38
@ -9,7 +9,7 @@ LUCI_TITLE:=LuCI support for SSR Pro
|
||||
LUCI_DEPENDS:=+iptables-mod-tproxy +kmod-ipt-tproxy +ip +ipset-lists +shadowsocksr-libev-alt +pdnsd-alt +coreutils +coreutils-base64 +coreutils-nohup +dnsmasq-full
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=2
|
||||
PKG_RELEASE:=22
|
||||
PKG_RELEASE:=23
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
|
@ -6,4 +6,12 @@ function index()
|
||||
local page
|
||||
page = entry({"admin", "services", "ssrpro"}, cbi("ssrpro"), _("ShadowsocksR Pro"))
|
||||
page.dependent = true
|
||||
entry({"admin","services","ssrpro","status"},call("act_status")).leaf=true
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e={}
|
||||
e.running=luci.sys.call("pgrep ssr-redir >/dev/null")==0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
|
@ -8,21 +8,14 @@ local conf = "/etc/shadowsocksr/base-gfwlist.txt"
|
||||
local watch = "/tmp/shadowsocksr_watchdog.log"
|
||||
local dog = "/tmp/ssrpro.log"
|
||||
|
||||
local Status
|
||||
|
||||
if SYS.call("pidof ssr-redir > /dev/null") == 0 then
|
||||
Status = translate("<strong><font color=\"green\">ShadowsocksR is Running</font></strong>")
|
||||
else
|
||||
Status = translate("<strong><font color=\"red\">ShadowsocksR is Not Running</font></strong>")
|
||||
end
|
||||
|
||||
m = Map("ssrpro")
|
||||
m.title = translate("Shadowsocksr Transparent Proxy")
|
||||
m.description = translate("A fast secure tunnel proxy that help you get through firewalls on your router")
|
||||
|
||||
m:section(SimpleSection).template = "ssrpro/ssrpro_status"
|
||||
|
||||
s = m:section(TypedSection, "ssrpro")
|
||||
s.anonymous = true
|
||||
s.description = translate(string.format("%s<br /><br />", Status))
|
||||
|
||||
-- ---------------------------------------------------
|
||||
|
||||
@ -222,10 +215,4 @@ e:value("disable",translate("No Proxy"))
|
||||
e:value("global",translate("Global Proxy"))
|
||||
e:value("game",translate("Game Mode"))
|
||||
|
||||
-- ---------------------------------------------------
|
||||
-- local apply = luci.http.formvalue("cbi.apply")
|
||||
-- if apply then
|
||||
-- os.execute("/etc/init.d/ssrpro restart >/dev/null 2>&1 &")
|
||||
-- end
|
||||
|
||||
return m
|
||||
|
@ -0,0 +1,22 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[ssrpro]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('ssrpro_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green>ShadowsocksR Pro<%:RUNNING%></font></b></em>';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red>ShadowsocksR Pro<%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="ssrpro_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
Loading…
Reference in New Issue
Block a user