From ed132e8bc63c8778884ad884606e6c37080654ab Mon Sep 17 00:00:00 2001 From: Dogfather Date: Wed, 11 Nov 2026 18:33:53 +0100 Subject: [PATCH] =?UTF-8?q?Rudel-Chat=20Feinschliff=20nach=20dem=20Ger?= =?UTF-8?q?=C3=A4te-Rundgang=20(Handy,=20Web-App,=20Safari,=20PC)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gefunden mit dem neuen Rundgang (server/mess-rudel-rundgang.mjs): zehn Gerätelagen inkl. installierter App mit Notch/Gestenleiste und Safari (WebKit), je Zustand Überdeckung, Rand, Tippflächen, Schrift, Konsole. - Installierte App am iPhone: Chat-Kopf lag unter Uhr/Notch, unter der Eingabe blieb ein schwarzer Streifen – jetzt halten Kopf, Eingabe und Verlauf selbst den Sicherheitsabstand (auch quer links/rechts). - Griffbrett: Der Loslass-Klick nach langem Druck traf „Ausblenden“ – ein Zeiger-Klick zählt nur noch, wenn sein Druck im offenen Blatt begann (nur Crew). Das geschlossene Blatt schien hinter der Liste durch (display-Regel schlug die Dialog-Vorgabe). - Werkzeugleiste setzt sich über die Blase, wenn daneben kein Platz ist (Faden offen am PC rollte der Verlauf seitlich). - Querformat/niedrige Fenster: Kopf, Aushang, Rückblick (eingeklappt mit „Zeigen“) und Eingabe rücken zusammen. - Aushänge auch am PC einzeilig mit Zähler; Wischleisten blenden am Rand weich aus; Tippflächen ≥ 44 px auch quer; Rollen-Plakette lesbar. Prüfung mit Gegenproben (Loslassen über „Ausblenden“, geschlossenes Blatt ohne Fläche). Chat-Reihe 46 Dateien grün. Co-Authored-By: Claude Opus 5.5 --- server/mess-rudel-rundgang.mjs | 503 +++++++++++++++++++++++++ server/pruef-rudel-vollendet.mjs | 38 ++ workspace/anleitung.html | 28 +- workspace/anruf-probe.html | 10 +- workspace/app.webmanifest | 8 +- workspace/assets/css/chat-rudel.css | 123 +++++- workspace/assets/js/chat-griff.js | 14 + workspace/assets/js/chat-ordnung.js | 67 +++- workspace/assets/js/chat-rueckblick.js | 15 +- workspace/aufgaben.html | 38 +- workspace/automation.html | 32 +- workspace/befinden.html | 34 +- workspace/bereich.html | 48 +-- workspace/bewerben.html | 38 +- workspace/bewerbungen.html | 36 +- workspace/buehne.html | 12 +- workspace/calls.html | 34 +- workspace/chat.html | 64 ++-- workspace/content.html | 34 +- workspace/crew-index.html | 12 +- workspace/crew.webmanifest | 8 +- workspace/dateien.html | 34 +- workspace/dogtags.html | 38 +- workspace/entwicklung.html | 36 +- workspace/fernbedienung.html | 20 +- workspace/hilfe.html | 30 +- workspace/index.html | 10 +- workspace/kalender.html | 34 +- workspace/koppeln.html | 14 +- workspace/leistung.html | 32 +- workspace/manager-ziele.html | 30 +- workspace/material.html | 32 +- workspace/nachbericht.html | 22 +- workspace/notizen.html | 28 +- workspace/personen.html | 32 +- workspace/probesaal.html | 14 +- workspace/profil.html | 36 +- workspace/reaktion-foyer.html | 38 +- workspace/reaktion.html | 166 ++++---- workspace/rechte.html | 34 +- workspace/report.html | 36 +- workspace/scouting.html | 32 +- workspace/start.html | 40 +- workspace/startcheck.html | 34 +- workspace/steckbrief.html | 36 +- workspace/support.html | 32 +- workspace/tafel.html | 10 +- workspace/talente.html | 36 +- workspace/team.html | 32 +- workspace/teamlage.html | 34 +- workspace/teilen.html | 30 +- workspace/treff-moderation.html | 32 +- workspace/treff-regeln.html | 32 +- workspace/uebersicht.html | 32 +- workspace/unsere-seiten.html | 30 +- workspace/unterstuetzen.html | 32 +- workspace/werdegang.html | 32 +- workspace/willkommen.html | 2 +- workspace/wissen.html | 34 +- 59 files changed, 1598 insertions(+), 856 deletions(-) create mode 100644 server/mess-rudel-rundgang.mjs diff --git a/server/mess-rudel-rundgang.mjs b/server/mess-rudel-rundgang.mjs new file mode 100644 index 00000000..a979ce0c --- /dev/null +++ b/server/mess-rudel-rundgang.mjs @@ -0,0 +1,503 @@ +/* ===================================================================== + mess-rudel-rundgang.mjs — Der Rudel-Chat auf jedem Gerät (11.11.2026) + + Kein Prüfstand, sondern ein Rundgang mit Messgerät: Ein Rudel mit + ALLEM, was es gibt (Text, lange Texte, Nur-Emoji, Antworten, + Reaktionen, Faden, Umfrage, Termin, Bilder-Raster, Sprachnachricht mit + Abschrift, Sticker, Aushänge, Angeheftetes, Rückblick), wird auf + Handy (klein/mittel/groß), als installierte Web-App (Vollbild, mit + Sicherheitsabständen wie am iPhone) und am Rechner (drei Größen) + geöffnet -- in jedem Zustand, den ein Mensch herstellen kann. + + Je Zustand wird gemessen: + · ragt etwas über den Rand (waagerecht)? + · liegt etwas über einem Knopf (elementFromPoint in der Mitte)? + · Tippflächen am Finger unter 44 px? + · Schrift unter 11,5 px? + · Fehler in der Konsole? + und ein Bild gemacht: /tmp/rundgang/-.png + + Aufruf: node server/mess-rudel-rundgang.mjs [nur-geraet] + ===================================================================== */ +import { mkdtempSync, mkdirSync, readFileSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { execFileSync } from "node:child_process"; +import { request as httpAnfrage } from "node:http"; +import { createServer as httpsServer } from "node:https"; +import { eigenerPort } from "./helfer-port.mjs"; +import { notbremse } from "./helfer-notbremse.mjs"; +import { zertifikatBauen } from "./helfer-openssl.mjs"; + +const NUR = process.argv[2] || ""; +const ZIEL = process.env.RUNDGANG_BILDER || join(tmpdir(), "rundgang"); +mkdirSync(ZIEL, { recursive: true }); +const PORT = await eigenerPort(import.meta); +const HP = await eigenerPort(import.meta, "mess-rudel-rundgang (HTTPS)", 1); +const CREW = "crew.dogfather-universe.com"; +const ordner = mkdtempSync(join(tmpdir(), "ws-rundgang-")); +process.env.WORKSPACE_DB = join(ordner, "workspace.db"); +process.env.PORT = String(PORT); +process.env.SITE_ACCESS_SECRET = "lokaler-test"; +process.env.SITE_PUBLIC_LAUNCH_AT = "2020-01-01T00:00:00+01:00"; +const STUNDE = (d = new Date()) => Number(new Intl.DateTimeFormat("de-DE", { timeZone: "Europe/Berlin", hour: "2-digit", hour12: false }).format(d).replace(/\D/g, "")) % 24; +const stunde = STUNDE(); +process.env.TREFF_NACHT_AB = String((stunde + 3) % 24); +process.env.TREFF_NACHT_BIS = String((stunde + 5) % 24); +process.env.PUSH_RUHE_AB = String((stunde + 3) % 24); +process.env.PUSH_RUHE_BIS = String((stunde + 4) % 24); +process.env.WHISPER_ATTRAPPE = join(ordner, "w.mjs"); +writeFileSync(process.env.WHISPER_ATTRAPPE, "process.stdout.write(' Hallo Rudel, heute Abend um acht spielen wir zusammen. Wer Lust hat, kommt einfach dazu.');"); + +const express = (await import("express")).default; +const ec = express.response.cookie; +express.response.cookie = function (n, w, o) { return ec.call(this, n, w, { ...(o || {}), secure: false }); }; +await import("./index.js"); +notbremse(1_500_000, "mess-rudel-rundgang"); +await new Promise((r) => setTimeout(r, 700)); + +const { DatabaseSync } = await import("node:sqlite"); +const { scryptSync, randomBytes, createHmac } = await import("node:crypto"); +const oeffne = () => new DatabaseSync(process.env.WORKSPACE_DB); +const sql = (q, ...w) => { const db = oeffne(); try { return db.prepare(q).all(...w); } finally { db.close(); } }; +const d = oeffne(); +const vorMin = (m) => new Date(Date.now() - m * 60_000).toISOString(); +const sch = randomBytes(32).toString("hex"); +d.prepare("INSERT INTO einstellungen (schluessel, wert, geaendert, von) VALUES (?,?,?,NULL) ON CONFLICT(schluessel) DO NOTHING").run("code_kennung_schluessel", sch, vorMin(0)); +const anlegen = (name, rolle, code, tageAlt = 60) => { + const s = randomBytes(16).toString("hex"); + const h = scryptSync(code, s, 64, { N: 32768, r: 8, p: 1, maxmem: 96 * 1024 * 1024 }).toString("hex"); + return d.prepare("INSERT INTO personen (name, rolle, code_hash, code_salt, code_n, code_kennung, aktiv, erstellt, rudel_regeln_am) VALUES (?,?,?,?,?,?,1,?,?) RETURNING id") + .get(name, rolle, h, s, 32768, createHmac("sha256", sch).update(code).digest("hex"), vorMin(tageAlt * 1440), vorMin(5000)).id; +}; +const P = { + Dogfather: anlegen("Dogfather", "admin", "CODE-DOGI-0001"), Diene: anlegen("Diene", "modi", "CODE-MODI-0001"), + Ghost: anlegen("Ghost", "modi", "CODE-MODI-0002"), VanVan: anlegen("VanVan", "hand", "CODE-HAND-0001"), + Mila: anlegen("Mila", "gast", "CODE-GAST-0001", 45), Paul: anlegen("Paul", "gast", "CODE-GAST-0002", 40), + Lena: anlegen("Lena", "gast", "CODE-GAST-0003", 2), Maximilian: anlegen("Maximilian-Alexander", "gast", "CODE-GAST-0004", 30), + Nora: anlegen("Nora", "gast", "CODE-GAST-0005", 0.1), +}; +/* Die Chat-Moderation gibt es live schon; hier wird sie angelegt (team-raeume legt sie nicht an). */ +d.prepare("INSERT INTO chat_raeume (art, name, kategorie, erstellt, erstellt_von, haus) VALUES ('kanal','Chat-Moderation','chat',?,?,'crew')").run(vorMin(90000), P.Dogfather); +d.prepare("INSERT INTO chat_raeume (art, name, kategorie, erstellt, erstellt_von, haus) VALUES ('kanal','Abmeldungen','eigen-abmeldung',?,?,'crew')").run(vorMin(90000), P.Dogfather); +/* Nora ist neu: Regeln noch nicht bestätigt, noch nichts geschrieben. */ +d.prepare("UPDATE personen SET rudel_regeln_am = NULL WHERE id = ?").run(P.Nora); +const rudel = d.prepare("INSERT INTO chat_raeume (art, name, kategorie, erstellt, erstellt_von, haus) VALUES ('kanal','Das Rudel','treff',?,?,'crew') RETURNING id").get(vorMin(90000), P.Dogfather).id; +for (const [n, id] of Object.entries(P)) { + d.prepare("INSERT INTO chat_teilnehmer (raum_id, person_id, seit, gelesen_bis, leitung, zuletzt_da) VALUES (?,?,?,0,?,?)") + .run(rudel, id, vorMin(90000), ["Dogfather", "Diene", "Ghost", "VanVan"].includes(n) ? 1 : 0, new Intl.DateTimeFormat("en-CA", { timeZone: "Europe/Berlin" }).format(new Date())); +} +const T = (wer, text, min, extra = {}) => { + const id = d.prepare("INSERT INTO chat_nachrichten (raum_id, person_id, text, erstellt) VALUES (?,?,?,?) RETURNING id").get(rudel, P[wer], text, vorMin(min)).id; + for (const [k, v] of Object.entries(extra)) d.prepare(`UPDATE chat_nachrichten SET ${k} = ? WHERE id = ?`).run(v, id); + return id; +}; +const R = (id, wer, z) => d.prepare("INSERT OR IGNORE INTO chat_reaktionen (nachricht_id, person_id, zeichen, wann) VALUES (?,?,?,?)").run(id, P[wer], z, vorMin(1)); +/* Gestern */ +T("Mila", "Gute Nacht ihr Lieben 🌙", 1500); +T("Paul", "Schlaft gut!", 1495); +/* Heute */ +const morgen = T("Mila", "Guten Morgen ihr Lieben ☀️", 600); +for (const w of ["Diene", "Paul", "VanVan", "Lena"]) R(morgen, w, "🩵"); +T("Diene", "Moin!", 595); +T("Paul", "Morgen 👋", 590); +const lang = T("Maximilian", "Ich wollte nur mal sagen, dass ich den Stream gestern richtig gut fand – vor allem den Teil, wo ihr das Rätsel gelöst habt und alle im Chat gleichzeitig „JAAA“ geschrieben haben. Das war so ein Moment, für den ich hier bin. Danke euch allen dafür, wirklich! https://www.beispiel.de/ein-sehr-langer-link-der-nicht-umbrechen-will-und-trotzdem-in-die-blase-passen-muss", 585); +R(lang, "Mila", "🩵"); R(lang, "Diene", "🩵"); R(lang, "Ghost", "🔥"); +T("Mila", "😂😂😂", 580); +T("Lena", "Hey! Bin über den Stream gestern hier gelandet 😊", 575); +T("Lena", "Wann ist der nächste?", 574); +const antw = T("Ghost", "Heute 20 Uhr! Willkommen im Rudel 🐺", 570); +d.prepare("UPDATE chat_nachrichten SET antwort_auf = ? WHERE id = ?").run(antw - 1, antw); +T("Dogfather", "📌 Streamplan Woche 46 – heute 20 Uhr Koop, Freitag Quizabend", 560, { angeheftet_am: vorMin(559), angeheftet_von: P.Dogfather }); +T("Paul", "||Spoiler: Der Boss hat nur 1 HP am Ende||", 555); +const faden = T("Diene", "Wer macht heute die Clips?", 550); +d.prepare("INSERT INTO chat_nachrichten (raum_id, person_id, text, erstellt, faden_von) VALUES (?,?,?,?,?)").run(rudel, P.VanVan, "Ich mach das!", vorMin(548), faden); +d.prepare("INSERT INTO chat_nachrichten (raum_id, person_id, text, erstellt, faden_von) VALUES (?,?,?,?,?)").run(rudel, P.Mila, "Ich helf mit 🎬", vorMin(546), faden); +/* Der Stand des Betrachters: Paul liest seit 8 h nicht -- es kommt der Rückblick. */ +const paulStand = sql("SELECT MAX(id) AS m FROM chat_nachrichten")[0]?.m; +d.prepare("UPDATE chat_nachrichten SET erstellt = ? WHERE raum_id = ? AND erstellt > ?").run(vorMin(480), rudel, vorMin(480)); +for (let i = 0; i < 8; i++) T(["Mila", "Lena", "Ghost", "VanVan"][i % 4], ["Ich bin heute Abend dabei!", "Ich auch 🙋‍♀️", "Super, dann sind wir viele", "Ich bring Snacks mit 🍿", "Haha 😂", "Welches Spiel eigentlich?", "Das sehen wir dann 😉", "Freu mich!"][i], 400 - i * 20); +d.prepare("UPDATE chat_nachrichten SET erstellt = ? WHERE id <= ? AND raum_id = ?").run(vorMin(500), paulStand, rudel); +d.close(); +const CH = await import("./workspace-chat.js"); +(await import("./team-raeume.js")).teamRaeumeAngleichen(); +CH.gifStartbestand(); + +const anfrage = (pfad, { art = "GET", koerper = null, keks = "", roh = null, kopf = {} } = {}) => new Promise((fertig, schief) => { + const k = { Host: CREW, Origin: `https://${CREW}`, "Content-Type": roh ? "application/octet-stream" : "application/json", ...kopf }; + if (keks) k.Cookie = keks; + const a = httpAnfrage({ host: "127.0.0.1", port: PORT, path: pfad, method: art, headers: k, agent: false }, (r) => { + let t = ""; r.setEncoding("utf8"); r.on("data", (x) => { t += x; }); + r.on("end", () => { let daten = null; try { daten = JSON.parse(t); } catch { /* */ } fertig({ code: r.statusCode, daten, keks: (r.headers["set-cookie"] || []).map((x) => x.split(";")[0]).join("; ") }); }); + }); + a.on("error", schief); + if (roh) a.write(roh); else if (koerper) a.write(JSON.stringify(koerper)); + a.end(); +}); +const anmelden = async (koerper) => (await anfrage("/workspace/api/anmelden", { art: "POST", koerper })).keks; +const K = { + paul: await anmelden({ rolle: "gast", code: "CODE-GAST-0002", alter_ok: true }), + diene: await anmelden({ rolle: "modi", code: "CODE-MODI-0001" }), + mila: await anmelden({ rolle: "gast", code: "CODE-GAST-0001", alter_ok: true }), +}; +const ff = (await import("./helfer-ffmpeg.mjs")).ffmpegPfad(); +const bild = (farbe, b, h) => { const f = join(ordner, `${farbe}.png`); execFileSync(ff, ["-v", "error", "-y", "-f", "lavfi", "-i", `color=c=0x${farbe}:s=${b}x${h}`, "-frames:v", "1", f]); return readFileSync(f); }; +const hoch = async (keks, roh, name, kopf = {}) => (await anfrage(`/workspace/api/chat/raeume/${rudel}/anhang`, { art: "POST", keks, roh, kopf: { "x-dateiname": name, ...kopf } })).daten?.nachricht; +/* Umfrage, Termin, Bilder, Sprachnachricht -- über die echten Wege */ +const um = await anfrage(`/workspace/api/chat/raeume/${rudel}/umfrage`, { art: "POST", keks: K.diene, koerper: { frage: "Welches Spiel heute Abend?", antworten: ["Koop-Abenteuer", "Rennspiel", "Quiz mit dem ganzen Rudel"] } }); +await anfrage(`/workspace/api/chat/umfragen/${um.daten?.nachricht?.umfrage?.id}/stimme`, { art: "PUT", keks: K.mila, koerper: { wahl: [0] } }); +await anfrage(`/workspace/api/chat/raeume/${rudel}/termin`, { art: "POST", keks: K.diene, koerper: { titel: "Rudel-Abend: Koop", beginn: new Date(Date.now() + 4 * 3600e3).toISOString(), ort: "Stream" } }); +const b1 = await hoch(K.diene, bild("c8503c", 1200, 900), "foto1.png"); +const b2 = await hoch(K.diene, bild("3c64c8", 900, 1200), "foto2.png"); +const b3 = await hoch(K.diene, bild("3cc864", 1200, 900), "foto3.png"); +const vorl = sql("SELECT anhang_datei, anhang_typ, anhang_name, anhang_groesse, anhang_breite, anhang_hoehe, anhang_farbe FROM chat_nachrichten WHERE id = ?", b2?.id)[0]; +for (let i = 0; i < 2; i++) { + sql(`INSERT INTO chat_nachrichten (raum_id, person_id, text, erstellt, anhang_art, anhang_datei, anhang_typ, anhang_name, anhang_groesse, anhang_breite, anhang_hoehe, anhang_farbe) + VALUES (?,?,'',?,'bild',?,?,?,?,?,?,?)`, rudel, P.Diene, new Date().toISOString(), vorl.anhang_datei, vorl.anhang_typ, vorl.anhang_name, vorl.anhang_groesse, vorl.anhang_breite, vorl.anhang_hoehe, vorl.anhang_farbe); +} +await new Promise((r) => setTimeout(r, 10_500)); /* Mengen-Bremse */ +const einzel = await hoch(K.mila, bild("b48cdc", 800, 1000), "einzeln.png"); +const tonF = join(ordner, "ton.m4a"); +execFileSync(ff, ["-v", "error", "-y", "-f", "lavfi", "-i", "sine=frequency=330:duration=6", "-c:a", "aac", "-b:a", "48k", tonF]); +const ton = await hoch(K.diene, readFileSync(tonF), "sprachnachricht.m4a", { "x-dauer": "6000" }); +await anfrage(`/workspace/api/chat/nachrichten/${ton?.id}/abschrift`, { art: "POST", keks: K.mila }); +await anfrage(`/workspace/api/chat/raeume/${rudel}/nachrichten`, { art: "POST", keks: K.mila, koerper: { text: "[[sticker:pfote]]" } }); +await new Promise((r) => setTimeout(r, 10_500)); +await anfrage(`/workspace/api/chat/raeume/${rudel}/nachrichten`, { art: "POST", keks: K.mila, koerper: { text: "@Paul kommst du heute auch? 🙂" } }); +sql("UPDATE chat_teilnehmer SET gelesen_bis = ? WHERE raum_id = ? AND person_id = ?", paulStand, rudel, P.Paul); +/* Für die Team-Räume: ein Fall (Paul meldet), eine Abmeldung (Diene). */ +K.nora = await anmelden({ rolle: "gast", code: "CODE-GAST-0005", alter_ok: true }); +const zuMelden = sql("SELECT id FROM chat_nachrichten WHERE raum_id = ? AND person_id = ? AND text LIKE 'Haha%' LIMIT 1", rudel, P.Lena)[0]?.id + || sql("SELECT id FROM chat_nachrichten WHERE raum_id = ? AND person_id = ? ORDER BY id DESC LIMIT 1", rudel, P.Lena)[0]?.id; +await anfrage(`/workspace/api/chat/nachrichten/${zuMelden}/melden`, { art: "POST", keks: K.paul, koerper: { grund: "Das war nicht nett gegenüber den Neuen, bitte ansehen." } }); +const heuteB = new Intl.DateTimeFormat("en-CA", { timeZone: "Europe/Berlin" }).format(new Date()); +const inZwei = new Intl.DateTimeFormat("en-CA", { timeZone: "Europe/Berlin" }).format(new Date(Date.now() + 2 * 86400e3)); +await anfrage("/workspace/api/chat/abmeldung", { art: "POST", keks: K.diene, koerper: { von: heuteB, bis: inZwei, einspringer: "Ghost" } }); +const RAUM = Object.fromEntries(sql("SELECT kategorie, id FROM chat_raeume WHERE kategorie LIKE 'eigen-%' OR kategorie = 'chat'").map((z) => [z.kategorie, z.id])); +console.log(`Team-Räume: ${Object.keys(RAUM).join(", ")}`); +console.log(`Daten: ${sql("SELECT COUNT(*) AS n FROM chat_nachrichten WHERE raum_id = ?", rudel)[0].n} Nachrichten, Bilder ${[b1, b2, b3, einzel].filter(Boolean).length}, Ton ${ton ? "ja" : "nein"}`); + +/* ---- Vorbau und Browser ---- */ +const schl = join(ordner, "b.key"), zert = join(ordner, "b.crt"); +zertifikatBauen(schl, zert, CREW); +const vorbau = httpsServer({ key: readFileSync(schl), cert: readFileSync(zert) }, (von, nach) => { + const w = httpAnfrage({ host: "127.0.0.1", port: PORT, path: von.url, method: von.method, headers: { ...von.headers, host: `${CREW}:${HP}` } }, + (a) => { nach.writeHead(a.statusCode || 502, a.headers); a.pipe(nach); }); + w.on("error", () => { try { nach.destroy(); } catch { /* */ } }); + von.pipe(w); +}); +await new Promise((r) => vorbau.listen(HP, "127.0.0.1", r)); +const pw = await import("file:///C:/Users/qciga/Documents/Obelix/Analyse/node_modules/playwright/index.mjs"); +const browser = await pw.chromium.launch({ args: [`--host-resolver-rules=MAP ${CREW} 127.0.0.1`, "--ignore-certificate-errors"] }); +/* SAFARI (WebKit): kennt keine Chromium-Schalter für die Namensauflösung. + Ein kleiner Weiterleiter nimmt CONNECT für die Testadresse an und + verbindet auf den lokalen Vorbau -- sonst ginge die Anfrage ins Netz. */ +const { createServer: netServer, connect: netConnect } = await import("node:net"); +const umleiter = (await import("node:http")).createServer((q, a) => { a.writeHead(405); a.end(); }); +umleiter.on("connect", (q, sock, kopf) => { + const [host, port] = String(q.url).split(":"); + if (host !== CREW) { sock.end("HTTP/1.1 403 Forbidden\r\n\r\n"); return; } + const z = netConnect(Number(port) || HP, "127.0.0.1", () => { sock.write("HTTP/1.1 200 Connection Established\r\n\r\n"); if (kopf?.length) z.write(kopf); z.pipe(sock); sock.pipe(z); }); + z.on("error", () => sock.destroy()); sock.on("error", () => z.destroy()); +}); +await new Promise((r) => umleiter.listen(0, "127.0.0.1", r)); +let safari = null; + +const GERAETE = [ + { name: "handy-klein", b: 360, h: 740, finger: true }, + { name: "handy", b: 390, h: 844, finger: true }, + { name: "handy-gross", b: 430, h: 932, finger: true }, + { name: "app-iphone", b: 390, h: 844, finger: true, app: true, sicher: { oben: 47, unten: 34 } }, + { name: "app-handy-quer", b: 844, h: 390, finger: true, app: true, sicher: { oben: 0, unten: 21, links: 47, rechts: 47 } }, + { name: "pc-klein", b: 1280, h: 800, finger: false }, + { name: "pc", b: 1440, h: 900, finger: false }, + { name: "pc-gross", b: 1920, h: 1080, finger: false }, + { name: "app-pc", b: 1440, h: 860, finger: false, app: true }, + { name: "iphone-safari", b: 390, h: 844, finger: true, webkit: true }, +].filter((g) => !NUR || g.name === NUR); + +/* Die Messung je Zustand -- im Browser */ +function messung(finger) { + const sichtbar = (e) => { + const r = e.getBoundingClientRect(); const s = getComputedStyle(e); + if (!(r.width > 1 && r.height > 1 && s.visibility !== "hidden" && e.getClientRects().length)) return false; + /* Deckkraft samt Vorfahren: Eine unsichtbare Leiste ist nicht „verdeckt“. */ + for (let a = e; a && a !== document.documentElement; a = a.parentElement) if (getComputedStyle(a).opacity === "0") return false; + return true; + }; + /* Bewusst schwebend -- wer darunter liegt, ist nicht „verdeckt“. */ + const SCHWEBT = "#zum-neuesten, .chat-stickertafel, .chat-datum-oben"; + const befunde = []; + const W = innerWidth, H = innerHeight; + if (document.documentElement.scrollWidth > W + 1) befunde.push(`Seite breiter als das Fenster (${document.documentElement.scrollWidth} > ${W})`); + /* VERSTECKT, ABER DA: ein geschlossener Dialog oder ein [hidden], das + eine eigene display-Regel trotzdem zeichnet (Lehre 16.10./22.10.). */ + for (const e of document.querySelectorAll("dialog:not([open]), [hidden]")) { + if (e.getClientRects().length && e.getBoundingClientRect().height > 0) { + befunde.push(`versteckt, aber gezeichnet: ${e.tagName.toLowerCase()}${e.id ? "#" + e.id : ""}.${String(e.className || "").split(" ")[0]}`); + } + } + for (const id of ["verlauf", "eingabe", "chat-liste"]) { + const e = document.getElementById(id); + if (e && sichtbar(e) && e.scrollWidth > e.clientWidth + 2 && getComputedStyle(e).overflowX !== "visible") befunde.push(`#${id} rollt waagerecht (${e.scrollWidth} > ${e.clientWidth})`); + } + /* DIE OBERSTE EBENE: Ist ein Dialog offen (oder am Handy der Faden über + dem ganzen Schirm), gilt nur sie -- alles darunter ist zu Recht verdeckt. */ + const oberste = (() => { + const dlg = [...document.querySelectorAll("dialog[open]")].filter((x) => x.matches(":modal")); + if (dlg.length) return dlg[dlg.length - 1]; + const sl = document.querySelector(".chat-seitenleiste"); + if (sl && sichtbar(sl)) { const r = sl.getBoundingClientRect(); if (r.width >= W - 2 && r.height >= H - 2) return sl; } + return null; + })(); + /* WEGGEROLLT ist nicht verdeckt: Liegt die Mitte außerhalb eines + beschneidenden Vorfahren (der Verlauf, eine Leiste), zählt es nicht. */ + const imSichtfeld = (e) => { + const r = e.getBoundingClientRect(); + const cx = r.left + r.width / 2, cy = r.top + r.height / 2; + for (let a = e.parentElement; a && a !== document.body; a = a.parentElement) { + const st = getComputedStyle(a); + if (/(auto|scroll|hidden|clip)/.test(st.overflowX + st.overflowY)) { + const q = a.getBoundingClientRect(); + /* 2 px Rand: Was genau auf der Kante liegt, ist angeschnitten, nicht verdeckt. */ + if (cx < q.left + 2 || cx > q.right - 2 || cy < q.top + 2 || cy > q.bottom - 2) return false; + } + } + return true; + }; + const knoepfe = [...document.querySelectorAll("button, a[href], input:not([type=hidden]), textarea, select, summary, [role=button], label.teamwerk__schalter")] + .filter((e) => sichtbar(e) && !e.closest("[hidden], [aria-hidden=true]") && (!oberste || oberste.contains(e)) && imSichtfeld(e)); + const name = (e) => (e.id ? "#" + e.id : "") + "." + String(e.className || "").split(" ")[0] + ` „${(e.getAttribute("aria-label") || e.textContent || e.placeholder || "").trim().slice(0, 24)}“`; + let gezaehlt = 0; + for (const e of knoepfe) { + const r = e.getBoundingClientRect(); + /* nur, was im Fenster liegt -- der Rest ist weggerollt */ + if (r.bottom <= 0 || r.top >= H) continue; + const im = r.left >= -1 && r.right <= W + 1; + const scroller = e.closest("#verlauf, .chat-ecken, .chat-arten, [data-rollt], .chat-liste, .chat-pins, #chat-liste, .reiter, .chat-befehle, .chat-stickertafel, .chat-rueckblick"); + if (!im && !scroller) befunde.push(`ragt über den Rand: ${name(e)} (${Math.round(r.left)}…${Math.round(r.right)})`); + if (r.top < 0 || r.bottom > H) continue; + gezaehlt++; + const cx = Math.min(W - 1, Math.max(0, r.left + r.width / 2)), cy = Math.min(H - 1, Math.max(0, r.top + r.height / 2)); + const oben = document.elementFromPoint(cx, cy); + if (oben && oben !== e && !e.contains(oben) && !oben.contains(e) && !oben.closest(SCHWEBT) && !(e.tagName === "LABEL" && e.control === oben) + && !(e.htmlFor && document.getElementById(e.htmlFor) === oben)) { + const vonVerlauf = oben.closest("#verlauf") && !e.closest("#verlauf"); + befunde.push(`verdeckt: ${name(e)} unter ${name(oben)}${vonVerlauf ? " (vom Verlauf)" : ""}`); + } + if (finger && (r.height < 40 || r.width < 40) && !e.closest(".chat-nachricht__text, .chat-text, p") && e.tagName !== "INPUT" && e.tagName !== "TEXTAREA") { + befunde.push(`klein am Finger: ${name(e)} ${Math.round(r.width)}×${Math.round(r.height)}`); + } + } + const zuKlein = new Set(); + const lauf = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT); + let t; + while ((t = lauf.nextNode())) { + if (!t.textContent.trim() || !t.parentElement) continue; + const e = t.parentElement; + if (!sichtbar(e) || e.closest("[hidden], [aria-hidden=true], script, style") || (oberste && !oberste.contains(e)) || !imSichtfeld(e)) continue; + const r = e.getBoundingClientRect(); + if (r.bottom <= 0 || r.top >= H) continue; + const g = parseFloat(getComputedStyle(e).fontSize); + if (g < 11.5) zuKlein.add(`${name(e)} ${g}px`); + } + for (const z of [...zuKlein].slice(0, 8)) befunde.push(`Schrift zu klein: ${z}`); + return { befunde, gezaehlt }; +} + +const alleBefunde = {}; +async function zustand(g, s, wie, vorher, nachher) { + try { if (vorher) await vorher(); } catch (f) { (alleBefunde[g.name] ||= []).push(`${wie}: Zustand nicht herstellbar – ${String(f).split("\n")[0].slice(0, 120)}`); await aufraeumen(s); return; } + await s.waitForTimeout(450); + const m = await s.evaluate(messung, g.finger); + (alleBefunde[g.name] ||= []).push(...m.befunde.map((b) => `${wie}: ${b}`)); + await s.screenshot({ path: join(ZIEL, `${g.name}-${wie}.png`) }); + console.log(` ${g.name} · ${wie}: ${m.gezaehlt} Bedienelemente, ${m.befunde.length} Befunde`); + if (process.env.RUNDGANG_FRAGE) console.log(" Frage:", JSON.stringify(await s.evaluate(process.env.RUNDGANG_FRAGE).catch((f) => String(f).slice(0, 120)))); + if (nachher) await nachher().catch(() => {}); + await aufraeumen(s); +} +/* JEDER ZUSTAND RÄUMT HINTER SICH AUF -- ein Dialog, der offen bleibt, + fängt sonst den nächsten Klick (im ersten Lauf: „Mila ausblenden“). */ +async function aufraeumen(s) { + await s.evaluate(() => { + for (const d of document.querySelectorAll("dialog[open]")) d.close(); + window.ChatOrdnung?.zu?.(); + const t = document.getElementById("stickertafel"); if (t) t.hidden = true; + }).catch(() => {}); + await s.waitForTimeout(150); +} + +for (const g of GERAETE) { + if (g.webkit && !safari) safari = await pw.webkit.launch({ proxy: { server: `http://127.0.0.1:${umleiter.address().port}` } }); + const k = await (g.webkit ? safari : browser).newContext({ viewport: { width: g.b, height: g.h }, hasTouch: g.finger, isMobile: g.finger, + deviceScaleFactor: g.finger ? 2 : 1, ignoreHTTPSErrors: true }); + await k.addCookies(K.paul.split("; ").map((x) => { const [n, ...r] = x.split("="); return { name: n, value: r.join("="), domain: CREW, path: "/" }; })); + const s = await k.newPage(); + const fehler = []; + s.on("pageerror", (e) => fehler.push("SKRIPT: " + String(e).slice(0, 160))); + s.on("console", (e) => { if (e.type() === "error" && !/favicon|ERR_CERT|net::ERR|Failed to load resource/i.test(e.text())) fehler.push(e.text().slice(0, 160)); }); + const cdp = g.webkit ? null : await k.newCDPSession(s); + if (g.app) { + /* INSTALLIERTE WEB-APP: Chromium kann `display-mode` nicht vortäuschen + (gemessen: setEmulatedMedia greift nicht) -- also antwortet + matchMedia so, wie es die installierte App täte. Die Sicherheits- + abstände kommen echt aus dem Browser (setSafeAreaInsetsOverride). */ + await k.addInitScript(() => { + const echt = window.matchMedia.bind(window); + window.matchMedia = (q) => (/display-mode:\s*standalone/.test(q) + ? { matches: true, media: q, onchange: null, addListener() {}, removeListener() {}, + addEventListener() {}, removeEventListener() {}, dispatchEvent() { return false; } } : echt(q)); + }); + if (g.sicher) { + try { + await cdp.send("Emulation.setSafeAreaInsetsOverride", { insets: { top: g.sicher.oben || 0, bottom: g.sicher.unten || 0, left: g.sicher.links || 0, right: g.sicher.rechts || 0 } }); + } catch (f) { (alleBefunde[g.name] ||= []).push(`(Sicherheitsabstände nicht nachstellbar: ${String(f.message).slice(0, 80)})`); } + } + } + /* Jedes Gerät beginnt beim selben Stand: „8 h weg“, niemand ausgeblendet. */ + sql("UPDATE chat_teilnehmer SET gelesen_bis = ? WHERE raum_id = ? AND person_id = ?", paulStand, rudel, P.Paul); + sql("DELETE FROM chat_ausgeblendet WHERE person_id = ?", P.Paul); + await s.goto(`https://${CREW}:${HP}/workspace/chat.html?raum=${rudel}`, { waitUntil: "networkidle" }); + await s.waitForSelector(".chat-nachricht", { timeout: 15000 }); + await s.waitForTimeout(1200); + if (g.app) { + const app = await s.evaluate(() => ({ app: matchMedia("(display-mode: standalone)").matches, + env: (() => { const p = document.createElement("div"); p.style.paddingTop = "env(safe-area-inset-top, 0px)"; document.body.append(p); const v = getComputedStyle(p).paddingTop; p.remove(); return v; })() })); + console.log(` ${g.name}: Web-App ${app.app ? "ja" : "NEIN"}, safe-area oben ${app.env}`); + } + await zustand(g, s, "2-rudel-rueckblick"); + await zustand(g, s, "3-rudel-unten", async () => { await s.evaluate(() => { const v = document.getElementById("verlauf"); v.scrollTop = v.scrollHeight; }); }); + await zustand(g, s, "4-rudel-mitte", async () => { await s.evaluate(() => { const v = document.getElementById("verlauf"); v.scrollTop = v.scrollHeight * 0.45; v.dispatchEvent(new Event("scroll")); }); await s.waitForTimeout(150); }); + await zustand(g, s, "5-umfrage-raster", async () => { await s.locator(".chat-umfrage").first().scrollIntoViewIfNeeded(); }); + await zustand(g, s, "6-ton-abschrift", async () => { + const det = s.locator(".chat-abschrift__klapp").first(); + await det.scrollIntoViewIfNeeded(); + if (!(await det.evaluate((x) => x.open))) await det.locator("summary").click(); + }); + if (g.finger && cdp) { + await zustand(g, s, "7-griffbrett", async () => { + const z = s.locator(".chat-nachricht:not([data-selbst]) .chat-nachricht__text").last(); + await z.scrollIntoViewIfNeeded(); + const r = await z.boundingBox(); + await cdp.send("Input.dispatchTouchEvent", { type: "touchStart", touchPoints: [{ x: r.x + 10, y: r.y + r.height / 2 }] }); + const auf = await s.waitForSelector("dialog.griffbrett[open]", { timeout: 2500 }).then(() => true).catch(() => false); + await cdp.send("Input.dispatchTouchEvent", { type: "touchEnd", touchPoints: [] }); + if (!auf) await s.waitForSelector("dialog.griffbrett[open]", { timeout: 1500 }); + }); + } else if (!g.finger) { + await zustand(g, s, "7-werkzeug-hover", async () => { + const z = s.locator(".chat-nachricht:not([data-selbst]) .chat-nachricht__blase").last(); + await z.scrollIntoViewIfNeeded(); await z.hover(); + }); + } + await zustand(g, s, "8-sticker", async () => { + if (await s.locator("#sticker-auf").isVisible()) await s.click("#sticker-auf"); + else { await s.click("#werkzeuge-mehr"); await s.waitForSelector("dialog.griffbrett[open]"); await s.locator("dialog.griffbrett .griffbrett__zeile", { hasText: "Rudel-Sticker" }).click(); } + await s.waitForSelector("#stickertafel:not([hidden])", { timeout: 3000 }); + }); + await zustand(g, s, "9-schreiben", async () => { await s.fill("#text", "Ich bin heute Abend auch dabei und bringe gute Laune mit! 🎉"); }, async () => { await s.fill("#text", ""); }); + await zustand(g, s, "10-faden", async () => { const f = s.locator(".chat-nachricht__faden").first(); await f.scrollIntoViewIfNeeded(); await f.click(); await s.waitForTimeout(600); }); + await zustand(g, s, "11-bildschau", async () => { const b = s.locator(".chat-bild").first(); await b.scrollIntoViewIfNeeded(); await b.click(); await s.waitForSelector("dialog.bildschau[open]", { timeout: 3000 }); }); + if (g.finger) { + await zustand(g, s, "1-liste", async () => { await s.click("#zur-liste"); await s.waitForTimeout(500); }); + } + await zustand(g, s, "12-einstellungen", async () => { + const k2 = s.locator("text=⚙ Rudel").first(); + if (!(await k2.isVisible()) && g.finger) await s.click("#zur-liste").catch(() => {}); + await k2.click(); + await s.waitForSelector("#teamwerk[open]", { timeout: 3000 }); + }); + if (fehler.length) (alleBefunde[g.name] ||= []).push(...fehler.map((f) => `Konsole: ${f}`)); + await k.close(); +} +/* ===================================================================== + DIE TEAM-SICHT (Diene, Modi) und DIE NEUE (Nora) + ===================================================================== */ +const TEAM_GERAETE = GERAETE.filter((g) => ["handy", "app-iphone", "app-handy-quer", "iphone-safari", "pc", "pc-klein"].includes(g.name)); +async function geraetSeite(g, keks) { + if (g.webkit && !safari) safari = await pw.webkit.launch({ proxy: { server: `http://127.0.0.1:${umleiter.address().port}` } }); + const k = await (g.webkit ? safari : browser).newContext({ viewport: { width: g.b, height: g.h }, hasTouch: g.finger, isMobile: g.finger, + deviceScaleFactor: g.finger ? 2 : 1, ignoreHTTPSErrors: true }); + await k.addCookies(keks.split("; ").map((x) => { const [n, ...r] = x.split("="); return { name: n, value: r.join("="), domain: CREW, path: "/" }; })); + const s = await k.newPage(); + const fehler = []; + s.on("pageerror", (e) => fehler.push("SKRIPT: " + String(e).slice(0, 160))); + s.on("console", (e) => { if (e.type() === "error" && !/favicon|ERR_CERT|net::ERR|Failed to load resource|interactive-widget/i.test(e.text())) fehler.push(e.text().slice(0, 160)); }); + const cdp = g.webkit ? null : await k.newCDPSession(s); + if (g.app && cdp && g.sicher) await cdp.send("Emulation.setSafeAreaInsetsOverride", { insets: { top: g.sicher.oben || 0, bottom: g.sicher.unten || 0, left: g.sicher.links || 0, right: g.sicher.rechts || 0 } }).catch(() => {}); + return { k, s, fehler }; +} +const oeffneRaum = async (s, id) => { + await s.goto(`https://${CREW}:${HP}/workspace/chat.html?raum=${id}`, { waitUntil: "networkidle" }); + await s.waitForSelector("#verlauf .chat-nachricht, #verlauf .chat__leer", { timeout: 15000, state: "attached" }); + await s.waitForTimeout(900); +}; +/* Eine Aktion am Beitrag: am Rechner aus der Werkzeugleiste, am Finger übers Griffbrett. */ +async function amBeitrag(g, s, wort) { + const z = s.locator(".chat-nachricht:not([data-selbst]):not([data-system]) .chat-nachricht__blase").last(); + await z.scrollIntoViewIfNeeded(); + if (!g.finger) { await z.hover(); await s.locator(".chat-nachricht:not([data-selbst]):not([data-system])").last().locator(".chat-nachricht__werkzeug button", { hasText: wort }).first().click(); return; } + await s.locator(".chat-nachricht:not([data-selbst]):not([data-system])").last().locator(".chat-nachricht__griff-knopf").click(); + await s.waitForSelector("dialog.griffbrett[open]", { timeout: 3000 }); + await s.locator("dialog.griffbrett .griffbrett__zeile", { hasText: wort }).first().click(); +} +for (const g of TEAM_GERAETE) { + const gT = { ...g, name: `team-${g.name}` }; + const { k, s, fehler } = await geraetSeite(g, K.diene); + await oeffneRaum(s, rudel); + await zustand(gT, s, "T1-rudel"); + await zustand(gT, s, "T2-wache", async () => { await s.click("#wache-auf"); await s.waitForSelector("#teamwerk[open]", { timeout: 3000 }); }); + await zustand(gT, s, "T3-bausteine", async () => { + if (await s.locator("#bausteine-auf").isVisible()) await s.click("#bausteine-auf"); + else { await s.click("#werkzeuge-mehr"); await s.waitForSelector("dialog.griffbrett[open]"); await s.locator("dialog.griffbrett .griffbrett__zeile", { hasText: "Textbausteine" }).click(); } + await s.waitForSelector(".teamwerk-bausteine:not([hidden])", { timeout: 3000 }); + }); + await zustand(gT, s, "T4-hinweis", async () => { await amBeitrag(g, s, "Hinweis"); await s.waitForSelector("#teamwerk[open]", { timeout: 3000 }); }); + await zustand(gT, s, "T5-pause", async () => { await amBeitrag(g, s, "Pause"); await s.waitForSelector("#teamwerk[open]", { timeout: 3000 }); }); + await zustand(gT, s, "T6-umfrage-formular", async () => { await s.fill("#text", "/umfrage"); await s.press("#text", "Enter"); await s.waitForSelector("#teamwerk[open] #umf-frage", { timeout: 3000 }); }, async () => { await s.fill("#text", ""); }); + await zustand(gT, s, "T7-termin-formular", async () => { await s.fill("#text", "/termin"); await s.press("#text", "Enter"); await s.waitForSelector("#teamwerk[open]", { timeout: 3000 }); }, async () => { await s.fill("#text", ""); }); + await zustand(gT, s, "T8-befehle", async () => { await s.fill("#text", "/"); await s.waitForSelector("#befehle:not([hidden])", { timeout: 3000 }); }, async () => { await s.fill("#text", ""); }); + await zustand(gT, s, "T9-stumm", async () => { await s.click("#stumm-auf"); await s.waitForSelector("dialog[open]", { timeout: 3000 }); }); + await zustand(gT, s, "T10-medien", async () => { await s.click("#medien-auf"); await s.waitForTimeout(700); }); + await zustand(gT, s, "T11-profilkarte", async () => { + const n = s.locator("#verlauf .chat-nachricht:not([data-selbst]) .chat-nachricht__von").last(); + await n.scrollIntoViewIfNeeded(); await n.click(); await s.waitForSelector("#teamwerk[open]", { timeout: 3000 }); + }); + for (const [kat, wie] of [["eigen-faelle", "T12-faelle"], ["eigen-wolfsbau", "T13-wolfsbau"], ["chat", "T14-moderation"], ["eigen-abmeldung", "T15-abmeldungen"]]) { + if (!RAUM[kat]) { (alleBefunde[gT.name] ||= []).push(`${wie}: Raum ${kat} fehlt`); continue; } + await oeffneRaum(s, RAUM[kat]); + await zustand(gT, s, wie); + } + if (RAUM["eigen-abmeldung"]) await zustand(gT, s, "T16-abmelde-formular", async () => { await s.click("#abmelden-auf"); await s.waitForSelector("#teamwerk[open]", { timeout: 3000 }); }); + await oeffneRaum(s, rudel); + if (g.finger) await s.click("#zur-liste").catch(() => {}); + await zustand(gT, s, "T17-suche", async () => { await s.fill("#suche", "von:Mila Abend"); await s.waitForTimeout(1200); }, async () => { await s.fill("#suche", ""); }); + await zustand(gT, s, "T18-merkliste", async () => { await s.locator("text=★ Gemerkt").first().click(); await s.waitForTimeout(700); }); + if (!g.finger) await zustand(gT, s, "T19-kuerzel", async () => { await s.locator("text=⌨ Kürzel").first().click(); await s.waitForSelector("#teamwerk[open]", { timeout: 3000 }); }); + if (fehler.length) (alleBefunde[gT.name] ||= []).push(...fehler.map((f) => `Konsole: ${f}`)); + await k.close(); +} +for (const g of GERAETE.filter((x) => ["handy", "iphone-safari", "pc"].includes(x.name))) { + const gN = { ...g, name: `neu-${g.name}` }; + const { k, s, fehler } = await geraetSeite(g, K.nora); + await oeffneRaum(s, rudel); + await zustand(gN, s, "N1-regelkarte", async () => { await s.waitForSelector("#regelkarte", { timeout: 4000 }); }); + if (fehler.length) (alleBefunde[gN.name] ||= []).push(...fehler.map((f) => `Konsole: ${f}`)); + await k.close(); +} +await browser.close(); +if (safari) await safari.close(); +umleiter.close(); +vorbau.close(); +console.log("\n=== BEFUNDE ==="); +let summe = 0; +for (const [g, l] of Object.entries(alleBefunde)) { + const einzig = [...new Set(l)]; + summe += einzig.length; + console.log(`\n${g} (${einzig.length})`); + for (const b of einzig) console.log(" · " + b); +} +writeFileSync(join(ZIEL, "befunde.json"), JSON.stringify(alleBefunde, null, 2)); +console.log(`\n${summe} Befunde, Bilder in ${ZIEL}`); +process.exit(0); diff --git a/server/pruef-rudel-vollendet.mjs b/server/pruef-rudel-vollendet.mjs index adfae8a2..e6e6f529 100644 --- a/server/pruef-rudel-vollendet.mjs +++ b/server/pruef-rudel-vollendet.mjs @@ -269,6 +269,10 @@ ok(sql("SELECT COUNT(*) AS n FROM chat_nachrichten WHERE id = ? AND text = 'Agen ok(!!fr && weg8 === 1 && rest.join() === "frisch", `nach 7 Tagen ist sie weg, vorher nicht (${weg8} geräumt, übrig: ${rest.join()})`); } +/* Eine fremde Textnachricht ganz unten -- zum Gedrückthalten (C1b). */ +await new Promise((r) => setTimeout(r, 10_500)); +await schreib(K.mila, "Bis später, ihr Lieben! Ich freu mich auf heute Abend."); + /* ===================================================================== C. IM BROWSER ===================================================================== */ @@ -362,6 +366,40 @@ try { await p.s.keyboard.press("Escape"); ok(await p.s.evaluate(() => !document.querySelector("dialog.bildschau")?.open), "Esc schließt"); + titel("C1b. Paul (Handy): Das Griffbrett löst beim Loslassen nichts aus"); + { + await p.s.evaluate(() => { const v = document.getElementById("verlauf"); v.scrollTop = v.scrollHeight; }); + await p.s.waitForTimeout(400); + const ziel = p.s.locator(".chat-nachricht:not([data-selbst]) .chat-nachricht__text").last(); + const zb = await ziel.boundingBox(); + const fx = zb.x + 14, fy = zb.y + zb.height / 2; + const cdp2 = await p.k.newCDPSession(p.s); + await cdp2.send("Input.dispatchTouchEvent", { type: "touchStart", touchPoints: [{ x: fx, y: fy }] }); + const auf = await p.s.waitForSelector("dialog.griffbrett[open]", { timeout: 3000 }).then(() => true).catch(() => false); + /* DIE VORAUSSETZUNG GEHÖRT IN DIE BEDINGUNG: Liegt beim Loslassen gar + kein Knopf des Blatts unter dem Finger, beweist die Zeile nichts. */ + const unterFinger = await p.s.evaluate(([x, y]) => { + const e = document.elementFromPoint(x, y); + const k = e && e.closest("dialog.griffbrett") && e.closest("button"); + return k ? (k.textContent || k.getAttribute("aria-label") || "").trim().slice(0, 30) : null; + }, [fx, fy]); + await cdp2.send("Input.dispatchTouchEvent", { type: "touchEnd", touchPoints: [] }); + await p.s.waitForTimeout(600); + const nochOffen = await p.s.evaluate(() => !!document.querySelector("dialog.griffbrett[open]")); + const ausgeblendet = sql("SELECT COUNT(*) AS n FROM chat_ausgeblendet WHERE person_id = ?", P.Paul)[0].n; + ok(auf && !!unterFinger && nochOffen && ausgeblendet === 0, + `beim Loslassen liegt „${unterFinger}“ unter dem Finger – nichts wird ausgelöst, das Blatt bleibt offen`); + const reihe = await p.s.locator("dialog.griffbrett .griffbrett__zeile").first().boundingBox(); + await cdp2.send("Input.dispatchTouchEvent", { type: "touchStart", touchPoints: [{ x: reihe.x + reihe.width / 2, y: reihe.y + reihe.height / 2 }] }); + await cdp2.send("Input.dispatchTouchEvent", { type: "touchEnd", touchPoints: [] }); + await p.s.waitForTimeout(600); + ok(await p.s.evaluate(() => !document.querySelector("dialog.griffbrett[open]")), "ein echter Tipp auf eine Zeile wirkt (das Blatt schließt)"); + ok(await p.s.evaluate(() => { const g = document.querySelector("dialog.griffbrett"); return !g || !g.getClientRects().length; }), + "das geschlossene Blatt ist wirklich weg (keine Fläche)"); + await p.s.evaluate(() => { for (const d of document.querySelectorAll("dialog[open]")) d.close(); }); + await p.s.keyboard.press("Escape").catch(() => {}); + } + titel("C2. Paul (Handy): Datum klebt oben"); await p.s.evaluate(() => { const v = document.getElementById("verlauf"); v.scrollTop = Math.round(v.scrollHeight * 0.3); v.dispatchEvent(new Event("scroll")); }); await p.s.waitForTimeout(200); diff --git a/workspace/anleitung.html b/workspace/anleitung.html index 8bf9079e..e38a9103 100644 --- a/workspace/anleitung.html +++ b/workspace/anleitung.html @@ -7,17 +7,17 @@ - - - - - + + + + + - - + + @@ -289,16 +289,16 @@ Und anleitung.js braucht es doppelt: Symbol, Farbe, Name und Adresse jeder Karte kommen von dort, nicht vom Server. --> - + - - - - - - + + + + + + diff --git a/workspace/anruf-probe.html b/workspace/anruf-probe.html index 646d56d0..fefcf926 100644 --- a/workspace/anruf-probe.html +++ b/workspace/anruf-probe.html @@ -16,8 +16,8 @@ verdeckt. Gefunden hat es pruef-struktur. Richtig sind `gate.css` (die Farbwerte des Hauses) und `haus.css`. --> - - + + - +