diff --git a/mock/logschreiber.py b/mock/logschreiber.py index 50d34d7..4646c13 100644 --- a/mock/logschreiber.py +++ b/mock/logschreiber.py @@ -5,7 +5,8 @@ Grundlage ist `vorlage/hand-beispiel.txt`, eine echte Hand. Beim Abspielen werde nur Raum, Tischnummer, Sitznummern und Zeitstempel ersetzt; alles andere bleibt Zeichen für Zeichen die Aufnahme. Am eigenen Zug (`game.user_turn` mit Zugoptionen) hält der Lauf an, bis `aktion()` kommt, schreibt dann die eigene Aktionszeile -(`game.seat`, Beschriftung aus dem Klick, Beträge aus der Aufnahme) und spielt weiter. +(`game.user_action` wie im Archiv, dann `game.seat` mit der Beschriftung aus dem Klick +und den Beträgen der Aufnahme) und spielt weiter. from logschreiber import Logschreiber, Handlauf """ @@ -221,6 +222,9 @@ class Handlauf(threading.Thread): else: d["caption"] = "Raise" d["newCaption"] = "Raise" if zug.get("roundMaxBet") else "Bet" + # Was der echte Client beim eigenen Klick sendet - Form aus dem Archiv + self.schreiber.schreiben("[Method] -> SendExtensionMessageToConnector - RoomName " + f"{self.raum} RequestId - game.user_action") zeile = mit_bohne(vorbild, d) if not STEMPEL.match(zeile): zeile = "2000-01-01 00:00:00:000 [info] [UNITY] Stdout: " + zeile diff --git a/mock/seiten/lobby.html b/mock/seiten/lobby.html index df10b6f..966041c 100644 --- a/mock/seiten/lobby.html +++ b/mock/seiten/lobby.html @@ -29,6 +29,9 @@ .button { border: 0; border-radius: 6px; padding: 6px 14px; cursor: pointer; font: inherit; } .button-module__primary___C1vVV { background: #1fae64; color: #fff; } .quick-join-button { background: #2b3045; color: #fff; } + .table-seat-progress { display: inline-flex; gap: 3px; margin-left: 8px; vertical-align: middle; } + .table-seat-progress__seat { width: 6px; height: 6px; border-radius: 50%; background: #1fae64; } + .table-seat-progress__seat--empty { background: #3a3f52; } .lobby-footer { display: flex; gap: 16px; padding: 8px 16px; color: #778; font-size: 12px; } @@ -85,7 +88,7 @@ function zeile(t) { r.className = "table-row"; r.dataset.tableId = t.id; r.innerHTML = `
-
+
`; r.querySelector(".game-info").textContent = t.id; r.querySelector("button").addEventListener("click", () => { @@ -106,7 +109,10 @@ async function laden() { let r = liste.querySelector(`[data-table-id="${CSS.escape(t.id)}"]`); if (!r) { r = zeile(t); liste.appendChild(r); } r.querySelector(".avg-stack").textContent = t.schnitt; - r.querySelector(".players").textContent = `${t.spieler}/6`; + r.querySelector(".player-count").textContent = `${t.spieler}/6`; + const sitze = r.querySelector(".table-seat-progress"); + sitze.innerHTML = Array.from({length: 6}, (_, i) => + ``).join(""); } } catch (e) { /* Server weg - nichts zu tun */ } } diff --git a/mock/seiten/table.html b/mock/seiten/table.html index 37a8359..33115a5 100644 --- a/mock/seiten/table.html +++ b/mock/seiten/table.html @@ -37,19 +37,21 @@ .betrag { position: absolute; transform: translate(-50%, -50%); width: 9vw; height: 4.4vh; text-align: center; background: #0d0f15; color: #fff; border: 1px solid #333; border-radius: 6px; } .dialog-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); display: none; } - .sfs-buy-in-modal { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); width: 380px; + .sfs-buy-in-modal { position: absolute; width: 380px; box-sizing: border-box; background: #1b1e29; border-radius: 12px; padding: 18px; display: none; } .sfs-buy-in-header { display: flex; justify-content: space-between; align-items: center; } - .sfs-buy-in-heading { font-size: 20px; font-weight: 700; } + .sfs-buy-in-heading { font-size: 20px; font-weight: 700; margin: 0; } .sfs-buy-in-header-game-info { color: #99a; margin: 6px 0 14px; } .sfs-buy-in-balance-container { display: flex; justify-content: space-between; margin-bottom: 12px; } .sfs-buy-in-user-balance { color: #f5c542; font-weight: 700; } .sfs-slider-range-value { width: 100%; box-sizing: border-box; padding: 8px; font-size: 18px; text-align: center; background: #0d0f15; color: #fff; border: 1px solid #333; border-radius: 6px; } .sfs-buy-in-body-range-buttons { display: flex; justify-content: space-between; margin: 10px 0 16px; } - .sfs-buy-in-body-range-buttons [role=button], .sfs-buy-in-modal-button { - background: #2b3045; border-radius: 6px; padding: 6px 16px; cursor: pointer; } - .sfs-buy-in-modal-button { background: #1fae64; text-align: center; font-weight: 700; padding: 10px; } + .sfs-buy-in-body-range-buttons button, .sfs-buy-in-modal-button { + background: #2b3045; color: #fff; border: 0; border-radius: 6px; padding: 6px 16px; cursor: pointer; + font: inherit; } + .sfs-buy-in-modal-button-container { padding: 6px 40px; } + .sfs-buy-in-modal-button { background: #1fae64; font-weight: 700; padding: 10px; width: 100%; } .sfs-buy-in-body-error { color: #ff6b6b; min-height: 1em; font-size: 12px; } .common-dialog-cross-icon { cursor: pointer; font-size: 22px; } @@ -67,7 +69,7 @@
-
Buy-In
+

Buy-In

×
{{TITEL}}
@@ -78,19 +80,20 @@
-
Min
-
Max
+ +
-
Buy-In
+
diff --git a/mock/start.py b/mock/start.py index 75114ce..60bc38a 100644 --- a/mock/start.py +++ b/mock/start.py @@ -68,6 +68,22 @@ def chrome_starten(pfad, cdp_port, url, headless): raise SystemExit(f"Chrome antwortet nicht am Debug-Port {cdp_port}") +def reste(profil): + """PIDs aller Prozesse, deren Befehlszeile den Profilordner nennt - Chrome samt Helfern. + + Die eine PID reicht nicht: ein Chrome kann Helfer überleben lassen, und unter + Windows lässt sich ein Chrome-Prozess nicht zuverlässig nach seinem Zustand fragen. + """ + if sys.platform == "win32": + befehl = ["powershell", "-NoProfile", "-Command", + "Get-CimInstance Win32_Process | Where-Object { $_.ProcessId -ne $PID -and " + f"$_.CommandLine -like '*{profil}*' }} | ForEach-Object {{ $_.ProcessId }}"] + else: + befehl = ["pgrep", "-f", "--", profil] + r = subprocess.run(befehl, capture_output=True, text=True) + return [int(p) for p in r.stdout.split() if p.isdigit() and int(p) != os.getpid()] + + def chrome_beenden(proc, profil, cdp_port): try: with cdp.Verbindung(cdp.browser_ws(cdp_port), frist=3) as b: @@ -79,6 +95,16 @@ def chrome_beenden(proc, profil, cdp_port): except subprocess.TimeoutExpired: proc.kill() proc.wait() + for _ in range(10): + uebrig = reste(profil) + if not uebrig: + break + for pid in uebrig: + try: + os.kill(pid, signal.SIGTERM if sys.platform == "win32" else signal.SIGKILL) + except OSError: + pass + time.sleep(0.3) for _ in range(50): # Windows gibt Dateien erst nach und nach frei shutil.rmtree(profil, ignore_errors=True) if not os.path.exists(profil): diff --git a/tests/mock_spec.py b/tests/mock_spec.py index c1d7e75..6e87f61 100644 --- a/tests/mock_spec.py +++ b/tests/mock_spec.py @@ -11,8 +11,15 @@ Werkzeuge es täten: * eine Hand läuft und hält am eigenen Zug an * ein Mausklick an der README-Stelle von `Call` wird geschrieben und von hand/nachsehen.py belegt + * jedes bedienbare Element ist über seinen Text erreichbar (Auswahl wie + lobby/cdp.mjs --click) und trifft einen