From b03e02e4cf9fa480fccfd6b29dbc71b99bd5a8d1 Mon Sep 17 00:00:00 2001 From: soxa <6390896+Soxasora@users.noreply.github.com> Date: Thu, 6 Mar 2025 16:24:49 +0100 Subject: [PATCH] Expose env-dependent constant to service worker; Add Brave Browser-specific push registration error and guidance; Remove unused fetch debug plugin (#1947) --- components/notifications.js | 5 ++++- next.config.js | 1 + sw/index.js | 4 ---- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/notifications.js b/components/notifications.js index 97561d49..c03ebdf9 100644 --- a/components/notifications.js +++ b/components/notifications.js @@ -733,7 +733,10 @@ export function NotificationAlert () { error ? ( setError(null)}> - {error.toString()} + {navigator?.brave && error.name === 'AbortError' + ? 'Push registration failed. Enable "Use Google services for push messaging" in Brave\'s privacy settings and try again.' + : error.toString()} + ) : showAlert diff --git a/next.config.js b/next.config.js index 04ace97a..4714b532 100644 --- a/next.config.js +++ b/next.config.js @@ -220,6 +220,7 @@ module.exports = withPlausibleProxy()({ 'process.env.NEXT_PUBLIC_NORMAL_POLL_INTERVAL': JSON.stringify(process.env.NEXT_PUBLIC_NORMAL_POLL_INTERVAL), 'process.env.NEXT_PUBLIC_LONG_POLL_INTERVAL': JSON.stringify(process.env.NEXT_PUBLIC_LONG_POLL_INTERVAL), 'process.env.NEXT_PUBLIC_EXTRA_LONG_POLL_INTERVAL': JSON.stringify(process.env.NEXT_PUBLIC_EXTRA_LONG_POLL_INTERVAL), + 'process.env.SANCTIONED_COUNTRY_CODES': JSON.stringify(process.env.SANCTIONED_COUNTRY_CODES), 'process.env.NEXT_IS_EXPORT_WORKER': 'true' }) ] diff --git a/sw/index.js b/sw/index.js index c5e8db52..6e5c875c 100644 --- a/sw/index.js +++ b/sw/index.js @@ -31,10 +31,6 @@ self.addEventListener('install', () => self.skipWaiting()) // Also, the offline fallback only works if request matched a route setDefaultHandler(new NetworkOnly({ plugins: [{ - fetchDidFail: async (args) => { - // tell us why a request failed in dev - process.env.NODE_ENV !== 'production' && console.log('fetch did fail', ...args) - }, fetchDidSucceed: async ({ request, response, event, state }) => { if ( response.ok &&