Skip to content

Commit

Permalink
refine plugin support & close #79
Browse files Browse the repository at this point in the history
  • Loading branch information
aa65535 committed Jan 17, 2017
1 parent 5771123 commit 0584ed8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=luci-app-shadowsocks
PKG_VERSION:=1.4.0
PKG_RELEASE:=2
PKG_VERSION:=1.5.0
PKG_RELEASE:=1

PKG_LICENSE:=GPLv3
PKG_LICENSE_FILES:=LICENSE
Expand Down
5 changes: 4 additions & 1 deletion files/luci/i18n/shadowsocks.zh-cn.po
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,12 @@ msgstr "传递到iptables的额外参数。小心使用!"
msgid "Password"
msgstr "密码"

msgid "Plugin arguments"
msgid "Plugin Arguments"
msgstr "插件参数"

msgid "Plugin Name"
msgstr "插件名称"

msgid "Port Forward"
msgstr "端口转发"

Expand Down
7 changes: 5 additions & 2 deletions files/luci/model/cbi/shadowsocks/servers-details.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ o = s:option(ListValue, "encrypt_method", translate("Encrypt Method"))
for _, v in ipairs(encrypt_methods) do o:value(v, v:upper()) end
o.rmempty = false

o = s:option(Value, "plugin", translate("Plugin arguments"))
o.placeholder = "eg: obfs-local --obfs http --obfs-host www.baidu.com"
o = s:option(Value, "plugin", translate("Plugin Name"))
o.placeholder = "eg: obfs-local"

o = s:option(Value, "plugin_opts", translate("Plugin Arguments"))
o.placeholder = "eg: obfs=http;obfs-host=www.baidu.com"

return m
10 changes: 6 additions & 4 deletions files/root/etc/init.d/shadowsocks
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,21 @@ get_lan_hosts() {
}

get_plugin_config() {
local args=$(uci_get_by_name $1 plugin)
[ -n "$args" ] && echo "\"plugin\": \"$args\","
local plugin=$(uci_get_by_name $1 plugin)
local plugin_opts=$(uci_get_by_name $1 plugin_opts)
[ -n "$plugin" -a -n "$plugin_opts" ] && echo "
\"plugin\": \"$plugin\",
\"plugin_opts\": \"$plugin_opts\","
}

gen_config_file() {
cat <<-EOF >$CONFIG_FILE
{
"server": "$(uci_get_by_name $1 server)",
"server_port": $(uci_get_by_name $1 server_port),
"local_address": "0.0.0.0",
"local_address": "0.0.0.0",$(get_plugin_config $1)
"password": "$(uci_get_by_name $1 password)",
"timeout": $(uci_get_by_name $1 timeout 60),
$(get_plugin_config $1)
"method": "$(uci_get_by_name $1 encrypt_method)"
}
EOF
Expand Down

0 comments on commit 0584ed8

Please sign in to comment.