Vanilla JS uden build-trin: én WebSocket pr. skærm med automatisk genforbindelse, tegner altid fra seneste snapshot. Storskærmen viser kode, QR, nedtælling og en animeret afsløring; telefonen er bygget til store knapper og genoptager sin plads efter genindlæsning. dev.html viser alle faser uden server. deploy/ har systemd-unit, deploy-script og en bot-test, der spiller et helt spil mod en kørende server. Claude-Session: https://claude.ai/code/session_01JmhJG6JnhXfzNiKv8f2vHu
32 lines
1.6 KiB
JavaScript
32 lines
1.6 KiB
JavaScript
const puppeteer = require('/opt/isms/node_modules/puppeteer');
|
|
const base = 'file:///root/wppui/dev.html';
|
|
const WAIT = 2200;
|
|
const jobs = [];
|
|
const phases = ['join','lobby','category','lie','guess','reveal','scores','final'];
|
|
for (const p of phases) {
|
|
jobs.push({name:`all-${p}`, url:`${base}?phase=${p}`, w:2620, h:930});
|
|
jobs.push({name:`host-${p}`, url:`${base}?phase=${p}&only=host`, w:1920, h:1080});
|
|
}
|
|
for (const t of [500, 1700, 3200, 11200, 15200, 17500]) {
|
|
jobs.push({name:`host-reveal-t${t}`, url:`${base}?phase=reveal&only=host&t=${t - WAIT}`, w:1920, h:1080});
|
|
}
|
|
jobs.push({name:`phones360-lie`, url:`${base}?phase=lie&only=phones&pw=360`, w:1300, h:930});
|
|
jobs.push({name:`phones360-guess`, url:`${base}?phase=guess&only=phones&pw=360`, w:1300, h:930});
|
|
jobs.push({name:`host720-lobby`, url:`${base}?phase=lobby&only=host`, w:1280, h:720});
|
|
const only = process.argv[2];
|
|
(async () => {
|
|
const browser = await puppeteer.launch({args:['--no-sandbox']});
|
|
const page = await browser.newPage();
|
|
page.on('console', m => { if (m.type()==='error' || m.type()==='warning') console.log('CONSOLE', m.type(), m.text()); });
|
|
page.on('pageerror', e => console.log('PAGEERROR', e.message));
|
|
for (const j of jobs) {
|
|
if (only && !j.name.includes(only)) continue;
|
|
await page.setViewport({width:j.w, height:j.h});
|
|
await page.goto(j.url, {waitUntil:'load', timeout: 15000}).catch(e=>console.log('goto', e.message));
|
|
await new Promise(r=>setTimeout(r, WAIT));
|
|
await page.screenshot({path:`/root/wppui/shots/${j.name}.png`});
|
|
console.log('shot', j.name);
|
|
}
|
|
await browser.close();
|
|
})();
|