new functions and js v=
This commit is contained in:
1 parent
d1d8bb0259
commit
0a02a0880e
31 files changed
+1035
-610
No files matched your search
@@ -40,6 +40,16 @@ export function setNickname(value) {
|
||||
setNicknameCookie(nickname);
|
||||
}
|
||||
|
||||
const GUEST_ID_COOKIE = "rustpad_guest_id";
|
||||
export function getGuestId() {
|
||||
let guestId = getCookie(GUEST_ID_COOKIE);
|
||||
if (!/^[a-zA-Z0-9_-]{16,64}$/.test(guestId)) {
|
||||
guestId = crypto.randomUUID().replaceAll("-", "");
|
||||
document.cookie = `${GUEST_ID_COOKIE}=${guestId}; Path=/; SameSite=Lax`;
|
||||
}
|
||||
return guestId;
|
||||
}
|
||||
|
||||
const AUTH_TOKEN_KEY = "rustpad:auth-token";
|
||||
// Account sessions must be shared by every tab on this origin. Keep a
|
||||
// compatibility fallback for sessions created by older frontend versions.
|
||||
|
||||
Reference in new issue
Block a user