Update SquadJS API requests

This commit is contained in:
Thomas Smyth 2021-01-09 14:51:59 +00:00
parent 070867377e
commit 8ca9c0b38b

View File

@ -396,26 +396,28 @@ export default class SquadServer extends EventEmitter {
Logger.verbose('SquadServer', 1, 'Pinging SquadJS API...'); Logger.verbose('SquadServer', 1, 'Pinging SquadJS API...');
const config = { const payload = {
// send minimal information on server // Send information about the server.
server: { server: {
host: this.options.host, host: this.options.host,
queryPort: this.options.queryPort, 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. // Send information about SquadJS.
plugins: this.plugins.map((plugin) => ({ squadjs: {
...plugin.optionsRaw, version: SQUADJS_VERSION,
plugin: plugin.constructor.name logReaderMode: this.options.logReaderMode,
})),
// send additional information about SquadJS // Send the plugin config so we can see what plugins they're using (none of the config is sensitive).
version: SQUADJS_VERSION plugins: this.plugins.map((plugin) => ({ ...plugin.rawOptions, plugin: plugin.constructor.name }))
}
}; };
try { 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) if (data.error)
Logger.verbose( Logger.verbose(