- Update dbis_core, cross-chain-pmm-lps, explorer-monorepo, metamask-integration, pr-workspace/chains - Omit embedded publish git dirs and empty placeholders from index Made-with: Cursor
132 lines
4.6 KiB
Bash
Executable File
132 lines
4.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Verify https://info.defi-oracle.io (or INFO_SITE_BASE) serves the Chain 138 SPA and static agent files.
|
|
# Run after: pnpm --filter info-defi-oracle-138 build && sync-info-defi-oracle-to-vmid2400.sh (or your CDN upload).
|
|
set -euo pipefail
|
|
|
|
BASE="${INFO_SITE_BASE:-https://info.defi-oracle.io}"
|
|
BASE="${BASE%/}"
|
|
|
|
echo "Checking info site: $BASE"
|
|
|
|
BODY=/tmp/info-site-check-body
|
|
|
|
fetch() {
|
|
local path=$1
|
|
curl -sS "${BASE}${path}" --max-time 25 -o "$BODY" -w '%{http_code}'
|
|
}
|
|
|
|
check_spa() {
|
|
local path=$1
|
|
local min_bytes=${2:-512}
|
|
local url="${BASE}${path}"
|
|
local code
|
|
code=$(fetch "$path") || true
|
|
if [[ "$code" != "200" ]]; then
|
|
echo "FAIL $path → HTTP $code ($url)" >&2
|
|
return 1
|
|
fi
|
|
local sz
|
|
sz=$(wc -c < "$BODY" | tr -d ' ')
|
|
if [[ "$sz" -lt "$min_bytes" ]]; then
|
|
echo "FAIL $path → body too small (${sz}b, min ${min_bytes}) ($url)" >&2
|
|
return 1
|
|
fi
|
|
if grep -q '<title>Default Page</title>' "$BODY" 2>/dev/null; then
|
|
echo "FAIL $path → generic placeholder page (hosting default). Point NPMplus/upstream at info-defi-oracle-138 dist/ per docs/04-configuration/INFO_DEFI_ORACLE_IO_DEPLOYMENT.md ($url)" >&2
|
|
return 1
|
|
fi
|
|
# Vite/React SPA
|
|
if grep -qE 'id="root"|id='"'"'root'"'"'' "$BODY" 2>/dev/null; then
|
|
echo "OK $path (SPA HTML, ${sz}b)"
|
|
return 0
|
|
fi
|
|
if grep -qE '/assets/index-[A-Za-z0-9_-]+\.(js|mjs)' "$BODY" 2>/dev/null; then
|
|
echo "OK $path (SPA bundle reference, ${sz}b)"
|
|
return 0
|
|
fi
|
|
echo "FAIL $path → expected Vite SPA (root div or /assets/index-*.js), got unknown HTML ($url)" >&2
|
|
return 1
|
|
}
|
|
|
|
check_text() {
|
|
local path=$1
|
|
local min_bytes=$2
|
|
local pattern=$3
|
|
local url="${BASE}${path}"
|
|
local code
|
|
code=$(fetch "$path") || true
|
|
if [[ "$code" != "200" ]]; then
|
|
echo "FAIL $path → HTTP $code ($url)" >&2
|
|
return 1
|
|
fi
|
|
local sz
|
|
sz=$(wc -c < "$BODY" | tr -d ' ')
|
|
if [[ "$sz" -lt "$min_bytes" ]]; then
|
|
echo "FAIL $path → body too small (${sz}b) ($url)" >&2
|
|
return 1
|
|
fi
|
|
if ! grep -qE "$pattern" "$BODY"; then
|
|
echo "FAIL $path → body does not match expected pattern (got HTML fallback? check static file deploy) ($url)" >&2
|
|
head -c 120 "$BODY" | xxd >&2 || true
|
|
return 1
|
|
fi
|
|
echo "OK $path (${sz}b)"
|
|
}
|
|
|
|
check_spa "/" 400
|
|
check_spa "/agents" 400
|
|
check_spa "/disclosures" 400
|
|
check_spa "/governance" 400
|
|
check_spa "/ecosystem" 400
|
|
check_spa "/documentation" 400
|
|
check_spa "/solacenet" 400
|
|
|
|
check_text "/llms.txt" 80 '^#'
|
|
check_text "/robots.txt" 10 'User-agent'
|
|
check_text "/sitemap.xml" 80 '<urlset'
|
|
|
|
code=$(fetch "/agent-hints.json") || true
|
|
if [[ "$code" != "200" ]]; then
|
|
echo "FAIL /agent-hints.json → HTTP $code" >&2
|
|
exit 1
|
|
fi
|
|
first_json_char=$(sed 's/^[[:space:]]*//;q' "$BODY" | head -c 1 || true)
|
|
if [[ "$first_json_char" != '{' ]]; then
|
|
echo "FAIL /agent-hints.json → not JSON (SPA fallback serving index.html?)" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if command -v jq >/dev/null 2>&1; then
|
|
if ! jq -e '.chain138.chainId == 138 and .chain138.dodopmmIntegration != null and (.tokenAggregation.defaultBase | contains("info.defi-oracle.io/token-aggregation")) and (.intendedAudience | type == "string") and (.assetFraming | type == "string") and (.governanceSummary | type == "string") and (.publicHubPages | type == "array") and (.authenticatedDocsNote | type == "string")' "$BODY" >/dev/null; then
|
|
echo "FAIL agent-hints.json schema sanity (expected chainId 138, tokenAggregation defaultBase, audience/framing/governanceSummary/publicHubPages/authenticatedDocsNote)" >&2
|
|
exit 1
|
|
fi
|
|
echo "OK /agent-hints.json (jq validation)"
|
|
else
|
|
echo "OK /agent-hints.json (basic JSON brace check; install jq for full validation)"
|
|
fi
|
|
|
|
# Same-origin token-aggregation proxy (info LXC nginx → Blockscout). Catches 502/HTML fallback.
|
|
code=$(curl -sS "${BASE}/token-aggregation/api/v1/networks?refresh=1" --max-time 25 -o "$BODY" -w '%{http_code}') || true
|
|
if [[ "$code" != "200" ]]; then
|
|
echo "FAIL /token-aggregation/api/v1/networks → HTTP $code (${BASE})" >&2
|
|
exit 1
|
|
fi
|
|
if command -v jq >/dev/null 2>&1; then
|
|
if ! jq -e '.networks | type == "array"' "$BODY" >/dev/null; then
|
|
echo "FAIL token-aggregation networks response (expected .networks array; SPA/nginx misroute?)" >&2
|
|
head -c 200 "$BODY" | tr -d '\0' >&2 || true
|
|
exit 1
|
|
fi
|
|
echo "OK /token-aggregation/api/v1/networks (jq .networks)"
|
|
else
|
|
first=$(sed 's/^[[:space:]]*//;q' "$BODY" | head -c 1 || true)
|
|
if [[ "$first" != '{' ]]; then
|
|
echo "FAIL /token-aggregation/api/v1/networks → expected JSON object (install jq for stricter checks)" >&2
|
|
exit 1
|
|
fi
|
|
echo "OK /token-aggregation/api/v1/networks (200, JSON object)"
|
|
fi
|
|
|
|
echo "All checks passed for $BASE"
|