#!/bin/bash # 验证新官网(修正引号问题) set -u BASE=http://127.0.0.1:8080 PUB=https://relay.xxmxxs.top curl -s --max-time 20 "$BASE/" -o /tmp/site.html 2>/dev/null size=$(wc -c < /tmp/site.html) echo " 官网: HTTP $(curl -s -o /dev/null -w '%{http_code}' --max-time 15 "$BASE/") ${size} 字节" echo echo " 各区块(注意 HTML 里是 id=\"xxx\" 带引号):" check() { if grep -q "$2" /tmp/site.html; then echo " OK $1" else echo " XX $1" fi } check "吸顶导航" 'nav-in' check "Hero 标题" '老师抬一下手腕' check "最新版号" 'badge' check "功能网格" 'id="features"' check "三步上手" 'id="how"' check "下载区" 'id="download"' check "常见问题" 'id="faq"' check "页脚" 'foot-in' check "应用图标" 'favicon.ico' check "九张功能卡" 'feat-title' check "三个步骤卡" 'step-num' check "三个下载卡" 'dl-card' check "六条 FAQ" 'class="faq"' echo echo " 各区块计数:" printf " 功能卡 %s 张\n" "$(grep -o 'feat-title' /tmp/site.html | wc -l)" printf " 步骤卡 %s 个\n" "$(grep -o 'step-num' /tmp/site.html | wc -l)" printf " 下载卡 %s 个\n" "$(grep -o 'dl-card' /tmp/site.html | wc -l)" printf " FAQ %s 条\n" "$(grep -o 'class="faq"' /tmp/site.html | wc -l)" echo echo " 下载链接:" grep -o 'href="/download/[^"]*"' /tmp/site.html | sed 's/^/ /' echo echo " 配色(白底主题,深色只该有正文色):" python3 - <<'PY' import re html = open('/tmp/site.html', encoding='utf-8').read() colors = sorted(set(re.findall(r'#[0-9a-fA-F]{6}', html))) print(' ', ' '.join(colors)) # 允许的深色:正文 #1a1d21、主色 #2563eb、深一档 #1d4ed8 ALLOW_DARK = {'#1a1d21', '#2563eb', '#1d4ed8'} bad = [] for c in colors: v = int(c[1:3], 16) + int(c[3:5], 16) + int(c[5:7], 16) if v < 420 and c not in ALLOW_DARK: bad.append(c) print(' 非白底配色里不该出现的深色:', bad if bad else '无 ✓') print(' 底色是白:', '#ffffff' in colors) PY echo echo " 其它页面没被影响:" echo " 管理页 /zhongzhuanzhan HTTP $(curl -s -o /dev/null -w '%{http_code}' --max-time 15 "$BASE/zhongzhuanzhan")" echo " /admin 跳转 -> $(curl -s -o /dev/null -w '%{redirect_url}' --max-time 15 "$BASE/admin")" echo " favicon HTTP $(curl -s -o /dev/null -w '%{http_code}' --max-time 15 "$BASE/favicon.ico")" echo " 下载接口 HTTP $(curl -s -o /dev/null -w '%{http_code}' --max-time 15 "$BASE/v1/downloads")" echo " 官网里没有管理入口: $(grep -c '管理入口' /tmp/site.html) 处" echo echo " 公网:" echo " 官网 HTTP $(curl -s -o /dev/null -w '%{http_code}' --max-time 40 -H 'User-Agent: LanRemote/1.4.0' "$PUB/")" echo " 延迟 $(curl -s -o /dev/null -w '%{time_total}' --max-time 40 -H 'User-Agent: LanRemote/1.4.0' "$PUB/") 秒"