From b881db6b62621894f8952d848f328e3e3cc905bc Mon Sep 17 00:00:00 2001 From: hotyue <52734432+hotyue@users.noreply.github.com> Date: Wed, 1 Apr 2026 13:53:32 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=85=AC=E7=BD=91=20IP=20=E6=97=B6=E9=99=84=E5=B8=A6=E6=8D=A2?= =?UTF-8?q?=E8=A1=8C=E7=AC=A6=E5=AF=BC=E8=87=B4=E8=8A=82=E7=82=B9=E9=87=8D?= =?UTF-8?q?=E5=90=AF=E5=90=8E=E9=87=8D=E5=A4=8D=E8=A7=A6=E5=8F=91=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E7=94=B3=E8=AF=B7=E7=9A=84=20Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/agent_daemon.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/agent_daemon.sh b/core/agent_daemon.sh index 1da271a..55102f1 100644 --- a/core/agent_daemon.sh +++ b/core/agent_daemon.sh @@ -26,13 +26,13 @@ if pgrep -f "webhook.py $AGENT_PORT" > /dev/null; then exit 0 fi -# 1. 获取本机原生公网 IPv4 -AGENT_IP=$(curl -4 -s -m 5 api.ip.sb/ip) +# 1. 获取本机原生公网 IPv4 (强制去除所有不可见换行符和空格) +AGENT_IP=$(curl -4 -s -m 5 api.ip.sb/ip | tr -d '[:space:]') if [ -n "$AGENT_IP" ]; then # --- [重点升级 2: 智能防打扰注册机制] --- LAST_IP="" - [ -f "$IP_CACHE" ] && LAST_IP=$(cat "$IP_CACHE") + [ -f "$IP_CACHE" ] && LAST_IP=$(cat "$IP_CACHE" | tr -d '[:space:]') # 只有当这是第一次运行,或者公网 IP 发生变动时,才发送 Telegram 申请 if [ "$AGENT_IP" != "$LAST_IP" ]; then