From 6b34ca974b372146c9a74ee012cf6a9d3af80ac1 Mon Sep 17 00:00:00 2001 From: gitea-action Date: Mon, 24 Mar 2025 20:30:27 +0800 Subject: [PATCH] luci-app-passwall: sync upstream last commit: https://github.com/xiaorouji/openwrt-passwall/commit/d18bbd00ba7046413d01b2917e586853367b8836 --- luci-app-passwall/luasrc/passwall/util_sing-box.lua | 11 +++++++++-- .../root/usr/share/passwall/haproxy_check.sh | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/luci-app-passwall/luasrc/passwall/util_sing-box.lua b/luci-app-passwall/luasrc/passwall/util_sing-box.lua index 2e0be42ef..5c916d97e 100644 --- a/luci-app-passwall/luasrc/passwall/util_sing-box.lua +++ b/luci-app-passwall/luasrc/passwall/util_sing-box.lua @@ -12,7 +12,7 @@ local version_ge_1_11_0 = api.compare_versions(local_version:match("[^v]+"), ">= local geosite_all_tag = {} local geoip_all_tag = {} -local srss_path = "/tmp/etc/" .. appname .."/srss/" +local srss_path = "/tmp/etc/" .. appname .."_tmp/srss/" local function convert_geofile() local geo_dir = (uci:get(appname, "@global_rules[0]", "v2ray_location_asset") or "/usr/share/v2ray/"):match("^(.*)/") @@ -27,10 +27,17 @@ local function convert_geofile() end local function convert(file_path, prefix, tags) if next(tags) and fs.access(file_path) then + local md5_file = srss_path .. prefix .. ".dat.md5" + local new_md5 = sys.exec("md5sum " .. file_path .. " 2>/dev/null | awk '{print $1}'"):gsub("\n", "") + local old_md5 = sys.exec("[ -f " .. md5_file .. " ] && head -n 1 " .. md5_file .. " | tr -d ' \t\n' || echo ''") + if new_md5 ~= "" and new_md5 ~= old_md5 then + sys.call("printf '%s' " .. new_md5 .. " > " .. md5_file) + sys.call("rm -rf " .. srss_path .. prefix .. "-*.srs" ) + end for k in pairs(tags) do local srs_file = srss_path .. prefix .. "-" .. k .. ".srs" if not fs.access(srs_file) then - local cmd = string.format("geoview -type %s -action convert -input %s -list '%s' -output %s -lowmem=true", + local cmd = string.format("geoview -type %s -action convert -input '%s' -list '%s' -output '%s' -lowmem=true", prefix, file_path, k, srs_file) sys.exec(cmd) --local status = fs.access(srs_file) and "成功。" or "失败!" diff --git a/luci-app-passwall/root/usr/share/passwall/haproxy_check.sh b/luci-app-passwall/root/usr/share/passwall/haproxy_check.sh index fa430ca6d..1a9564e8e 100755 --- a/luci-app-passwall/root/usr/share/passwall/haproxy_check.sh +++ b/luci-app-passwall/root/usr/share/passwall/haproxy_check.sh @@ -8,7 +8,7 @@ server_port=$4 probe_file="/tmp/etc/passwall/haproxy/Probe_URL" probeUrl="https://www.google.com/generate_204" if [ -f "$probe_file" ]; then - firstLine=$(head -n 1 "$probe_file" | tr -d ' \t') + firstLine=$(head -n 1 "$probe_file" | tr -d ' \t\n') [ -n "$firstLine" ] && probeUrl="$firstLine" fi