aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands
diff options
context:
space:
mode:
authorAndrea Lepori <alepori@student.ethz.ch>2020-04-29 09:13:23 +0200
committerAndrea Lepori <alepori@student.ethz.ch>2020-04-29 09:13:23 +0200
commit357a34a3d5f5be3b8015b9ccda09444444b4fc48 (patch)
tree7d60b62ff566c6ee8531b501212fea50c750ffe7 /server/src/commands
parentremove logging (diff)
downloadhackchat-357a34a3d5f5be3b8015b9ccda09444444b4fc48.tar.gz
hackchat-357a34a3d5f5be3b8015b9ccda09444444b4fc48.zip
add ip check in chat and join
Diffstat (limited to 'server/src/commands')
-rw-r--r--server/src/commands/core/chat.js12
-rw-r--r--server/src/commands/core/join.js12
2 files changed, 14 insertions, 10 deletions
diff --git a/server/src/commands/core/chat.js b/server/src/commands/core/chat.js
index fad9ea0..c69f6cb 100644
--- a/server/src/commands/core/chat.js
+++ b/server/src/commands/core/chat.js
@@ -33,11 +33,13 @@ export async function run(core, server, socket, data) {
// check for spam
const score = text.length / 83 / 4;
- if (server.police.frisk(socket.address, score) && !UAC.isModerator(socket.level)) {
- return server.reply({
- cmd: 'warn',
- text: 'You are sending too much text. Wait a moment and try again.\nPress the up arrow key to restore your last message.',
- }, socket);
+ if (socket.address != "::ffff:172.18.0.1") {
+ if (server.police.frisk(socket.address, score) && !UAC.isModerator(socket.level)) {
+ return server.reply({
+ cmd: 'warn',
+ text: 'You are sending too much text. Wait a moment and try again.\nPress the up arrow key to restore your last message.',
+ }, socket);
+ }
}
// build chat payload
diff --git a/server/src/commands/core/join.js b/server/src/commands/core/join.js
index 719fa51..b22bc7d 100644
--- a/server/src/commands/core/join.js
+++ b/server/src/commands/core/join.js
@@ -66,11 +66,13 @@ export function parseNickname(core, data) {
// module main
export async function run(core, server, socket, data) {
// check for spam
- if (server.police.frisk(socket.address, 3) && !UAC.isModerator(socket.level)) {
- return server.reply({
- cmd: 'warn',
- text: 'You are joining channels too fast. Wait a moment and try again.',
- }, socket);
+ if (socket.address != "::ffff:172.18.0.1") {
+ if (server.police.frisk(socket.address, 3)) {
+ return server.reply({
+ cmd: 'warn',
+ text: 'You are joining channels too fast. Wait a moment and try again.',
+ }, socket);
+ }
}
// calling socket already in a channel