mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-01-17 21:02:22 +01:00
add ban expires time to config file, it can be auto moved when the time is expires
This commit is contained in:
2
config/env/torrents.js
vendored
2
config/env/torrents.js
vendored
@@ -77,7 +77,7 @@ module.exports = {
|
||||
},
|
||||
chat: {
|
||||
ban: {
|
||||
expires: 60 * 60 * 1000 * 2
|
||||
expires: 60 * 60 * 1000 * 1
|
||||
}
|
||||
},
|
||||
tmdbConfig: {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 + '] ');
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user