luci-app-ssr-plus: sync upstream

last commit: cf1aeaca74
This commit is contained in:
gitea-action 2024-11-09 13:30:39 +08:00
parent 90429028a6
commit b8081d58ba
3 changed files with 13 additions and 12 deletions

View File

@ -432,7 +432,7 @@ msgid "No new data!"
msgstr "你已经是最新数据,无需更新!"
msgid "Total Records:"
msgstr "新的总录数:"
msgstr "新的总录数:"
msgid "Check Server Port"
msgstr "【服务器端口】检查"

View File

@ -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

View File

@ -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 查询"