const puppeteer = require('puppeteer'); const fs = require('fs').promises; const path = require('path'); const TARGETS = [ { url: 'http://photon.obnh.io:5001', outputPath: '/home/olaf/dockge-migration-guide/screenshots/photon-dockge-home.png', description: 'Photon Dockge showing exited services' }, { url: 'http://fry.obr.sh:5001', outputPath: '/home/olaf/dockge-migration-guide/screenshots/fry-dockge-home.png', description: 'Fry Dockge showing active services' }, { url: 'http://45.131.64.213:3000', outputPath: '/home/olaf/dockge-migration-guide/screenshots/gitea-on-fry.png', description: 'Gitea running on fry' } ]; const TIMEOUT = 60000; // 60 seconds async function captureScreenshot(target) { const { url, outputPath, description } = target; console.log(`\nā–¶ļø Capturing: ${description}`); console.log(` URL: ${url}`); let browser = null; try { // Ensure output directory exists await fs.mkdir(path.dirname(outputPath), { recursive: true }); // Launch browser browser = await puppeteer.launch({ headless: true, args: ['--no-sandbox', '--disable-setuid-sandbox'], executablePath: '/usr/bin/google-chrome' }); const page = await browser.newPage(); // Set viewport await page.setViewport({ width: 1920, height: 1080 }); // Navigate and wait for network idle console.log(` Navigating...`); await page.goto(url, { waitUntil: 'networkidle2', timeout: TIMEOUT }); // Wait a bit more for dynamic content await new Promise(resolve => setTimeout(resolve, 2000)); // Take screenshot console.log(` šŸ“ø Taking screenshot...`); await page.screenshot({ path: outputPath, fullPage: true }); console.log(` āœ… Success! Saved to ${outputPath}`); } catch (error) { console.log(` āŒ Failure: ${error.message}`); } finally { if (browser) { await browser.close(); } } } async function main() { console.log('='.repeat(60)); console.log('SCREENSHOT CAPTURE MISSION'); console.log('='.repeat(60)); const manifest = []; for (const target of TARGETS) { await captureScreenshot(target); manifest.push({ ...target, timestamp: new Date().toISOString() }); console.log('-'.repeat(60)); } // Save manifest const manifestPath = '/home/olaf/dockge-migration-guide/screenshots/MANIFEST.json'; await fs.writeFile(manifestPath, JSON.stringify(manifest, null, 2)); console.log(`\nšŸ“‹ Manifest saved to ${manifestPath}`); console.log('\n' + '='.repeat(60)); console.log('ALL TASKS COMPLETED'); console.log('='.repeat(60)); } main().catch(console.error);