summaryrefslogtreecommitdiffhomepage
path: root/applications
diff options
context:
space:
mode:
authorYousong Zhou <yszhou4tech@gmail.com>2019-05-09 06:00:52 +0000
committerYousong Zhou <yszhou4tech@gmail.com>2019-05-09 06:18:55 +0000
commit62d8a4fdd71540dba56fa4c982df2b753a49996d (patch)
tree7d3f66372a60ea77173d86862715fc128c59514a /applications
parent6b7afabcdd270a5215a225553dda08e0cd1c5e40 (diff)
luci-app-shadowsocks-libev: move plugin options to server sections
In this change, plugin options are moved from component settings to only server settings. This should make the configuration easier. And it will be less error-prone as it's impossible now for users to inconsisitent plugin settings for instances referring to the same remote server Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Diffstat (limited to 'applications')
-rw-r--r--applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/instance-details.lua2
-rw-r--r--applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/servers.lua7
-rw-r--r--applications/luci-app-shadowsocks-libev/luasrc/model/shadowsocks-libev.lua22
3 files changed, 20 insertions, 11 deletions
diff --git a/applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/instance-details.lua b/applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/instance-details.lua
index 195a31f2f..c6323b4df 100644
--- a/applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/instance-details.lua
+++ b/applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/instance-details.lua
@@ -27,7 +27,7 @@ ss.option_install_package(s, "general")
ss.options_common(s, "advanced")
if stype == "ss_server" then
- ss.options_server(s, "general")
+ ss.options_server(s, {tab="general"})
o = s:taboption("general", Value, "bind_address",
translate("Bind address"),
translate("The address ss-server will initiate connection from"))
diff --git a/applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/servers.lua b/applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/servers.lua
index a0d007927..ec601c4fe 100644
--- a/applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/servers.lua
+++ b/applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/servers.lua
@@ -19,13 +19,18 @@ if sname then
end
s = m:section(NamedSection, sname, "server")
m.title = m.title .. ' - ' .. sname
+ opts = {}
else
s = m:section(TypedSection, "server")
s.template = 'cbi/tblsection'
s.addremove = true
+ s.extedit = function(self, section)
+ return 'servers/' .. section
+ end
+ opts = {row=true}
end
s:option(Flag, "disabled", translate("Disable"))
-ss.options_server(s)
+ss.options_server(s, opts)
return m
diff --git a/applications/luci-app-shadowsocks-libev/luasrc/model/shadowsocks-libev.lua b/applications/luci-app-shadowsocks-libev/luasrc/model/shadowsocks-libev.lua
index a3c9ed16b..abb6ce8d4 100644
--- a/applications/luci-app-shadowsocks-libev/luasrc/model/shadowsocks-libev.lua
+++ b/applications/luci-app-shadowsocks-libev/luasrc/model/shadowsocks-libev.lua
@@ -76,9 +76,11 @@ function options_client(s, tab)
o.datatype = "port"
end
-function options_server(s, tab)
+function options_server(s, opts)
local o
local optfunc
+ local tab = opts and opts.tab or nil
+ local row = opts and opts.row or false
if tab == nil then
optfunc = function(...) return s:option(...) end
@@ -96,13 +98,17 @@ function options_server(s, tab)
for _, m in ipairs(methods) do
o:value(m)
end
- o = optfunc(Value, "key", translate("Key (base64)"))
- o.datatype = "base64"
- o.password = true
- o.size = 12
o = optfunc(Value, "password", translate("Password"))
o.password = true
o.size = 12
+ if not row then
+ o = optfunc(Value, "key", translate("Key (base64)"))
+ o.datatype = "base64"
+ o.password = true
+ o.size = 12
+ optfunc(Value, "plugin", translate("Plugin"))
+ optfunc(Value, "plugin_opts", translate("Plugin Options"))
+ end
end
function options_common(s, tab)
@@ -117,8 +123,6 @@ function options_common(s, tab)
o.datatype = "uinteger"
o = s:taboption(tab, Value, "timeout", translate("Timeout (sec)"))
o.datatype = "uinteger"
- s:taboption(tab, Value, "plugin", translate("Plugin"))
- s:taboption(tab, Value, "plugin_opts", translate("Plugin Options"))
s:taboption(tab, Value, "user", translate("Run as"))
s:taboption(tab, Flag, "verbose", translate("Verbose"))
@@ -213,6 +217,8 @@ names_options_server = {
"method",
"key",
"password",
+ "plugin",
+ "plugin_opts",
}
names_options_client = {
@@ -230,8 +236,6 @@ names_options_common = {
"mode",
"mtu",
"timeout",
- "plugin",
- "plugin_opts",
"user",
}