#!/usr/bin/env node /** Screenshot every public HTTPS door on zapier.georgelambert.org. */ import fs from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; import puppeteer from 'puppeteer-core'; const ROOT = path.join(path.dirname(fileURLToPath(import.meta.url)), '..'); const SHOTS = path.join(ROOT, 'screenshots', 'live'); const CHROME = process.env.CHROME_PATH || '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'; fs.mkdirSync(SHOTS, { recursive: true }); const DOORS = [ { file: 'portal.png', url: 'https://portal.zapier.georgelambert.org/portal/' }, { file: 'api.png', url: 'https://api.zapier.georgelambert.org/health' }, { file: 'leaf.png', url: 'https://leaf.zapier.georgelambert.org/health' }, { file: 'zap.png', url: 'https://zap.zapier.georgelambert.org/health' }, { file: 'staff.png', url: 'https://staff.zapier.georgelambert.org/' }, { file: 'iam.png', url: 'https://iam.zapier.georgelambert.org/' }, { file: 'login.png', url: 'https://login.zapier.georgelambert.org/' }, { file: 'cs.png', url: 'https://cs.zapier.georgelambert.org/' }, { file: 'sales.png', url: 'https://sales.zapier.georgelambert.org/' }, { file: 'acct.png', url: 'https://acct.zapier.georgelambert.org/' }, { file: 'mw.png', url: 'https://mw.zapier.georgelambert.org/health' }, { file: 'fleet.png', url: 'https://fleet.zapier.georgelambert.org/' }, { file: 'docs.png', url: 'https://zapier.georgelambert.org/' }, { file: 'git.png', url: 'https://git.georgelambert.org/' }, ]; const browser = await puppeteer.launch({ executablePath: CHROME, headless: 'new', args: ['--no-sandbox', '--window-size=1280,800', '--disable-dev-shm-usage'], defaultViewport: { width: 1280, height: 800 }, }); try { for (const d of DOORS) { const page = await browser.newPage(); try { await page.goto(d.url, { waitUntil: 'networkidle2', timeout: 25000 }); } catch { await page.goto(d.url, { waitUntil: 'domcontentloaded', timeout: 15000 }).catch(() => {}); } await new Promise((r) => setTimeout(r, 600)); const dest = path.join(SHOTS, d.file); await page.screenshot({ path: dest, fullPage: false }); process.stdout.write(`wrote ${dest}\n`); await page.close(); } } finally { await browser.close(); }