From 6c68b74367901ac681ca60380bd74ff64c9bcd0d Mon Sep 17 00:00:00 2001 From: OldHawk Date: Fri, 12 May 2017 16:55:30 +0800 Subject: [PATCH] add ban expires time to config file, it can be auto moved when the time is expires --- config/env/torrents.js | 2 +- config/lib/socket.io.js | 5 ----- modules/chat/client/controllers/chat.client.controller.js | 6 +----- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/config/env/torrents.js b/config/env/torrents.js index 24e29ce4..e28991d7 100644 --- a/config/env/torrents.js +++ b/config/env/torrents.js @@ -77,7 +77,7 @@ module.exports = { }, chat: { ban: { - expires: 60 * 60 * 1000 * 2 + expires: 60 * 60 * 1000 * 1 } }, tmdbConfig: { diff --git a/config/lib/socket.io.js b/config/lib/socket.io.js index 086b0f08..10576e3a 100644 --- a/config/lib/socket.io.js +++ b/config/lib/socket.io.js @@ -99,19 +99,14 @@ module.exports = function (app, db) { passport.session()(socket.request, {}, function () { if (socket.request.user) { // check ban list - //console.log(io.banClients); var banned = false; for (var i = io.banClients.length - 1; i >= 0; i--) { var buser = io.banClients[i]; - //console.log('buser.expires=' + buser.expires); - //console.log('Date.now()=' + Date.now()); if (buser.expires <= Date.now()) { //already expires, remove it io.banClients.splice(io.banClients.indexOf(buser), 1); continue; } else { var address = socket.handshake.address; - console.log(address); - console.log(buser.ip); if (buser.user.username === socket.request.user.username) { //username in ban list banned = true; next(new Error('username "' + buser.user.username + '" is banned from the server'), false); diff --git a/modules/chat/client/controllers/chat.client.controller.js b/modules/chat/client/controllers/chat.client.controller.js index ad80a929..a6b45b88 100644 --- a/modules/chat/client/controllers/chat.client.controller.js +++ b/modules/chat/client/controllers/chat.client.controller.js @@ -64,10 +64,7 @@ // Make sure the Socket is connected if (!Socket.socket) { - Socket.connect(function (err) { - console.log('========server error==========='); - console.log(err); - }); + Socket.connect(); } // Remove the event listener when the controller instance is destroyed @@ -308,7 +305,6 @@ * @param uitem */ vm.onUserListItemDblClicked = function (uitem) { - console.log(uitem); addAtUserToInput(' [@' + uitem.displayName + '] '); };