From 269a04b5df12fad456db365530ec18eb32f919f6 Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Tue, 2 Jan 2024 14:05:12 -0800 Subject: [PATCH 1/4] Use browserslist configuration for kolibri as single source of truth for supported browsers. --- .../src/utils/minimumBrowserRequirements.js | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/kolibri/core/assets/src/utils/minimumBrowserRequirements.js b/kolibri/core/assets/src/utils/minimumBrowserRequirements.js index b5f470d8822..15eafba0aac 100644 --- a/kolibri/core/assets/src/utils/minimumBrowserRequirements.js +++ b/kolibri/core/assets/src/utils/minimumBrowserRequirements.js @@ -1,16 +1,30 @@ +import isUndefined from 'lodash/isUndefined'; +import browsers from 'browserslist-config-kolibri'; import { browser, passesRequirements } from './browserInfo'; import plugin_data from 'plugin_data'; -const minimumBrowserRequirements = { - IE: { - major: 11, - }, - Android: { - major: 4, - minor: 0, - patch: 2, - }, -}; +const minimumBrowserRequirements = {}; + +const browserRegex = /^([a-zA-Z]+) ([><=]+) (\d+)(?:\.(\d+))?(?:\.(\d+))?$/; + +for (const browser of browsers) { + const [name, sign, major, minor, patch] = browserRegex.exec(browser).slice(1); + // This only supports > and >=, but that's all we need. + const addOne = sign === '>' ? 1 : 0; + const entry = { + major: isUndefined(minor) && isUndefined(patch) ? Number(major) + addOne : Number(major), + }; + if (!isUndefined(minor)) { + entry.minor = Number(minor); + if (isUndefined(patch)) { + entry.minor += addOne; + } + } + if (!isUndefined(patch)) { + entry.patch = Number(patch) + addOne; + } + minimumBrowserRequirements[name] = entry; +} if (!passesRequirements(browser, minimumBrowserRequirements)) { window.location.href = plugin_data.unsupportedUrl; From fba8264079f2c5784706832e035d106dc81b8498 Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Tue, 2 Jan 2024 14:23:47 -0800 Subject: [PATCH 2/4] Remove support for IE11. --- packages/browserslist-config-kolibri/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/browserslist-config-kolibri/index.js b/packages/browserslist-config-kolibri/index.js index c9525782afa..81d13efc66a 100644 --- a/packages/browserslist-config-kolibri/index.js +++ b/packages/browserslist-config-kolibri/index.js @@ -9,7 +9,6 @@ module.exports = [ 'Chrome >= 49', 'ChromeAndroid >= 49', 'Edge >= 18', - 'IE >= 11', 'Firefox >= 52', 'FirefoxAndroid >= 68', 'iOS >= 9.3', From d061cfbf95d85c43d719be53add8fd82fde9b3d8 Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Tue, 2 Jan 2024 14:35:27 -0800 Subject: [PATCH 3/4] Update warning banner to say IE11 support has been dropped. --- .../assets/src/mixins/commonCoreStrings.js | 11 +++-------- .../src/views/DeprecationWarningBanner.vue | 18 ++++-------------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/kolibri/core/assets/src/mixins/commonCoreStrings.js b/kolibri/core/assets/src/mixins/commonCoreStrings.js index 5ec5a98b485..a13fff1b6e7 100644 --- a/kolibri/core/assets/src/mixins/commonCoreStrings.js +++ b/kolibri/core/assets/src/mixins/commonCoreStrings.js @@ -1289,19 +1289,14 @@ export const coreStrings = createTranslator('CommonCoreStrings', { }, // Device upgrades recommended - currentDeviceUsingIE11: { - message: 'You seem to be using Internet Explorer 11.', - context: - 'Displayed on a device that is using Internet Explorer 11, as part of a message encouraging the user to upgrade.', - }, userDevicesUsingIE11: { - message: 'Some users seem to be accessing Kolibri via Internet Explorer 11', + message: 'Some users seem to have accessed Kolibri via Internet Explorer 11', context: 'Displayed to an admin, where devices on their network are using Internet Explorer 11, as part of a message encouraging the user to upgrade.', }, - browserSupportWillBeDroppedIE11: { + browserSupportDroppedIE11: { message: - 'Please note that support for this browser will be dropped in the upcoming version, 0.17. We recommend installing other browsers, such as Mozilla Firefox or Google Chrome, in order to continue working with Kolibri.', + 'Please note that support for this browser has been dropped. We recommend installing other browsers, such as Mozilla Firefox or Google Chrome, in order to continue working with Kolibri.', context: 'Displayed to users of kolibri where one or more devices on the network are using Internet Explorer 11, as part of a message encouraging the user to upgrade.', }, diff --git a/kolibri/plugins/device/assets/src/views/DeprecationWarningBanner.vue b/kolibri/plugins/device/assets/src/views/DeprecationWarningBanner.vue index b2190147b5e..d6dcc2cdff9 100644 --- a/kolibri/plugins/device/assets/src/views/DeprecationWarningBanner.vue +++ b/kolibri/plugins/device/assets/src/views/DeprecationWarningBanner.vue @@ -1,7 +1,7 @@