mirror of
https://github.com/nextcloud/server.git
synced 2026-02-23 01:40:59 -05:00
fix: Fix ServiceWorker scope when Nextcloud installed in subfolder
Signed-off-by: Kostiantyn Miakshyn <molodchick@gmail.com>
This commit is contained in:
parent
ad045d6ede
commit
2e1cd23a7d
1 changed files with 3 additions and 2 deletions
|
|
@ -2,7 +2,7 @@
|
|||
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
import { generateUrl, getRootUrl } from '@nextcloud/router'
|
||||
import logger from '../logger.ts'
|
||||
|
||||
export default () => {
|
||||
|
|
@ -11,7 +11,8 @@ export default () => {
|
|||
window.addEventListener('load', async () => {
|
||||
try {
|
||||
const url = generateUrl('/apps/files/preview-service-worker.js', {}, { noRewrite: true })
|
||||
const registration = await navigator.serviceWorker.register(url, { scope: '/' })
|
||||
const scope = getRootUrl()
|
||||
const registration = await navigator.serviceWorker.register(url, { scope })
|
||||
logger.debug('SW registered: ', { registration })
|
||||
} catch (error) {
|
||||
logger.error('SW registration failed: ', { error })
|
||||
|
|
|
|||
Loading…
Reference in a new issue