#!/bin/bash # 1.8.0 发布验收 —— 从公网走一遍用户会走的路 set -u BASE=https://relay.xxmxxs.top UA='LanRemote/1.8.0' echo "════════ 1. 中转版本 ════════" curl -s --max-time 15 "$BASE/v1/health" | head -c 200 echo echo echo "════════ 2. 官网 ════════" code=$(curl -s -o /tmp/site.html -w '%{http_code}' --max-time 20 -H "User-Agent: $UA" "$BASE/") echo " HTTP $code $(wc -c < /tmp/site.html) 字节" echo " 版本号显示: $(grep -o '1\.8\.0' /tmp/site.html | head -1 || echo '(页面上没直接标版本,正常)')" echo " 下载按钮指向:" grep -o 'href="/download/[^"]*"' /tmp/site.html | sort -u | sed 's/^/ /' echo echo "════════ 3. 三个成品能不能下(只看前 1KB 和响应头)════════" for f in ykxmz-setup-1.8.0.exe ykxmz-server-1.8.0.zip ykxmz-watch-1.8.0.apk; do hdr=$(curl -sI --max-time 30 -H "User-Agent: $UA" "$BASE/download/$f") code=$(echo "$hdr" | head -1 | awk '{print $2}') length=$(echo "$hdr" | grep -i '^content-length' | tr -d '\r' | awk '{print $2}') kind=$(echo "$hdr" | grep -i '^content-type' | tr -d '\r' | cut -d' ' -f2) # 真下 1KB 验证能读 got=$(curl -s --max-time 40 -r 0-1023 -o /tmp/chunk.bin -w '%{http_code}' \ -H "User-Agent: $UA" "$BASE/download/$f" 2>/dev/null) real=$(wc -c < /tmp/chunk.bin 2>/dev/null || echo 0) printf " %-32s HTTP %-4s 共 %-10s %s 取到 %s 字节\n" \ "$f" "$code" "${length:-?}" "${kind:-?}" "$real" done echo echo "════════ 4. 管理后台 ════════" PASS=$(cat /root/lanremote-relay/data/admin_password.txt 2>/dev/null) curl -s -c /tmp/ck.txt -o /dev/null --max-time 20 \ -d "username=xmz7891&password=$PASS" "$BASE/admin/login" for p in "/zhongzhuanzhan" "/admin"; do printf " %-20s HTTP %s\n" "$p" \ "$(curl -s -o /dev/null -w '%{http_code}' -b /tmp/ck.txt --max-time 20 -H "User-Agent: $UA" "$BASE$p")" done curl -s -b /tmp/ck.txt --max-time 20 "$BASE/zhongzhuanzhan" -o /tmp/adm.html echo " 管理页 $(wc -c < /tmp/adm.html) 字节" for k in 'class="top"' 'class="hero"' 'class="nums"' 'class="card"' 'ykxmz 中转站'; do if grep -q "$k" /tmp/adm.html; then echo " ✓ $k"; else echo " ✗ $k"; fi done echo echo "════════ 5. 其它页面 ════════" for p in "/shot/pc-main.png" "/favicon.ico"; do printf " %-22s HTTP %s\n" "$p" \ "$(curl -s -o /dev/null -w '%{http_code}' --max-time 20 "$BASE$p")" done echo echo "════════ 6. 公网可用率(12 次)════════" ok=0 for i in $(seq 1 12); do c=$(curl -s -o /dev/null -w '%{http_code}' --max-time 20 -H "User-Agent: $UA" "$BASE/v1/health") [ "$c" = "200" ] && ok=$((ok + 1)) printf " %2d: %s\n" "$i" "$c" sleep 1 done echo " 可用 $ok/12" echo echo "════════ 7. 中转日志(看有没有报错)════════" journalctl -u lanremote-relay --since '3 minutes ago' --no-pager 2>/dev/null \ | grep -icE 'traceback|nameerror|typeerror' | sed 's/^/ 错误行数: /' tail -4 /root/lanremote-relay/relay.log | sed 's/^/ /'