#!/bin/bash # 验证新官网:每个区块都要在,且能正常访问 set -u BASE=http://127.0.0.1:8080 PUB=https://relay.xxmxxs.top echo " 1) 本地官网" 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 " 2) 各区块" for pair in "吸顶导航:nav-in" "Hero:hero" "功能网格:id=features" \ "三步上手:id=how" "下载区:id=download" "FAQ:id=faq" \ "页脚:foot-in" "应用图标:favicon.ico"; do label="${pair%%:*}" key="${pair##*:}" if grep -q "$key" /tmp/site.html; then echo " OK $label" else echo " XX $label" fi done echo " 3) 下载链接" grep -o 'href="/download/[^"]*"' /tmp/site.html | sed 's/^/ /' echo " 4) 配色(应该全是浅色)" 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))) dark = [c for c in colors if int(c[1:3], 16) + int(c[3:5], 16) + int(c[5:7], 16) < 200] print(' 用到的颜色:', ' '.join(colors)) print(' 深色值:', dark if dark else '无 ✓') PY echo " 5) 公网访问" echo " HTTP $(curl -s -o /dev/null -w '%{http_code}' --max-time 40 -H 'User-Agent: LanRemote/1.4.0' "$PUB/")" echo " 6) 管理页还能进吗(路径应该没被影响)" echo " /zhongzhuanzhan HTTP $(curl -s -o /dev/null -w '%{http_code}' --max-time 15 "$BASE/zhongzhuanzhan")" echo " 官网里不该有管理入口: $(grep -c '管理入口\|zhongzhuanzhan' /tmp/site.html) 处"