From e3bd562efa5359890da12f27c25d1c7928df99dc Mon Sep 17 00:00:00 2001 From: Diogo Castro Date: Thu, 10 Nov 2022 14:00:31 +0100 Subject: [PATCH] Warn when using incompatible browser --- .../enhancement-warn-unsuported-browsers | 8 ++ package.json | 1 + packages/web-container/index.html.ejs | 102 ++++++++++++++---- pnpm-lock.yaml | 60 +++++++++++ rollup.config.mjs | 8 +- 5 files changed, 154 insertions(+), 25 deletions(-) create mode 100644 changelog/unreleased/enhancement-warn-unsuported-browsers diff --git a/changelog/unreleased/enhancement-warn-unsuported-browsers b/changelog/unreleased/enhancement-warn-unsuported-browsers new file mode 100644 index 00000000000..5a6932cd918 --- /dev/null +++ b/changelog/unreleased/enhancement-warn-unsuported-browsers @@ -0,0 +1,8 @@ +Enhancement: Warn users when using unsupported browsers + +We've added a warning message if the browser is older than our supported configuration, instead of just failing and showing blue/white screens or generic errors. +Users still have the option to proceed and open the page if they want to. By proceeding to the page, the setting is set for 30 days, afterwards the warning is shown again. + +When building web, it's possible to pass a documentation url for users to know more about this issue, by setting the env variable DOCUMENTATION_URL. + +https://github.com/owncloud/web/pull/7942 diff --git a/package.json b/package.json index 55f07ed1484..c427b237d0e 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,7 @@ "autoprefixer": "10.4.12", "babel-core": "7.0.0-bridge.0", "babel-jest": "29.2.1", + "browserslist-useragent-regexp": "^3.0.2", "commander": "8.3.0", "core-js": "3.26.0", "cucumber-html-reporter": "5.5.0", diff --git a/packages/web-container/index.html.ejs b/packages/web-container/index.html.ejs index b3fd72a35e3..712e0db9627 100644 --- a/packages/web-container/index.html.ejs +++ b/packages/web-container/index.html.ejs @@ -22,16 +22,13 @@ } .splash-banner { display: flex; - flex-direction: row; + flex-direction: column; justify-content: center; align-items: center; padding: 0.5rem; height: 100%; } - #splash-loading{ - height: 100%; - } - .splash-loading-hide { + .splash-hide { display: none; } #loading { @@ -44,6 +41,9 @@ animation: spin 1s ease-in-out infinite; -webkit-animation: spin 1s linear infinite; } + #splash-incompatible button { + margin: 30px 0; + } @keyframes spin { to { -webkit-transform: rotate(360deg); } @@ -54,7 +54,34 @@ -
+
+
+
+
+ + + +

Your browser is not supported

