From 787692b7ee2c10b87db7841314c8513aebdd9a5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20B=C3=A4ume?= <julian.baeume@open-xchange.com> Date: Wed, 15 Mar 2023 17:38:09 +0100 Subject: [PATCH] inject app root variable into webmanifest template this should fix paths for apps with app root different than / --- src/plugins/webmanifest.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/plugins/webmanifest.js b/src/plugins/webmanifest.js index 67fd5ad..4951213 100644 --- a/src/plugins/webmanifest.js +++ b/src/plugins/webmanifest.js @@ -2,13 +2,15 @@ import { get } from '../cache.js' import Validator from '../validator.js' import { getRedisKey } from '../util.js' +const appRoot = process.env.APP_ROOT + const template = { // custom values name: 'OX App Suite', short_name: 'OX App Suite', icons: [ { - src: '/themes/default/logo_512.png', + src: `${appRoot}themes/default/logo_512.png`, type: 'image/png', sizes: '512x512', purpose: 'any' @@ -17,15 +19,15 @@ const template = { // fixed values // theme_color is taken from index.html and is changed by the theme theme_color: 'white', - start_url: '/#pwa=true', + start_url: `${appRoot}#pwa=true`, display: 'standalone', background_color: 'white', - scope: '/', - id: '/#pwa=true', + scope: `${appRoot}`, + id: `${appRoot}#pwa=true`, protocol_handlers: [ { protocol: 'mailto', - url: '/#app=io.ox/mail&mailto=%s' + url: `${appRoot}#app=io.ox/mail&mailto=%s` } ] } @@ -47,7 +49,7 @@ export default async function serveWebmanifest (fastify) { } async function fetchWebManifest (url) { - const serverConfigURL = new URL('/api/apps/manifests?action=config', url) + const serverConfigURL = new URL('api/apps/manifests?action=config', url) const conf = await fetch(serverConfigURL) if (conf.ok) { -- GitLab