aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/internal/socketreply.js
blob: fa3b8cfdcce91d123968948e8e8edb036196e070 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
  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
    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',
  description: 'Internally used to relay warnings to clients'
};