Skip to content

Commit 1ec4d93

Browse files
committed
coderabbit feedback
1 parent 32900db commit 1ec4d93

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/client/HostLobbyModal.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ export class HostLobbyModal extends LitElement {
596596
// join lobby
597597
const cookieDurationSec = 60 * 60 * 6; //Store cookie for max 6 hours
598598
// getting error here from lobby.hostToken
599-
document.cookie = `hostToken=${lobby.hostToken}; Max-Axe=${cookieDurationSec}; Path=/`;
599+
document.cookie = `hostToken=${lobby.hostToken}; Max-Age=${cookieDurationSec}; Path=/`;
600600
})
601601
.then(() => {
602602
this.dispatchEvent(
@@ -818,7 +818,8 @@ export class HostLobbyModal extends LitElement {
818818
body: JSON.stringify({ hostToken: hostToken }),
819819
},
820820
);
821-
document.cookie = "hostToken=;Max-Age=-1"; //delete cookie
821+
const secure = location.protocol === "https:" ? "; Secure" : "";
822+
document.cookie = `hostToken=; Max-Age=0; Path=/; SameSite=Strict${secure}`; //delete cookie
822823
return response;
823824
}
824825

src/server/Worker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export async function startWorker() {
175175

176176
if (hostToken !== game.getHostToken()) {
177177
log.info(`cannot start private game ${game.id}, requestor is not host`);
178-
res.status(403).json({ success: false };
178+
res.status(403).json({ success: false });
179179
return;
180180
}
181181
game.start();

0 commit comments

Comments
 (0)