fix(control): pause, resume, false start and reset are master-only too (1.77.1)

This commit is contained in:
larssand committed 2026-11-07 17:48:25 +01:00
1 parent cf3a4c5fdb
commit 0589fe5f65
8 files changed
+35 -9

No files matched your search

+6 -1
View File
@@ -46,12 +46,17 @@ export function renderSpeakerPanel({ state, t, escapeHtml }) {
</section>`;
}
export function bindSpeakerPanel(root, { state, getActiveSession, cancelRaceStart, triggerRaceAudio, saveState, updateHeaderState, renderView }) {
export function bindSpeakerPanel(root, { state, getActiveSession, cancelRaceStart, triggerRaceAudio, saveState, updateHeaderState, renderView, canRunRace = () => true, notifyNotMaster = () => {} }) {
if (!root) return;
root.querySelectorAll("#speakerPanel [data-race-audio-cue]").forEach((node) => {
node.addEventListener("click", () => {
const cue = node.dataset.raceAudioCue;
const session = getActiveSession();
// Pause, resume and false start change the heat: only the Race Controller Master may.
if (["false_start", "race_paused", "race_resumed"].includes(cue) && !canRunRace()) {
notifyNotMaster();
return;
}
if (cue === "false_start") {
cancelRaceStart();
} else if (cue === "race_paused" && session?.status === "running") {