mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-03-12 17:20:08 +01:00
fix: Fix manifest PWA non registrato correttamente
This commit is contained in:
parent
83d1c1ddd4
commit
e894086b4c
@ -4,6 +4,7 @@ import {createInertiaApp} from '@maicol07/inertia-mithril';
|
||||
import {showSnackbar} from '@osm/utils/misc';
|
||||
import Mithril from 'mithril';
|
||||
import Stream from 'mithril/stream';
|
||||
import {pwaInfo} from 'virtual:pwa-info';
|
||||
import {registerSW} from 'virtual:pwa-register';
|
||||
|
||||
import {resolvePage} from '~inertia';
|
||||
@ -63,3 +64,15 @@ const updateSW = registerSW({
|
||||
void showSnackbar(__('È ora possibile lavorare offline!'), false);
|
||||
}
|
||||
}) as (reloadPage?: boolean) => Promise<void>;
|
||||
|
||||
if (pwaInfo) {
|
||||
const {href, useCredentials} = pwaInfo.webManifest;
|
||||
/* Add link to head: href is the link */
|
||||
const linkElement = document.createElement('link');
|
||||
linkElement.setAttribute('rel', 'manifest');
|
||||
linkElement.setAttribute('href', href);
|
||||
if (useCredentials) {
|
||||
linkElement.setAttribute('crossorigin', 'use-credentials');
|
||||
}
|
||||
document.head.append(linkElement);
|
||||
}
|
||||
|
1
resources/ts/typings/global.d.ts
vendored
1
resources/ts/typings/global.d.ts
vendored
@ -2,6 +2,7 @@
|
||||
// noinspection JSFileReferences,JSUnusedGlobalSymbols,LocalVariableNamingConventionJS
|
||||
import 'inertia-plugin/client';
|
||||
import 'vite-plugin-pwa/client.d';
|
||||
import 'vite-plugin-pwa/info.d';
|
||||
import 'vite/client';
|
||||
|
||||
import type Mithril from 'mithril';
|
||||
|
@ -65,7 +65,12 @@ export default defineConfig(async () => {
|
||||
assetsInclude: '**/*.xml',
|
||||
build: {
|
||||
sourcemap: true,
|
||||
target: 'esnext'
|
||||
target: 'esnext',
|
||||
rollupOptions: {
|
||||
output: {
|
||||
assetFileNames: '[name].[ext]'
|
||||
}
|
||||
}
|
||||
},
|
||||
resolve: {
|
||||
alias: aliases
|
||||
@ -102,15 +107,11 @@ export default defineConfig(async () => {
|
||||
// }),
|
||||
VitePWA({
|
||||
registerType: 'autoUpdate',
|
||||
outDir: 'public',
|
||||
buildBase: '/',
|
||||
scope: '/',
|
||||
// TODO: Check options
|
||||
buildBase: '/build/',
|
||||
includeAssets: [
|
||||
'resources/images/favicon/favicon.ico',
|
||||
'../robots.txt',
|
||||
'resources/images/favicon/apple-touch-icon.png',
|
||||
'resources/images/*.png'
|
||||
'build/assets/*.ico',
|
||||
'robots.txt',
|
||||
'build/assets/*.png'
|
||||
],
|
||||
manifest: {
|
||||
name: 'OpenSTAManager',
|
||||
@ -119,7 +120,6 @@ export default defineConfig(async () => {
|
||||
categories: ['business', 'productivity'],
|
||||
display: 'minimal-ui',
|
||||
theme_color: '#3f3f3f',
|
||||
background_color: '#fffff',
|
||||
icons: [
|
||||
{
|
||||
src: 'android-chrome-192x192.png',
|
||||
@ -134,8 +134,7 @@ export default defineConfig(async () => {
|
||||
{
|
||||
src: 'android-chrome-512x512.png',
|
||||
sizes: '512x512',
|
||||
type: 'image/png',
|
||||
purpose: 'any maskable'
|
||||
type: 'image/png'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user