mirror of https://gitgud.io/fatchan/jschan.git
The ban table now has a column or whether a ban is of an IP or Bypass ID. (Or pruned IP, if you were dumb enough to ban one of those)merge-requests/341/head
parent
00ec5182f0
commit
62678c2b19
15 changed files with 154 additions and 14 deletions
@ -0,0 +1,26 @@ |
||||
'use strict'; |
||||
|
||||
module.exports = async(db, redis) => { |
||||
console.log('Addjusting bans to categorise between normal/bypass/pruned, required for ban upgrading capabilities'); |
||||
await db.collection('bans').updateMany({ |
||||
'ip.cloak': /\.IP$/ |
||||
}, { |
||||
'$set':{ |
||||
'category': 0, |
||||
}, |
||||
}); |
||||
await db.collection('bans').updateMany({ |
||||
'ip.cloak': /\.BP$/ |
||||
}, { |
||||
'$set':{ |
||||
'category': 1, |
||||
}, |
||||
}); |
||||
await db.collection('bans').updateMany({ |
||||
'ip.cloak': /\.PRUNED$/ |
||||
}, { |
||||
'$set':{ |
||||
'category': 2, |
||||
}, |
||||
}); |
||||
}; |
@ -0,0 +1,17 @@ |
||||
'use strict'; |
||||
|
||||
const { Bans } = require(__dirname+'/../../db/'); |
||||
|
||||
module.exports = async (req, res, next) => { |
||||
|
||||
const nReturned = await Bans.upgrade(req.params.board, req.body.checkedbans, req.body.upgrade) |
||||
.then(explain => { |
||||
if (explain && explain.stages){ |
||||
return explain.stages[0].nReturned; |
||||
} |
||||
return 0; |
||||
}); |
||||
|
||||
return nReturned; |
||||
|
||||
} |
Loading…
Reference in new issue