Runde 7: Stream-Deck-Tasten zeigen Zeichen und Zustand, MIDI-Pads bekommen Note an/aus, Saal-Fenster öffnet mit Zocken starten (mit Spende, Tipp-Runde, Zuschauerzahl); mess-zocken mit eigenem Handy-Zugang

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-05 15:26:19 +01:00
co-authored by Claude Opus 5.5
parent 8d93cc24ec
commit b5698eb2a1
59 changed files with 1000 additions and 848 deletions
+8 -4
View File
@@ -107,9 +107,13 @@ function anlegen(name, rolle, code) {
.run(name, rolle, hash, salt, 32768,
createHmac("sha256", kenn).update(code).digest("hex"), ALT);
}
const CODES = { admin: "CODE-Z00-000001", gast: "CODE-Z01-000001" };
const CODES = { admin: "CODE-Z00-000001", gast: "CODE-Z01-000001", handy: "CODE-Z02-000001" };
anlegen("Filipe", "admin", CODES.admin);
anlegen("Nachtfalter", "gast", CODES.gast);
/* EIN EIGENER ZUGANG FÜR DIE HANDY-ZUSCHAUER (05.11.2026): Mit demselben Zugang
wie der Rechner-Zuschauer nahm jede Handy-Seite dessen Leitung (eine je Person
auf dem Direktweg) – danach maß der Rechner-Zuschauer Stille. */
anlegen("Lenny", "gast", CODES.handy);
d.close();
function roh(pfad, { method = "GET", keks = "", rumpf = null } = {}) {
@@ -138,11 +142,11 @@ function roh(pfad, { method = "GET", keks = "", rumpf = null } = {}) {
}
async function anmelden(rolle) {
const a = await roh("/workspace/api/anmelden", {
method: "POST", rumpf: { rolle, code: CODES[rolle], alter_ok: true },
method: "POST", rumpf: { rolle: rolle === "handy" ? "gast" : rolle, code: CODES[rolle], alter_ok: true },
});
return [].concat(a.kopf["set-cookie"] || []).map((z) => z.split(";")[0]).join("; ");
}
const k = { admin: await anmelden("admin"), gast: await anmelden("gast") };
const k = { admin: await anmelden("admin"), gast: await anmelden("gast"), handy: await anmelden("handy") };
/* ---------- Der Vorbau (https, weil WebRTC es verlangt) ----------------- */
const schluesselDatei = join(ordner, "p.key");
@@ -627,7 +631,7 @@ ok(kam, "beim Zuschauer kommt ein Bild an (videoWidth > 0)");
nur „liegt sie obenauf", sondern auch: ganz im Bild, auf keinem
anderen Bedienelement, und keine Schrift unter 11 Punkten. */
for (const [lage, b, h] of [["hoch", 390, 844], ["schmal", 360, 780], ["quer", 844, 390]]) {
const hy = await alsWer("gast", false, b, h);
const hy = await alsWer("handy", false, b, h);
await hy.seite.goto(`${BASIS}/workspace/reaktion.html`, { waitUntil: "domcontentloaded" });
const da = await warteBis(() => hy.seite.evaluate(() =>
!!document.querySelector('.sziel[data-an="ja"] .szk[data-sichtbar="ja"]')
+25 -1
View File
@@ -206,12 +206,14 @@ seite.on("console", (m) => { if (m.type() === "error" && !/compute-pressure|yout
Tasten ab Byte 3). */
await seite.addInitScript(() => {
const geraet = { vendorId: 0x0fd9, productId: 0x0080, productName: "Stream Deck MK.2", opened: false, h: [],
async open() { this.opened = true; }, addEventListener(a, f) { if (a === "inputreport") this.h.push(f); }, removeEventListener(a, f) { this.h = this.h.filter((x) => x !== f); } };
async open() { this.opened = true; }, berichte: [], async sendReport(id, daten) { this.berichte.push({ id, d: Array.from(daten.slice(0, 7)), jpeg: daten[7] === 0xff && daten[8] === 0xd8 }); }, addEventListener(a, f) { if (a === "inputreport") this.h.push(f); }, removeEventListener(a, f) { this.h = this.h.filter((x) => x !== f); } };
window.__sd = geraet;
window.__sdDruck = (taste) => {
const bytes = new Uint8Array(3 + 15); bytes[0] = 0; bytes[1] = 15; if (taste >= 0) bytes[3 + taste] = 1;
for (const f of geraet.h) f({ reportId: 1, device: geraet, data: new DataView(bytes.buffer) });
};
window.__midiAus = [];
navigator.requestMIDIAccess = async () => ({ inputs: new Map(), outputs: new Map([["o1", { name: "RØDECaster", send: (b) => window.__midiAus.push(Array.from(b)) }]]), onstatechange: null });
Object.defineProperty(navigator, "hid", { configurable: true, value: { requestDevice: async () => [geraet], getDevices: async () => [geraet] } });
window.__tasten = [];
document.addEventListener("keydown", (e) => { if (!e.isTrusted) window.__tasten.push(e.key); }, true);
@@ -255,6 +257,28 @@ const z2 = await seite.evaluate(() => window.Pads.zuordnung());
ok(z2["sd:1:2"] === "band" && !Object.values(z2).includes("moment"), `eine Taste, eine Funktion: Taste 3 ist jetzt nur noch „Band“ (${JSON.stringify(z2)})`);
const sagt = await seite.evaluate(() => document.getElementById("pads-sagt").textContent);
ok(/Stream Deck · Taste 3 war „Moment merken“/.test(sagt), `und das wird gesagt („${sagt}“)`);
/* Rückmeldung (Runde 7): Taste 3 bekommt ihr Bild (JPEG in 1016er-Stücken, Bericht 2). */
await warte(1500);
const bilder = await seite.evaluate(() => window.__sd.berichte.filter((b) => b.d[1] === 2));
ok(bilder.length >= 1 && bilder[0].id === 2 && bilder[0].d[0] === 0x07 && bilder[0].jpeg && bilder.at(-1).d[2] === 1, `Taste 3 bekommt ihr Zeichen als Bild (${bilder.length} Stück, JPEG, letztes markiert)`);
/* Mikro stumm → das Bild der Mikro-Taste wechselt auf „aus“ */
await seite.evaluate(() => { window.Pads.zuordnen("mikro", "sd:1:7"); window.Pads.zuordnen("kamera", "note:1:36"); });
await warte(1500);
const vorStumm = await seite.evaluate(() => window.__sd.berichte.filter((b) => b.d[1] === 7).length);
await seite.evaluate(() => { const m = document.getElementById("s-mikro"); m.setAttribute("aria-pressed", "true"); });
await warte(1500);
const nachStumm = await seite.evaluate(() => window.__sd.berichte.filter((b) => b.d[1] === 7).length);
ok(vorStumm >= 1 && nachStumm > vorStumm, `Mikro stumm: die Mikro-Taste bekommt ein neues Bild (${vorStumm} → ${nachStumm} Berichte)`);
await seite.evaluate(() => document.getElementById("s-mikro").setAttribute("aria-pressed", "false"));
/* MIDI: ein Pad bekommt Note an/aus für seinen Zustand – erst nach dem Verbinden */
await seite.evaluate(() => window.Pads.verbinden());
await warte(1500);
const m1 = await seite.evaluate(() => window.__midiAus.slice());
await seite.evaluate(() => document.getElementById("s-kamera").setAttribute("aria-pressed", "true"));
await warte(1500);
const m2 = await seite.evaluate(() => window.__midiAus.slice());
await seite.evaluate(() => document.getElementById("s-kamera").setAttribute("aria-pressed", "false"));
ok(m1.some((x) => x[0] === 0x90 && x[1] === 36 && x[2] === 127) && m2.some((x) => x[0] === 0x90 && x[1] === 36 && x[2] === 0), `das Kamera-Pad bekommt Note 36 an (127) und bei „Kamera aus“ aus (0): ${JSON.stringify(m2.slice(-2))}`);
if (BILDER) await seite.locator("#pads").screenshot({ path: `${BILDER}/streamdeck-1440.png` });
ok(!konsole.length, `keine Fehler in der Konsole (${konsole.slice(0, 3).join(" | ")})`);
await browser.close();
+6
View File
@@ -209,10 +209,16 @@ await s.goto(`${BASIS}/workspace/reaktion.html`, { waitUntil: "domcontentloaded"
await s.waitForSelector("#zock-start", { state: "attached", timeout: 20000 });
await s.waitForFunction(() => window.RegieLaden?.fertig?.(), null, { timeout: 20000 }).catch(() => {});
await s.fill("#zock-titel", "Ton-Probe");
const pipKommt = kx.waitForEvent("page", { timeout: 15000 }).catch(() => null);
await s.click("#zock-start");
let teile = false;
for (let i = 0; i < 60 && !teile; i++) { teile = await s.evaluate(() => !!window.SaalKamera?.teile?.()?.spiel); if (!teile) await warte(500); }
ok(teile, "beim Zocken gibt es Mikro und Spiel als Einzelausgänge");
/* Runde 7: Das Saal-Fenster geht mit „Zocken starten“ auf (derselbe Klick, solange die Frist reicht). */
const pip = await pipKommt;
if (pip) await pip.waitForTimeout(1500);
const pz = pip ? await pip.evaluate(() => ({ stand: document.getElementById("sf-stand")?.textContent, zeilen: [...document.querySelectorAll(".sf-zeile")].map((x) => x.textContent) })) : null;
ok(!!pip && pz?.stand === "LIVE" && pz.zeilen.some((z) => /sehen zu|sieht zu/.test(z)), `„Zocken starten“ öffnet das Saal-Fenster gleich mit, mit Zuschauerzeile (${JSON.stringify(pz)})`);
await s.evaluate(() => document.getElementById("reiter-ton")?.click());
let q = null;
for (let i = 0; i < 40; i++) { q = await s.evaluate(() => window.Lautheit?.quellen?.()); if (q?.mikro?.bloecke > 30 && q?.spiel?.bloecke > 30) break; await warte(300); }