aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/internal/socketreply.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/commands/internal/socketreply.js')
-rw-r--r--server/src/commands/internal/socketreply.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/server/src/commands/internal/socketreply.js b/server/src/commands/internal/socketreply.js
new file mode 100644
index 0000000..82834b7
--- /dev/null
+++ b/server/src/commands/internal/socketreply.js
@@ -0,0 +1,22 @@
+/*
+ Description: Used to relay warnings to clients internally
+*/
+
+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;
+ }
+
+ server.reply({ cmd: 'warn', text: data.text }, socket);
+};
+
+exports.requiredData = ['cmdKey', 'text'];
+
+exports.info = {
+ name: 'socketreply',
+ usage: 'Internal Use Only',
+ description: 'Internally used to relay warnings to clients'
+};