From 73e5c5ccfe408e58eb4bb927c71a77e0fceb22c4 Mon Sep 17 00:00:00 2001 From: neelkamath Date: Fri, 11 May 2018 20:46:12 +0530 Subject: Remove forgettable, unused, occasionally harmful (w.r.t. ES6) directive --- server/src/commands/core/stats.js | 2 -- 1 file changed, 2 deletions(-) (limited to 'server/src/commands/core/stats.js') diff --git a/server/src/commands/core/stats.js b/server/src/commands/core/stats.js index a1abddb..3a96381 100644 --- a/server/src/commands/core/stats.js +++ b/server/src/commands/core/stats.js @@ -2,8 +2,6 @@ Description: Legacy stats output, kept for compatibility, outputs user and channel count */ -'use strict'; - exports.run = async (core, server, socket, data) => { let ips = {}; let channels = {}; -- cgit v1.2.1 From acbad15f2bc4a6733407bc17e1a5b4190ed3b287 Mon Sep 17 00:00:00 2001 From: neelkamath Date: Sat, 12 May 2018 14:13:12 +0530 Subject: Remove unused object fields --- server/src/commands/core/stats.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'server/src/commands/core/stats.js') diff --git a/server/src/commands/core/stats.js b/server/src/commands/core/stats.js index 3a96381..2802579 100644 --- a/server/src/commands/core/stats.js +++ b/server/src/commands/core/stats.js @@ -26,7 +26,4 @@ exports.run = async (core, server, socket, data) => { core.managers.stats.increment('stats-requested'); }; -exports.info = { - name: 'stats', - description: 'Sends back legacy server stats to the calling client' -}; +exports.info = { name: 'stats' }; -- cgit v1.2.1 From 343157350f627b9495184246a90033a1c41f1a2c Mon Sep 17 00:00:00 2001 From: Neel Kamath Date: Sun, 13 May 2018 16:03:22 +0530 Subject: Re-add module documentation --- server/src/commands/core/stats.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'server/src/commands/core/stats.js') diff --git a/server/src/commands/core/stats.js b/server/src/commands/core/stats.js index 2802579..b9dc002 100644 --- a/server/src/commands/core/stats.js +++ b/server/src/commands/core/stats.js @@ -26,4 +26,7 @@ exports.run = async (core, server, socket, data) => { core.managers.stats.increment('stats-requested'); }; -exports.info = { name: 'stats' }; +exports.info = { + name: 'stats', + description: 'Sends back legacy server stats to the calling client' +}; \ No newline at end of file -- cgit v1.2.1 From 2bb5ced363b692a5696b176bc317fe525c0c05df Mon Sep 17 00:00:00 2001 From: Neel Kamath Date: Sun, 13 May 2018 16:09:55 +0530 Subject: Flatten --- server/src/commands/core/stats.js | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 server/src/commands/core/stats.js (limited to 'server/src/commands/core/stats.js') diff --git a/server/src/commands/core/stats.js b/server/src/commands/core/stats.js deleted file mode 100644 index b9dc002..0000000 --- a/server/src/commands/core/stats.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - Description: Legacy stats output, kept for compatibility, outputs user and channel count -*/ - -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', - text: `${uniqueClientCount} unique IPs in ${uniqueChannels} channels` - }, socket); - - core.managers.stats.increment('stats-requested'); -}; - -exports.info = { - name: 'stats', - description: 'Sends back legacy server stats to the calling client' -}; \ No newline at end of file -- cgit v1.2.1 From 949404cd1aad8492ae0338130f16054adfa38ab7 Mon Sep 17 00:00:00 2001 From: Neel Kamath Date: Sun, 13 May 2018 16:37:56 +0530 Subject: Prevent fucking shit up --- server/src/commands/core/stats.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 server/src/commands/core/stats.js (limited to 'server/src/commands/core/stats.js') diff --git a/server/src/commands/core/stats.js b/server/src/commands/core/stats.js new file mode 100644 index 0000000..b9dc002 --- /dev/null +++ b/server/src/commands/core/stats.js @@ -0,0 +1,32 @@ +/* + Description: Legacy stats output, kept for compatibility, outputs user and channel count +*/ + +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', + text: `${uniqueClientCount} unique IPs in ${uniqueChannels} channels` + }, socket); + + core.managers.stats.increment('stats-requested'); +}; + +exports.info = { + name: 'stats', + description: 'Sends back legacy server stats to the calling client' +}; \ No newline at end of file -- cgit v1.2.1