Finished upgrade logic

This commit is contained in:
rainbow napkin 2026-07-06 01:06:33 -04:00
parent d03e221891
commit 0dda73cd14
8 changed files with 230 additions and 32 deletions

View file

@ -18,6 +18,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.*/
const {validationResult, matchedData} = require('express-validator');
//Local Imports
const server = require('../server.js');
const config = require('../../config.json');
const {userModel} = require('../schemas/user/userSchema.js');
const userBanModel = require('../schemas/user/userBanSchema.js');
@ -187,6 +188,22 @@ module.exports.killSession = async function(session){
session.destroy();
}
module.exports.killAllSessions = function(){
//Grab the entire session store from the server
server.store.all((err, sessions) => {
//You guys ever hear of a 'not my' problem? Fucking y33tskies lmao, better use a try/catch
if(err){
throw err;
}
//crawl through active sessions
sessions.forEach((session) => {
//Fuckin' nukem!
server.store.destroy(session.seshid);
});
});
}
/**
* Returns how many failed login attempts within the past day or so since the last login has occured for a given user
* @param {String} user - User to check map against