Fix initial cookie display during handshake;
Signed-off-by: James Ketrenos <james_eikona@ketrenos.com>
This commit is contained in:
parent
5db9139b5c
commit
d42070ed36
@ -3898,10 +3898,16 @@ const shuffleBoard = (game) => {
|
|||||||
/* Simple NO-OP to set session cookie so player-id can use it as the
|
/* Simple NO-OP to set session cookie so player-id can use it as the
|
||||||
* index */
|
* index */
|
||||||
router.get("/", (req, res/*, next*/) => {
|
router.get("/", (req, res/*, next*/) => {
|
||||||
|
let playerId;
|
||||||
if (!req.cookies.player) {
|
if (!req.cookies.player) {
|
||||||
res.cookie('player', crypto.randomBytes(16).toString('hex'));
|
playerId = crypto.randomBytes(16).toString('hex');
|
||||||
|
res.cookie('player', playerId);
|
||||||
|
} else {
|
||||||
|
playerId = req.cookies.player;
|
||||||
}
|
}
|
||||||
console.log(`[${req.cookies.player.substring(0, 8)}]: Browser hand-shake has started.`)
|
|
||||||
|
console.log(`[${req.cookies.player.substring(0, 8)}]: Browser hand-shake has started.`);
|
||||||
|
|
||||||
return res.status(200).send({ player: req.cookies.player });
|
return res.status(200).send({ player: req.cookies.player });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user