mirror of
https://github.com/AlecM33/Werewolf.git
synced 2025-12-26 15:57:50 +01:00
expand game e2e tests with moderator view
This commit is contained in:
@@ -145,14 +145,15 @@ const ServerBootstrapper = {
|
||||
};
|
||||
|
||||
function isAuthorized (req) {
|
||||
const KEY = process.env.NODE_ENV.trim() === 'development'
|
||||
? globals.MOCK_AUTH
|
||||
: process.env.ADMIN_KEY;
|
||||
if (process.env.NODE_ENV.trim() === 'development') {
|
||||
return true;
|
||||
}
|
||||
|
||||
const header = req.headers.authorization;
|
||||
if (header) {
|
||||
const token = header.split(/\s+/).pop() || '';
|
||||
const decodedToken = Buffer.from(token, 'base64').toString();
|
||||
return decodedToken.trim() === KEY?.trim();
|
||||
return decodedToken.trim() === process.env.ADMIN_KEY?.trim();
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user