flagtldr / scripts /demo.sh
botezx's picture
FlagTLDR 0.5.0 (snapshot of local f98bb37)
043267b
Raw History Blame Contribute Delete
1.16 kB
#!/usr/bin/env bash
# Local demo + screenshots, no real X account needed:
# mock x.com (HTTPS, :8443) + classifier service (:8765) + Chrome for Testing with the unpacked extension.
# XA_CLASSIFIER=basal scripts/demo.sh # needs scripts/basal-serve.sh running on :8000
set -euo pipefail
source "$(dirname "$0")/env.sh"
cd "$XA_ROOT"
[ -d scripts/e2e/node_modules ] || (cd scripts/e2e && npm install --no-fund --no-audit)
CHROME="$(ls -d "$XA_ROOT"/.tools/cft/chrome/*/chrome-linux64/chrome 2>/dev/null | head -1 || true)"
if [ -z "$CHROME" ]; then
(cd scripts/e2e && npx @puppeteer/browsers install chrome@stable --path "$XA_ROOT/.tools/cft")
CHROME="$(ls -d "$XA_ROOT"/.tools/cft/chrome/*/chrome-linux64/chrome | head -1)"
fi
python3 scripts/e2e/mock-x-server.py 8443 & MOCK=$!
(cd classifier && uv run xaddons-classifier serve --backend "${XA_CLASSIFIER:-rules}") & CLS=$!
trap 'kill $MOCK $CLS 2>/dev/null || true' EXIT
for i in $(seq 1 30); do curl -sf localhost:8765/health >/dev/null && break; sleep 1; done
(cd scripts/e2e && node screens.mjs "$CHROME" && node diag.mjs "$CHROME" && node geo.mjs "$CHROME")
echo "Screenshots in docs/screenshots/"