Merge pull request #1301 from yousong/shadowsocks-libev
authorHannu Nyman <hannu.nyman@iki.fi>
Sun, 13 Aug 2017 16:47:25 +0000 (19:47 +0300)
committerGitHub <noreply@github.com>
Sun, 13 Aug 2017 16:47:25 +0000 (19:47 +0300)
luci-app-shadowsocks-libev: minor adaption for ease of use

applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/rules.lua
applications/luci-app-shadowsocks-libev/luasrc/model/shadowsocks-libev.lua

index fe5f9c3..5df59cb 100644 (file)
@@ -16,8 +16,13 @@ m = Map("shadowsocks-libev",
                If the prior check results in action <em>checkdst</em>, packets will continue \
                to have their destination addresses checked."))
 
+local sdata = m:get('ss_rules')
+if not sdata then
+       m:set('ss_rules', nil, 'ss_rules')
+       m:set('ss_rules', 'ss_rules', 'disabled', true)
+end
 
-s = m:section(NamedSection, "ss_rules", "ss-rules")
+s = m:section(NamedSection, "ss_rules", "ss_rules")
 s:tab("general", translate("General Settings"))
 s:tab("srcip", translate("Source Settings"))
 s:tab("dstip", translate("Destination Settings"))
index 0a14f33..6608ee8 100644 (file)
@@ -22,7 +22,7 @@ end
 function values_redir(o, xmode)
        o.map.uci.foreach("shadowsocks-libev", "ss_redir", function(sdata)
                local sname = sdata[".name"]
-               local mode = sdata["mode"]
+               local mode = sdata["mode"] or "tcp_only"
                if mode and mode:find(xmode) then
                        local desc = "%s - %s" % {sname, mode}
                        o:value(sname, desc)