diff options
author | marzavec <admin@marzavec.com> | 2019-11-07 18:46:55 +0100 |
---|---|---|
committer | marzavec <admin@marzavec.com> | 2019-11-07 18:46:55 +0100 |
commit | f34ee18c301322ea02009efcc10ce86d350c68d0 (patch) | |
tree | 71a5b12a873f7c76e5dff03371349008ae826d8e | |
parent | Update DEPLOY.md (diff) | |
download | hackchat-f34ee18c301322ea02009efcc10ce86d350c68d0.tar.gz hackchat-f34ee18c301322ea02009efcc10ce86d350c68d0.zip |
Minor bug fixes
-rw-r--r-- | server/src/commands/core/changenick.js | 2 | ||||
-rw-r--r-- | server/src/commands/core/chat.js | 4 | ||||
-rw-r--r-- | server/src/commands/core/emote.js | 2 | ||||
-rw-r--r-- | server/src/commands/core/help.js | 2 | ||||
-rw-r--r-- | server/src/commands/core/morestats.js | 4 | ||||
-rw-r--r-- | server/src/commands/core/stats.js | 2 | ||||
-rw-r--r-- | server/src/commands/core/whisper.js | 2 | ||||
-rw-r--r-- | server/src/commands/mod/dumb.js | 4 | ||||
-rw-r--r-- | server/src/serverLib/RateLimiter.js | 2 |
9 files changed, 12 insertions, 12 deletions
diff --git a/server/src/commands/core/changenick.js b/server/src/commands/core/changenick.js index 632da83..6dbdfd2 100644 --- a/server/src/commands/core/changenick.js +++ b/server/src/commands/core/changenick.js @@ -87,7 +87,7 @@ export async function run(core, server, socket, data) { // module hook functions export function initHooks(server) { - server.registerHook('in', 'chat', this.nickCheck, 29); + server.registerHook('in', 'chat', this.nickCheck.bind(this), 29); } // hooks chat commands checking for /nick diff --git a/server/src/commands/core/chat.js b/server/src/commands/core/chat.js index 8d0098b..6c491b1 100644 --- a/server/src/commands/core/chat.js +++ b/server/src/commands/core/chat.js @@ -66,8 +66,8 @@ export async function run(core, server, socket, data) { // module hook functions export function initHooks(server) { - server.registerHook('in', 'chat', this.commandCheckIn, 20); - server.registerHook('in', 'chat', this.finalCmdCheck, 254); + server.registerHook('in', 'chat', this.commandCheckIn.bind(this), 20); + server.registerHook('in', 'chat', this.finalCmdCheck.bind(this), 254); } // checks for miscellaneous '/' based commands diff --git a/server/src/commands/core/emote.js b/server/src/commands/core/emote.js index f244d74..19a5fbe 100644 --- a/server/src/commands/core/emote.js +++ b/server/src/commands/core/emote.js @@ -56,7 +56,7 @@ export async function run(core, server, socket, payload) { // module hook functions export function initHooks(server) { - server.registerHook('in', 'chat', this.emoteCheck, 30); + server.registerHook('in', 'chat', this.emoteCheck.bind(this), 30); } // hooks chat commands checking for /me diff --git a/server/src/commands/core/help.js b/server/src/commands/core/help.js index 25f8844..f33dd12 100644 --- a/server/src/commands/core/help.js +++ b/server/src/commands/core/help.js @@ -59,7 +59,7 @@ export async function run(core, server, socket, payload) { // module hook functions export function initHooks(server) { - server.registerHook('in', 'chat', this.helpCheck, 28); + server.registerHook('in', 'chat', this.helpCheck.bind(this), 28); } // hooks chat commands checking for /whisper diff --git a/server/src/commands/core/morestats.js b/server/src/commands/core/morestats.js index 3cbf8f3..3b5ceb2 100644 --- a/server/src/commands/core/morestats.js +++ b/server/src/commands/core/morestats.js @@ -26,7 +26,7 @@ export async function run(core, server, socket) { let ips = {}; let channels = {}; // for (const client of server.clients) { - this.clients.forEach((client) => { + server.clients.forEach((client) => { if (client.channel) { channels[client.channel] = true; ips[client.address] = true; @@ -59,7 +59,7 @@ export async function run(core, server, socket) { // module hook functions export function initHooks(server) { - server.registerHook('in', 'chat', this.statsCheck, 26); + server.registerHook('in', 'chat', this.statsCheck.bind(this), 26); } // hooks chat commands checking for /stats diff --git a/server/src/commands/core/stats.js b/server/src/commands/core/stats.js index 8badd5b..421aec2 100644 --- a/server/src/commands/core/stats.js +++ b/server/src/commands/core/stats.js @@ -8,7 +8,7 @@ export async function run(core, server, socket) { let ips = {}; let channels = {}; // for (const client of server.clients) { - this.clients.forEach((client) => { + server.clients.forEach((client) => { if (client.channel) { channels[client.channel] = true; ips[client.address] = true; diff --git a/server/src/commands/core/whisper.js b/server/src/commands/core/whisper.js index 1cfa157..decf765 100644 --- a/server/src/commands/core/whisper.js +++ b/server/src/commands/core/whisper.js @@ -78,7 +78,7 @@ export async function run(core, server, socket, payload) { // module hook functions export function initHooks(server) { - server.registerHook('in', 'chat', this.whisperCheck, 20); + server.registerHook('in', 'chat', this.whisperCheck.bind(this), 20); } // hooks chat commands checking for /whisper diff --git a/server/src/commands/mod/dumb.js b/server/src/commands/mod/dumb.js index 644bd4f..89aad4b 100644 --- a/server/src/commands/mod/dumb.js +++ b/server/src/commands/mod/dumb.js @@ -63,8 +63,8 @@ export async function run(core, server, socket, data) { // module hook functions export function initHooks(server) { - server.registerHook('in', 'chat', this.chatCheck, 25); - server.registerHook('in', 'invite', this.inviteCheck, 25); + server.registerHook('in', 'chat', this.chatCheck.bind(this), 25); + server.registerHook('in', 'invite', this.inviteCheck.bind(this), 25); // TODO: add whisper hook, need hook priorities todo finished first } diff --git a/server/src/serverLib/RateLimiter.js b/server/src/serverLib/RateLimiter.js index 3f9bc27..a4a0cd8 100644 --- a/server/src/serverLib/RateLimiter.js +++ b/server/src/serverLib/RateLimiter.js @@ -77,7 +77,7 @@ class RateLimiter { return true; } - record.score *= 2 ** -(Date.now() - record.time) / this.halflife; + record.score *= Math.pow(2, -(Date.now() - record.time ) / this.halflife); record.score += deltaScore; record.time = Date.now(); |