Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: dynamic manifest.json via nitro #119

Open
OrbisK opened this issue Mar 8, 2024 · 2 comments
Open

[Feature Request]: dynamic manifest.json via nitro #119

OrbisK opened this issue Mar 8, 2024 · 2 comments

Comments

@OrbisK
Copy link

OrbisK commented Mar 8, 2024

I think it would be a nice feature to have the possibility to keep at least some keys of the manifest file dynamic to get them from an api for example. One use case would be to change the app icon without having to create a new build.

As a proof of concept I wrote a module with a server handler that can return a manifest. (and replaced hrefs from manifest.webmanifest to my manifest route

export default defineEventHandler((event) => {
    setResponseHeaders(event, {
        "Content-Type": "application/manifest+json"
    })

    const test = Math.random() * 12
    // maybe fetch some api (configured via config) to merge default config and dynamic keys via defu

    return { /* this might be replaced by e.g. $fetch(/api/manifest-overrides) + merge with default*/
        "name": `Vitesse for Nuxt ${test}`,
        "short_name": `Vitesse for Nuxt ${test}`,
        "start_url": "/",
        "display": "standalone",
        "background_color": "#ffffff",
        "lang": "en",
        "scope": "/",
        "id": "/",
        "description": `Vitesse for Nuxt ${test}`,
        "theme_color": "#ffffff",
        "icons": [{"src": "/pwa-192x192.png", "sizes": "192x192", "type": "image/png"}, {
            "src": "/pwa-512x512.png",
            "sizes": "512x512",
            "type": "image/png"
        }, {"src": "/maskable-icon.png", "sizes": "512x512", "type": "image/png", "purpose": "any maskable"}]
    }

})

Note

Changing the title is only for poc. It is more of a usecase to change colors, locale or images

result:
image
next try:
image

might solve: #104

@yossefAlatter
Copy link

yossefAlatter commented Mar 26, 2024

is there any solution we can make until feature added ?

@yossefAlatter
Copy link

please i wanna to see the repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants