#!/usr/bin/env bash # Captures of every served route at 390 and 1440, dark and light (site-ui-5, 7 October 2026). Runs on igneum-build-2 (the # Mac captures nothing: CLAUDE.md "Nothing heavy on the Mac"), one headless chromium at a time, against tools/site/serve.mjs # on a port of its own with /api passed through to the live observer, so the chain scene paints from the real feed. # # tools/site/capture.sh [] [] # ROUTES="/ /live" tools/site/capture.sh a subset # WIDTHS="390 1440" THEMES="dark light" the defaults # # The binary defaults to Playwright's headless shell in ~/.cache/ms-playwright (the box has it); no npm package is needed. # One PNG per route, width and theme: __-.png (the home is "home"). set -euo pipefail OUT="${1:?out dir}"; HERE="$(cd "$(dirname "$0")" && pwd)"; SITE="${2:-$HERE/../../site}"; CHROME="${3:-}" if [ -z "$CHROME" ]; then CHROME="$(ls -d "$HOME"/.cache/ms-playwright/chromium_headless_shell-*/chrome-linux/headless_shell 2>/dev/null | sort | tail -1 || true)"; fi [ -x "$CHROME" ] || { echo "no chromium headless shell (pass its path as the third argument)" >&2; exit 2; } PORT="${IGNEUM_SITE_PORT:-$((4500 + RANDOM % 400))}" mkdir -p "$OUT" node "$HERE/serve.mjs" "$PORT" "$SITE" > "$OUT/serve.log" 2>&1 & SRV=$! trap 'kill "$SRV" 2>/dev/null || true' EXIT for i in $(seq 1 40); do curl -fsS "http://127.0.0.1:$PORT/" > /dev/null 2>&1 && break; sleep 0.25; done curl -fsS "http://127.0.0.1:$PORT/" > /dev/null || { echo "the site did not answer on $PORT" >&2; cat "$OUT/serve.log" >&2; exit 3; } ROUTES="${ROUTES:-/ /download /miner /app /wallet /live /explorer /journey /bench /evidence /litepaper /ledger /claims /randomx /provenance /miners /dev-fee /faucet /metamask /404}" WIDTHS="${WIDTHS:-390 1440}"; THEMES="${THEMES:-dark light}" shot() { # local route="$1" width="$2" theme="$3" name height name="${route#/}"; name="${name:-home}"; name="${name//\//-}" if [ "$width" -le 480 ]; then height="${IGNEUM_SHOT_H_PHONE:-2400}"; else height="${IGNEUM_SHOT_H_DESKTOP:-1600}"; fi local file="${name}__${width}-${theme}.png" "$CHROME" --headless --no-sandbox --disable-gpu --hide-scrollbars --force-device-scale-factor=2 \ --window-size="$width,$height" --virtual-time-budget=12000 --run-all-compositor-stages-before-draw \ --screenshot="$OUT/$file" "http://127.0.0.1:$PORT$route?theme=$theme&motion=off" > "$OUT/$file.log" 2>&1 || { echo "FAILED $file"; cat "$OUT/$file.log"; return 1; } echo "$file $(stat -c %s "$OUT/$file" 2>/dev/null || stat -f %z "$OUT/$file") B" } for r in $ROUTES; do for w in $WIDTHS; do for t in $THEMES; do shot "$r" "$w" "$t"; done; done; done echo "done: $OUT"