1
0
mirror of https://github.com/hack-chat/main.git synced 2024-03-22 13:20:33 +08:00

Remove forgettable, unused, occasionally harmful (w.r.t. ES6) directive

This commit is contained in:
neelkamath 2018-05-11 20:46:12 +05:30
parent 97f8a61c76
commit 73e5c5ccfe
27 changed files with 1 additions and 55 deletions

View File

@ -2,8 +2,6 @@
Description: Adds the target trip to the mod list then elevates the uType Description: Adds the target trip to the mod list then elevates the uType
*/ */
'use strict';
exports.run = async (core, server, socket, data) => { exports.run = async (core, server, socket, data) => {
if (socket.uType != 'admin') { if (socket.uType != 'admin') {
// ignore if not admin // ignore if not admin

View File

@ -2,8 +2,6 @@
Description: Outputs all current channels and their user nicks Description: Outputs all current channels and their user nicks
*/ */
'use strict';
exports.run = async (core, server, socket, data) => { exports.run = async (core, server, socket, data) => {
if (socket.uType != 'admin') { if (socket.uType != 'admin') {
// ignore if not admin // ignore if not admin

View File

@ -2,8 +2,6 @@
Description: Clears and resets the command modules, outputting any errors Description: Clears and resets the command modules, outputting any errors
*/ */
'use strict';
exports.run = async (core, server, socket, data) => { exports.run = async (core, server, socket, data) => {
if (socket.uType != 'admin') { if (socket.uType != 'admin') {
// ignore if not admin // ignore if not admin

View File

@ -2,8 +2,6 @@
Description: Writes any changes to the config to the disk Description: Writes any changes to the config to the disk
*/ */
'use strict';
exports.run = async (core, server, socket, data) => { exports.run = async (core, server, socket, data) => {
if (socket.uType != 'admin') { if (socket.uType != 'admin') {
// ignore if not admin // ignore if not admin

View File

@ -2,8 +2,6 @@
Description: Emmits a server-wide message as `info` Description: Emmits a server-wide message as `info`
*/ */
'use strict';
exports.run = async (core, server, socket, data) => { exports.run = async (core, server, socket, data) => {
if (socket.uType != 'admin') { if (socket.uType != 'admin') {
// ignore if not admin // ignore if not admin

View File

@ -2,8 +2,6 @@
Description: Generates a semi-unique channel name then broadcasts it to each client Description: Generates a semi-unique channel name then broadcasts it to each client
*/ */
'use strict';
const verifyNickname = (nick) => { const verifyNickname = (nick) => {
return /^[a-zA-Z0-9_]{1,24}$/.test(nick); return /^[a-zA-Z0-9_]{1,24}$/.test(nick);
}; };

View File

@ -2,8 +2,6 @@
Description: Rebroadcasts any `text` to all clients in a `channel` Description: Rebroadcasts any `text` to all clients in a `channel`
*/ */
'use strict';
const parseText = (text) => { const parseText = (text) => {
if (typeof text !== 'string') { if (typeof text !== 'string') {
return false; return false;

View File

@ -4,8 +4,6 @@
by a client to have the connection severed. by a client to have the connection severed.
*/ */
'use strict';
exports.run = async (core, server, socket, data) => { exports.run = async (core, server, socket, data) => {
if (socket.channel) { if (socket.channel) {
server.broadcast({ server.broadcast({

View File

@ -2,8 +2,6 @@
Description: Outputs the current command module list or command categories Description: Outputs the current command module list or command categories
*/ */
'use strict';
const stripIndents = require('common-tags').stripIndents; const stripIndents = require('common-tags').stripIndents;
exports.run = async (core, server, socket, data) => { exports.run = async (core, server, socket, data) => {

View File

@ -2,8 +2,6 @@
Description: Generates a semi-unique channel name then broadcasts it to each client Description: Generates a semi-unique channel name then broadcasts it to each client
*/ */
'use strict';
const verifyNickname = (nick) => { const verifyNickname = (nick) => {
return /^[a-zA-Z0-9_]{1,24}$/.test(nick); return /^[a-zA-Z0-9_]{1,24}$/.test(nick);
}; };

View File

@ -2,8 +2,6 @@
Description: Initial entry point, applies `channel` and `nick` to the calling socket Description: Initial entry point, applies `channel` and `nick` to the calling socket
*/ */
'use strict';
const crypto = require('crypto'); const crypto = require('crypto');
const hash = (password) => { const hash = (password) => {

View File

@ -2,8 +2,6 @@
Description: Outputs more info than the legacy stats command Description: Outputs more info than the legacy stats command
*/ */
'use strict';
const stripIndents = require('common-tags').stripIndents; const stripIndents = require('common-tags').stripIndents;
const formatTime = (time) => { const formatTime = (time) => {

View File

@ -2,8 +2,6 @@
Description: Generates a semi-unique channel name then broadcasts it to each client Description: Generates a semi-unique channel name then broadcasts it to each client
*/ */
'use strict';
exports.run = async (core, server, socket, data) => { exports.run = async (core, server, socket, data) => {
if (server._police.frisk(socket.remoteAddress, 6)) { if (server._police.frisk(socket.remoteAddress, 6)) {
server.reply({ server.reply({

View File

@ -2,8 +2,6 @@
Description: This is a template module that should not be on prod Description: This is a template module that should not be on prod
*/ */
'use strict';
// you can require() modules here // you can require() modules here
// this function will only be only in the scope of the module // this function will only be only in the scope of the module

View File

@ -2,8 +2,6 @@
Description: Legacy stats output, kept for compatibility, outputs user and channel count Description: Legacy stats output, kept for compatibility, outputs user and channel count
*/ */
'use strict';
exports.run = async (core, server, socket, data) => { exports.run = async (core, server, socket, data) => {
let ips = {}; let ips = {};
let channels = {}; let channels = {};

View File

@ -2,8 +2,6 @@
Description: Adds the target socket's ip to the ratelimiter Description: Adds the target socket's ip to the ratelimiter
*/ */
'use strict';
exports.run = async (core, server, socket, data) => { exports.run = async (core, server, socket, data) => {
if (socket.uType == 'user') { if (socket.uType == 'user') {
// ignore if not mod or admin // ignore if not mod or admin

View File

@ -2,8 +2,6 @@
Description: Forces a change on the target socket's channel, then broadcasts event Description: Forces a change on the target socket's channel, then broadcasts event
*/ */
'use strict';
exports.run = async (core, server, socket, data) => { exports.run = async (core, server, socket, data) => {
if (socket.uType === 'user') { if (socket.uType === 'user') {
// ignore if not mod or admin // ignore if not mod or admin

View File

@ -2,8 +2,6 @@
Description: Removes a target ip from the ratelimiter Description: Removes a target ip from the ratelimiter
*/ */
'use strict';
exports.run = async (core, server, socket, data) => { exports.run = async (core, server, socket, data) => {
if (socket.uType == 'user') { if (socket.uType == 'user') {
// ignore if not mod or admin // ignore if not mod or admin

View File

@ -8,15 +8,13 @@
* *
*/ */
'use strict';
class Police { class Police {
/** /**
* Create a ratelimiter instance. * Create a ratelimiter instance.
*/ */
constructor () { constructor () {
this._records = {}; this._records = {};
this._halflife = 30000; // ms this._halflife = 30 * 1000; // milliseconds
this._threshold = 25; this._threshold = 25;
this._hashes = []; this._hashes = [];
} }

View File

@ -7,8 +7,6 @@
* *
*/ */
'use strict';
const wsServer = require('ws').Server; const wsServer = require('ws').Server;
const socketReady = require('ws').OPEN; const socketReady = require('ws').OPEN;
const crypto = require('crypto'); const crypto = require('crypto');

View File

@ -7,8 +7,6 @@
* *
*/ */
'use strict';
const path = require('path'); const path = require('path');
const chalk = require('chalk'); const chalk = require('chalk');
const didYouMean = require('didyoumean2'); const didYouMean = require('didyoumean2');

View File

@ -8,8 +8,6 @@
* *
*/ */
'use strict';
const stripIndents = require('common-tags').stripIndents; const stripIndents = require('common-tags').stripIndents;
const dateFormat = require('dateformat'); const dateFormat = require('dateformat');
const chalk = require('chalk'); const chalk = require('chalk');

View File

@ -7,8 +7,6 @@
* *
*/ */
'use strict';
const read = require('readdir-recursive'); const read = require('readdir-recursive');
const path = require('path'); const path = require('path');

View File

@ -7,8 +7,6 @@
* *
*/ */
'use strict';
class Stats { class Stats {
/** /**
* Create a stats instance. * Create a stats instance.

View File

@ -7,8 +7,6 @@
* *
*/ */
'use strict';
// import required classes // import required classes
const path = require('path'); const path = require('path');
const ImportsManager = require('../managers/imports-manager'); const ImportsManager = require('../managers/imports-manager');

View File

@ -7,8 +7,6 @@
* *
*/ */
'use strict';
// import required classes // import required classes
const path = require('path'); const path = require('path');
const ConfigManager = require('../managers/config'); const ConfigManager = require('../managers/config');

View File

@ -7,8 +7,6 @@
* *
*/ */
'use strict';
// import required classes // import required classes