The dragonflight.sid cookie was hardcoded in 12 Playwright capture scripts. Read it from the environment instead, fail fast when unset, and add .env.example /.env gitignore. The leaked session has been revoked.
191 lines
6 KiB
JavaScript
191 lines
6 KiB
JavaScript
const { chromium } = require('playwright');
|
|
if (!process.env.DF_SESSION_COOKIE) { console.error('DF_SESSION_COOKIE env var not set — grab the dragonflight.sid cookie value from your browser devtools, export it, rerun.'); process.exit(1); }
|
|
const path = require('path');
|
|
const fs = require('fs');
|
|
|
|
const OUT_DIR = '/home/zgaetano/media-command-guide/screenshots';
|
|
fs.mkdirSync(OUT_DIR, { recursive: true });
|
|
|
|
const COOKIE_VAL = process.env.DF_SESSION_COOKIE;
|
|
|
|
(async () => {
|
|
const browser = await chromium.launch({
|
|
headless: true,
|
|
args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage', '--disable-gpu']
|
|
});
|
|
|
|
const context = await browser.newContext({
|
|
viewport: { width: 1920, height: 1080 },
|
|
deviceScaleFactor: 1,
|
|
ignoreHTTPSErrors: true
|
|
});
|
|
|
|
// Set auth cookie
|
|
await context.addCookies([{
|
|
name: 'dragonflight.sid',
|
|
value: COOKIE_VAL,
|
|
domain: 'mediacmdr.com',
|
|
path: '/',
|
|
httpOnly: true,
|
|
secure: true,
|
|
sameSite: 'Lax'
|
|
}]);
|
|
|
|
const page = await context.newPage();
|
|
|
|
// Helper to pause videos and screenshot
|
|
async function snap(filename, waitMs = 2000) {
|
|
await page.waitForTimeout(waitMs);
|
|
await page.evaluate(() => {
|
|
document.querySelectorAll('video').forEach(v => { try { v.pause(); } catch(e){} });
|
|
});
|
|
const dest = path.join(OUT_DIR, filename);
|
|
await page.screenshot({ path: dest, fullPage: false });
|
|
console.log(`Saved: ${filename}`);
|
|
}
|
|
|
|
// Helper to click sidebar nav
|
|
async function clickNav(label) {
|
|
console.log(`Navigating to: ${label}`);
|
|
await page.evaluate((lbl) => {
|
|
const items = Array.from(document.querySelectorAll('.nav-item'));
|
|
const target = items.find(i => i.innerText.trim().startsWith(lbl));
|
|
if (target) target.click();
|
|
}, label);
|
|
}
|
|
|
|
// 1. Home / Dashboard
|
|
await page.goto('https://mediacmdr.com/', { waitUntil: 'networkidle' });
|
|
await snap('02-dashboard-home.png', 3000);
|
|
|
|
// 2. LIVE Section
|
|
await clickNav('Recorders');
|
|
await snap('05-live-recorders.png', 3000);
|
|
|
|
await clickNav('Schedule');
|
|
await snap('06-live-schedule.png', 2000);
|
|
|
|
await clickNav('Graphics');
|
|
await snap('07-live-graphics.png', 2000);
|
|
|
|
await clickNav('Monitor Wall');
|
|
await snap('08-live-monitor-wall.png', 3000);
|
|
|
|
// 3. MEDIA Section
|
|
await clickNav('Projects');
|
|
await snap('03-projects.png', 2000);
|
|
|
|
// Open Broadcast Managment Group project
|
|
await page.evaluate(() => {
|
|
const all = Array.from(document.querySelectorAll('*'));
|
|
const bmgCard = all.find(el => el.innerText && el.innerText.includes('Broadcast Managment Group') && el.innerText.includes('assets'));
|
|
if (bmgCard) bmgCard.click();
|
|
});
|
|
await snap('04-project-bmg-overview.png', 3000);
|
|
|
|
await clickNav('Library');
|
|
await snap('09-media-library.png', 4000);
|
|
|
|
// Open an asset inspector modal
|
|
try {
|
|
await page.evaluate(() => {
|
|
const row = document.querySelector('tbody tr') || document.querySelector('.asset-row') || document.querySelector('.asset-card');
|
|
if (row) row.click();
|
|
});
|
|
await snap('09b-media-library-asset-inspector.png', 3000);
|
|
|
|
// Close modal
|
|
await page.evaluate(() => {
|
|
const closeBtn = document.querySelector('.modal-close, button[aria-label="Close"], .dialog-close, .btn-close');
|
|
if (closeBtn) closeBtn.click();
|
|
else document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', code: 'Escape', bubbles: true }));
|
|
});
|
|
await page.waitForTimeout(1000);
|
|
} catch (e) {
|
|
console.log('Asset inspector modal skip:', e.message);
|
|
}
|
|
|
|
await clickNav('Upload');
|
|
await snap('10-media-upload.png', 2000);
|
|
|
|
await clickNav('Contribution');
|
|
await snap('11-media-contribution.png', 2000);
|
|
|
|
await clickNav('YouTube');
|
|
await snap('12-media-youtube.png', 2000);
|
|
|
|
await clickNav('Cloud Import');
|
|
await snap('13-media-cloud-import.png', 2000);
|
|
|
|
// 4. OPERATIONS Section
|
|
await clickNav('Jobs');
|
|
await snap('14-ops-jobs.png', 2000);
|
|
|
|
await clickNav('Staging');
|
|
await snap('15-ops-staging.png', 2000);
|
|
|
|
await clickNav('Playout');
|
|
await snap('16-ops-playout.png', 2000);
|
|
|
|
await clickNav('Clip Server');
|
|
await snap('17-ops-clip-server.png', 2000);
|
|
|
|
await clickNav('Editor');
|
|
await snap('18-ops-editor.png', 3000);
|
|
|
|
await clickNav('Engineering');
|
|
await snap('19-ops-engineering.png', 2000);
|
|
|
|
await clickNav('Applications');
|
|
await snap('20-ops-applications.png', 2000);
|
|
|
|
// 5. ADMIN Section
|
|
await clickNav('Users & Groups');
|
|
await snap('21-admin-users-groups.png', 2000);
|
|
|
|
await clickNav('API Tokens');
|
|
await snap('22-admin-api-tokens.png', 2000);
|
|
|
|
await clickNav('Containers');
|
|
await snap('23-admin-containers.png', 2000);
|
|
|
|
await clickNav('Logs');
|
|
await snap('24-admin-logs.png', 2000);
|
|
|
|
await clickNav('Audit Log');
|
|
await snap('25-admin-audit-log.png', 2000);
|
|
|
|
await clickNav('Cluster');
|
|
await snap('26-admin-cluster.png', 2000);
|
|
|
|
await clickNav('Alerts');
|
|
await snap('27-admin-alerts.png', 2000);
|
|
|
|
await clickNav('Settings');
|
|
await snap('28-admin-settings.png', 2000);
|
|
|
|
// Settings tabs if present
|
|
try {
|
|
const tabs = await page.evaluate(() => {
|
|
return Array.from(document.querySelectorAll('.tab, [role="tab"], .settings-tab, button')).filter(b => {
|
|
const t = b.innerText.trim();
|
|
return ['Storage', 'S3', 'Encoder', 'Playout', 'General', 'Integrations', 'License'].includes(t);
|
|
}).map(b => b.innerText.trim());
|
|
});
|
|
console.log('Found settings tabs:', tabs);
|
|
for (let i = 0; i < tabs.length; i++) {
|
|
const tabName = tabs[i];
|
|
await page.evaluate((t) => {
|
|
const all = Array.from(document.querySelectorAll('.tab, [role="tab"], .settings-tab, button'));
|
|
const target = all.find(el => el.innerText.trim() === t);
|
|
if (target) target.click();
|
|
}, tabName);
|
|
await snap(`28-settings-tab-${tabName.toLowerCase().replace(/[^a-z0-9]/g, '-')}.png`, 1500);
|
|
}
|
|
} catch(e) {
|
|
console.log('Settings tabs error:', e.message);
|
|
}
|
|
|
|
await browser.close();
|
|
console.log('All screenshots captured successfully!');
|
|
})();
|