From 5a3f374fd52698fecc830ad64bd0c181fd8f274a Mon Sep 17 00:00:00 2001 From: gitea-action Date: Fri, 24 Jan 2025 23:30:19 +0800 Subject: [PATCH] luci-app-passwall: sync upstream last commit: https://github.com/xiaorouji/openwrt-passwall/commit/6dcf51f3a2cf462afaf77dc98a84243f0ab9bfcc --- .../model/cbi/passwall/server/type/ray.lua | 20 ++++++++++++++++++- .../luasrc/passwall/util_xray.lua | 4 +--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ray.lua b/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ray.lua index ed1367e4d..cec60a343 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ray.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ray.lua @@ -151,8 +151,26 @@ o = s:option(Value, _n("reality_dest"), translate("Dest")) o.default = "google.com:443" o:depends({ [_n("reality")] = true }) -o = s:option(Value, _n("reality_serverNames"), translate("serverNames")) +o = s:option(DynamicList, _n("reality_serverNames"), translate("serverNames")) o:depends({ [_n("reality")] = true }) +function o.write(self, section, value) + local t = {} + local t2 = {} + if type(value) == "table" then + local x + for _, x in ipairs(value) do + if x and #x > 0 then + if not t2[x] then + t2[x] = x + t[#t+1] = x + end + end + end + else + t = { value } + end + return DynamicList.write(self, section, t) +end o = s:option(ListValue, _n("alpn"), translate("alpn")) o.default = "h2,http/1.1" diff --git a/luci-app-passwall/luasrc/passwall/util_xray.lua b/luci-app-passwall/luasrc/passwall/util_xray.lua index 828b7681f..c2b7d6d50 100644 --- a/luci-app-passwall/luasrc/passwall/util_xray.lua +++ b/luci-app-passwall/luasrc/passwall/util_xray.lua @@ -536,9 +536,7 @@ function gen_config_server(node) config.inbounds[1].streamSettings.realitySettings = { show = false, dest = node.reality_dest, - serverNames = { - node.reality_serverNames - }, + serverNames = node.reality_serverNames or {}, privateKey = node.reality_private_key, shortIds = node.reality_shortId or "" } or nil