From 4f9139d1249fd2f06e0b6e824e2e282f376d329d Mon Sep 17 00:00:00 2001 From: SethBurkart123 Date: Tue, 27 Feb 2024 09:53:16 +1100 Subject: [PATCH] fix: add visual brave browser warnings --- src/interface/components/BackgroundSelector.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/interface/components/BackgroundSelector.tsx b/src/interface/components/BackgroundSelector.tsx index 4d1765cc..529baedc 100644 --- a/src/interface/components/BackgroundSelector.tsx +++ b/src/interface/components/BackgroundSelector.tsx @@ -37,6 +37,8 @@ function BackgroundSelector({ selectedType, setSelectedType, isEditMode }: Backg const [downloadedPresetIds, setDownloadedPresetIds] = useState([]); const [downloadProgress, setDownloadProgress] = useState>({}); + const [BackgroundsBlocked, setBackgroundsBlocked] = useState(false); + useEffect(() => { GetTheme().then((theme) => { setSelectedBackground(theme); @@ -73,8 +75,11 @@ function BackgroundSelector({ selectedType, setSelectedType, isEditMode }: Backg } catch (error) { // @ts-expect-error - Brave is not in the navigator type (unless you are actually using brave browser, then it is there) if (navigator.brave && await navigator.brave.isBrave() || false) { - alert('Brave browser is blocking access to IndexedDB. Please disable the "Cross-site cookies blocked" setting in the Shields panel.'); + console.log('[BetterSEQTA+] Brave browser is blocking access to IndexedDB. Please disable the "Cross-site cookies blocked" setting in the Shields panel.'); + setBackgroundsBlocked(true); + return; } + alert("[BetterSEQTA+] IndexedDB is not accessible. Please check your browser settings (It's probably cross-site cookies that are blocked)."); return; } @@ -140,6 +145,15 @@ function BackgroundSelector({ selectedType, setSelectedType, isEditMode }: Backg className={`w-full px-4 py-2 mb-4 dark:text-white transition ${selectedBackground == null && selectedType != 'theme' ? 'dark:bg-zinc-900 bg-zinc-100' : 'bg-blue-500 text-white'} rounded`} onClick={() => selectNoBackground()}> {selectedBackground == null && selectedType != 'theme' ? 'No Background' : 'Remove Background'} + + {BackgroundsBlocked && ( +
+

File Storage Blocked

+

Brave browser is blocking access to IndexedDB. Please disable the "Cross-site cookies blocked" setting in the Shields panel.

+ Brave browser logo +
+ )} +

Background Images