Skip to content
Snippets Groups Projects
Commit 787692b7 authored by julian.baeume's avatar julian.baeume :pick:
Browse files

inject app root variable into webmanifest template

this should fix paths for apps with app root different than /
parent 39269d46
No related branches found
No related tags found
No related merge requests found
...@@ -2,13 +2,15 @@ import { get } from '../cache.js' ...@@ -2,13 +2,15 @@ import { get } from '../cache.js'
import Validator from '../validator.js' import Validator from '../validator.js'
import { getRedisKey } from '../util.js' import { getRedisKey } from '../util.js'
const appRoot = process.env.APP_ROOT
const template = { const template = {
// custom values // custom values
name: 'OX App Suite', name: 'OX App Suite',
short_name: 'OX App Suite', short_name: 'OX App Suite',
icons: [ icons: [
{ {
src: '/themes/default/logo_512.png', src: `${appRoot}themes/default/logo_512.png`,
type: 'image/png', type: 'image/png',
sizes: '512x512', sizes: '512x512',
purpose: 'any' purpose: 'any'
...@@ -17,15 +19,15 @@ const template = { ...@@ -17,15 +19,15 @@ const template = {
// fixed values // fixed values
// theme_color is taken from index.html and is changed by the theme // theme_color is taken from index.html and is changed by the theme
theme_color: 'white', theme_color: 'white',
start_url: '/#pwa=true', start_url: `${appRoot}#pwa=true`,
display: 'standalone', display: 'standalone',
background_color: 'white', background_color: 'white',
scope: '/', scope: `${appRoot}`,
id: '/#pwa=true', id: `${appRoot}#pwa=true`,
protocol_handlers: [ protocol_handlers: [
{ {
protocol: 'mailto', 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) { ...@@ -47,7 +49,7 @@ export default async function serveWebmanifest (fastify) {
} }
async function fetchWebManifest (url) { 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) const conf = await fetch(serverConfigURL)
if (conf.ok) { if (conf.ok) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment