Skip to content

Commit

Permalink
Merge pull request #244 from Zekiah-A/main
Browse files Browse the repository at this point in the history
[OOF] Fix broken  toQueryObject and gnarly client switch case overruns
  • Loading branch information
Zekiah-A authored Feb 25, 2024
2 parents 8d3ea8c + 93b1b44 commit 4d7c7b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions db-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ function toQueryObject<T extends object>(object: T): T {
// @ts-expect-error Chicanery to keep type inference whilst transforming
const queryObject:T = {}
for (const k of Object.keys(object)) {
queryObject["$" + k] = queryObject[k]
queryObject["$" + k] = object[k]
}
return queryObject
}
Expand Down Expand Up @@ -370,7 +370,7 @@ const internal: DbInternals = {
// Messages may or may not be in the DB by the time they are being asked to be deleted due to periodic transactions
deleteLiveChat: function(data) {
const deletionQuery = db.query<LiveChatDeletion, DeletionMessageInfo>(
"INSERT INTO LiveChatDeletions (moderatorIntId, reason, deletionDate) VALUES ($moderatorIntId, $reason, $messageId) RETURNING *")
"INSERT INTO LiveChatDeletions (moderatorIntId, reason, deletionDate) VALUES ($moderatorIntId, $reason, $deletionDate) RETURNING *")
const deletion = deletionQuery.get(toQueryObject(data))
if (deletion == null) return

Expand Down
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,7 @@
canvasLocked = true
chatPunishNote.innerText = "You have been banned from placing on the canvas or sending messages in live chat."
}
break
}
case 15: {
let repliesTo = null
Expand Down Expand Up @@ -932,6 +933,7 @@
}
case 16: { // Captcha success
captchaPopup.style.display = "none"
break
}
case 17: {// Live chat delete
const messageId = data.getUint32(1)
Expand All @@ -942,6 +944,7 @@
messageEl.remove()
}
}
break
}
case 18: { // Text capcha
let textsSize = data.getUint8(1)
Expand Down

0 comments on commit 4d7c7b0

Please sign in to comment.