From 61c0be77d568fb9add0f15ef4dbdfb37319a5fbb Mon Sep 17 00:00:00 2001 From: marzavec Date: Wed, 27 Dec 2023 00:26:49 -0800 Subject: [PATCH] hackchat-server 2.3 update --- commands/admin/addmod.js | 2 +- commands/admin/listusers.js | 2 +- commands/admin/reload.js | 2 +- commands/admin/removemod.js | 2 +- commands/admin/saveconfig.js | 2 +- commands/admin/shout.js | 2 +- commands/core/changecolor.js | 2 +- commands/core/changenick.js | 2 +- commands/core/chat.js | 6 +++--- commands/core/emote.js | 4 ++-- commands/core/help.js | 2 +- commands/core/invite.js | 2 +- commands/core/join.js | 2 +- commands/core/updateMessage.js | 10 +++++----- commands/core/whisper.js | 4 ++-- commands/internal/disconnect.js | 2 +- commands/internal/socketreply.js | 2 +- commands/mod/ban.js | 2 +- commands/mod/disablecaptcha.js | 2 +- commands/mod/dumb.js | 10 +++++----- commands/mod/enablecaptcha.js | 4 ++-- commands/mod/forcecolor.js | 2 +- commands/mod/kick.js | 2 +- commands/mod/lockroom.js | 2 +- commands/mod/speak.js | 2 +- commands/mod/unban.js | 2 +- commands/mod/unbanall.js | 2 +- commands/mod/unlockroom.js | 2 +- documentation/admin_addmod.js.html | 2 +- documentation/admin_listusers.js.html | 2 +- documentation/admin_reload.js.html | 2 +- documentation/admin_removemod.js.html | 2 +- documentation/admin_saveconfig.js.html | 2 +- documentation/admin_shout.js.html | 2 +- documentation/core_changecolor.js.html | 2 +- documentation/core_changenick.js.html | 4 ++-- documentation/core_chat.js.html | 4 ++-- documentation/core_emote.js.html | 4 ++-- documentation/core_help.js.html | 2 +- documentation/core_invite.js.html | 2 +- documentation/core_join.js.html | 2 +- documentation/core_whisper.js.html | 4 ++-- documentation/internal_disconnect.js.html | 2 +- documentation/internal_socketreply.js.html | 2 +- documentation/mod_ban.js.html | 2 +- documentation/mod_dumb.js.html | 10 +++++----- documentation/mod_forcecolor.js.html | 2 +- documentation/mod_kick.js.html | 2 +- documentation/mod_speak.js.html | 2 +- documentation/mod_unban.js.html | 2 +- documentation/mod_unbanall.js.html | 2 +- package.json | 2 +- 52 files changed, 73 insertions(+), 73 deletions(-) diff --git a/commands/admin/addmod.js b/commands/admin/addmod.js index 204c38f..a1631de 100644 --- a/commands/admin/addmod.js +++ b/commands/admin/addmod.js @@ -24,7 +24,7 @@ export async function run({ }) { // increase rate limit chance and ignore if not admin if (!isAdmin(socket.level)) { - return server.police.frisk(socket.address, 20); + return server.police.frisk(socket, 20); } // add new trip to config diff --git a/commands/admin/listusers.js b/commands/admin/listusers.js index f5081f0..7a02c43 100644 --- a/commands/admin/listusers.js +++ b/commands/admin/listusers.js @@ -23,7 +23,7 @@ import { export async function run({ server, socket }) { // increase rate limit chance and ignore if not admin if (!isAdmin(socket.level)) { - return server.police.frisk(socket.address, 20); + return server.police.frisk(socket, 20); } // find all users currently in a channel diff --git a/commands/admin/reload.js b/commands/admin/reload.js index aa4d212..5f39733 100644 --- a/commands/admin/reload.js +++ b/commands/admin/reload.js @@ -22,7 +22,7 @@ export async function run({ }) { // increase rate limit chance and ignore if not admin if (!isAdmin(socket.level)) { - return server.police.frisk(socket.address, 20); + return server.police.frisk(socket, 20); } // do command reload and store results diff --git a/commands/admin/removemod.js b/commands/admin/removemod.js index d01db82..e8ddacf 100644 --- a/commands/admin/removemod.js +++ b/commands/admin/removemod.js @@ -24,7 +24,7 @@ export async function run({ }) { // increase rate limit chance and ignore if not admin if (!isAdmin(socket.level)) { - return server.police.frisk(socket.address, 20); + return server.police.frisk(socket, 20); } // remove trip from config diff --git a/commands/admin/saveconfig.js b/commands/admin/saveconfig.js index 1407c94..90072b8 100644 --- a/commands/admin/saveconfig.js +++ b/commands/admin/saveconfig.js @@ -20,7 +20,7 @@ import { export async function run({ core, server, socket }) { // increase rate limit chance and ignore if not admin if (!isAdmin(socket.level)) { - return server.police.frisk(socket.address, 20); + return server.police.frisk(socket, 20); } // attempt save, notify of failure diff --git a/commands/admin/shout.js b/commands/admin/shout.js index 3e5914a..a68a156 100644 --- a/commands/admin/shout.js +++ b/commands/admin/shout.js @@ -19,7 +19,7 @@ import { export async function run({ server, socket, payload }) { // increase rate limit chance and ignore if not admin if (!isAdmin(socket.level)) { - return server.police.frisk(socket.address, 20); + return server.police.frisk(socket, 20); } // send text to all channels diff --git a/commands/core/changecolor.js b/commands/core/changecolor.js index 5143c7b..8326b2a 100644 --- a/commands/core/changecolor.js +++ b/commands/core/changecolor.js @@ -30,7 +30,7 @@ export async function run({ }) { const { channel } = socket; - if (server.police.frisk(socket.address, 1)) { + if (server.police.frisk(socket, 1)) { return server.reply({ cmd: 'warn', // @todo Add numeric error code as `id` text: 'You are changing colors too fast. Wait a moment before trying again.', diff --git a/commands/core/changenick.js b/commands/core/changenick.js index 664561e..184e966 100644 --- a/commands/core/changenick.js +++ b/commands/core/changenick.js @@ -24,7 +24,7 @@ export async function run({ }) { const { channel } = socket; - if (server.police.frisk(socket.address, 6)) { + if (server.police.frisk(socket, 6)) { return server.reply({ cmd: 'warn', // @todo Add numeric error code as `id` text: 'You are changing nicknames too fast. Wait a moment before trying again.', diff --git a/commands/core/chat.js b/commands/core/chat.js index 8e15539..b8ed943 100644 --- a/commands/core/chat.js +++ b/commands/core/chat.js @@ -88,12 +88,12 @@ export async function run({ if (!text) { // lets not send objects or empty text, yea? - return server.police.frisk(socket.address, 13); + return server.police.frisk(socket, 13); } // check for spam const score = text.length / 83 / 4; - if (server.police.frisk(socket.address, score)) { + if (server.police.frisk(socket, score)) { return server.reply({ cmd: 'warn', // @todo Add numeric error code as `id` text: 'You are sending too much text. Wait a moment and try again.\nPress the up arrow key to restore your last message.', @@ -105,7 +105,7 @@ export async function run({ if (typeof (customId) === 'string' && customId.length > MAX_MESSAGE_ID_LENGTH) { // There's a limit on the custom id length. - return server.police.frisk(socket.address, 13); + return server.police.frisk(socket, 13); } // build chat payload diff --git a/commands/core/emote.js b/commands/core/emote.js index e080504..0f00eda 100644 --- a/commands/core/emote.js +++ b/commands/core/emote.js @@ -41,12 +41,12 @@ export async function run({ server, socket, payload }) { if (!text) { // lets not send objects or empty text, yea? - return server.police.frisk(socket.address, 8); + return server.police.frisk(socket, 8); } // check for spam const score = text.length / 83 / 4; - if (server.police.frisk(socket.address, score)) { + if (server.police.frisk(socket, score)) { return server.reply({ cmd: 'warn', // @todo Add numeric error code as `id` text: 'You are sending too much text. Wait a moment and try again.\nPress the up arrow key to restore your last message.', diff --git a/commands/core/help.js b/commands/core/help.js index b8e70b2..dab5ba5 100644 --- a/commands/core/help.js +++ b/commands/core/help.js @@ -16,7 +16,7 @@ export async function run({ core, server, socket, payload, }) { // check for spam - if (server.police.frisk(socket.address, 2)) { + if (server.police.frisk(socket, 2)) { return server.reply({ cmd: 'warn', // @todo Add numeric error code as `id` text: 'You are sending too much text. Wait a moment and try again.\nPress the up arrow key to restore your last message.', diff --git a/commands/core/invite.js b/commands/core/invite.js index 09b2670..2121157 100644 --- a/commands/core/invite.js +++ b/commands/core/invite.js @@ -40,7 +40,7 @@ export async function run({ core, server, socket, payload, }) { // check for spam - if (server.police.frisk(socket.address, 2)) { + if (server.police.frisk(socket, 2)) { return server.reply({ cmd: 'warn', text: 'You are sending invites too fast. Wait a moment before trying again.', diff --git a/commands/core/join.js b/commands/core/join.js index 6e327bd..81e154d 100644 --- a/commands/core/join.js +++ b/commands/core/join.js @@ -39,7 +39,7 @@ export async function run({ core, server, socket, payload, }) { // check for spam - if (server.police.frisk(socket.address, 3)) { + if (server.police.frisk(socket, 3)) { return server.reply({ cmd: 'warn', text: 'You are joining channels too fast. Wait a moment and try again.', diff --git a/commands/core/updateMessage.js b/commands/core/updateMessage.js index 752ca2b..8459bfc 100644 --- a/commands/core/updateMessage.js +++ b/commands/core/updateMessage.js @@ -36,15 +36,15 @@ export async function run({ } if (mode !== 'overwrite' && mode !== 'append' && mode !== 'prepend' && mode !== 'complete') { - return server.police.frisk(socket.address, 13); + return server.police.frisk(socket, 13); } if (!customId || typeof customId !== 'string' || customId.length > MAX_MESSAGE_ID_LENGTH) { - return server.police.frisk(socket.address, 13); + return server.police.frisk(socket, 13); } if (typeof (text) !== 'string') { - return server.police.frisk(socket.address, 13); + return server.police.frisk(socket, 13); } if (mode === 'overwrite') { @@ -56,7 +56,7 @@ export async function run({ } if (!text) { - return server.police.frisk(socket.address, 13); + return server.police.frisk(socket, 13); } // TODO: What score should we use for this? It isn't as space filling as chat messages. @@ -77,7 +77,7 @@ export async function run({ } if (!message) { - return server.police.frisk(socket.address, 6); + return server.police.frisk(socket, 6); } const outgoingPayload = { diff --git a/commands/core/whisper.js b/commands/core/whisper.js index 317c756..7a2ae17 100644 --- a/commands/core/whisper.js +++ b/commands/core/whisper.js @@ -59,12 +59,12 @@ export async function run({ server, socket, payload }) { if (!text) { // lets not send objects or empty text, yea? - return server.police.frisk(socket.address, 13); + return server.police.frisk(socket, 13); } // check for spam const score = text.length / 83 / 4; - if (server.police.frisk(socket.address, score)) { + if (server.police.frisk(socket, score)) { return server.reply({ cmd: 'warn', // @todo Add numeric error code as `id` text: 'You are sending too much text. Wait a moment and try again.\nPress the up arrow key to restore your last message.', diff --git a/commands/internal/disconnect.js b/commands/internal/disconnect.js index cef5913..292c0c3 100644 --- a/commands/internal/disconnect.js +++ b/commands/internal/disconnect.js @@ -19,7 +19,7 @@ import { export async function run({ server, socket, payload }) { if (payload.cmdKey !== server.cmdKey) { // internal command attempt by client, increase rate limit chance and ignore - return server.police.frisk(socket.address, 20); + return server.police.frisk(socket, 20); } // send leave notice to client peers diff --git a/commands/internal/socketreply.js b/commands/internal/socketreply.js index 3c4405c..6042937 100644 --- a/commands/internal/socketreply.js +++ b/commands/internal/socketreply.js @@ -16,7 +16,7 @@ export async function run({ server, socket, payload }) { if (payload.cmdKey !== server.cmdKey) { // internal command attempt by client, increase rate limit chance and ignore - return server.police.frisk(socket.address, 20); + return server.police.frisk(socket, 20); } // send warning to target socket diff --git a/commands/mod/ban.js b/commands/mod/ban.js index a791ec9..abd41ec 100644 --- a/commands/mod/ban.js +++ b/commands/mod/ban.js @@ -29,7 +29,7 @@ export async function run({ }) { // increase rate limit chance and ignore if not admin or mod if (!isModerator(socket.level)) { - return server.police.frisk(socket.address, 10); + return server.police.frisk(socket, 10); } // check user input diff --git a/commands/mod/disablecaptcha.js b/commands/mod/disablecaptcha.js index ff310c7..61eab0b 100644 --- a/commands/mod/disablecaptcha.js +++ b/commands/mod/disablecaptcha.js @@ -34,7 +34,7 @@ export async function run({ }) { // increase rate limit chance and ignore if not admin or mod if (!isModerator(socket.level)) { - return server.police.frisk(socket.address, 10); + return server.police.frisk(socket, 10); } let targetChannel; diff --git a/commands/mod/dumb.js b/commands/mod/dumb.js index 54578d1..ea602ac 100644 --- a/commands/mod/dumb.js +++ b/commands/mod/dumb.js @@ -82,7 +82,7 @@ export async function run({ }) { // increase rate limit chance and ignore if not admin or mod if (!isModerator(socket.level)) { - return server.police.frisk(socket.address, 10); + return server.police.frisk(socket, 10); } // check user input @@ -205,7 +205,7 @@ export function chatCheck({ * May expose the ratelimiting lines from `chat` and use that * @todo one day #lazydev */ - server.police.frisk(socket.address, 9); + server.police.frisk(socket, 9); return false; } @@ -227,7 +227,7 @@ export function inviteCheck({ }) { if (core.muzzledHashes[socket.hash]) { // check for spam - if (server.police.frisk(socket.address, 2)) { + if (server.police.frisk(socket, 2)) { return server.reply({ cmd: 'warn', text: 'You are sending invites too fast. Wait a moment before trying again.', @@ -308,12 +308,12 @@ export function whisperCheck({ if (!text) { // lets not send objects or empty text, yea? - return server.police.frisk(socket.address, 13); + return server.police.frisk(socket, 13); } // check for spam const score = text.length / 83 / 4; - if (server.police.frisk(socket.address, score)) { + if (server.police.frisk(socket, score)) { return server.reply({ cmd: 'warn', // @todo Add numeric error code as `id` text: 'You are sending too much text. Wait a moment and try again.\nPress the up arrow key to restore your last message.', diff --git a/commands/mod/enablecaptcha.js b/commands/mod/enablecaptcha.js index 571326a..0992219 100644 --- a/commands/mod/enablecaptcha.js +++ b/commands/mod/enablecaptcha.js @@ -51,7 +51,7 @@ export async function run({ }) { // increase rate limit chance and ignore if not admin or mod if (!isModerator(socket.level)) { - return server.police.frisk(socket.address, 10); + return server.police.frisk(socket, 10); } let targetChannel; @@ -141,7 +141,7 @@ export function chatCheck({ return false; } - server.police.frisk(socket.address, 7); + server.police.frisk(socket, 7); socket.terminate(); return false; diff --git a/commands/mod/forcecolor.js b/commands/mod/forcecolor.js index c5be5bd..8c53caf 100644 --- a/commands/mod/forcecolor.js +++ b/commands/mod/forcecolor.js @@ -37,7 +37,7 @@ export async function run({ }) { // increase rate limit chance and ignore if not admin or mod if (!isModerator(socket.level)) { - return server.police.frisk(socket.address, 10); + return server.police.frisk(socket, 10); } const { channel } = socket; diff --git a/commands/mod/kick.js b/commands/mod/kick.js index 7520c86..09506c4 100644 --- a/commands/mod/kick.js +++ b/commands/mod/kick.js @@ -29,7 +29,7 @@ export async function run({ }) { // increase rate limit chance and ignore if not admin or mod if (!isModerator(socket.level)) { - return server.police.frisk(socket.address, 10); + return server.police.frisk(socket, 10); } // check user input diff --git a/commands/mod/lockroom.js b/commands/mod/lockroom.js index babcd7e..d2eb10c 100644 --- a/commands/mod/lockroom.js +++ b/commands/mod/lockroom.js @@ -72,7 +72,7 @@ export async function run({ }) { // increase rate limit chance and ignore if not admin or mod if (!isModerator(socket.level)) { - return server.police.frisk(socket.address, 10); + return server.police.frisk(socket, 10); } let targetChannel; diff --git a/commands/mod/speak.js b/commands/mod/speak.js index 0c988d9..ded8802 100644 --- a/commands/mod/speak.js +++ b/commands/mod/speak.js @@ -35,7 +35,7 @@ export async function run({ }) { // increase rate limit chance and ignore if not admin or mod if (!isModerator(socket.level)) { - return server.police.frisk(socket.address, 10); + return server.police.frisk(socket, 10); } // check user input diff --git a/commands/mod/unban.js b/commands/mod/unban.js index 2c04b02..16405b2 100644 --- a/commands/mod/unban.js +++ b/commands/mod/unban.js @@ -21,7 +21,7 @@ export async function run({ }) { // increase rate limit chance and ignore if not admin or mod if (!isModerator(socket.level)) { - return server.police.frisk(socket.address, 10); + return server.police.frisk(socket, 10); } // check user input diff --git a/commands/mod/unbanall.js b/commands/mod/unbanall.js index 83f5afc..93133d2 100644 --- a/commands/mod/unbanall.js +++ b/commands/mod/unbanall.js @@ -19,7 +19,7 @@ import { export async function run({ core, server, socket }) { // increase rate limit chance and ignore if not admin or mod if (!isModerator(socket.level)) { - return server.police.frisk(socket.address, 10); + return server.police.frisk(socket, 10); } // remove arrest records diff --git a/commands/mod/unlockroom.js b/commands/mod/unlockroom.js index 9fcfebb..fc217d0 100644 --- a/commands/mod/unlockroom.js +++ b/commands/mod/unlockroom.js @@ -35,7 +35,7 @@ export async function run({ }) { // increase rate limit chance and ignore if not admin or mod if (!isModerator(socket.level)) { - return server.police.frisk(socket.address, 10); + return server.police.frisk(socket, 10); } let targetChannel; diff --git a/documentation/admin_addmod.js.html b/documentation/admin_addmod.js.html index 63e1265..94ee2a3 100644 --- a/documentation/admin_addmod.js.html +++ b/documentation/admin_addmod.js.html @@ -52,7 +52,7 @@ export async function run({ }) { // increase rate limit chance and ignore if not admin if (!isAdmin(socket.level)) { - return server.police.frisk(socket.address, 20); + return server.police.frisk(socket, 20); } // add new trip to config diff --git a/documentation/admin_listusers.js.html b/documentation/admin_listusers.js.html index 705a369..c2d28a0 100644 --- a/documentation/admin_listusers.js.html +++ b/documentation/admin_listusers.js.html @@ -51,7 +51,7 @@ import { export async function run({ server, socket }) { // increase rate limit chance and ignore if not admin if (!isAdmin(socket.level)) { - return server.police.frisk(socket.address, 20); + return server.police.frisk(socket, 20); } // find all users currently in a channel diff --git a/documentation/admin_reload.js.html b/documentation/admin_reload.js.html index 6759d6a..fa80ba2 100644 --- a/documentation/admin_reload.js.html +++ b/documentation/admin_reload.js.html @@ -50,7 +50,7 @@ export async function run({ }) { // increase rate limit chance and ignore if not admin if (!isAdmin(socket.level)) { - return server.police.frisk(socket.address, 20); + return server.police.frisk(socket, 20); } // do command reload and store results diff --git a/documentation/admin_removemod.js.html b/documentation/admin_removemod.js.html index 9422420..5c79041 100644 --- a/documentation/admin_removemod.js.html +++ b/documentation/admin_removemod.js.html @@ -52,7 +52,7 @@ export async function run({ }) { // increase rate limit chance and ignore if not admin if (!isAdmin(socket.level)) { - return server.police.frisk(socket.address, 20); + return server.police.frisk(socket, 20); } // remove trip from config diff --git a/documentation/admin_saveconfig.js.html b/documentation/admin_saveconfig.js.html index 696eb3d..336418e 100644 --- a/documentation/admin_saveconfig.js.html +++ b/documentation/admin_saveconfig.js.html @@ -48,7 +48,7 @@ import { export async function run({ core, server, socket }) { // increase rate limit chance and ignore if not admin if (!isAdmin(socket.level)) { - return server.police.frisk(socket.address, 20); + return server.police.frisk(socket, 20); } // attempt save, notify of failure diff --git a/documentation/admin_shout.js.html b/documentation/admin_shout.js.html index b76de12..68b9e61 100644 --- a/documentation/admin_shout.js.html +++ b/documentation/admin_shout.js.html @@ -47,7 +47,7 @@ import { export async function run({ server, socket, payload }) { // increase rate limit chance and ignore if not admin if (!isAdmin(socket.level)) { - return server.police.frisk(socket.address, 20); + return server.police.frisk(socket, 20); } // send text to all channels diff --git a/documentation/core_changecolor.js.html b/documentation/core_changecolor.js.html index 202b272..e63a2c2 100644 --- a/documentation/core_changecolor.js.html +++ b/documentation/core_changecolor.js.html @@ -58,7 +58,7 @@ export async function run({ }) { const { channel } = socket; - if (server.police.frisk(socket.address, 1)) { + if (server.police.frisk(socket, 1)) { return server.reply({ cmd: 'warn', // @todo Add numeric error code as `id` text: 'You are changing colors too fast. Wait a moment before trying again.', diff --git a/documentation/core_changenick.js.html b/documentation/core_changenick.js.html index 33ed8cd..1715f7f 100644 --- a/documentation/core_changenick.js.html +++ b/documentation/core_changenick.js.html @@ -52,7 +52,7 @@ export async function run({ }) { const { channel } = socket; - if (server.police.frisk(socket.address, 6)) { + if (server.police.frisk(socket, 6)) { return server.reply({ cmd: 'warn', // @todo Add numeric error code as `id` text: 'You are changing nicknames too fast. Wait a moment before trying again.', @@ -80,7 +80,7 @@ export async function run({ // prevent admin impersonation // @todo prevent mod impersonation if (newNick.toLowerCase() === core.config.adminName.toLowerCase()) { - server.police.frisk(socket.address, 4); + server.police.frisk(socket, 4); return server.reply({ cmd: 'warn', // @todo Add numeric error code as `id` diff --git a/documentation/core_chat.js.html b/documentation/core_chat.js.html index 915af4d..f41697e 100644 --- a/documentation/core_chat.js.html +++ b/documentation/core_chat.js.html @@ -76,12 +76,12 @@ export async function run({ if (!text) { // lets not send objects or empty text, yea? - return server.police.frisk(socket.address, 13); + return server.police.frisk(socket, 13); } // check for spam const score = text.length / 83 / 4; - if (server.police.frisk(socket.address, score)) { + if (server.police.frisk(socket, score)) { return server.reply({ cmd: 'warn', // @todo Add numeric error code as `id` text: 'You are sending too much text. Wait a moment and try again.\nPress the up arrow key to restore your last message.', diff --git a/documentation/core_emote.js.html b/documentation/core_emote.js.html index 1832c4a..f4392c3 100644 --- a/documentation/core_emote.js.html +++ b/documentation/core_emote.js.html @@ -69,12 +69,12 @@ export async function run({ server, socket, payload }) { if (!text) { // lets not send objects or empty text, yea? - return server.police.frisk(socket.address, 8); + return server.police.frisk(socket, 8); } // check for spam const score = text.length / 83 / 4; - if (server.police.frisk(socket.address, score)) { + if (server.police.frisk(socket, score)) { return server.reply({ cmd: 'warn', // @todo Add numeric error code as `id` text: 'You are sending too much text. Wait a moment and try again.\nPress the up arrow key to restore your last message.', diff --git a/documentation/core_help.js.html b/documentation/core_help.js.html index c337611..a062853 100644 --- a/documentation/core_help.js.html +++ b/documentation/core_help.js.html @@ -44,7 +44,7 @@ export async function run({ core, server, socket, payload, }) { // check for spam - if (server.police.frisk(socket.address, 2)) { + if (server.police.frisk(socket, 2)) { return server.reply({ cmd: 'warn', // @todo Add numeric error code as `id` text: 'You are sending too much text. Wait a moment and try again.\nPress the up arrow key to restore your last message.', diff --git a/documentation/core_invite.js.html b/documentation/core_invite.js.html index b33aeaf..0b8023b 100644 --- a/documentation/core_invite.js.html +++ b/documentation/core_invite.js.html @@ -68,7 +68,7 @@ export async function run({ core, server, socket, payload, }) { // check for spam - if (server.police.frisk(socket.address, 2)) { + if (server.police.frisk(socket, 2)) { return server.reply({ cmd: 'warn', text: 'You are sending invites too fast. Wait a moment before trying again.', diff --git a/documentation/core_join.js.html b/documentation/core_join.js.html index 518fa80..50a162d 100644 --- a/documentation/core_join.js.html +++ b/documentation/core_join.js.html @@ -63,7 +63,7 @@ export async function run({ core, server, socket, payload, }) { // check for spam - if (server.police.frisk(socket.address, 3)) { + if (server.police.frisk(socket, 3)) { return server.reply({ cmd: 'warn', text: 'You are joining channels too fast. Wait a moment and try again.', diff --git a/documentation/core_whisper.js.html b/documentation/core_whisper.js.html index 351c19c..dcc81b9 100644 --- a/documentation/core_whisper.js.html +++ b/documentation/core_whisper.js.html @@ -87,12 +87,12 @@ export async function run({ server, socket, payload }) { if (!text) { // lets not send objects or empty text, yea? - return server.police.frisk(socket.address, 13); + return server.police.frisk(socket, 13); } // check for spam const score = text.length / 83 / 4; - if (server.police.frisk(socket.address, score)) { + if (server.police.frisk(socket, score)) { return server.reply({ cmd: 'warn', // @todo Add numeric error code as `id` text: 'You are sending too much text. Wait a moment and try again.\nPress the up arrow key to restore your last message.', diff --git a/documentation/internal_disconnect.js.html b/documentation/internal_disconnect.js.html index e83bd69..5379738 100644 --- a/documentation/internal_disconnect.js.html +++ b/documentation/internal_disconnect.js.html @@ -43,7 +43,7 @@ export async function run({ server, socket, payload }) { if (payload.cmdKey !== server.cmdKey) { // internal command attempt by client, increase rate limit chance and ignore - return server.police.frisk(socket.address, 20); + return server.police.frisk(socket, 20); } // send leave notice to client peers diff --git a/documentation/internal_socketreply.js.html b/documentation/internal_socketreply.js.html index 144e062..1f233bd 100644 --- a/documentation/internal_socketreply.js.html +++ b/documentation/internal_socketreply.js.html @@ -44,7 +44,7 @@ export async function run({ server, socket, payload }) { if (payload.cmdKey !== server.cmdKey) { // internal command attempt by client, increase rate limit chance and ignore - return server.police.frisk(socket.address, 20); + return server.police.frisk(socket, 20); } // send warning to target socket diff --git a/documentation/mod_ban.js.html b/documentation/mod_ban.js.html index 9e61eb0..d87bc9b 100644 --- a/documentation/mod_ban.js.html +++ b/documentation/mod_ban.js.html @@ -57,7 +57,7 @@ export async function run({ }) { // increase rate limit chance and ignore if not admin or mod if (!isModerator(socket.level)) { - return server.police.frisk(socket.address, 10); + return server.police.frisk(socket, 10); } // check user input diff --git a/documentation/mod_dumb.js.html b/documentation/mod_dumb.js.html index 7ae8eae..5227833 100644 --- a/documentation/mod_dumb.js.html +++ b/documentation/mod_dumb.js.html @@ -110,7 +110,7 @@ export async function run({ }) { // increase rate limit chance and ignore if not admin or mod if (!isModerator(socket.level)) { - return server.police.frisk(socket.address, 10); + return server.police.frisk(socket, 10); } // check user input @@ -233,7 +233,7 @@ export function chatCheck({ * May expose the ratelimiting lines from `chat` and use that * @todo one day #lazydev */ - server.police.frisk(socket.address, 9); + server.police.frisk(socket, 9); return false; } @@ -255,7 +255,7 @@ export function inviteCheck({ }) { if (core.muzzledHashes[socket.hash]) { // check for spam - if (server.police.frisk(socket.address, 2)) { + if (server.police.frisk(socket, 2)) { return server.reply({ cmd: 'warn', text: 'You are sending invites too fast. Wait a moment before trying again.', @@ -336,12 +336,12 @@ export function whisperCheck({ if (!text) { // lets not send objects or empty text, yea? - return server.police.frisk(socket.address, 13); + return server.police.frisk(socket, 13); } // check for spam const score = text.length / 83 / 4; - if (server.police.frisk(socket.address, score)) { + if (server.police.frisk(socket, score)) { return server.reply({ cmd: 'warn', // @todo Add numeric error code as `id` text: 'You are sending too much text. Wait a moment and try again.\nPress the up arrow key to restore your last message.', diff --git a/documentation/mod_forcecolor.js.html b/documentation/mod_forcecolor.js.html index f8610d7..93c07ae 100644 --- a/documentation/mod_forcecolor.js.html +++ b/documentation/mod_forcecolor.js.html @@ -65,7 +65,7 @@ export async function run({ }) { // increase rate limit chance and ignore if not admin or mod if (!isModerator(socket.level)) { - return server.police.frisk(socket.address, 10); + return server.police.frisk(socket, 10); } const { channel } = socket; diff --git a/documentation/mod_kick.js.html b/documentation/mod_kick.js.html index 6b65861..9ca38e9 100644 --- a/documentation/mod_kick.js.html +++ b/documentation/mod_kick.js.html @@ -57,7 +57,7 @@ export async function run({ }) { // increase rate limit chance and ignore if not admin or mod if (!isModerator(socket.level)) { - return server.police.frisk(socket.address, 10); + return server.police.frisk(socket, 10); } // check user input diff --git a/documentation/mod_speak.js.html b/documentation/mod_speak.js.html index a9c6eb4..1e6fb78 100644 --- a/documentation/mod_speak.js.html +++ b/documentation/mod_speak.js.html @@ -63,7 +63,7 @@ export async function run({ }) { // increase rate limit chance and ignore if not admin or mod if (!isModerator(socket.level)) { - return server.police.frisk(socket.address, 10); + return server.police.frisk(socket, 10); } // check user input diff --git a/documentation/mod_unban.js.html b/documentation/mod_unban.js.html index ecf73cc..45d2427 100644 --- a/documentation/mod_unban.js.html +++ b/documentation/mod_unban.js.html @@ -49,7 +49,7 @@ export async function run({ }) { // increase rate limit chance and ignore if not admin or mod if (!isModerator(socket.level)) { - return server.police.frisk(socket.address, 10); + return server.police.frisk(socket, 10); } // check user input diff --git a/documentation/mod_unbanall.js.html b/documentation/mod_unbanall.js.html index a2ce97f..d1ae5fe 100644 --- a/documentation/mod_unbanall.js.html +++ b/documentation/mod_unbanall.js.html @@ -47,7 +47,7 @@ import { export async function run({ core, server, socket }) { // increase rate limit chance and ignore if not admin or mod if (!isModerator(socket.level)) { - return server.police.frisk(socket.address, 10); + return server.police.frisk(socket, 10); } // remove arrest records diff --git a/package.json b/package.json index a5e8980..61b70af 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "dependencies": { "ascii-captcha": "^0.0.3", "enquirer": "^2.3.6", - "hackchat-server": "^2.2.27", + "hackchat-server": "^2.3.0", "http-server": "^14.1.0", "jsonwebtoken": "^9.0.2", "lowdb": "^3.0.0",