From 708286d7c6dec91e502cf952e15388e49d1a1794 Mon Sep 17 00:00:00 2001 From: Alexander <105135724+clibequilibrium@users.noreply.github.com> Date: Sun, 10 Mar 2024 12:33:59 -0400 Subject: [PATCH 1/2] Added await so the limiter actually limits messages instead of ignoring the Promise --- src/chat.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chat.mjs b/src/chat.mjs index 79837c6c..6f5c1d47 100644 --- a/src/chat.mjs +++ b/src/chat.mjs @@ -334,7 +334,7 @@ export class ChatRoom { } // Check if the user is over their rate limit and reject the message if so. - if (!session.limiter.checkLimit()) { + if (!await session.limiter.checkLimit()) { webSocket.send(JSON.stringify({ error: "Your IP is being rate-limited, please try again later." })); From a5e2de0fd7dca0d36cf61f886dd87dbce550c3e0 Mon Sep 17 00:00:00 2001 From: Alexander <105135724+clibequilibrium@users.noreply.github.com> Date: Sun, 10 Mar 2024 12:36:27 -0400 Subject: [PATCH 2/2] Added parentheses --- src/chat.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chat.mjs b/src/chat.mjs index 6f5c1d47..2276147e 100644 --- a/src/chat.mjs +++ b/src/chat.mjs @@ -334,7 +334,7 @@ export class ChatRoom { } // Check if the user is over their rate limit and reject the message if so. - if (!await session.limiter.checkLimit()) { + if (!(await session.limiter.checkLimit())) { webSocket.send(JSON.stringify({ error: "Your IP is being rate-limited, please try again later." }));