Skip to content

Commit

Permalink
add alias support for server
Browse files Browse the repository at this point in the history
  • Loading branch information
aa65535 committed Dec 25, 2015
1 parent 91ccddd commit 656829f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
Binary file modified files/luci/i18n/shadowsocks.zh-cn.lmo
Binary file not shown.
3 changes: 3 additions & 0 deletions files/luci/i18n/shadowsocks.zh-cn.po
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ msgstr "与全局服务器相同"
msgid "Servers Setting"
msgstr "服务器配置"

msgid "Alias(optional)"
msgstr "别名(可选)"

msgid "Onetime Authentication"
msgstr "一次验证"

Expand Down
26 changes: 10 additions & 16 deletions files/luci/model/cbi/shadowsocks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ ipkg.list_installed("shadowsocks-libev-spec-polarssl", function(n, v, d)
end)

uci:foreach(shadowsocks, "servers", function(s)
if s.server and s.server_port then
if s.alias then
server_table[s[".name"]] = s.alias
elseif s.server and s.server_port then
server_table[s[".name"]] = "%s:%s" %{s.server, s.server_port}
end
end)
Expand All @@ -53,24 +55,22 @@ s.anonymous = true

o = s:option(ListValue, "global_server", translate("Global Server"))
o:value("nil", translate("Disable ShadowSocks"))
for k, v in pairs(server_table) do
o:value(k, v)
end
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:value("", translate("Disable"))
o:value("same", translate("Same as Global Server"))
for k, v in pairs(server_table) do
o:value(k, v)
end
for k, v in pairs(server_table) do o:value(k, v) end

-- [[ Servers Setting ]]--
s = m:section(TypedSection, "servers", translate("Servers Setting"))
s.anonymous = true
s.addremove = true

o = s:option(Value, "alias", translate("Alias(optional)"))

o = s:option(Flag, "auth_enable", translate("Onetime Authentication"))
o.rmempty = false

Expand All @@ -97,9 +97,7 @@ o.password = true
o.rmempty = false

o = s:option(ListValue, "encrypt_method", translate("Encrypt Method"))
for _, v in ipairs(encrypt_methods) do
o:value(v)
end
for _, v in ipairs(encrypt_methods) do o:value(v) end
o.rmempty = false

-- [[ UDP Forward ]]--
Expand Down Expand Up @@ -128,9 +126,7 @@ s:tab("wan_ac", translate("Interfaces - WAN"))

o = s:taboption("wan_ac", Value, "wan_bp_list", translate("Bypassed IP List"))
o:value("/dev/null", translate("NULL - As Global Proxy"))
if chnroute then
o:value(chnroute, translate("ChinaDNS CHNRoute"))
end
if chnroute then o:value(chnroute, translate("ChinaDNS CHNRoute")) end
o.default = "/dev/null"
o.rmempty = false

Expand All @@ -151,8 +147,6 @@ o.rmempty = false

o = s:taboption("lan_ac", DynamicList, "lan_ac_ips", translate("LAN Host List"))
o.datatype = "ipaddr"
for _, v in ipairs(arp_table) do
o:value(v["IP address"])
end
for _, v in ipairs(arp_table) do o:value(v["IP address"]) end

return m

0 comments on commit 656829f

Please sign in to comment.