Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

fix(app): keep starting when browser storage fails (#3728)

Hampus670626f5cdad
diff --git a/fluxer_app/src/features/app/components/layout/GlobalOverlays.tsx b/fluxer_app/src/features/app/components/layout/GlobalOverlays.tsx
index 2006dcbbf..e9fd98f26 100644
--- a/fluxer_app/src/features/app/components/layout/GlobalOverlays.tsx
+++ b/fluxer_app/src/features/app/components/layout/GlobalOverlays.tsx
@@ -4,6 +4,7 @@ import {Modals} from '@app/features/app/components/dialogs/Modals';
import styles from '@app/features/app/components/layout/GlobalOverlays.module.css';
import {MEDIA_VIEWER_PORTAL_ROOT_ID} from '@app/features/messaging/components/modals/MediaViewerPortal';
import {createNamedLoadableComponent} from '@app/features/platform/components/loadable/LoadableComponent';
+import {useAppStorageDegradedNotice} from '@app/features/platform/hooks/useAppStorageDegradedNotice';
import * as QuickSwitcherCommands from '@app/features/search/commands/QuickSwitcherCommands';
import QuickSwitcher from '@app/features/search/state/QuickSwitcher';
import {ContextMenu} from '@app/features/ui/action_menu/ContextMenu';
@@ -27,6 +28,7 @@ const GlobalOverlays: React.FC = observer(() => {
const isMobile = MobileLayout.isMobileLayout();
const quickSwitcherOpen = QuickSwitcher.isOpen;
const [quickSwitcherBottomSheetLoaded, setQuickSwitcherBottomSheetLoaded] = useState(false);
+ useAppStorageDegradedNotice();
useEffect(() => {
LayerManager.init();
document.addEventListener('contextmenu', handleContextMenu, false);
diff --git a/fluxer_app/src/features/i18n/locales/ar/messages.po b/fluxer_app/src/features/i18n/locales/ar/messages.po
index b1999d20c..00ca3d914 100644
--- a/fluxer_app/src/features/i18n/locales/ar/messages.po
+++ b/fluxer_app/src/features/i18n/locales/ar/messages.po
@@ -36924,6 +36924,11 @@ msgstr "يطلب هذا البوت إذن المسؤول. لا تمنحه هذا
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "لا يمكن لهذا المتصفح قص ملفات {avifFormatLabel} المتحركة. قم بتحميل ملف GIF أو WebP بدلاً من ذلك."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "لا يستطيع هذا المتصفح حفظ بيانات Fluxer. ستحتاج إلى تسجيل الدخول مرة أخرى بعد إغلاقه."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/bg/messages.po b/fluxer_app/src/features/i18n/locales/bg/messages.po
index e8f374f06..4199d8ae7 100644
--- a/fluxer_app/src/features/i18n/locales/bg/messages.po
+++ b/fluxer_app/src/features/i18n/locales/bg/messages.po
@@ -36924,6 +36924,11 @@ msgstr "Този бот иска разрешението „Администр
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "Този браузър не може да обработва анимирани {avifFormatLabel} файлове. Вместо това качете GIF или WebP."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "Този браузър не може да запазва данните на Fluxer. Ще трябва да влезете отново, след като го затворите."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/cs/messages.po b/fluxer_app/src/features/i18n/locales/cs/messages.po
index 31202b2d0..e02863ad6 100644
--- a/fluxer_app/src/features/i18n/locales/cs/messages.po
+++ b/fluxer_app/src/features/i18n/locales/cs/messages.po
@@ -36924,6 +36924,11 @@ msgstr "Tento bot vyžaduje administrátorská oprávnění. Udělte mu je, pouz
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "Tento prohlížeč neumí oříznout animované soubory {avifFormatLabel}. Nahrajte místo toho GIF nebo WebP."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "Tento prohlížeč nemůže ukládat data Fluxeru. Po jeho zavření se budete muset znovu přihlásit."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/da/messages.po b/fluxer_app/src/features/i18n/locales/da/messages.po
index b2b2b2dce..f04d9ee3a 100644
--- a/fluxer_app/src/features/i18n/locales/da/messages.po
+++ b/fluxer_app/src/features/i18n/locales/da/messages.po
@@ -36924,6 +36924,11 @@ msgstr "Denne bot anmoder om administratorrettigheder. Giv kun adgang, hvis du h
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "Denne browser kan ikke beskære animerede {avifFormatLabel}-filer. Upload en GIF eller WebP i stedet."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "Denne browser kan ikke gemme Fluxers data. Du skal logge ind igen, når du har lukket den."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/de/messages.po b/fluxer_app/src/features/i18n/locales/de/messages.po
index 63087764d..a59ee7a79 100644
--- a/fluxer_app/src/features/i18n/locales/de/messages.po
+++ b/fluxer_app/src/features/i18n/locales/de/messages.po
@@ -36924,6 +36924,11 @@ msgstr "Dieser Bot fordert die Administratorberechtigung an. Erteile sie nur, we
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "Dieser Browser kann keine animierten {avifFormatLabel}-Dateien zuschneiden. Lade stattdessen eine GIF- oder WebP-Datei hoch."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "Dieser Browser kann die Daten von Fluxer nicht speichern. Nachdem du ihn geschlossen hast, musst du dich erneut anmelden."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/el/messages.po b/fluxer_app/src/features/i18n/locales/el/messages.po
index 9ab2936f8..17e040987 100644
--- a/fluxer_app/src/features/i18n/locales/el/messages.po
+++ b/fluxer_app/src/features/i18n/locales/el/messages.po
@@ -36924,6 +36924,11 @@ msgstr "Αυτό το bot ζητά το δικαίωμα διαχειριστή.
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "Αυτό το πρόγραμμα περιήγησης δεν μπορεί να περικόψει κινούμενα αρχεία {avifFormatLabel}. Ανεβάστε ένα αρχείο GIF ή WebP αντ' αυτού."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "Αυτό το πρόγραμμα περιήγησης δεν μπορεί να αποθηκεύσει τα δεδομένα του Fluxer. Θα πρέπει να συνδεθείτε ξανά αφού το κλείσετε."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/en-GB/messages.po b/fluxer_app/src/features/i18n/locales/en-GB/messages.po
index 515806974..520eeca03 100644
--- a/fluxer_app/src/features/i18n/locales/en-GB/messages.po
+++ b/fluxer_app/src/features/i18n/locales/en-GB/messages.po
@@ -36924,6 +36924,11 @@ msgstr "This bot requests the administrator permission. Only grant it if you ful
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/en-US/messages.po b/fluxer_app/src/features/i18n/locales/en-US/messages.po
index f24129e5d..575dce11d 100644
--- a/fluxer_app/src/features/i18n/locales/en-US/messages.po
+++ b/fluxer_app/src/features/i18n/locales/en-US/messages.po
@@ -36924,6 +36924,11 @@ msgstr "This bot requests the administrator permission. Only grant it if you ful
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/es-419/messages.po b/fluxer_app/src/features/i18n/locales/es-419/messages.po
index f6397d598..13c94af52 100644
--- a/fluxer_app/src/features/i18n/locales/es-419/messages.po
+++ b/fluxer_app/src/features/i18n/locales/es-419/messages.po
@@ -36924,6 +36924,11 @@ msgstr "Este bot solicita el permiso de administrador. Concédeselo solo si conf
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "Este navegador no puede recortar archivos animados de {avifFormatLabel}. Sube un GIF o WebP en su lugar."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "Este navegador no puede guardar los datos de Fluxer. Tendrás que volver a iniciar sesión después de cerrarlo."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/es-ES/messages.po b/fluxer_app/src/features/i18n/locales/es-ES/messages.po
index 7ece40e37..d0a3deebc 100644
--- a/fluxer_app/src/features/i18n/locales/es-ES/messages.po
+++ b/fluxer_app/src/features/i18n/locales/es-ES/messages.po
@@ -36924,6 +36924,11 @@ msgstr "Este bot solicita permiso de administrador. Concédeselo solo si confía
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "Este navegador no puede recortar archivos animados de {avifFormatLabel}. Sube un GIF o WebP en su lugar."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "Este navegador no puede guardar los datos de Fluxer. Tendrás que volver a iniciar sesión después de cerrarlo."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/fi/messages.po b/fluxer_app/src/features/i18n/locales/fi/messages.po
index 71abb47b8..af40f150d 100644
--- a/fluxer_app/src/features/i18n/locales/fi/messages.po
+++ b/fluxer_app/src/features/i18n/locales/fi/messages.po
@@ -36924,6 +36924,11 @@ msgstr "Tämä botti pyytää ylläpitäjän käyttöoikeutta. Myönnä se vain,
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "Selaimesi ei voi rajata animoituja {avifFormatLabel} -tiedostoja. Lataa sen sijaan GIF- tai WebP-tiedosto."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "Tämä selain ei voi tallentaa Fluxerin tietoja. Sinun täytyy kirjautua uudelleen, kun olet sulkenut sen."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/fr/messages.po b/fluxer_app/src/features/i18n/locales/fr/messages.po
index 9bab487c5..30b51c832 100644
--- a/fluxer_app/src/features/i18n/locales/fr/messages.po
+++ b/fluxer_app/src/features/i18n/locales/fr/messages.po
@@ -36924,6 +36924,11 @@ msgstr "Ce bot demande la permission d'administrateur. Ne l'accordez que si vous
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "Ce navigateur ne peut pas recadrer les fichiers {avifFormatLabel} animés. Téléchargez plutôt un GIF ou un WebP."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "Ce navigateur ne peut pas enregistrer les données de Fluxer. Vous devrez vous reconnecter après l'avoir fermé."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/he/messages.po b/fluxer_app/src/features/i18n/locales/he/messages.po
index 0d89c93a7..5da047a1a 100644
--- a/fluxer_app/src/features/i18n/locales/he/messages.po
+++ b/fluxer_app/src/features/i18n/locales/he/messages.po
@@ -36924,6 +36924,11 @@ msgstr "הבוט הזה מבקש הרשאת מנהל מערכת. הענק אות
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "הדפדפן הזה לא יכול לחתוך קבצי {avifFormatLabel} מונפשים. העלה קובץ GIF או WebP במקום זאת."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "הדפדפן הזה לא יכול לשמור את הנתונים של Fluxer. יהיה צריך להתחבר שוב אחרי שסוגרים אותו."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/hi/messages.po b/fluxer_app/src/features/i18n/locales/hi/messages.po
index 7541c2dea..4b70c34ea 100644
--- a/fluxer_app/src/features/i18n/locales/hi/messages.po
+++ b/fluxer_app/src/features/i18n/locales/hi/messages.po
@@ -36924,6 +36924,11 @@ msgstr "यह बॉट एडमिनिस्ट्रेटर की अ
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "यह ब्राउज़र एनिमेटेड {avifFormatLabel} फ़ाइलों को क्रॉप नहीं कर सकता है। इसके बजाय GIF या WebP अपलोड करें।"
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "यह ब्राउज़र Fluxer का डेटा सेव नहीं कर सकता। इसे बंद करने के बाद आपको फिर से साइन इन करना होगा।"
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/hr/messages.po b/fluxer_app/src/features/i18n/locales/hr/messages.po
index 8fc123913..c80454f42 100644
--- a/fluxer_app/src/features/i18n/locales/hr/messages.po
+++ b/fluxer_app/src/features/i18n/locales/hr/messages.po
@@ -36924,6 +36924,11 @@ msgstr "Ovaj bot traži administratorsko dopuštenje. Dajte mu ga samo ako u pot
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "Ovaj preglednik ne može obrezivati animirane {avifFormatLabel} datoteke. Umjesto toga, učitajte GIF ili WebP."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "Ovaj preglednik ne može spremiti Fluxerove podatke. Nakon što ga zatvorite, morat ćete se ponovno prijaviti."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/hu/messages.po b/fluxer_app/src/features/i18n/locales/hu/messages.po
index 5f6d780cb..6b020f081 100644
--- a/fluxer_app/src/features/i18n/locales/hu/messages.po
+++ b/fluxer_app/src/features/i18n/locales/hu/messages.po
@@ -36924,6 +36924,11 @@ msgstr "Ez a bot rendszergazdai jogosultságot kér. Csak akkor add meg, ha telj
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "Ez a böngésző nem tud animált {avifFormatLabel} fájlokat vágni. Tölts fel inkább GIF vagy WebP fájlt."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "Ez a böngésző nem tudja menteni a Fluxer adatait. Bezárása után újra be kell jelentkezned."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/id/messages.po b/fluxer_app/src/features/i18n/locales/id/messages.po
index 6c9a6d10d..edde4166a 100644
--- a/fluxer_app/src/features/i18n/locales/id/messages.po
+++ b/fluxer_app/src/features/i18n/locales/id/messages.po
@@ -36924,6 +36924,11 @@ msgstr "Bot ini meminta izin administrator. Berikan izin hanya jika kamu sepenuh
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "Peramban ini tidak dapat memotong file {avifFormatLabel} animasi. Unggah GIF atau WebP sebagai gantinya."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "Browser ini tidak dapat menyimpan data Fluxer. Kamu perlu masuk lagi setelah menutupnya."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/it/messages.po b/fluxer_app/src/features/i18n/locales/it/messages.po
index 26ec57e51..296ff96cf 100644
--- a/fluxer_app/src/features/i18n/locales/it/messages.po
+++ b/fluxer_app/src/features/i18n/locales/it/messages.po
@@ -36924,6 +36924,11 @@ msgstr "Questo bot richiede i permessi di amministratore. Concedili solo se ti f
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "Questo browser non può ritagliare file animati {avifFormatLabel}. Carica invece una GIF o WebP."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "Questo browser non può salvare i dati di Fluxer. Dovrai accedere di nuovo dopo averlo chiuso."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/ja/messages.po b/fluxer_app/src/features/i18n/locales/ja/messages.po
index c06210c41..77ad32f38 100644
--- a/fluxer_app/src/features/i18n/locales/ja/messages.po
+++ b/fluxer_app/src/features/i18n/locales/ja/messages.po
@@ -36924,6 +36924,11 @@ msgstr "このボットは管理者権限を要求しています。開発者を
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "このブラウザでは、アニメーションの{avifFormatLabel}ファイルをクロップできません。代わりにGIFまたはWebPをアップロードしてください。"
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "このブラウザーでは Fluxer のデータを保存できません。ブラウザーを閉じた後は、もう一度サインインする必要があります。"
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/ko/messages.po b/fluxer_app/src/features/i18n/locales/ko/messages.po
index da8d228b2..3b6bb3373 100644
--- a/fluxer_app/src/features/i18n/locales/ko/messages.po
+++ b/fluxer_app/src/features/i18n/locales/ko/messages.po
@@ -36924,6 +36924,11 @@ msgstr "이 봇은 관리자 권한을 요청합니다. 개발자를 완전히
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "이 브라우저에서는 애니메이션 {avifFormatLabel} 파일을 편집할 수 없습니다. 대신 GIF 또는 WebP 파일을 업로드하세요."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "이 브라우저에서는 Fluxer 데이터를 저장할 수 없습니다. 브라우저를 닫은 후에는 다시 로그인해야 합니다."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/lt/messages.po b/fluxer_app/src/features/i18n/locales/lt/messages.po
index bc0318bd6..9407bdb0e 100644
--- a/fluxer_app/src/features/i18n/locales/lt/messages.po
+++ b/fluxer_app/src/features/i18n/locales/lt/messages.po
@@ -36925,6 +36925,11 @@ msgstr "Šis botas prašo administratoriaus leidimo. Suteikite jį tik tuo atvej
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "Ši naršyklė negali apkarpyti animuotų {avifFormatLabel} failų. Įkelkite GIF arba WebP."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "Ši naršyklė negali išsaugoti Fluxer duomenų. Ją uždarius reikės prisijungti iš naujo."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/nl/messages.po b/fluxer_app/src/features/i18n/locales/nl/messages.po
index 6d54446bf..094b57457 100644
--- a/fluxer_app/src/features/i18n/locales/nl/messages.po
+++ b/fluxer_app/src/features/i18n/locales/nl/messages.po
@@ -36924,6 +36924,11 @@ msgstr "Deze bot vraagt om beheerdersrechten. Geef deze alleen als je de ontwikk
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "Deze browser kan geen geanimeerde {avifFormatLabel}-bestanden bijsnijden. Upload in plaats daarvan een GIF of WebP."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "Deze browser kan de gegevens van Fluxer niet opslaan. Je moet opnieuw inloggen nadat je hem hebt gesloten."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/no/messages.po b/fluxer_app/src/features/i18n/locales/no/messages.po
index 0f820ad64..a42fe9c0c 100644
--- a/fluxer_app/src/features/i18n/locales/no/messages.po
+++ b/fluxer_app/src/features/i18n/locales/no/messages.po
@@ -36924,6 +36924,11 @@ msgstr "Denne boten ber om administratortillatelsen. Gi den bare denne tillatels
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "Denne nettleseren kan ikke beskjære animerte {avifFormatLabel}-filer. Last opp en GIF eller WebP i stedet."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "Denne nettleseren kan ikke lagre dataene til Fluxer. Du må logge på igjen etter at du har lukket den."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/pl/messages.po b/fluxer_app/src/features/i18n/locales/pl/messages.po
index bca6ac73d..24428fe4a 100644
--- a/fluxer_app/src/features/i18n/locales/pl/messages.po
+++ b/fluxer_app/src/features/i18n/locales/pl/messages.po
@@ -36924,6 +36924,11 @@ msgstr "Ten bot prosi o uprawnienia administratora. Udziel ich tylko, jeśli w p
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "Ta przeglądarka nie może przycinać animowanych plików {avifFormatLabel}. Zamiast tego prześlij plik GIF lub WebP."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "Ta przeglądarka nie może zapisać danych Fluxera. Po jej zamknięciu trzeba będzie zalogować się ponownie."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/pt-BR/messages.po b/fluxer_app/src/features/i18n/locales/pt-BR/messages.po
index 590cbd68f..40f6dbb56 100644
--- a/fluxer_app/src/features/i18n/locales/pt-BR/messages.po
+++ b/fluxer_app/src/features/i18n/locales/pt-BR/messages.po
@@ -36924,6 +36924,11 @@ msgstr "Este bot solicita permissão de administrador. Conceda-a apenas se você
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "Este navegador não consegue cortar arquivos animados de {avifFormatLabel}. Envie um GIF ou WebP em vez disso."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "Este navegador não consegue salvar os dados do Fluxer. Você precisará entrar novamente depois de fechá-lo."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/ro/messages.po b/fluxer_app/src/features/i18n/locales/ro/messages.po
index 02b3d4045..5cadd40e3 100644
--- a/fluxer_app/src/features/i18n/locales/ro/messages.po
+++ b/fluxer_app/src/features/i18n/locales/ro/messages.po
@@ -36924,6 +36924,11 @@ msgstr "Acest bot solicită permisiunea de administrator. Acordă această permi
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "Browserul tău nu poate decupa fișiere animate {avifFormatLabel}. Încarcă în schimb un GIF sau WebP."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "Acest browser nu poate salva datele Fluxer. Va trebui să te conectezi din nou după ce îl închizi."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/ru/messages.po b/fluxer_app/src/features/i18n/locales/ru/messages.po
index de03bdf07..c51cf989e 100644
--- a/fluxer_app/src/features/i18n/locales/ru/messages.po
+++ b/fluxer_app/src/features/i18n/locales/ru/messages.po
@@ -36924,6 +36924,11 @@ msgstr "Этот бот запрашивает права администрат
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "Этот браузер не может обрезать анимированные файлы {avifFormatLabel}. Загрузите вместо этого GIF или WebP."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "Этот браузер не может сохранять данные Fluxer. После его закрытия придётся войти снова."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/sv-SE/messages.po b/fluxer_app/src/features/i18n/locales/sv-SE/messages.po
index 5674bdf0e..5fe653c70 100644
--- a/fluxer_app/src/features/i18n/locales/sv-SE/messages.po
+++ b/fluxer_app/src/features/i18n/locales/sv-SE/messages.po
@@ -36924,6 +36924,11 @@ msgstr "Den här boten begär administratörsbehörighet. Ge den bara behörighe
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "Webbläsaren kan inte beskära animerade {avifFormatLabel}-filer. Ladda upp en GIF eller WebP istället."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "Den här webbläsaren kan inte spara Fluxers data. Du behöver logga in igen när du har stängt den."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/th/messages.po b/fluxer_app/src/features/i18n/locales/th/messages.po
index 88c71c7c2..eaf8f3ba9 100644
--- a/fluxer_app/src/features/i18n/locales/th/messages.po
+++ b/fluxer_app/src/features/i18n/locales/th/messages.po
@@ -36924,6 +36924,11 @@ msgstr "บอทนี้ขอสิทธิ์ผู้ดูแลระบ
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "เบราว์เซอร์นี้ไม่สามารถครอบตัดไฟล์ {avifFormatLabel} แบบเคลื่อนไหวได้ โปรดอัปโหลดไฟล์ GIF หรือ WebP แทน"
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "เบราว์เซอร์นี้บันทึกข้อมูลของ Fluxer ไม่ได้ คุณจะต้องลงชื่อเข้าใช้อีกครั้งหลังจากปิดเบราว์เซอร์"
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/tr/messages.po b/fluxer_app/src/features/i18n/locales/tr/messages.po
index 0465e8f01..5867f80e0 100644
--- a/fluxer_app/src/features/i18n/locales/tr/messages.po
+++ b/fluxer_app/src/features/i18n/locales/tr/messages.po
@@ -36924,6 +36924,11 @@ msgstr "Bu bot yönetici izni istiyor. Yalnızca geliştiriciye tamamen güveniy
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "Bu tarayıcı animasyonlu {avifFormatLabel} dosyalarını kırpamaz. Bunun yerine GIF veya WebP yükleyin."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "Bu tarayıcı Fluxer verilerini kaydedemiyor. Tarayıcıyı kapattıktan sonra yeniden oturum açmanız gerekecek."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/uk/messages.po b/fluxer_app/src/features/i18n/locales/uk/messages.po
index bf6f2c225..975fe504f 100644
--- a/fluxer_app/src/features/i18n/locales/uk/messages.po
+++ b/fluxer_app/src/features/i18n/locales/uk/messages.po
@@ -36924,6 +36924,11 @@ msgstr "Цей бот запитує дозвіл адміністратора.
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "Цей браузер не може обрізати анімовані файли {avifFormatLabel}. Натомість завантажте GIF або WebP."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "Цей браузер не може зберігати дані Fluxer. Після його закриття доведеться ввійти знову."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/vi/messages.po b/fluxer_app/src/features/i18n/locales/vi/messages.po
index c1994fb92..5a1fde8b6 100644
--- a/fluxer_app/src/features/i18n/locales/vi/messages.po
+++ b/fluxer_app/src/features/i18n/locales/vi/messages.po
@@ -36924,6 +36924,11 @@ msgstr "Bot này yêu cầu quyền quản trị viên. Chỉ cấp quyền nế
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "Trình duyệt này không thể cắt tệp {avifFormatLabel} động. Vui lòng tải lên GIF hoặc WebP thay thế."
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "Trình duyệt này không thể lưu dữ liệu của Fluxer. Bạn sẽ cần đăng nhập lại sau khi đóng trình duyệt."
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/zh-CN/messages.po b/fluxer_app/src/features/i18n/locales/zh-CN/messages.po
index 6da52c48e..310695939 100644
--- a/fluxer_app/src/features/i18n/locales/zh-CN/messages.po
+++ b/fluxer_app/src/features/i18n/locales/zh-CN/messages.po
@@ -36924,6 +36924,11 @@ msgstr "此机器人请求管理员权限。请仅在完全信任开发者的情
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "此浏览器无法裁剪动态 {avifFormatLabel} 文件。请改用 GIF 或 WebP。"
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "此浏览器无法保存 Fluxer 的数据。关闭浏览器后,你需要重新登录。"
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/i18n/locales/zh-TW/messages.po b/fluxer_app/src/features/i18n/locales/zh-TW/messages.po
index 41c1bd272..f809e241f 100644
--- a/fluxer_app/src/features/i18n/locales/zh-TW/messages.po
+++ b/fluxer_app/src/features/i18n/locales/zh-TW/messages.po
@@ -36924,6 +36924,11 @@ msgstr "此機器人要求管理員權限。請只在您完全信任開發人員
msgid "This browser can't crop animated {avifFormatLabel} files. Upload a GIF or WebP instead."
msgstr "這個瀏覽器無法裁切動態的 {avifFormatLabel} 檔案。請改為上傳 GIF 或 WebP 檔案。"
+#. Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.
+#: src/features/platform/hooks/useAppStorageDegradedNotice.ts
+msgid "This browser can't save Fluxer's data. You'll need to sign in again after you close it."
+msgstr "此瀏覽器無法儲存 Fluxer 的資料。關閉瀏覽器後,你需要重新登入。"
+
#. Console warning line explaining that the browser console is meant for developers.
#: src/features/devtools/utils/SelfXssNotice.ts
msgid "This browser console is a developer tool."
diff --git a/fluxer_app/src/features/platform/hooks/useAppStorageDegradedNotice.ts b/fluxer_app/src/features/platform/hooks/useAppStorageDegradedNotice.ts
new file mode 100644
index 000000000..ed758bce8
--- /dev/null
+++ b/fluxer_app/src/features/platform/hooks/useAppStorageDegradedNotice.ts
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import {getAppStorageDegradedReason, subscribeAppStorageDegraded} from '@app/features/platform/state/PersistentStorage';
+import * as ToastCommands from '@app/features/ui/commands/ToastCommands';
+import {msg} from '@lingui/core/macro';
+import {useLingui} from '@lingui/react/macro';
+import {useEffect} from 'react';
+
+const STORAGE_UNAVAILABLE_DESCRIPTOR = msg({
+ message: "This browser can't save Fluxer's data. You'll need to sign in again after you close it.",
+ comment: 'Notice shown when the browser refuses to store app data and the app keeps it in memory for this tab.',
+});
+
+const STORAGE_UNAVAILABLE_TIMEOUT_MS = 15_000;
+
+let noticeShown = false;
+
+export function useAppStorageDegradedNotice(): void {
+ const {i18n} = useLingui();
+ useEffect(() => {
+ const show = (): void => {
+ if (noticeShown) {
+ return;
+ }
+ noticeShown = true;
+ ToastCommands.createToast({
+ type: 'info',
+ children: i18n._(STORAGE_UNAVAILABLE_DESCRIPTOR),
+ timeout: STORAGE_UNAVAILABLE_TIMEOUT_MS,
+ });
+ };
+ if (getAppStorageDegradedReason() !== null) {
+ show();
+ }
+ return subscribeAppStorageDegraded(show);
+ }, [i18n]);
+}
diff --git a/fluxer_app/src/features/platform/state/AppStorageBroadcast.ts b/fluxer_app/src/features/platform/state/AppStorageBroadcast.ts
index 534040125..38d54486f 100644
--- a/fluxer_app/src/features/platform/state/AppStorageBroadcast.ts
+++ b/fluxer_app/src/features/platform/state/AppStorageBroadcast.ts
@@ -32,25 +32,45 @@ interface LockManagerLike {
request<T>(name: string, callback: () => Promise<T>): Promise<T>;
}
-class AppStorageLockUnavailableError extends Error {
- public constructor(name: string, options?: ErrorOptions) {
- super(`Web Locks could not serialise app storage operation ${name}`, options);
- this.name = 'AppStorageLockUnavailableError';
+function readLockManager(): LockManagerLike | null | undefined {
+ try {
+ return (globalThis.navigator as {locks?: LockManagerLike | null} | undefined)?.locks;
+ } catch {
+ return null;
}
}
function resolveLockManager(): LockManagerLike | null {
- const locks = (globalThis.navigator as {locks?: LockManagerLike | null} | undefined)?.locks;
+ const locks = readLockManager();
if (locks == null || typeof locks.request !== 'function') {
return null;
}
return locks;
}
+const inTabLockTails = new Map<string, Promise<void>>();
+const reportedLockFailures = new Set<string>();
+
+function withInTabLock<T>(name: string, operation: () => Promise<T>): Promise<T> {
+ const previous = inTabLockTails.get(name) ?? Promise.resolve();
+ const result = previous.then(operation);
+ const tail = result.then(
+ () => undefined,
+ () => undefined,
+ );
+ inTabLockTails.set(name, tail);
+ void tail.then(() => {
+ if (inTabLockTails.get(name) === tail) {
+ inTabLockTails.delete(name);
+ }
+ });
+ return result;
+}
+
export async function withAppStorageLock<T>(name: string, operation: () => Promise<T>): Promise<T> {
const locks = resolveLockManager();
if (locks === null) {
- return operation();
+ return withInTabLock(name, operation);
}
let started = false;
try {
@@ -62,7 +82,11 @@ export async function withAppStorageLock<T>(name: string, operation: () => Promi
if (started) {
throw error;
}
- throw new AppStorageLockUnavailableError(name, {cause: error});
+ if (!reportedLockFailures.has(name)) {
+ reportedLockFailures.add(name);
+ console.warn(`[AppStorage] Web Locks could not serialise ${name}, serialising within this tab`, error);
+ }
+ return withInTabLock(name, operation);
}
}
diff --git a/fluxer_app/src/features/platform/state/PersistentStorage.ts b/fluxer_app/src/features/platform/state/PersistentStorage.ts
index 2cbce412a..5d49f06f1 100644
--- a/fluxer_app/src/features/platform/state/PersistentStorage.ts
+++ b/fluxer_app/src/features/platform/state/PersistentStorage.ts
@@ -18,6 +18,7 @@ import {
import {
getPersistentStorageBackend,
PersistentStorageBackendKind,
+ switchToMemoryPersistentStorageBackend,
} from '@app/features/platform/state/PersistentStorageBackend';
import {PersistentStorageWriteQueue} from '@app/features/platform/state/PersistentStorageWriteQueue';
import {
@@ -73,6 +74,13 @@ interface LoadedScopeCache {
readonly deletedKeys: Set<string>;
}
+export interface AppStorageScopeActivation {
+ readonly scope: string;
+ readonly failure: Error | null;
+}
+
+type AppStorageDegradedListener = (reason: Error) => void;
+
export const GLOBAL_APP_STORAGE_SCOPE = 'global';
export const UNAUTHENTICATED_APP_STORAGE_SCOPE = 'unauthenticated';
@@ -116,6 +124,8 @@ const deletedKeys = new Set<string>();
const listeners = new Set<{listener: StorageChangeListener; options: StorageSubscriptionOptions}>();
const beforeScopeChangeListeners = new Set<AppStorageScopeListener>();
const scopeChangeListeners = new Set<AppStorageScopeListener>();
+const degradedListeners = new Set<AppStorageDegradedListener>();
+let degradedReason: Error | null = null;
function isContentAppStorageKey(key: string): boolean {
return resolveLegacyAppStorageKey(key)?.row.fanout === 'content';
@@ -683,6 +693,9 @@ export async function initializeAppStorage(): Promise<void> {
}
replayRawMirror(activeScope);
storageInitialized = true;
+ if (getPersistentStorageBackend().kind === PersistentStorageBackendKind.MEMORY) {
+ markAppStorageDegraded(new Error('IndexedDB is not available in this browser'));
+ }
notifyListeners({key: null, oldValue: null, newValue: null, source: 'external'});
})
.catch((error: unknown) => {
@@ -719,20 +732,73 @@ async function activateScopeWithinTransition(previousScope: string, nextScope: s
}
}
-export async function activateAppStorageScope(scope: string | null): Promise<void> {
+function toError(value: unknown): Error {
+ return value instanceof Error ? value : new Error(String(value));
+}
+
+export function getAppStorageDegradedReason(): Error | null {
+ return degradedReason;
+}
+
+export function subscribeAppStorageDegraded(listener: AppStorageDegradedListener): () => void {
+ degradedListeners.add(listener);
+ return () => {
+ degradedListeners.delete(listener);
+ };
+}
+
+function markAppStorageDegraded(reason: Error): void {
+ if (degradedReason !== null) {
+ return;
+ }
+ degradedReason = reason;
+ for (const listener of [...degradedListeners]) {
+ try {
+ listener(reason);
+ } catch (error) {
+ console.error('[AppStorage] A degraded storage listener failed', error);
+ }
+ }
+}
+
+async function activateScopeInMemory(
+ previousScope: string,
+ nextScope: string,
+ cause: Error,
+): Promise<AppStorageScopeActivation> {
+ const retainedGlobalEntries = [...scopedCache].filter(([key]) => isGlobalStorageKey(key));
+ const memory = switchToMemoryPersistentStorageBackend();
+ storageEventType = 'memory';
+ await memory.setMany(retainedGlobalEntries.map(([key, value]) => ({scope: GLOBAL_APP_STORAGE_SCOPE, key, value})));
+ markAppStorageDegraded(cause);
+ try {
+ await activateScopeWithinTransition(previousScope, nextScope);
+ } catch (error) {
+ console.error('[AppStorage] Failed to activate the storage scope in memory', error);
+ return {scope: activeScope, failure: toError(error)};
+ }
+ return {scope: activeScope, failure: cause};
+}
+
+export async function activateAppStorageScope(scope: string | null): Promise<AppStorageScopeActivation> {
const nextScope = normalizeAppStorageScope(scope);
- await runTransition(async () => {
+ return runTransition(async (): Promise<AppStorageScopeActivation> => {
const previousScope = activeScope;
if (!scopedStorageEngaged) {
activeScope = nextScope;
- return;
+ return {scope: activeScope, failure: null};
+ }
+ try {
+ await withAppStorageLock(APP_STORAGE_SCOPE_LOCK_NAME, () =>
+ activateScopeWithinTransition(previousScope, nextScope),
+ );
+ return {scope: activeScope, failure: null};
+ } catch (error) {
+ const cause = toError(error);
+ countTelemetryEvent(TelemetryEvent.STORAGE_SCOPE_ACTIVATION_FAILED, 1, nextScope);
+ console.error('[AppStorage] Failed to activate the storage scope, keeping it in memory', cause);
+ return activateScopeInMemory(previousScope, nextScope, cause);
}
- await withAppStorageLock(APP_STORAGE_SCOPE_LOCK_NAME, () =>
- activateScopeWithinTransition(previousScope, nextScope),
- );
- }).catch((error: unknown) => {
- countTelemetryEvent(TelemetryEvent.STORAGE_SCOPE_ACTIVATION_FAILED, 1, nextScope);
- console.error('[AppStorage] Failed to activate the storage scope', error);
});
}
diff --git a/fluxer_app/src/features/platform/state/PersistentStorageBackend.ts b/fluxer_app/src/features/platform/state/PersistentStorageBackend.ts
index 1043c1cbb..b0056e474 100644
--- a/fluxer_app/src/features/platform/state/PersistentStorageBackend.ts
+++ b/fluxer_app/src/features/platform/state/PersistentStorageBackend.ts
@@ -609,3 +609,13 @@ export function getPersistentStorageBackend(): PersistentStorageBackend {
export function installPersistentStorageBackend(backend: PersistentStorageBackend): void {
sharedBackend = backend;
}
+
+export function switchToMemoryPersistentStorageBackend(): PersistentStorageBackend {
+ const current = getPersistentStorageBackend();
+ if (current.kind === PersistentStorageBackendKind.MEMORY) {
+ return current;
+ }
+ const memory = createMemoryBackend();
+ sharedBackend = memory;
+ return memory;
+}
diff --git a/fluxer_app/src/features/platform/state/auth_session/AuthSessionCheckpoint.ts b/fluxer_app/src/features/platform/state/auth_session/AuthSessionCheckpoint.ts
index 4a00edf39..856f1f42a 100644
--- a/fluxer_app/src/features/platform/state/auth_session/AuthSessionCheckpoint.ts
+++ b/fluxer_app/src/features/platform/state/auth_session/AuthSessionCheckpoint.ts
@@ -21,7 +21,10 @@ import type {
SessionCredentialMirror,
StoredSessionMirror,
} from '@app/features/platform/state/auth_session/SessionCredentialMirror';
-import {UNAUTHENTICATED_APP_STORAGE_SCOPE} from '@app/features/platform/state/PersistentStorage';
+import {
+ type AppStorageScopeActivation,
+ UNAUTHENTICATED_APP_STORAGE_SCOPE,
+} from '@app/features/platform/state/PersistentStorage';
import type {UserSettingsAccountTransitionCheckpoint} from '@app/features/user/state/UserSettings';
export class AuthSessionRuntimeUnavailableError extends Error {
@@ -53,6 +56,13 @@ export interface AuthSessionCheckpointState {
readonly restore: (snapshot: AuthSessionSnapshot) => void;
}
+function scopeActivationError(label: string, failure: Error | null): Error {
+ if (failure === null) {
+ return new Error(`Storage scope did not activate ${label}`);
+ }
+ return new Error(`Storage scope did not activate ${label}: ${failure.name}: ${failure.message}`, {cause: failure});
+}
+
export interface AuthSessionCheckpointDependencies {
readonly accountStorage: AuthSessionAccountStorage;
readonly credentialMirror: SessionCredentialMirror;
@@ -61,7 +71,7 @@ export interface AuthSessionCheckpointDependencies {
readonly resolveAndPrepareRuntimeSnapshot: (snapshot: RuntimeConfigSnapshot) => Promise<PreparedRuntimeConfig>;
readonly prepareRuntimeSnapshot: (snapshot: RuntimeConfigSnapshot) => Promise<PreparedRuntimeConfig>;
readonly deactivateRuntime: () => Promise<void>;
- readonly activateStorageScope: (accountKey: string | null) => Promise<void>;
+ readonly activateStorageScope: (accountKey: string | null) => Promise<AppStorageScopeActivation>;
readonly captureSyncedUserSettingsCheckpoint: () => Promise<UserSettingsAccountTransitionCheckpoint>;
readonly restoreSyncedUserSettingsCheckpoint: (checkpoint: UserSettingsAccountTransitionCheckpoint) => Promise<void>;
readonly captureLocalPresenceIntent: () => AccountPresenceIntent | null;
@@ -83,9 +93,9 @@ export class AuthSessionCheckpointManager {
async activateStorageScope(accountKey: string | null): Promise<void> {
const label = accountKey ?? UNAUTHENTICATED_APP_STORAGE_SCOPE;
- await this.dependencies.activateStorageScope(accountKey);
+ const activation = await this.dependencies.activateStorageScope(accountKey);
if (this.currentStorageScope() !== label) {
- throw new Error(`Storage scope did not activate ${label}`);
+ throw scopeActivationError(label, activation.failure);
}
}
diff --git a/fluxer_app/src/features/platform/state/auth_session/AuthSessionDependencies.ts b/fluxer_app/src/features/platform/state/auth_session/AuthSessionDependencies.ts
index 209416437..4711a7f7e 100644
--- a/fluxer_app/src/features/platform/state/auth_session/AuthSessionDependencies.ts
+++ b/fluxer_app/src/features/platform/state/auth_session/AuthSessionDependencies.ts
@@ -30,6 +30,7 @@ import {
type SessionCredentialMirror,
} from '@app/features/platform/state/auth_session/SessionCredentialMirror';
import AppStorage, {
+ type AppStorageScopeActivation,
activateAppStorageScope,
deleteAppStorageScope,
getAppStorageScope,
@@ -91,7 +92,7 @@ export interface AuthSessionDependencies {
readonly abortRuntimeSnapshot: (prepared: PreparedRuntimeConfig) => Promise<void>;
readonly deactivateRuntime: () => Promise<void>;
readonly allowsCrossInstanceSwitching: () => boolean;
- readonly activateStorageScope: (accountKey: string | null) => Promise<void>;
+ readonly activateStorageScope: (accountKey: string | null) => Promise<AppStorageScopeActivation>;
readonly resetClientState: (options: ResetClientStateOptions, accountScope?: string) => Promise<void>;
readonly deleteAccountStorageScope: (accountKey: string) => Promise<void>;
readonly closeLayers: () => void | Promise<void>;