diff options
author | marzavec <admin@marzavec.com> | 2018-06-04 09:07:24 +0200 |
---|---|---|
committer | marzavec <admin@marzavec.com> | 2018-06-04 09:07:24 +0200 |
commit | e35fff59ba30e78046c9212e74fce9aef56c6e93 (patch) | |
tree | c7d3e0cd75f5a6063d629d4295952488907e9562 /server/src/commands/admin/saveconfig.js | |
parent | Completed protocol decoupling (diff) | |
download | hackchat-e35fff59ba30e78046c9212e74fce9aef56c6e93.tar.gz hackchat-e35fff59ba30e78046c9212e74fce9aef56c6e93.zip |
cleaned up and commented modules
Diffstat (limited to '')
-rw-r--r-- | server/src/commands/admin/saveconfig.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/server/src/commands/admin/saveconfig.js b/server/src/commands/admin/saveconfig.js index ed3a312..20927e7 100644 --- a/server/src/commands/admin/saveconfig.js +++ b/server/src/commands/admin/saveconfig.js @@ -1,16 +1,17 @@ /* - Description: Writes any changes to the config to the disk + Description: Writes the current config to disk */ exports.run = async (core, server, socket, data) => { + // increase rate limit chance and ignore if not admin if (socket.uType != 'admin') { - // ignore if not admin + server._police.frisk(socket.remoteAddress, 20); + return; } - let saveResult = core.managers.config.save(); - - if (!saveResult) { + // attempt save, notify of failure + if (!core.managers.config.save()) { server.reply({ cmd: 'warn', text: 'Failed to save config, check logs.' @@ -19,11 +20,13 @@ exports.run = async (core, server, socket, data) => { return; } + // return success message server.reply({ cmd: 'info', text: 'Config saved!' }, socket); + // notify mods #transparency server.broadcast({ cmd: 'info', text: 'Config saved!' @@ -32,5 +35,5 @@ exports.run = async (core, server, socket, data) => { exports.info = { name: 'saveconfig', - description: 'Saves current config' + description: 'Writes the current config to disk' }; |