- Add Next.js app structure with base configs, linting, and formatting - Implement LiveKit Meet page, types, and utility functions - Add Docker, Compose, and deployment scripts for backend and token server - Provide E2E and smoke test scaffolding with Puppeteer and Playwright helpers - Include CSS modules and global styles for UI - Add postMessage and studio integration utilities - Update package.json with dependencies and scripts for development and testing
37 lines
1.5 KiB
JavaScript
37 lines
1.5 KiB
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
const puppeteer = require('puppeteer-core');
|
|
|
|
(async () => {
|
|
try {
|
|
const token = process.env.BROWSERLESS_TOKEN;
|
|
if (!token) {
|
|
console.error('No BROWSERLESS_TOKEN');
|
|
process.exit(1);
|
|
}
|
|
const broadcastUrl = process.env.BROADCAST_URL || 'https://avanzacast-broadcastpanel.bfzqqk.easypanel.host';
|
|
const wsEndpoint = process.env.BROWSERLESS_WS || `wss://browserless.bfzqqk.easypanel.host?token=${token}`;
|
|
const outDir = path.resolve(process.cwd(), 'packages', 'broadcast-panel', 'tmp');
|
|
if (!fs.existsSync(outDir)) fs.mkdirSync(outDir, { recursive: true });
|
|
const outFile = path.join(outDir, 'public_page.html');
|
|
|
|
console.log('Connecting to Browserless at', wsEndpoint);
|
|
const browser = await puppeteer.connect({ browserWSEndpoint: wsEndpoint, defaultViewport: { width: 1280, height: 900 } });
|
|
const page = await browser.newPage();
|
|
page.on('console', m => console.log('PAGE_CONSOLE:', m.type(), m.text()));
|
|
page.on('pageerror', e => console.error('PAGE_ERROR:', e && e.stack ? e.stack : e));
|
|
|
|
console.log('Navigating to', broadcastUrl);
|
|
await page.goto(broadcastUrl, { waitUntil: 'networkidle2', timeout: 60000 });
|
|
const html = await page.content();
|
|
fs.writeFileSync(outFile, html, 'utf8');
|
|
console.log('Saved HTML to', outFile);
|
|
await browser.disconnect();
|
|
process.exit(0);
|
|
} catch (err) {
|
|
console.error('FATAL', err && err.stack ? err.stack : err);
|
|
process.exit(2);
|
|
}
|
|
})();
|
|
|