diff options
Diffstat (limited to 'core/src/views/UnsupportedBrowser.vue')
-rw-r--r-- | core/src/views/UnsupportedBrowser.vue | 76 |
1 files changed, 31 insertions, 45 deletions
diff --git a/core/src/views/UnsupportedBrowser.vue b/core/src/views/UnsupportedBrowser.vue index e46c64da24c..408cccf61e9 100644 --- a/core/src/views/UnsupportedBrowser.vue +++ b/core/src/views/UnsupportedBrowser.vue @@ -1,24 +1,7 @@ - <!-- - - @copyright 2022 John Molakvoæ <skjnldsv@protonmail.com> - - - - @author John Molakvoæ <skjnldsv@protonmail.com> - - - - @license GNU AGPL version 3 or any later version - - - - This program is free software: you can redistribute it and/or modify - - it under the terms of the GNU Affero General Public License as - - published by the Free Software Foundation, either version 3 of the - - License, or (at your option) any later version. - - - - 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 - - GNU Affero General Public License for more details. - - - - You should have received a copy of the GNU Affero General Public License - - along with this program. If not, see <http://www.gnu.org/licenses/>. - - - --> +<!-- + - SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors + - SPDX-License-Identifier: AGPL-3.0-or-later +--> <template> <div class="content-unsupported-browser guest-box"> <NcEmptyContent> @@ -48,11 +31,14 @@ </template> <script> -import { generateUrl } from '@nextcloud/router' +// eslint-disable-next-line n/no-extraneous-import +import { agents } from 'caniuse-lite/dist/unpacker/agents.js' +import { generateUrl, getRootUrl } from '@nextcloud/router' import { translate as t, translatePlural as n } from '@nextcloud/l10n' -import NcButton from '@nextcloud/vue/dist/Components/NcButton.js' -import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent' -import Web from 'vue-material-design-icons/Web' + +import NcButton from '@nextcloud/vue/components/NcButton' +import NcEmptyContent from '@nextcloud/vue/components/NcEmptyContent' +import Web from 'vue-material-design-icons/Web.vue' import { browserStorageKey } from '../utils/RedirectUnsupportedBrowsers.js' import { supportedBrowsers } from '../services/BrowsersListService.js' @@ -69,12 +55,6 @@ export default { NcEmptyContent, }, - data() { - return { - agents: {}, - } - }, - computed: { isMobile() { return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) @@ -109,12 +89,12 @@ export default { }) return Object.keys(list).map(id => { - if (!this.agents[id]?.browser) { + if (!agents[id]?.browser) { return null } const version = list[id] - const name = this.agents[id]?.browser + const name = agents[id]?.browser return this.t('core', '{name} version {version} and above', { name, version, }) @@ -122,13 +102,6 @@ export default { }, }, - async beforeMount() { - // Dynamic load big list of user agents - // eslint-disable-next-line node/no-extraneous-import - const { agents } = await import('caniuse-lite') - this.agents = agents - }, - methods: { t, n, @@ -140,10 +113,22 @@ export default { // Redirect if there is the data const urlParams = new URLSearchParams(window.location.search) if (urlParams.has('redirect_url')) { - const redirectPath = Buffer.from(urlParams.get('redirect_url'), 'base64').toString() || '/' - window.location = redirectPath - return + let redirectPath = Buffer.from(urlParams.get('redirect_url'), 'base64').toString() || '/' + + // remove index.php and double slashes + redirectPath = redirectPath + .replace('index.php', '') + .replace(getRootUrl(), '') + .replace(/\/\//g, '/') + + // if we have a valid redirect url, use it + if (redirectPath.startsWith('/')) { + window.location = generateUrl(redirectPath) + return + } } + + // else redirect to root window.location = generateUrl('/') }, @@ -179,7 +164,8 @@ $spacing: 30px; .empty-content { margin: 0; - &::v-deep .empty-content__icon { + + :deep(.empty-content__icon) { opacity: 1; } } @@ -193,7 +179,7 @@ $spacing: 30px; margin-top: 2 * $spacing; margin-bottom: $spacing; li { - text-align: left; + text-align: start; } } } |