Skip to content

Commit

Permalink
Hotfix pixel checks hole + log
Browse files Browse the repository at this point in the history
  • Loading branch information
Zekiah-A committed Mar 3, 2024
1 parent 64b97c9 commit 529c11e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -714,13 +714,15 @@ const serverOptions:TLSWebSocketServeOptions<ClientData> = {
}
if (LOCKED === true || toValidate.has(ws) || bans.has(IP) || ws.data.challenge == "active" || cd > NOW) {
rejectPixel(ws, i, cd)
return
}
// On first pixel place, give them a challenge
if (CHALLENGE && ws.data.challenge === "pending") {
ws.send(padlock.requestChallenge(ws))
ws.data.challenge = "active"
}
if (checkPreban(i % WIDTH, Math.floor(i / HEIGHT), ws)) {
rejectPixel(ws, i, cd)
return
}
CHANGES[i] = c
Expand Down Expand Up @@ -895,7 +897,9 @@ const serverOptions:TLSWebSocketServeOptions<ClientData> = {
const result = await padlock.verifySolution(ws, data)
if (result === "badpacket" || result === "nosolution") return ws.close(4000, "Invalid solve packet")
if (result === false) {
modWebhookLog(`Client ${IP}/${ws.data.intId} failed verification challenge, kicking`)
ws.close(4000, "No solution")
return
}
else {
delete ws.data.challenge
Expand Down

0 comments on commit 529c11e

Please sign in to comment.