diff options
author | marzavec <admin@marzavec.com> | 2018-09-30 08:44:36 +0200 |
---|---|---|
committer | marzavec <admin@marzavec.com> | 2018-09-30 08:44:36 +0200 |
commit | c719020e17cb1c98da55be6cc7efe0e50ab51ffa (patch) | |
tree | 4c1e7f05aec2b6a995e21d2bbecbb45c2ae14bd6 /server/src/commands/internal | |
parent | Merge pull request #28 from henrywright/27 (diff) | |
download | hackchat-c719020e17cb1c98da55be6cc7efe0e50ab51ffa.tar.gz hackchat-c719020e17cb1c98da55be6cc7efe0e50ab51ffa.zip |
Added hooks, modules and cleaned up code
Diffstat (limited to '')
-rw-r--r-- | server/src/commands/internal/disconnect.js | 7 | ||||
-rw-r--r-- | server/src/commands/internal/socketreply.js | 7 |
2 files changed, 6 insertions, 8 deletions
diff --git a/server/src/commands/internal/disconnect.js b/server/src/commands/internal/disconnect.js index 7b9b299..8656779 100644 --- a/server/src/commands/internal/disconnect.js +++ b/server/src/commands/internal/disconnect.js @@ -3,12 +3,11 @@ when a socket connection is closed or lost. */ +// module main exports.run = async (core, server, socket, data) => { if (data.cmdKey !== server._cmdKey) { // internal command attempt by client, increase rate limit chance and ignore - server._police.frisk(socket.remoteAddress, 20); - - return; + return server._police.frisk(socket.remoteAddress, 20); } // send leave notice to client peers @@ -23,8 +22,8 @@ exports.run = async (core, server, socket, data) => { socket.terminate(); }; +// module meta exports.requiredData = ['cmdKey']; - exports.info = { name: 'disconnect', usage: 'Internal Use Only', diff --git a/server/src/commands/internal/socketreply.js b/server/src/commands/internal/socketreply.js index e77d080..fa3b8cf 100644 --- a/server/src/commands/internal/socketreply.js +++ b/server/src/commands/internal/socketreply.js @@ -2,20 +2,19 @@ Description: Used to relay warnings to clients internally */ +// module main exports.run = async (core, server, socket, data) => { if (data.cmdKey !== server._cmdKey) { // internal command attempt by client, increase rate limit chance and ignore - server._police.frisk(socket.remoteAddress, 20); - - return; + return server._police.frisk(socket.remoteAddress, 20); } // send warning to target socket server.reply({ cmd: 'warn', text: data.text }, socket); }; +// module meta exports.requiredData = ['cmdKey', 'text']; - exports.info = { name: 'socketreply', usage: 'Internal Use Only', |