summaryrefslogtreecommitdiff
path: root/packages/frontend/src/account.ts
diff options
context:
space:
mode:
authorHazelnoot <acomputerdog@gmail.com>2025-02-03 14:31:26 -0500
committerHazelnoot <acomputerdog@gmail.com>2025-02-03 14:36:09 -0500
commita4e86758c1c53f4e623b6e8f613d4a6e34e96156 (patch)
treed09bf325b7f52512a1fe2a9d35f1953d2b310309 /packages/frontend/src/account.ts
parentmerge: Use package manager version from package.json (!883) (diff)
parentfix(build): corepackのバグの回避 (#15387) (diff)
downloadsharkey-a4e86758c1c53f4e623b6e8f613d4a6e34e96156.tar.gz
sharkey-a4e86758c1c53f4e623b6e8f613d4a6e34e96156.tar.bz2
sharkey-a4e86758c1c53f4e623b6e8f613d4a6e34e96156.zip
merge upstream 2025-02-03
Diffstat (limited to 'packages/frontend/src/account.ts')
-rw-r--r--packages/frontend/src/account.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/frontend/src/account.ts b/packages/frontend/src/account.ts
index 366345b5b3..5005b17b3c 100644
--- a/packages/frontend/src/account.ts
+++ b/packages/frontend/src/account.ts
@@ -102,6 +102,9 @@ export async function removeAccount(idOrToken: Account['id']) {
}
function fetchAccount(token: string, id?: string, forceShowDialog?: boolean): Promise<Account> {
+ document.cookie = `token=; path=/; max-age=0${ location.protocol === 'https:' ? '; Secure' : ''}`;
+ document.cookie = `token=; path=/queue; max-age=86400${ location.protocol === 'https:' ? '; SameSite=Strict; Secure' : ''}`; // bull dashboardの認証とかで使う
+
return new Promise((done, fail) => {
window.fetch(`${apiUrl}/i`, {
method: 'POST',
@@ -150,9 +153,9 @@ function fetchAccount(token: string, id?: string, forceShowDialog?: boolean): Pr
} else if (res.error.id === 'd5826d14-3982-4d2e-8011-b9e9f02499ef') {
// rate limited
const timeToWait = res.error.info?.resetMs ?? 1000;
- window.setTimeout(timeToWait, () => {
+ window.setTimeout(() => {
fetchAccount(token, id, forceShowDialog).then(done, fail);
- });
+ }, timeToWait);
return;
} else {
await alert({
@@ -221,7 +224,6 @@ export async function login(token: Account['token'], redirect?: string) {
throw reason;
});
miLocalStorage.setItem('account', JSON.stringify(me));
- document.cookie = `token=${token}; path=/; max-age=31536000${ location.protocol === 'https:' ? '; Secure' : ''}`; // bull dashboardの認証とかで使う
await addAccount(me.id, token);
if (redirect) {