From 320f80fec6badfbecacb1ccab818f705afccc9d8 Mon Sep 17 00:00:00 2001 From: Max Zhao Date: Wed, 15 Jan 2020 11:05:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E4=BB=A5=E7=A9=BA=E6=A0=BC?= =?UTF-8?q?=E5=88=86=E5=89=B2=E7=9A=84=E8=AE=A2=E9=98=85=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E5=92=8C=E7=A9=BA=E8=AE=A2=E9=98=85=E8=8A=82=E7=82=B9=E7=9A=84?= =?UTF-8?q?=E5=A4=84=E7=90=86=20(#2770)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 支持以空格分割的订阅节点 * 修复订阅内容为空字符串时导致的json格式转换异常 --- .../root/usr/share/shadowsocksr/subscribe.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua b/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua index 03c924e91..26d4c068b 100755 --- a/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua +++ b/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua @@ -112,6 +112,11 @@ local function processData(szType, content) hash = md5(luci.jsonc.stringify(content)) end result.hashkey = hash + -- 如果节点内容为空,返回无效的节点信息 + if content == '' then + result.server = '' + return result, hash + end if szType == 'ssr' then local dat = split(content, "/\\?") local hostInfo = split(dat[1], ':') @@ -232,7 +237,7 @@ local execute = function() node = servers else -- ssd 外的格式 - node = split(base64Decode(raw, true), "\n") + node = split(base64Decode(raw, true):gsub(" ", "\n"), "\n") end for _, v in ipairs(node) do if v then @@ -336,4 +341,4 @@ if subscribe_url and #subscribe_url > 0 then luci.sys.call("/etc/init.d/" .. name .." stop > /dev/null 2>&1 &") -- 不加&的话日志会出现的更早 end end) -end \ No newline at end of file +end