diff options
author | neelkamath <neelkamath@protonmail.com> | 2018-05-11 17:16:12 +0200 |
---|---|---|
committer | neelkamath <neelkamath@protonmail.com> | 2018-05-11 17:16:12 +0200 |
commit | 73e5c5ccfe408e58eb4bb927c71a77e0fceb22c4 (patch) | |
tree | 22b19a574ae856a6df24ce56c149da03ef440d88 | |
parent | Add license as a file in the repo as GitHub's documentation (diff) | |
download | hackchat-73e5c5ccfe408e58eb4bb927c71a77e0fceb22c4.tar.gz hackchat-73e5c5ccfe408e58eb4bb927c71a77e0fceb22c4.zip |
Remove forgettable, unused, occasionally harmful (w.r.t. ES6) directive
27 files changed, 1 insertions, 55 deletions
diff --git a/server/src/commands/admin/addmod.js b/server/src/commands/admin/addmod.js index e9dde2c..4c13b22 100644 --- a/server/src/commands/admin/addmod.js +++ b/server/src/commands/admin/addmod.js @@ -2,8 +2,6 @@ Description: Adds the target trip to the mod list then elevates the uType */ -'use strict'; - exports.run = async (core, server, socket, data) => { if (socket.uType != 'admin') { // ignore if not admin diff --git a/server/src/commands/admin/listusers.js b/server/src/commands/admin/listusers.js index 226b000..a539a3c 100644 --- a/server/src/commands/admin/listusers.js +++ b/server/src/commands/admin/listusers.js @@ -2,8 +2,6 @@ Description: Outputs all current channels and their user nicks */ -'use strict'; - exports.run = async (core, server, socket, data) => { if (socket.uType != 'admin') { // ignore if not admin diff --git a/server/src/commands/admin/reload.js b/server/src/commands/admin/reload.js index 387ae97..4e22a95 100644 --- a/server/src/commands/admin/reload.js +++ b/server/src/commands/admin/reload.js @@ -2,8 +2,6 @@ Description: Clears and resets the command modules, outputting any errors */ -'use strict'; - exports.run = async (core, server, socket, data) => { if (socket.uType != 'admin') { // ignore if not admin diff --git a/server/src/commands/admin/saveconfig.js b/server/src/commands/admin/saveconfig.js index 0c4e0c9..ed3a312 100644 --- a/server/src/commands/admin/saveconfig.js +++ b/server/src/commands/admin/saveconfig.js @@ -2,8 +2,6 @@ Description: Writes any changes to the config to the disk */ -'use strict'; - exports.run = async (core, server, socket, data) => { if (socket.uType != 'admin') { // ignore if not admin diff --git a/server/src/commands/admin/shout.js b/server/src/commands/admin/shout.js index 736134a..4ebf696 100644 --- a/server/src/commands/admin/shout.js +++ b/server/src/commands/admin/shout.js @@ -2,8 +2,6 @@ Description: Emmits a server-wide message as `info` */ -'use strict'; - exports.run = async (core, server, socket, data) => { if (socket.uType != 'admin') { // ignore if not admin diff --git a/server/src/commands/core/changenick.js b/server/src/commands/core/changenick.js index 6b2932c..4041bb0 100644 --- a/server/src/commands/core/changenick.js +++ b/server/src/commands/core/changenick.js @@ -2,8 +2,6 @@ Description: Generates a semi-unique channel name then broadcasts it to each client */ -'use strict'; - const verifyNickname = (nick) => { return /^[a-zA-Z0-9_]{1,24}$/.test(nick); }; diff --git a/server/src/commands/core/chat.js b/server/src/commands/core/chat.js index ee45425..4e95940 100644 --- a/server/src/commands/core/chat.js +++ b/server/src/commands/core/chat.js @@ -2,8 +2,6 @@ Description: Rebroadcasts any `text` to all clients in a `channel` */ -'use strict'; - const parseText = (text) => { if (typeof text !== 'string') { return false; diff --git a/server/src/commands/core/disconnect.js b/server/src/commands/core/disconnect.js index 1a9c635..41ca380 100644 --- a/server/src/commands/core/disconnect.js +++ b/server/src/commands/core/disconnect.js @@ -4,8 +4,6 @@ by a client to have the connection severed. */ -'use strict'; - exports.run = async (core, server, socket, data) => { if (socket.channel) { server.broadcast({ diff --git a/server/src/commands/core/help.js b/server/src/commands/core/help.js index 71cc745..331e13f 100644 --- a/server/src/commands/core/help.js +++ b/server/src/commands/core/help.js @@ -2,8 +2,6 @@ Description: Outputs the current command module list or command categories */ -'use strict'; - const stripIndents = require('common-tags').stripIndents; exports.run = async (core, server, socket, data) => { diff --git a/server/src/commands/core/invite.js b/server/src/commands/core/invite.js index bd85812..735dace 100644 --- a/server/src/commands/core/invite.js +++ b/server/src/commands/core/invite.js @@ -2,8 +2,6 @@ Description: Generates a semi-unique channel name then broadcasts it to each client */ -'use strict'; - const verifyNickname = (nick) => { return /^[a-zA-Z0-9_]{1,24}$/.test(nick); }; diff --git a/server/src/commands/core/join.js b/server/src/commands/core/join.js index 82b48d2..b385b89 100644 --- a/server/src/commands/core/join.js +++ b/server/src/commands/core/join.js @@ -2,8 +2,6 @@ Description: Initial entry point, applies `channel` and `nick` to the calling socket */ -'use strict'; - const crypto = require('crypto'); const hash = (password) => { diff --git a/server/src/commands/core/morestats.js b/server/src/commands/core/morestats.js index d8bc23d..c1105f1 100644 --- a/server/src/commands/core/morestats.js +++ b/server/src/commands/core/morestats.js @@ -2,8 +2,6 @@ Description: Outputs more info than the legacy stats command */ -'use strict'; - const stripIndents = require('common-tags').stripIndents; const formatTime = (time) => { diff --git a/server/src/commands/core/move.js b/server/src/commands/core/move.js index 862025c..9e50f4f 100644 --- a/server/src/commands/core/move.js +++ b/server/src/commands/core/move.js @@ -2,8 +2,6 @@ Description: Generates a semi-unique channel name then broadcasts it to each client */ -'use strict'; - exports.run = async (core, server, socket, data) => { if (server._police.frisk(socket.remoteAddress, 6)) { server.reply({ diff --git a/server/src/commands/core/showcase.js b/server/src/commands/core/showcase.js index 5eca4a2..35d811a 100644 --- a/server/src/commands/core/showcase.js +++ b/server/src/commands/core/showcase.js @@ -2,8 +2,6 @@ Description: This is a template module that should not be on prod */ -'use strict'; - // you can require() modules here // this function will only be only in the scope of the module 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 = {}; diff --git a/server/src/commands/mod/ban.js b/server/src/commands/mod/ban.js index 409217a..e19efc2 100644 --- a/server/src/commands/mod/ban.js +++ b/server/src/commands/mod/ban.js @@ -2,8 +2,6 @@ Description: Adds the target socket's ip to the ratelimiter */ -'use strict'; - exports.run = async (core, server, socket, data) => { if (socket.uType == 'user') { // ignore if not mod or admin diff --git a/server/src/commands/mod/kick.js b/server/src/commands/mod/kick.js index f32eaf5..1797ba9 100644 --- a/server/src/commands/mod/kick.js +++ b/server/src/commands/mod/kick.js @@ -2,8 +2,6 @@ Description: Forces a change on the target socket's channel, then broadcasts event */ -'use strict'; - exports.run = async (core, server, socket, data) => { if (socket.uType === 'user') { // ignore if not mod or admin diff --git a/server/src/commands/mod/unban.js b/server/src/commands/mod/unban.js index 2406644..d63288e 100644 --- a/server/src/commands/mod/unban.js +++ b/server/src/commands/mod/unban.js @@ -2,8 +2,6 @@ Description: Removes a target ip from the ratelimiter */ -'use strict'; - exports.run = async (core, server, socket, data) => { if (socket.uType == 'user') { // ignore if not mod or admin diff --git a/server/src/core/rateLimiter.js b/server/src/core/rateLimiter.js index 0d94ef2..0c2a384 100644 --- a/server/src/core/rateLimiter.js +++ b/server/src/core/rateLimiter.js @@ -8,15 +8,13 @@ * */ -'use strict'; - class Police { /** * Create a ratelimiter instance. */ constructor () { this._records = {}; - this._halflife = 30000; // ms + this._halflife = 30 * 1000; // milliseconds this._threshold = 25; this._hashes = []; } diff --git a/server/src/core/server.js b/server/src/core/server.js index 9bea738..855aeba 100644 --- a/server/src/core/server.js +++ b/server/src/core/server.js @@ -7,8 +7,6 @@ * */ -'use strict'; - const wsServer = require('ws').Server; const socketReady = require('ws').OPEN; const crypto = require('crypto'); diff --git a/server/src/managers/commands.js b/server/src/managers/commands.js index 569206d..c38fb4d 100644 --- a/server/src/managers/commands.js +++ b/server/src/managers/commands.js @@ -7,8 +7,6 @@ * */ -'use strict'; - const path = require('path'); const chalk = require('chalk'); const didYouMean = require('didyoumean2'); diff --git a/server/src/managers/config.js b/server/src/managers/config.js index 1848cac..2865d00 100644 --- a/server/src/managers/config.js +++ b/server/src/managers/config.js @@ -8,8 +8,6 @@ * */ -'use strict'; - const stripIndents = require('common-tags').stripIndents; const dateFormat = require('dateformat'); const chalk = require('chalk'); diff --git a/server/src/managers/imports-manager.js b/server/src/managers/imports-manager.js index f4096b7..d8b2144 100644 --- a/server/src/managers/imports-manager.js +++ b/server/src/managers/imports-manager.js @@ -7,8 +7,6 @@ * */ -'use strict'; - const read = require('readdir-recursive'); const path = require('path'); diff --git a/server/src/managers/stats.js b/server/src/managers/stats.js index c3b6f9f..20f1ae3 100644 --- a/server/src/managers/stats.js +++ b/server/src/managers/stats.js @@ -7,8 +7,6 @@ * */ -'use strict'; - class Stats { /** * Create a stats instance. diff --git a/server/src/scripts/configure.js b/server/src/scripts/configure.js index 0ecd858..88cd098 100644 --- a/server/src/scripts/configure.js +++ b/server/src/scripts/configure.js @@ -7,8 +7,6 @@ * */ -'use strict'; - // import required classes const path = require('path'); const ImportsManager = require('../managers/imports-manager'); diff --git a/server/src/scripts/debug.js b/server/src/scripts/debug.js index 3a97d9f..97597cd 100644 --- a/server/src/scripts/debug.js +++ b/server/src/scripts/debug.js @@ -7,8 +7,6 @@ * */ -'use strict'; - // import required classes const path = require('path'); const ConfigManager = require('../managers/config'); diff --git a/server/src/scripts/dev.js b/server/src/scripts/dev.js index 5049b84..f1608ed 100644 --- a/server/src/scripts/dev.js +++ b/server/src/scripts/dev.js @@ -7,8 +7,6 @@ * */ -'use strict'; - // import required classes |