Skip to content

Commit

Permalink
fix cookies, add error log
Browse files Browse the repository at this point in the history
  • Loading branch information
benStre committed Mar 26, 2024
1 parent 4cdb14f commit f414b80
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions runtime/display.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ function setup() {
export function displayFatalError(code:string, reset_btn = true) {

// disable error screen (at least for now, immediately reset page)
console.error `
FATAL ERROR: ${code}
Cannot restore the current state. Deleting all caches.
`
errorReset();
return;

Expand Down
4 changes: 2 additions & 2 deletions utils/cookies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function deleteCookie(name: string) {
throw new Error("cannot delete cookies for non-browser environment");
}
if (port) name += "/" + port;
document.cookie = name +'=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
document.cookie = name +'=; Path=/; SameSite=None; Expires=Thu, 01 Jan 1970 00:00:01 GMT; Secure;'+ (browserIsSafariLocalhost ? "" :" Secure;");
}


Expand All @@ -28,7 +28,7 @@ export function setCookie(name: string, value: string, expDays?: number) {
expiryDate.setTime(expiryDate.getTime() + (expDays * 24 * 60 * 60 * 1000));
}
const expires = expDays == 0 ? "" : "expires=" + expiryDate.toUTCString() + ";";
document.cookie = name + "=" + value + "; " + expires + " path=/; SameSite=None;" + (browserIsSafariLocalhost ? "" :" Secure;")
document.cookie = name + "=" + value + "; " + expires + " path=/; SameSite=None;" + (browserIsSafariLocalhost ? "" :" Secure;")
}

export function getCookie(name: string) {
Expand Down

0 comments on commit f414b80

Please sign in to comment.