Files
graylog2-server/graylog2-web-interface/supportedBrowsers.js
Dennis Oelkers c4aed2b0b5 Extend browser support back to Chrome 68. (#14688)
* Extend browser support back to Chrome 68.

This change is extending our browser support to go back to Chrome 68 in order to support outdated browser versions commonly found e.g. on smart TVs. The cut is made at Chrome 68 in order to support at least the [last three version of webOS](https://webostv.developer.lge.com/develop/specifications/web-api-and-web-engine).

Fixes #14677.

* Adding changelog snippet.
2023-02-21 15:47:34 +01:00

47 lines
1.4 KiB
JavaScript

/*
* Copyright (C) 2020 Graylog, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the Server Side Public License, version 1,
* as published by MongoDB, Inc.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Server Side Public License for more details.
*
* You should have received a copy of the Server Side Public License
* along with this program. If not, see
* <http://www.mongodb.com/licensing/server-side-public-license>.
*/
const browserslist = require('browserslist');
const targets = browserslist('defaults, not ie 11, chrome 68');
const supportedProducts = ['chrome', 'edge', 'firefox', 'ios_saf', 'opera', 'safari'];
const productMapping = {
chrome: 'chrome',
edge: 'edge',
firefox: 'firefox',
ios_saf: 'ios',
opera: 'opera',
safari: 'safari',
};
const mapProductAndVersion = (product, version) => {
const mappedProduct = productMapping[product];
const mappedVersion = version.includes('-')
? version.split('-')[0]
: version;
return `${mappedProduct}${mappedVersion}`;
};
const mappedTargets = targets
.map((target) => target.split(' '))
.filter(([product]) => supportedProducts.includes(product))
.map(([product, version]) => mapProductAndVersion(product, version));
module.exports = mappedTargets;