From 62d28e23d2fc342e05edc8fdd2d8343b39485ade Mon Sep 17 00:00:00 2001 From: sindricn Date: Wed, 13 Aug 2025 16:49:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AE=A2=E9=98=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/node-info.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/scripts/node-info.sh b/scripts/node-info.sh index ce6ee7a..2c81608 100644 --- a/scripts/node-info.sh +++ b/scripts/node-info.sh @@ -153,9 +153,13 @@ EOF # 添加端口跳跃配置 if [[ -n "$port_hopping" && "$port_hopping" != "未配置" ]]; then - cat << EOF - ports: $port_hopping + # 提取纯净的端口范围格式(如果包含描述则提取端口范围部分) + local port_range=$(echo "$port_hopping" | grep -oE '[0-9]+-[0-9]+' | head -1) + if [[ -n "$port_range" ]]; then + cat << EOF + ports: $port_range EOF + fi fi if [[ -n "$obfs_password" ]]; then @@ -439,16 +443,8 @@ generate_subscription_files() { echo "$node_link" > "$hysteria2_sub" # 2. Base64编码订阅 (通用格式,兼容v2rayNG等客户端) - cat > "$base64_sub.tmp" << EOF -# Hysteria2 Subscription -# Generated: $(date) -# Server: $server_address:$port - -$node_link -EOF - # 生成标准base64订阅格式(多行内容编码) - base64 -w 0 "$base64_sub.tmp" > "$base64_sub" - rm -f "$base64_sub.tmp" + # 直接对节点链接进行base64编码,不添加注释避免解析问题 + echo "$node_link" | base64 -w 0 > "$base64_sub" # 获取端口跳跃信息 local port_hopping=$(get_port_hopping_info) @@ -465,11 +461,15 @@ proxies: password: $auth_password EOF - # 添加端口跳跃配置 + # 添加端口跳跃配置 if [[ -n "$port_hopping" && "$port_hopping" != "未配置" ]]; then - cat >> "$clash_sub" << EOF - ports: $port_hopping + # 提取纯净的端口范围格式(如:20000-50000) + local port_range=$(echo "$port_hopping" | grep -oE '[0-9]+-[0-9]+' | head -1) + if [[ -n "$port_range" ]]; then + cat >> "$clash_sub" << EOF + ports: $port_range EOF + fi fi if [[ -n "$obfs_password" ]]; then