feat: pwa with push notifications (#337)
This commit is contained in:
parent
a18e5e2332
commit
f0c91a3974
48 changed files with 2903 additions and 14 deletions
51
config/pwa.ts
Normal file
51
config/pwa.ts
Normal file
|
@ -0,0 +1,51 @@
|
|||
import { isCI } from 'std-env'
|
||||
import type { VitePWANuxtOptions } from '../modules/pwa/types'
|
||||
|
||||
const isPreview = process.env.PULL_REQUEST === 'true'
|
||||
|
||||
const pwa: VitePWANuxtOptions = {
|
||||
mode: isCI ? 'production' : 'development',
|
||||
// disabled PWA only on production
|
||||
disable: !isPreview && process.env.VITE_DEV_PWA !== 'true',
|
||||
scope: '/',
|
||||
srcDir: './service-worker',
|
||||
filename: 'sw.ts',
|
||||
strategies: 'injectManifest',
|
||||
injectRegister: false,
|
||||
includeManifestIcons: false,
|
||||
manifest: {
|
||||
scope: '/',
|
||||
id: '/',
|
||||
name: `Elk${isCI ? isPreview ? ' (preview)' : '' : ' (dev)'}`,
|
||||
short_name: `Elk${isCI ? isPreview ? ' (preview)' : '' : ' (dev)'}`,
|
||||
description: `A nimble Mastodon Web Client${isCI ? isPreview ? ' (preview)' : '' : ' (development)'}`,
|
||||
theme_color: '#ffffff',
|
||||
icons: [
|
||||
{
|
||||
src: 'pwa-192x192.png',
|
||||
sizes: '192x192',
|
||||
type: 'image/png',
|
||||
},
|
||||
{
|
||||
src: 'pwa-512x512.png',
|
||||
sizes: '512x512',
|
||||
type: 'image/png',
|
||||
},
|
||||
{
|
||||
src: 'logo.svg',
|
||||
sizes: '250x250',
|
||||
type: 'image/png',
|
||||
purpose: 'any maskable',
|
||||
},
|
||||
],
|
||||
},
|
||||
injectManifest: {
|
||||
globPatterns: ['**/*.{js,json,css,html,txt,svg,png,ico,webp,woff,woff2,ttf,eot,otf,wasm}'],
|
||||
},
|
||||
devOptions: {
|
||||
enabled: process.env.VITE_DEV_PWA === 'true',
|
||||
type: 'module',
|
||||
},
|
||||
}
|
||||
|
||||
export { pwa }
|
Loading…
Add table
Add a link
Reference in a new issue