mirror of
https://github.com/AlecM33/Werewolf.git
synced 2025-12-26 15:57:50 +01:00
send existing cookie on join call
This commit is contained in:
@@ -254,7 +254,11 @@ class GameManager {
|
||||
}
|
||||
};
|
||||
|
||||
joinGame = (game, name) => {
|
||||
joinGame = (game, name, cookie) => {
|
||||
const matchingPerson = findPersonByField(game, 'cookie', cookie);
|
||||
if (matchingPerson) {
|
||||
return Promise.resolve(matchingPerson.cookie);
|
||||
}
|
||||
if (isNameTaken(game, name)) {
|
||||
return Promise.reject(400);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ const http = require('http');
|
||||
const https = require('https');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const secure = require('express-force-https');
|
||||
|
||||
const ServerBootstrapper = {
|
||||
processCLIArgs: () => {
|
||||
@@ -56,8 +55,15 @@ const ServerBootstrapper = {
|
||||
}
|
||||
} else {
|
||||
logger.warn('starting main in PRODUCTION mode. This should not be used for local development.');
|
||||
app.use(secure);
|
||||
main = http.createServer(app);
|
||||
app.use(function(req,res,next) {
|
||||
const schema = (req.headers['x-forwarded-proto'] || '').toLowerCase();
|
||||
if (!req.path.includes('/_ah/start') && req.headers.host.indexOf('localhost')<0 && schema!=='https') {
|
||||
res.redirect('https://' + req.headers.host + req.url);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return main;
|
||||
|
||||
Reference in New Issue
Block a user