mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-19 03:43:29 +00:00
luci ssr plus: sort socks5 servers
This commit is contained in:
parent
37b4a94597
commit
15c55dfb99
@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-ssr-plus
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=90
|
||||
PKG_RELEASE:=91
|
||||
|
||||
PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_V2ray \
|
||||
|
@ -3,13 +3,20 @@ local uci = luci.model.uci.cursor()
|
||||
local server_table = {}
|
||||
|
||||
uci:foreach(shadowsocksr, "servers", function(s)
|
||||
if s.alias and s.type == "ssr" then
|
||||
server_table[s[".name"]] = s.alias
|
||||
elseif s.server and s.server_port and s.type == "ssr" then
|
||||
server_table[s[".name"]] = "%s:%s" %{s.server, s.server_port}
|
||||
if s.alias then
|
||||
server_table[s[".name"]] = "[%s]:%s" %{string.upper(s.type), s.alias}
|
||||
elseif s.server and s.server_port then
|
||||
server_table[s[".name"]] = "[%s]:%s:%s" %{string.upper(s.type), s.server, s.server_port}
|
||||
end
|
||||
end)
|
||||
|
||||
local key_table = {}
|
||||
for key,_ in pairs(server_table) do
|
||||
table.insert(key_table,key)
|
||||
end
|
||||
|
||||
table.sort(key_table)
|
||||
|
||||
m = Map(shadowsocksr)
|
||||
|
||||
s = m:section(TypedSection, "global", translate("Server failsafe auto swith settings"))
|
||||
@ -38,7 +45,7 @@ s.anonymous = true
|
||||
|
||||
o = s:option(ListValue, "server", translate("Server"))
|
||||
o:value("nil", translate("Disable"))
|
||||
for k, v in pairs(server_table) do o:value(k, v) end
|
||||
for _,key in pairs(key_table) do o:value(key,server_table[key]) end
|
||||
o.default = "nil"
|
||||
o.rmempty = false
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user