diff --git a/package-lock.json b/package-lock.json index 52926e020e9..b699adcde26 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,7 +42,7 @@ "mitt": "^3.0.1", "mockconsole": "0.0.1", "pinia": "^2.2.6", - "ua-parser-js": "^1.0.39", + "ua-parser-js": "^2.0.0", "util": "^0.12.5", "vue": "^2.7.16", "vue-cropperjs": "^4.2.0", @@ -68,7 +68,6 @@ "@nextcloud/stylelint-config": "^3.0.1", "@nextcloud/webpack-vue-config": "^6.2.0", "@types/jest": "^29.5.14", - "@types/ua-parser-js": "^0.7.39", "@vue/test-utils": "^1.3.6", "@vue/tsconfig": "^0.5.1", "@vue/vue2-jest": "^29.2.6", @@ -4645,13 +4644,6 @@ "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==" }, - "node_modules/@types/ua-parser-js": { - "version": "0.7.39", - "resolved": "https://registry.npmjs.org/@types/ua-parser-js/-/ua-parser-js-0.7.39.tgz", - "integrity": "sha512-P/oDfpofrdtF5xw433SPALpdSchtJmY7nsJItf8h3KXqOslkbySh8zq4dSWXH2oTjRvJ5PczVEoCZPow6GicLg==", - "dev": true, - "license": "MIT" - }, "node_modules/@types/unist": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz", @@ -7852,6 +7844,25 @@ "npm": "1.2.8000 || >= 1.4.16" } }, + "node_modules/detect-europe-js": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/detect-europe-js/-/detect-europe-js-0.1.2.tgz", + "integrity": "sha512-lgdERlL3u0aUdHocoouzT10d9I89VVhk0qNRmll7mXdGfJT1/wqZ2ZLA4oJAjeACPY5fT1wsbq2AT+GkuInsow==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/faisalman" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/ua-parser-js" + }, + { + "type": "paypal", + "url": "https://paypal.me/faisalman" + } + ] + }, "node_modules/detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -11442,6 +11453,25 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-standalone-pwa": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-standalone-pwa/-/is-standalone-pwa-0.1.1.tgz", + "integrity": "sha512-9Cbovsa52vNQCjdXOzeQq5CnCbAcRk05aU62K20WO372NrTv0NxibLFCK6lQ4/iZEFdEA3p3t2VNOn8AJ53F5g==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/faisalman" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/ua-parser-js" + }, + { + "type": "paypal", + "url": "https://paypal.me/faisalman" + } + ] + }, "node_modules/is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -19695,10 +19725,29 @@ "resolved": "https://registry.npmjs.org/typescript-event-target/-/typescript-event-target-1.1.1.tgz", "integrity": "sha512-dFSOFBKV6uwaloBCCUhxlD3Pr/P1a/tJdcmPrTXCHlEFD3faj0mztjcGn6VBAhQ0/Bdy8K3VWrrqwbt/ffsYsg==" }, + "node_modules/ua-is-frozen": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ua-is-frozen/-/ua-is-frozen-0.1.2.tgz", + "integrity": "sha512-RwKDW2p3iyWn4UbaxpP2+VxwqXh0jpvdxsYpZ5j/MLLiQOfbsV5shpgQiw93+KMYQPcteeMQ289MaAFzs3G9pw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/faisalman" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/ua-parser-js" + }, + { + "type": "paypal", + "url": "https://paypal.me/faisalman" + } + ] + }, "node_modules/ua-parser-js": { - "version": "1.0.39", - "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-1.0.39.tgz", - "integrity": "sha512-k24RCVWlEcjkdOxYmVJgeD/0a1TiSpqLg+ZalVGV9lsnr4yqu0w7tX/x2xX6G4zpkgQnRf89lxuZ1wsbjXM8lw==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-2.0.0.tgz", + "integrity": "sha512-SASgD4RlB7+SCMmlVNqrhPw0f/2pGawWBzJ2+LwGTD0GgNnrKGzPJDiraGHJDwW9Zm5DH2lTmUpqDpbZjJY4+Q==", "funding": [ { "type": "opencollective", @@ -19713,6 +19762,11 @@ "url": "https://github.com/sponsors/faisalman" } ], + "dependencies": { + "detect-europe-js": "^0.1.2", + "is-standalone-pwa": "^0.1.1", + "ua-is-frozen": "^0.1.2" + }, "bin": { "ua-parser-js": "script/cli.js" }, @@ -24727,12 +24781,6 @@ "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==" }, - "@types/ua-parser-js": { - "version": "0.7.39", - "resolved": "https://registry.npmjs.org/@types/ua-parser-js/-/ua-parser-js-0.7.39.tgz", - "integrity": "sha512-P/oDfpofrdtF5xw433SPALpdSchtJmY7nsJItf8h3KXqOslkbySh8zq4dSWXH2oTjRvJ5PczVEoCZPow6GicLg==", - "dev": true - }, "@types/unist": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz", @@ -27126,6 +27174,11 @@ "dev": true, "peer": true }, + "detect-europe-js": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/detect-europe-js/-/detect-europe-js-0.1.2.tgz", + "integrity": "sha512-lgdERlL3u0aUdHocoouzT10d9I89VVhk0qNRmll7mXdGfJT1/wqZ2ZLA4oJAjeACPY5fT1wsbq2AT+GkuInsow==" + }, "detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -29774,6 +29827,11 @@ "call-bind": "^1.0.2" } }, + "is-standalone-pwa": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-standalone-pwa/-/is-standalone-pwa-0.1.1.tgz", + "integrity": "sha512-9Cbovsa52vNQCjdXOzeQq5CnCbAcRk05aU62K20WO372NrTv0NxibLFCK6lQ4/iZEFdEA3p3t2VNOn8AJ53F5g==" + }, "is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -35849,10 +35907,20 @@ "resolved": "https://registry.npmjs.org/typescript-event-target/-/typescript-event-target-1.1.1.tgz", "integrity": "sha512-dFSOFBKV6uwaloBCCUhxlD3Pr/P1a/tJdcmPrTXCHlEFD3faj0mztjcGn6VBAhQ0/Bdy8K3VWrrqwbt/ffsYsg==" }, + "ua-is-frozen": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ua-is-frozen/-/ua-is-frozen-0.1.2.tgz", + "integrity": "sha512-RwKDW2p3iyWn4UbaxpP2+VxwqXh0jpvdxsYpZ5j/MLLiQOfbsV5shpgQiw93+KMYQPcteeMQ289MaAFzs3G9pw==" + }, "ua-parser-js": { - "version": "1.0.39", - "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-1.0.39.tgz", - "integrity": "sha512-k24RCVWlEcjkdOxYmVJgeD/0a1TiSpqLg+ZalVGV9lsnr4yqu0w7tX/x2xX6G4zpkgQnRf89lxuZ1wsbjXM8lw==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-2.0.0.tgz", + "integrity": "sha512-SASgD4RlB7+SCMmlVNqrhPw0f/2pGawWBzJ2+LwGTD0GgNnrKGzPJDiraGHJDwW9Zm5DH2lTmUpqDpbZjJY4+Q==", + "requires": { + "detect-europe-js": "^0.1.2", + "is-standalone-pwa": "^0.1.1", + "ua-is-frozen": "^0.1.2" + } }, "uc.micro": { "version": "2.1.0", diff --git a/package.json b/package.json index bb11dc2e5bf..f65f2bf7616 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "mitt": "^3.0.1", "mockconsole": "0.0.1", "pinia": "^2.2.6", - "ua-parser-js": "^1.0.39", + "ua-parser-js": "^2.0.0", "util": "^0.12.5", "vue": "^2.7.16", "vue-cropperjs": "^4.2.0", @@ -83,7 +83,6 @@ "@nextcloud/stylelint-config": "^3.0.1", "@nextcloud/webpack-vue-config": "^6.2.0", "@types/jest": "^29.5.14", - "@types/ua-parser-js": "^0.7.39", "@vue/test-utils": "^1.3.6", "@vue/tsconfig": "^0.5.1", "@vue/vue2-jest": "^29.2.6", diff --git a/src/utils/browserCheck.ts b/src/utils/browserCheck.ts index 3d98fa98395..276dc1589ad 100644 --- a/src/utils/browserCheck.ts +++ b/src/utils/browserCheck.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -import UAParser from 'ua-parser-js' +import { UAParser } from 'ua-parser-js' import { showError, TOAST_PERMANENT_TIMEOUT } from '@nextcloud/dialogs' import { t } from '@nextcloud/l10n' @@ -16,14 +16,14 @@ const os = parser.getOS() * Per-OS flags */ -export const isMac = os.name === 'Mac OS' +export const isMac = os.name === 'macOS' /** * Per-browser flags and a major version */ -export const isFirefox = browser.name === 'Firefox' -export const isChrome = browser.name === 'Chrome' || browser.name === 'Chromium' +export const isFirefox = browser.name === 'Firefox' || browser.name === 'Mobile Firefox' +export const isChrome = browser.name === 'Chrome' || browser.name === 'Chromium' || browser.name === 'Mobile Chrome' export const isOpera = browser.name === 'Opera' export const isSafari = browser.name === 'Safari' || browser.name === 'Mobile Safari' export const isEdge = browser.name === 'Edge' @@ -31,7 +31,7 @@ export const isBrave = browser.name === 'Brave' export const isIE = browser.name === 'IE' || browser.name === 'IEMobile' export const isYandex = browser.name === 'Yandex' -export const majorVersion = browser.version ? parseInt(browser.version.split('.')[0], 10) : 0 +export const majorVersion = browser.major ? parseInt(browser.major, 10) : 0 /** * Is the browser Chromium-based