From dd407a7084a2b9b8d3f0fbead948fb6948c972fd Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Sun, 10 May 2026 10:26:19 +0200 Subject: [PATCH] fix --- modules/web/web.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/modules/web/web.js b/modules/web/web.js index c3cf29a..972d246 100644 --- a/modules/web/web.js +++ b/modules/web/web.js @@ -86,16 +86,19 @@ function wsSend(obj) { ws.send(JSON.stringify(obj)); } +function gotLock() { + setTimeout(() => { + wsSend({action: "lock", "id": 0}); + wsSend({action: "get_toplay"}); + wsSend({action: "skipc"}); + wsSend({action: "skipi"}); + pollLockHeld = true; + }, 500 + (Math.random() * 1000)) +} + function handleLockState(msg) { if(msg[0] == true) pollLockHeld = false; - else { - setTimeout(() => { - wsSend({action: "lock", "id": 0}); - wsSend({action: "get_toplay"}); - wsSend({action: "skipc"}); - wsSend({action: "skipi"}); - }, 500 + (Math.random() * 1000)) - } + else gotLock(); } function handleMessage(msg) { @@ -109,6 +112,7 @@ function handleMessage(msg) { } case "lock": { if(msg.error) pollLockHeld = false; + else if (msg.id == 0 && msg.data == false) gotLock(); break; } case "rds":