aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorAndrea Lepori <alepori@student.ethz.ch>2020-04-24 22:23:30 +0200
committerAndrea Lepori <alepori@student.ethz.ch>2020-04-24 22:23:30 +0200
commit965fe684e290f9b76a6222136fc49d56a203d741 (patch)
treee4669caf5bb04b1158aea47079b6da254185fb58 /server
parentno rate limit for localhost (diff)
downloadhackchat-965fe684e290f9b76a6222136fc49d56a203d741.tar.gz
hackchat-965fe684e290f9b76a6222136fc49d56a203d741.zip
rate limit not for localhost fix
Diffstat (limited to 'server')
-rw-r--r--server/src/serverLib/MainServer.js5
1 files changed, 2 insertions, 3 deletions
diff --git a/server/src/serverLib/MainServer.js b/server/src/serverLib/MainServer.js
index ae26be3..6ba2d8d 100644
--- a/server/src/serverLib/MainServer.js
+++ b/server/src/serverLib/MainServer.js
@@ -153,7 +153,7 @@ class MainServer extends WsServer {
*/
handleData(socket, data) {
// Don't penalize yet, but check whether IP is rate-limited
- if (this.police.frisk(socket.address, 0)) {
+ if (this.police.frisk(socket.address, 0) && socket.address != "127.0.0.1") {
this.core.commands.handleCommand(this, socket, {
cmd: 'socketreply',
cmdKey: this.cmdKey,
@@ -165,8 +165,7 @@ class MainServer extends WsServer {
// Penalize here, but don't do anything about it
// Don't penalize localhost for bots
- if (socket.address == "localhost" || socket.address == "127.0.0.1") {
- } else {
+ if (socket.address != "127.0.0.1") {
this.police.frisk(socket.address, 1);
}