From 8ca9c0b38b1f325e629021064400105fb27b303a Mon Sep 17 00:00:00 2001 From: Thomas Smyth Date: Sat, 9 Jan 2021 14:51:59 +0000 Subject: [PATCH] Update SquadJS API requests --- squad-server/index.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/squad-server/index.js b/squad-server/index.js index d699cd5..4caf9fd 100644 --- a/squad-server/index.js +++ b/squad-server/index.js @@ -396,26 +396,28 @@ export default class SquadServer extends EventEmitter { Logger.verbose('SquadServer', 1, 'Pinging SquadJS API...'); - const config = { - // send minimal information on server + const payload = { + // Send information about the server. server: { host: this.options.host, queryPort: this.options.queryPort, - logReaderMode: this.options.logReaderMode + + name: this.serverName, + playerCount: this.players.length }, - // we send all plugin information as none of that is sensitive. - plugins: this.plugins.map((plugin) => ({ - ...plugin.optionsRaw, - plugin: plugin.constructor.name - })), + // Send information about SquadJS. + squadjs: { + version: SQUADJS_VERSION, + logReaderMode: this.options.logReaderMode, - // send additional information about SquadJS - version: SQUADJS_VERSION + // Send the plugin config so we can see what plugins they're using (none of the config is sensitive). + plugins: this.plugins.map((plugin) => ({ ...plugin.rawOptions, plugin: plugin.constructor.name })) + } }; try { - const { data } = await axios.post(SQUADJS_API_DOMAIN + '/api/v1/ping', { config }); + const { data } = await axios.post(SQUADJS_API_DOMAIN + '/api/v1/ping', payload); if (data.error) Logger.verbose(