From 9dd138b757b88101c0a6d1fa9dc212f5ca65a884 Mon Sep 17 00:00:00 2001 From: Jian Chang Date: Thu, 31 Dec 2015 22:09:40 +0800 Subject: [PATCH] add running status for ss --- files/luci/i18n/shadowsocks.zh-cn.lmo | Bin 1076 -> 1152 bytes files/luci/i18n/shadowsocks.zh-cn.po | 27 ++++++++++++++++--------- files/luci/model/cbi/shadowsocks.lua | 28 +++++++++++++++++++------- 3 files changed, 39 insertions(+), 16 deletions(-) diff --git a/files/luci/i18n/shadowsocks.zh-cn.lmo b/files/luci/i18n/shadowsocks.zh-cn.lmo index 500ba44707d91c0e8577846ddea858bc006d681e..c697069595e32cc52e624784b261215057f92907 100644 GIT binary patch delta 727 zcmXAneMnPL7>CcDbagVFTV|Q|VXYJ_&B`b+6Vrd(#4m&_lgJ9Kk<}!G37g@}$#l*P zH3ljUoMuj)uy^Ps!cinYf4fAvf>d%6wo2AfM;A~GTRGaiM!m5*cDXW8nGa4wM8+1qMg2PBA?oP`*p~FdpRF4QzJPISBI_KGr_C|8)bB3=%Csyt9l#&x5Fhie@SW9ySrP! z1IUi?src&=QqBjaPt3OyQI?8@$ZGH*gq>d;$}LU&ih1NXBI3u@hRjvw3|N5(y}MN3 zmp{oZ;4VbuZPV|(+Wq(R0%Q&eUGa@H6um9SKS0hQ!at4bw31qB0$vD8#Qt=ZVWxb2 M1Wt!Y@F`OM0lbj(UH||9 delta 622 zcmZqR+`?hKt4}v)Quf8UUSI+`3gWjf2Yp}-p#`6&H&jbK>YqmolB~ZiA@E{ z1Gx-rlbk}|PWh*L6Ug2J#5^-EbciHrCxAla2#CLU<;B1Smws;pvR{DsOL$+s_BqeR z2DG0M#pGKrFF;-E6NNa~eRlX#lb4Z8Pa5 z`S&DifNW3{usz*Z-Q)V6(H^K@1jy%nIlWUVb>UA?kgow^zVE%&4sk6)dO-FKAm;z= WRNQku^AGQKpoR{hfFJ_{lL7#a;JfDl diff --git a/files/luci/i18n/shadowsocks.zh-cn.po b/files/luci/i18n/shadowsocks.zh-cn.po index d7ae6c1..b1997df 100644 --- a/files/luci/i18n/shadowsocks.zh-cn.po +++ b/files/luci/i18n/shadowsocks.zh-cn.po @@ -4,17 +4,29 @@ msgstr "Content-Type: text/plain; charset=UTF-8\n" msgid "ShadowSocks" msgstr "ShadowSocks" +msgid "A lightweight secured SOCKS5 proxy" +msgstr "一个轻量级安全SOCKS5代理" + msgid "Enable" msgstr "启用" msgid "Disable" msgstr "停用" -msgid "ShadowSocks is running" -msgstr "ShadowSocks 运行中" +msgid "Running Status" +msgstr "运行状态" + +msgid "Transparent Proxy" +msgstr "透明代理" + +msgid "UDP Forward" +msgstr "UDP转发" -msgid "ShadowSocks is not running" -msgstr "ShadowSocks 未运行" +msgid "RUNNING" +msgstr "运行中" + +msgid "NOT RUNNING" +msgstr "未运行" msgid "Global Setting" msgstr "全局设置" @@ -25,8 +37,8 @@ msgstr "全局服务器" msgid "Disable ShadowSocks" msgstr "停用ShadowSocks" -msgid "UDP Relay Server" -msgstr "UDP中继服务器" +msgid "UDP-Relay Server" +msgstr "UDP服务器" msgid "Same as Global Server" msgstr "与全局服务器相同" @@ -58,9 +70,6 @@ msgstr "密码" msgid "Encrypt Method" msgstr "加密方式" -msgid "UDP Forward" -msgstr "UDP转发" - msgid "UDP Local Port" msgstr "UDP本地端口" diff --git a/files/luci/model/cbi/shadowsocks.lua b/files/luci/model/cbi/shadowsocks.lua index 0be6554..b2b2fe3 100644 --- a/files/luci/model/cbi/shadowsocks.lua +++ b/files/luci/model/cbi/shadowsocks.lua @@ -7,12 +7,6 @@ local shadowsocks = "shadowsocks" local uci = luci.model.uci.cursor() local ipkg = require("luci.model.ipkg") -if luci.sys.call("pidof ss-redir >/dev/null") == 0 then - m = Map(shadowsocks, translate("ShadowSocks"), translate("ShadowSocks is running")) -else - m = Map(shadowsocks, translate("ShadowSocks"), translate("ShadowSocks is not running")) -end - local chnroute = uci:get_first("chinadns", "chinadns", "chnroute") local server_table = {} local arp_table = luci.sys.net.arptable() or {} @@ -49,6 +43,26 @@ uci:foreach(shadowsocks, "servers", function(s) end end) +m = Map(shadowsocks, translate("ShadowSocks"), translate("A lightweight secured SOCKS5 proxy")) + +-- [[ Running Status ]]-- +s = m:section(TypedSection, "global", translate("Running Status")) +s.anonymous = true + +o = s:option(DummyValue, "_status", translate("Transparent Proxy")) +if luci.sys.call("pidof ss-redir >/dev/null") == 0 then + o.value = translate("RUNNING") +else + o.value = translate("NOT RUNNING") +end + +o = s:option(DummyValue, "_status", translate("UDP Forward")) +if luci.sys.call("pidof ss-tunnel >/dev/null") == 0 then + o.value = translate("RUNNING") +else + o.value = translate("NOT RUNNING") +end + -- [[ Global Setting ]]-- s = m:section(TypedSection, "global", translate("Global Setting")) s.anonymous = true @@ -59,7 +73,7 @@ for k, v in pairs(server_table) do o:value(k, v) end o.default = "nil" o.rmempty = false -o = s:option(ListValue, "udp_relay_server", translate("UDP Relay Server")) +o = s:option(ListValue, "udp_relay_server", translate("UDP-Relay Server")) o:value("", translate("Disable")) o:value("same", translate("Same as Global Server")) for k, v in pairs(server_table) do o:value(k, v) end