From b8081d58ba555b0d47ea638a73338201f246947a Mon Sep 17 00:00:00 2001 From: gitea-action Date: Sat, 9 Nov 2024 13:30:39 +0800 Subject: [PATCH] luci-app-ssr-plus: sync upstream last commit: https://github.com/fw876/helloworld/commit/cf1aeaca748668c85584e7cb3962d75f36a74943 --- luci-app-ssr-plus/po/zh_Hans/ssr-plus.po | 2 +- .../root/usr/share/shadowsocksr/update.lua | 21 ++++++++++--------- patch-luci-app-ssr-plus.patch | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/luci-app-ssr-plus/po/zh_Hans/ssr-plus.po b/luci-app-ssr-plus/po/zh_Hans/ssr-plus.po index f97309b39..307725e4b 100644 --- a/luci-app-ssr-plus/po/zh_Hans/ssr-plus.po +++ b/luci-app-ssr-plus/po/zh_Hans/ssr-plus.po @@ -432,7 +432,7 @@ msgid "No new data!" msgstr "你已经是最新数据,无需更新!" msgid "Total Records:" -msgstr "新的总纪录数:" +msgstr "新的总记录数:" msgid "Check Server Port" msgstr "【服务器端口】检查" diff --git a/luci-app-ssr-plus/root/usr/share/shadowsocksr/update.lua b/luci-app-ssr-plus/root/usr/share/shadowsocksr/update.lua index 8572f24aa..5eadb3e64 100755 --- a/luci-app-ssr-plus/root/usr/share/shadowsocksr/update.lua +++ b/luci-app-ssr-plus/root/usr/share/shadowsocksr/update.lua @@ -9,7 +9,7 @@ require "luci.model.uci" local icount = 0 local args = arg[1] local uci = luci.model.uci.cursor() -local TMP_DNSMASQ_PATH = luci.sys.exec("find /tmp/dnsmasq.*/dnsmasq-ssrplus.d -print 2>/dev/null | head -n 1"):gsub("%s+", "") +local TMP_DNSMASQ_PATH = luci.sys.exec("find /tmp/dnsmasq*/dnsmasq-ssrplus.d -type d -print -quit 2>/dev/null") local TMP_PATH = "/var/etc/ssrplus" -- match comments/title/whitelist/ip address/excluded_domain local comment_pattern = "^[!\\[@]+" @@ -44,10 +44,10 @@ local function base64_dec(data) return string.char(c) end)) end --- check excluded domain +-- check if domain is excluded local function check_excluded_domain(value) - for k, v in ipairs(excluded_domain) do - if value:find(v) then + for _, domain in ipairs(excluded_domain) do + if value:find(domain) then return true end end @@ -75,18 +75,19 @@ end -- adblock转码至dnsmasq格式 local function generate_adblock(type) - local domains = {} + local domains, domains_map = {}, {} local out = io.open("/tmp/ssr-update." .. type, "w") for line in io.lines("/tmp/ssr-update.tmp") do if not (string.find(line, comment_pattern)) then local start, finish, match = string.find(line, domain_pattern) - if (start) then - domains[match] = true + if start and not domains_map[match] then + domains_map[match] = true + table.insert(domains, match) end end end - for k, v in pairs(domains) do - out:write(string.format("address=/%s/\n", k)) + for _, domain in ipairs(domains) do + out:write(string.format("address=/%s/\n", domain)) end out:close() os.remove("/tmp/ssr-update.tmp") @@ -155,7 +156,7 @@ local function update(url, file, type, file2) if args then log(0, tonumber(icount) / Num) else - log("更新成功! 新的总纪录数:" .. tostring(tonumber(icount) / Num)) + log("更新成功! 新的总记录数:" .. tostring(tonumber(icount) / Num)) end end else diff --git a/patch-luci-app-ssr-plus.patch b/patch-luci-app-ssr-plus.patch index 88bb0c9c7..d48e2bfa2 100644 --- a/patch-luci-app-ssr-plus.patch +++ b/patch-luci-app-ssr-plus.patch @@ -430,7 +430,7 @@ index c81590e..18dcdf2 100644 } } diff --git a/luci-app-ssr-plus/po/zh_Hans/ssr-plus.po b/luci-app-ssr-plus/po/zh_Hans/ssr-plus.po -index da30ffc..f97309b 100644 +index 18f19a7..307725e 100644 --- a/luci-app-ssr-plus/po/zh_Hans/ssr-plus.po +++ b/luci-app-ssr-plus/po/zh_Hans/ssr-plus.po @@ -557,27 +557,6 @@ msgstr "使用 DNS2TCP 查询"