2018-03-09 23:47:00 -08:00
|
|
|
/*
|
2018-03-13 22:26:53 -07:00
|
|
|
Description: Legacy stats output, kept for compatibility, outputs user and channel count
|
2018-03-09 23:47:00 -08:00
|
|
|
*/
|
|
|
|
|
|
|
|
exports.run = async (core, server, socket, data) => {
|
|
|
|
let ips = {};
|
|
|
|
let channels = {};
|
|
|
|
for (let client of server.clients) {
|
|
|
|
if (client.channel) {
|
|
|
|
channels[client.channel] = true;
|
|
|
|
ips[client.remoteAddress] = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
let uniqueClientCount = Object.keys(ips).length;
|
|
|
|
let uniqueChannels = Object.keys(channels).length;
|
|
|
|
|
|
|
|
ips = null;
|
|
|
|
channels = null;
|
|
|
|
|
|
|
|
server.reply({
|
|
|
|
cmd: 'info',
|
2018-03-13 22:26:53 -07:00
|
|
|
text: `${uniqueClientCount} unique IPs in ${uniqueChannels} channels`
|
2018-03-09 23:47:00 -08:00
|
|
|
}, socket);
|
|
|
|
|
|
|
|
core.managers.stats.increment('stats-requested');
|
|
|
|
};
|
|
|
|
|
2018-05-13 16:03:22 +05:30
|
|
|
exports.info = {
|
|
|
|
name: 'stats',
|
|
|
|
description: 'Sends back legacy server stats to the calling client'
|
|
|
|
};
|