luci-app-shadowsocks-libev: tweak list of redir instances

- Skip disabled ones
 - Allow empty value

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
This commit is contained in:
Yousong Zhou 2017-08-22 09:50:10 +08:00
parent 56e9ac6642
commit fd085d9910

View file

@ -23,13 +23,16 @@ end
function values_redir(o, xmode) function values_redir(o, xmode)
o.map.uci.foreach("shadowsocks-libev", "ss_redir", function(sdata) o.map.uci.foreach("shadowsocks-libev", "ss_redir", function(sdata)
local disabled = ucival_to_bool(sdata["disabled"])
local sname = sdata[".name"] local sname = sdata[".name"]
local mode = sdata["mode"] or "tcp_only" local mode = sdata["mode"] or "tcp_only"
if mode and mode:find(xmode) then if not disabled and mode:find(xmode) then
local desc = "%s - %s" % {sname, mode} local desc = "%s - %s" % {sname, mode}
o:value(sname, desc) o:value(sname, desc)
end end
end) end)
o:value("", "<unset>")
o.default = ""
end end
function values_serverlist(o) function values_serverlist(o)