Compare commits

..

3 Commits

Author SHA1 Message Date
0880
fe7884233c Fix UI 2026-01-18 19:13:25 +03:30
0880
83a837f339 Remove debug print 2026-01-18 19:13:18 +03:30
0880
250ef92502 Send ready to spectators 2026-01-18 19:12:59 +03:30
2 changed files with 13 additions and 13 deletions

1
app.py
View File

@@ -245,6 +245,7 @@ async def join(request, room_id):
"code": "FULL", "code": "FULL",
"error": "Room Full", "error": "Room Full",
"board": room.board.serialize(), "board": room.board.serialize(),
"ready": len(room.players) == 2,
"turn": room.turn.value, "turn": room.turn.value,
"state": room.state.value, "state": room.state.value,
"start_time": ( "start_time": (

View File

@@ -177,7 +177,6 @@
link.href = "/favicon_update.ico"; link.href = "/favicon_update.ico";
link.type = "image/x-icon"; link.type = "image/x-icon";
} }
console.log("PLAYING SOUND!!");
piecemoveSound.currentTime = Math.round(Math.random() * 4) * 0.5; piecemoveSound.currentTime = Math.round(Math.random() * 4) * 0.5;
piecemoveSound.play() piecemoveSound.play()
.then(() => { .then(() => {
@@ -197,7 +196,7 @@
if (state == -1) { if (state == -1) {
document.getElementById('stats').textCotnent = ""; document.getElementById('stats').textCotnent = "";
const now = new Date(); const now = new Date();
const differenceMs = Math.abs(start_time.getTime() - now.getTime()); const differenceMs = 30 * 60 * 1000 - Math.abs(start_time.getTime() - now.getTime());
const totalSeconds = Math.floor(differenceMs / 1000); const totalSeconds = Math.floor(differenceMs / 1000);
const minutes = Math.floor(totalSeconds / 60); const minutes = Math.floor(totalSeconds / 60);
@@ -206,31 +205,31 @@
const paddedMinutes = String(minutes).padStart(2, '0'); const paddedMinutes = String(minutes).padStart(2, '0');
const paddedSeconds = String(seconds).padStart(2, '0'); const paddedSeconds = String(seconds).padStart(2, '0');
document.getElementById('clock').textCotnent = `${paddedMinutes}:${paddedSeconds}`; document.getElementById('clock').innerText = `${paddedMinutes}:${paddedSeconds}`;
if (UID === undefined || turn != color) { if (UID === undefined || turn != color) {
if (turn == 0) { if (turn == 0) {
document.getElementById('turn').textCotnent = "White's Turn"; document.getElementById('turn').innerText = "White's Turn";
} else if (turn == 0) { } else if (turn == 0) {
document.getElementById('turn').textCotnent = "Black's Turn"; document.getElementById('turn').innerText = "Black's Turn";
} }
} else if (turn == color) { } else if (turn == color) {
document.getElementById('turn').textCotnent = "Your Turn"; document.getElementById('turn').innerText = "Your Turn";
} }
} else { } else {
document.getElementById('turn').textCotnent = ""; document.getElementById('turn').innerText = "";
if (state == 0) { if (state == 0) {
document.getElementById('stats').textCotnent = "Tie"; document.getElementById('stats').innerText = "Tie";
} else if (state == 1) { } else if (state == 1) {
document.getElementById('stats').textCotnent = "White Won"; document.getElementById('stats').innerText = "White Won";
} else if (state == 2) { } else if (state == 2) {
document.getElementById('stats').textCotnent = "Black Won"; document.getElementById('stats').innerText = "Black Won";
} }
} }
} else { } else {
document.getElementById('turn').textCotnent = ""; document.getElementById('turn').innerText = "";
document.getElementById('clock').textCotnent = ""; document.getElementById('clock').innerText = "";
document.getElementById('stats').textCotnent = "Waiting for Opponent"; document.getElementById('stats').innerText = "Waiting for Opponent";
} }
} }