- Pre-filter lobby tables before bankroll selection, enforce single-table reserve floor on total bankroll, and expand cash pools via /get-cash-table-list including waitlist sub-tables - Enforce strict stakes band for fallback picks, keep open/waitlisted/seated sub-tables alive across pool updates, and guard duplicate OS windows from blocking the target table count - Trigger immediate 4-grid tiling with OS window fallback and align Cockpit Arrange button with the planned table count - Reject premature layout probes on the table proxy during Unity boot and suppress Mega-Splash and Winner celebration popups in-stream without mouse clicks - Stabilize top-up target sizing, CDP port routing, emergency stop behavior, tournament phantom filtering, and in-process tournament action relay
66 lines
3.7 KiB
Swift
66 lines
3.7 KiB
Swift
import CockpitKern
|
|
import Foundation
|
|
|
|
/// Wo die Huelle liegt und welche Dateien der Vertrag mit dem Laeufer sind
|
|
/// (der Treffpunkt: betrieb/scratch, docs/SCHNITTSTELLE.md).
|
|
enum Orte {
|
|
/// Die Reihenfolge entscheidet `Quellbaum.waehlen` (CockpitKern): QUELLBAUM, der beim Bauen
|
|
/// eingetragene Pfad (Info.plist), sonst der Baum, aus dem diese Datei kompiliert wurde.
|
|
static let shell: URL = {
|
|
let gebaut = URL(filePath: #filePath).deletingLastPathComponent() // Sources/Cockpit
|
|
.deletingLastPathComponent().deletingLastPathComponent() // mac
|
|
.deletingLastPathComponent() // der Quellbaum
|
|
let pfad = Quellbaum.waehlen(umgebung: ProcessInfo.processInfo.environment,
|
|
eingetragen: Bundle.main.object(forInfoDictionaryKey: "Quellbaum") as? String,
|
|
gebaut: gebaut.path(percentEncoded: false))
|
|
return URL(filePath: pfad, directoryHint: .isDirectory)
|
|
}()
|
|
|
|
// Der Treffpunkt: betrieb/scratch, und ohne betrieb/ das eigene scratch/ (dieselbe Regel wie in
|
|
// client/umgebung.py - der Baum ohne betrieb-Ordner heisst dort anders).
|
|
static var scratch: URL {
|
|
let mit = shell.appending(path: "betrieb/scratch", directoryHint: .isDirectory)
|
|
return FileManager.default.fileExists(atPath: shell.appending(path: "betrieb").path) ? mit
|
|
: shell.appending(path: "scratch", directoryHint: .isDirectory)
|
|
}
|
|
static let startSkript = shell.appending(path: "sicht/start.py")
|
|
/// Startet CoinPoker MIT dem Turnier-Relais (client/relais): baut die Lib, patcht die Signatur
|
|
/// bei Bedarf (nach Client-Update) und injiziert die Lib - so traegt der Zug-Kanal im Turnier.
|
|
static let clientStartSkript = shell.appending(path: "client/relais/starten.sh")
|
|
/// Rahmen des Panels fuer hand/act.py (Klickschutz) und sicht/tische.py (Anordnen).
|
|
static let cockpitRahmen = scratch.appending(path: "cockpit.json")
|
|
/// sicht/tische.py: so breit soll die Leiste werden - der Rest neben den lueckenlosen Kacheln.
|
|
static let cockpitZiel = scratch.appending(path: "cockpit_ziel.json")
|
|
/// hand/act.py legt sie an, bevor ein Laeufer-Klick unter dem Panel landet.
|
|
static let ausweichen = scratch.appending(path: "ausweichen")
|
|
/// Du hast Maus oder Tastatur benutzt (nicht der Laeufer): der Läufer lässt dir den Vortritt.
|
|
static let eingriff = scratch.appending(path: "eingriff")
|
|
|
|
/// Alter einer Datei in Sekunden, nil wenn es sie nicht gibt.
|
|
static func alter(_ url: URL, jetzt: Date = Date()) -> Double? {
|
|
guard let a = try? FileManager.default.attributesOfItem(atPath: url.path(percentEncoded: false)),
|
|
let m = a[.modificationDate] as? Date else { return nil }
|
|
return jetzt.timeIntervalSince(m)
|
|
}
|
|
}
|
|
|
|
/// Was schiefging, fuer die Fehlersuche: stderr (sichtbar bei `swift run Cockpit`) und das Systemprotokoll.
|
|
/// Was geschah, fuer die Fehlersuche: stderr (sichtbar bei `swift run Cockpit`) und
|
|
/// betrieb/scratch/cockpit.log (auch fuer die installierte App).
|
|
enum Protokoll {
|
|
static let datei = Orte.scratch.appending(path: "cockpit.log")
|
|
|
|
static func schreiben(_ text: String) {
|
|
let zeile = "\(Date().formatted(.iso8601)) \(text)\n"
|
|
FileHandle.standardError.write(Data(("Cockpit: " + text + "\n").utf8))
|
|
if let h = try? FileHandle(forWritingTo: datei) {
|
|
_ = try? h.seekToEnd()
|
|
h.write(Data(zeile.utf8))
|
|
try? h.close()
|
|
} else {
|
|
try? FileManager.default.createDirectory(at: Orte.scratch, withIntermediateDirectories: true)
|
|
try? Data(zeile.utf8).write(to: datei)
|
|
}
|
|
}
|
|
}
|