+
+
+ +
+ + <% if (data.config.documentation_url) { %> +

+ Click here to know more +

+ <% } %> +
+
@@ -63,32 +90,61 @@ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 57a11822743..f6cde6bd2c8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -34,6 +34,7 @@ importers: autoprefixer: 10.4.12 babel-core: 7.0.0-bridge.0 babel-jest: 29.2.1 + browserslist-useragent-regexp: ^3.0.2 commander: 8.3.0 core-js: 3.26.0 cucumber-html-reporter: 5.5.0 @@ -123,6 +124,7 @@ importers: autoprefixer: 10.4.12_postcss@8.4.18 babel-core: 7.0.0-bridge.0_@babel+core@7.19.6 babel-jest: 29.2.1_@babel+core@7.19.6 + browserslist-useragent-regexp: 3.0.2 commander: 8.3.0 core-js: 3.26.0 cucumber-html-reporter: 5.5.0 @@ -5148,6 +5150,11 @@ packages: mri: 1.1.4 dev: true + /argue-cli/1.2.1: + resolution: {integrity: sha512-Em3HDMlqiVLNOgXUCYz5NG1mx/44aijsxUOO8elmfvAN4/3ar1S3WPTua7WGhsMbeQm8clOwpDZ09sN7C2FnOg==} + engines: {node: '>=6.0.0'} + dev: true + /aria-query/5.0.2: resolution: {integrity: sha512-eigU3vhqSO+Z8BKDnVLN/ompjhf3pYzecKXz8+whRy+9gZu8n1TCGfwzQUUPnqdHl9ax1Hr9031orZ+UOEYr7Q==} engines: {node: '>=6.0'} @@ -5723,6 +5730,19 @@ packages: ua-parser-js: 1.0.2 dev: true + /browserslist-useragent-regexp/3.0.2: + resolution: {integrity: sha512-hOvTo9ObY+2PvCLxydvam5WD9hlvWB4bFzRLxc/M5OdJfzjgfsQ9wEF7EpJJP7UJUAnKJdJK28XsSrl5d1DfoA==} + engines: {node: '>=12.0.0'} + hasBin: true + dependencies: + '@types/node': 16.18.0 + argue-cli: 1.2.1 + browserslist: 4.21.4 + chalk: 4.1.2 + easy-table: 1.2.0 + useragent: 2.3.0 + dev: true + /browserslist/4.20.2: resolution: {integrity: sha512-CQOBCqp/9pDvDbx3xfMi+86pr4KXIf2FDkTTdeuYw8OxS9t898LA1Khq57gtufFILXpfgsSx5woNgsBgvGjpsA==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} @@ -7537,6 +7557,14 @@ packages: engines: {node: '>=0.10.0'} dev: true + /easy-table/1.2.0: + resolution: {integrity: sha512-OFzVOv03YpvtcWGe5AayU5G2hgybsg3iqA6drU8UaoZyB9jLGMTrz9+asnLp/E+6qPh88yEI1gvyZFZ41dmgww==} + dependencies: + ansi-regex: 5.0.1 + optionalDependencies: + wcwidth: 1.0.1 + dev: true + /ecc-jsbn/0.1.2: resolution: {integrity: sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==} dependencies: @@ -11660,6 +11688,11 @@ packages: wcwidth: 1.0.1 dev: true + /os-tmpdir/1.0.2: + resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==} + engines: {node: '>=0.10.0'} + dev: true + /ospec/3.1.0: resolution: {integrity: sha512-+nGtjV3vlADp+UGfL51miAh/hB4awPBkQrArhcgG4trAaoA2gKt5bf9w0m9ch9zOr555cHWaCHZEDiBOkNZSxw==} hasBin: true @@ -13590,6 +13623,11 @@ packages: resolution: {integrity: sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==} dev: true + /semver/5.5.1: + resolution: {integrity: sha512-PqpAxfrEhlSUWge8dwIp4tZnQ25DIOthpiaHNIthsjEFQD6EvqUKUDM7L8O2rShkFccYo1VjJR0coWfNkCubRw==} + hasBin: true + dev: true + /semver/5.7.1: resolution: {integrity: sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==} hasBin: true @@ -14201,6 +14239,13 @@ packages: '@popperjs/core': 2.11.5 dev: false + /tmp/0.0.33: + resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} + engines: {node: '>=0.6.0'} + dependencies: + os-tmpdir: 1.0.2 + dev: true + /tmp/0.2.1: resolution: {integrity: sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==} engines: {node: '>=8.17.0'} @@ -14574,6 +14619,16 @@ packages: resolution: {integrity: sha512-KmkCs6SjE6t4ihrfW9JelAPQIIIFbJweaaSLTh/4AO+c58JlDcb+GbdPt8yr5lRcFg4rPswRFRRhBGpWwh0K/Q==} dev: true + /useragent/2.3.0: + resolution: {integrity: sha512-4AoH4pxuSvHCjqLO04sU6U/uE65BYza8l/KKBS0b0hnUPWi+cQ2BpeTEwejCSx9SPV5/U03nniDTrWx5NrmKdw==} + dependencies: + lru-cache: 4.1.5 + request: 2.88.2 + semver: 5.5.1 + tmp: 0.0.33 + yamlparser: 0.0.2 + dev: true + /utf8/3.0.0: resolution: {integrity: sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==} dev: false @@ -14871,6 +14926,7 @@ packages: /wcwidth/1.0.1: resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==} + requiresBuild: true dependencies: defaults: 1.0.4 dev: true @@ -15132,6 +15188,10 @@ packages: engines: {node: '>= 6'} dev: true + /yamlparser/0.0.2: + resolution: {integrity: sha512-Cou9FCGblEENtn1/8La5wkDM/ISMh2bzu5Wh7dYzCzA0o9jD4YGyLkUJxe84oPBGoB92f+Oy4ZjVhA8S0C2wlQ==} + dev: true + /yargs-parser/13.1.2: resolution: {integrity: sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==} dependencies: diff --git a/rollup.config.mjs b/rollup.config.mjs index ad22415773a..16c0563febd 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -26,6 +26,7 @@ import copy from '@rollup-extras/plugin-copy' import packageJson from './package.json' assert { type: "json" } import {fileURLToPath} from 'url' import { dirname, resolve as pathResolve } from 'path' +import { getUserAgentRegExp } from 'browserslist-useragent-regexp' const production = !process.env.ROLLUP_WATCH @@ -33,10 +34,12 @@ const sourcemap = process.env.SOURCE_MAP === 'true' const { version } = packageJson const compilationTimestamp = new Date().getTime() +const supportedBrowsersRegex = getUserAgentRegExp({allowHigherVersions: true}) const config = { requirejs: {}, - cdn: process.env.CDN === 'true' + cdn: process.env.CDN === 'true', + documentation_url: process.env.DOCUMENTATION_URL } if (process.env.REQUIRE_TIMEOUT) { config.requirejs.waitSeconds = parseInt(process.env.REQUIRE_TIMEOUT) @@ -170,7 +173,8 @@ const plugins = [ js: 'js' }, config: config, - compilationTimestamp: compilationTimestamp + compilationTimestamp: compilationTimestamp, + supportedBrowsersRegex: supportedBrowsersRegex } }, {},