aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/admin/addmod.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/commands/admin/addmod.js')
-rw-r--r--server/src/commands/admin/addmod.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/server/src/commands/admin/addmod.js b/server/src/commands/admin/addmod.js
index 4c13b22..bde54a1 100644
--- a/server/src/commands/admin/addmod.js
+++ b/server/src/commands/admin/addmod.js
@@ -3,19 +3,18 @@
*/
exports.run = async (core, server, socket, data) => {
+ // increase rate limit chance and ignore if not admin
if (socket.uType != 'admin') {
- // ignore if not admin
- return;
- }
+ server._police.frisk(socket.remoteAddress, 20);
- let mod = {
- trip: data.trip
+ return;
}
- core.config.mods.push(mod); // purposely not using `config.set()` to avoid auto-save
+ // add new trip to config
+ core.config.mods.push({ trip: data.trip }); // purposely not using `config.set()` to avoid auto-save
+ // upgarde existing connections & notify user
let newMod = server.findSockets({ trip: data.trip });
-
if (newMod.length !== 0) {
for (let i = 0, l = newMod.length; i < l; i++) {
newMod[i].uType = 'mod';
@@ -27,11 +26,13 @@ exports.run = async (core, server, socket, data) => {
}
}
+ // return success message
server.reply({
cmd: 'info',
text: `Added mod trip: ${data.trip}`
}, socket);
+ // notify all mods
server.broadcast({
cmd: 'info',
text: `Added mod trip: ${data.trip}`