Init cs2 rcon panel

This commit is contained in:
Shobhit Pathak
2023-09-28 10:53:33 +05:30
commit 78d9792a03
22 changed files with 4384 additions and 0 deletions

14
modules/middleware.js Normal file
View File

@@ -0,0 +1,14 @@
function is_authenticated(req, res, next) {
if (req.session.user) {
next();
} else {
const accept_header = req.headers['accept'];
if (accept_header && accept_header.includes('text/html')) {
res.redirect('/');
} else {
res.status(401).json({ status: 401, message: 'Unauthorized' });
}
}
}
module.exports = is_authenticated;