Firefoxでの動作を改善
This commit is contained in:
tamaina 2021-08-05 02:58:17 +09:00
parent ba756204b7
commit b6804a6201
4 changed files with 25 additions and 22 deletions

View file

@ -146,7 +146,7 @@
"http-proxy-agent": "4.0.1", "http-proxy-agent": "4.0.1",
"http-signature": "1.3.5", "http-signature": "1.3.5",
"https-proxy-agent": "5.0.0", "https-proxy-agent": "5.0.0",
"idb-keyval": "5.0.6", "idb-keyval": "5.1.3",
"insert-text-at-cursor": "0.3.0", "insert-text-at-cursor": "0.3.0",
"is-root": "2.1.0", "is-root": "2.1.0",
"is-svg": "4.3.1", "is-svg": "4.3.1",

View file

@ -29,23 +29,23 @@ export async function signout() {
//#endregion //#endregion
//#region Remove push notification registration //#region Remove push notification registration
await navigator.serviceWorker.ready.then(async r => { const registration = await navigator.serviceWorker.ready
const push = await r.pushManager.getSubscription();
if (!push) return; const push = await registration.pushManager.getSubscription();
return fetch(`${apiUrl}/sw/unregister`, { if (!push) return;
method: 'POST', await fetch(`${apiUrl}/sw/unregister`, {
body: JSON.stringify({ method: 'POST',
i: $i.token, body: JSON.stringify({
endpoint: push.endpoint, i: $i.token,
}), endpoint: push.endpoint,
}); }),
}); });
//#endregion //#endregion
document.cookie = `igi=; path=/`; document.cookie = `igi=; path=/`;
if (accounts.length > 0) login(accounts[0].token); if (accounts.length > 0) login(accounts[0].token);
else unisonReload(true); else unisonReload();
} }
export async function getAccounts(): Promise<{ id: Account['id'], token: Account['token'] }[]> { export async function getAccounts(): Promise<{ id: Account['id'], token: Account['token'] }[]> {

View file

@ -4,6 +4,7 @@ import {
get as iget, get as iget,
set as iset, set as iset,
del as idel, del as idel,
createStore,
} from 'idb-keyval'; } from 'idb-keyval';
const fallbackName = (key: string) => `idbfallback::${key}`; const fallbackName = (key: string) => `idbfallback::${key}`;
@ -12,12 +13,7 @@ let idbAvailable = typeof window !== 'undefined' ? !!window.indexedDB : true;
if (idbAvailable) { if (idbAvailable) {
try { try {
const request = indexedDB.open('keyval-store'); await createStore('keyval-store', 'keyval')
await new Promise((res, rej) => {
request.onerror = (e) => rej(e);
request.onsuccess = (e) => res(e);
});
} catch (e) { } catch (e) {
console.error('idb open error', e); console.error('idb open error', e);
idbAvailable = false; idbAvailable = false;

View file

@ -5576,10 +5576,12 @@ icss-utils@^5.0.0, icss-utils@^5.1.0:
resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-5.1.0.tgz#c6be6858abd013d768e98366ae47e25d5887b1ae" resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-5.1.0.tgz#c6be6858abd013d768e98366ae47e25d5887b1ae"
integrity sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA== integrity sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==
idb-keyval@5.0.6: idb-keyval@5.1.3:
version "5.0.6" version "5.1.3"
resolved "https://registry.yarnpkg.com/idb-keyval/-/idb-keyval-5.0.6.tgz#62fe4a6703fb5ec86661f41330c94fda65e6d0e6" resolved "https://registry.yarnpkg.com/idb-keyval/-/idb-keyval-5.1.3.tgz#6ef5dff371897c23f144322dc6374eadd6a345d9"
integrity sha512-6lJuVbwyo82mKSH6Wq2eHkt9LcbwHAelMIcMe0tP4p20Pod7tTxq9zf0ge2n/YDfMOpDryerfmmYyuQiaFaKOg== integrity sha512-N9HbCK/FaXSRVI+k6Xq4QgWxbcZRUv+SfG1y7HJ28JdV8yEJu6k+C/YLea7npGckX2DQJeEVuMc4bKOBeU/2LQ==
dependencies:
safari-14-idb-fix "^1.0.4"
ieee754@1.1.13, ieee754@^1.1.13, ieee754@^1.1.4: ieee754@1.1.13, ieee754@^1.1.13, ieee754@^1.1.4:
version "1.1.13" version "1.1.13"
@ -9740,6 +9742,11 @@ s-age@1.1.2:
resolved "https://registry.yarnpkg.com/s-age/-/s-age-1.1.2.tgz#c0cf15233ccc93f41de92ea42c36d957977d1ea2" resolved "https://registry.yarnpkg.com/s-age/-/s-age-1.1.2.tgz#c0cf15233ccc93f41de92ea42c36d957977d1ea2"
integrity sha512-aSN2TlF39WLoZA/6cgYSJZhKt63kJ4EaadejPWjWY9/h4rksIqvfWY3gfd+3uAegSM1IXsA9aWeEhJtkxkFQtA== integrity sha512-aSN2TlF39WLoZA/6cgYSJZhKt63kJ4EaadejPWjWY9/h4rksIqvfWY3gfd+3uAegSM1IXsA9aWeEhJtkxkFQtA==
safari-14-idb-fix@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/safari-14-idb-fix/-/safari-14-idb-fix-1.0.4.tgz#5c68ba63e2a8ae0d89a0aa1e13fe89e3aef7da19"
integrity sha512-4+Y2baQdgJpzu84d0QjySl70Kyygzf0pepVg8NVg4NnQEPpfC91fAn0baNvtStlCjUUxxiu0BOMiafa98fRRuA==
safe-buffer@*: safe-buffer@*:
version "5.2.1" version "5.2.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"