mirror of
https://github.com/IrosTheBeggar/mStream.git
synced 2025-10-27 07:31:02 +00:00
fix redirect bug
This commit is contained in:
parent
48638fc363
commit
4763202afd
@ -82,7 +82,7 @@ exports.serveIt = async configFile => {
|
||||
const matchEnd = req.path.match(/(\/)+$/g);
|
||||
const queryString = req.url.match(/(\?.*)/g) === null ? '' : req.url.match(/(\?.*)/g);
|
||||
// redirect to a more sane URL
|
||||
return res.redirect(301, req.path.slice(0, (matchEnd[0].length - 1)*-1) + queryString);
|
||||
return res.redirect(302, req.path.slice(0, (matchEnd[0].length - 1)*-1) + queryString);
|
||||
}
|
||||
next();
|
||||
});
|
||||
@ -107,18 +107,18 @@ exports.serveIt = async configFile => {
|
||||
jwt.verify(req.cookies['x-access-token'], config.program.secret);
|
||||
next();
|
||||
} catch(err) {
|
||||
return res.redirect(301, 'login');
|
||||
return res.redirect(302, '/login');
|
||||
}
|
||||
});
|
||||
|
||||
mstream.get('/login', (req, res, next) => {
|
||||
if (Object.keys(config.program.users).length === 0){
|
||||
return res.redirect(301, '..');
|
||||
return res.redirect(302, '..');
|
||||
}
|
||||
|
||||
try {
|
||||
jwt.verify(req.cookies['x-access-token'], config.program.secret);
|
||||
return res.redirect(301, '..');
|
||||
return res.redirect(302, '..');
|
||||
} catch(err) {
|
||||
next();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user