luci/applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/servers.lua
Yousong Zhou 62d8a4fdd7 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>
2019-05-09 06:18:55 +00:00

36 lines
927 B
Lua

-- Copyright 2017 Yousong Zhou <yszhou4tech@gmail.com>
-- Licensed to the public under the Apache License 2.0.
local ds = require "luci.dispatcher"
local ss = require("luci.model.shadowsocks-libev")
local m, s
m = Map("shadowsocks-libev",
translate("Remote Servers"),
translate("Definition of remote shadowsocks servers. \
Disable any of them will also disable instances referring to it."))
local sname = arg[1]
if sname then
if not m:get(sname) then
luci.http.redirect(ds.build_url("admin/services/shadowsocks-libev/servers"))
return
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, opts)
return m