From c79127e7dae6fdda17f02c9ae399a729a3a2984f Mon Sep 17 00:00:00 2001 From: Roland Date: Sat, 18 Jul 2026 13:51:37 -0600 Subject: [PATCH] app: treat pure Chromium UA as supported for extension banner Match Chromium/ as well as Chrome/ so builds that omit Chrome in the user agent still see the install nudge. Cover with a unit test. --- .../admin/ExtensionInstallSuggestion.test.js | 10 ++++++++++ app/src/components/admin/browserDetect.js | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/src/components/admin/ExtensionInstallSuggestion.test.js b/app/src/components/admin/ExtensionInstallSuggestion.test.js index 7d9f2744..40646e58 100644 --- a/app/src/components/admin/ExtensionInstallSuggestion.test.js +++ b/app/src/components/admin/ExtensionInstallSuggestion.test.js @@ -3,6 +3,7 @@ import {render, screen, waitFor} from '../../test-utils'; import {ExtensionInstallSuggestion} from './ExtensionInstallSuggestion'; const CHROME_UA = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36'; +const CHROMIUM_UA = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chromium/147.0.0.0 Safari/537.36'; const FIREFOX_UA = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:128.0) Gecko/20100101 Firefox/128.0'; const SAFARI_UA = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15'; @@ -57,6 +58,15 @@ describe('ExtensionInstallSuggestion', () => { ); }); + it('renders the install message on pure Chromium (Chromium/ without Chrome/)', async () => { + setUserAgent(CHROMIUM_UA); + render(); + await waitFor( + () => expect(screen.getByText(/Install the WROLPi browser extension/i)).toBeInTheDocument(), + {timeout: 1500}, + ); + }); + it('renders nothing on Safari even when the marker is absent', async () => { setUserAgent(SAFARI_UA); render(); diff --git a/app/src/components/admin/browserDetect.js b/app/src/components/admin/browserDetect.js index e259bdf8..c8f2011b 100644 --- a/app/src/components/admin/browserDetect.js +++ b/app/src/components/admin/browserDetect.js @@ -12,7 +12,8 @@ export function detectBrowser() { if (ua.includes('Firefox')) return 'firefox'; if (ua.includes('Edg/')) return 'chromium'; if (ua.includes('OPR/') || ua.includes('Opera')) return 'chromium'; - if (ua.includes('Chrome')) return 'chromium'; + // Pure Chromium builds may advertise Chromium/ without Chrome/. + if (ua.includes('Chrome') || ua.includes('Chromium')) return 'chromium'; return 'unknown'; }