mirror of
https://github.com/VueTorrent/VueTorrent.git
synced 2024-12-18 09:42:06 +03:00
perf(PWA): Use Network-only strategy for service worker (#1468)
This commit is contained in:
parent
cf07601f8c
commit
f4842c4444
7 changed files with 108 additions and 3720 deletions
|
@ -13,6 +13,10 @@
|
|||
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
||||
<meta name="theme-color" content="#000" />
|
||||
<title>VueTorrent</title>
|
||||
|
||||
<!-- PWA setup -->
|
||||
<link rel="manifest" href="/manifest.webmanifest" crossorigin="use-credentials">
|
||||
<script src="/registerSW.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
|
|
3773
package-lock.json
generated
3773
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -28,7 +28,6 @@
|
|||
"pinia": "^2.1.6",
|
||||
"pinia-plugin-persist": "^1.0.0",
|
||||
"uuid": "^9.0.1",
|
||||
"vite-plugin-pwa": "^0.17.4",
|
||||
"vite-plugin-vuetify": "^2.0.1",
|
||||
"vue": "^3.4.14",
|
||||
"vue-i18n": "^9.9.0",
|
||||
|
|
22
public/manifest.webmanifest
Normal file
22
public/manifest.webmanifest
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"name": "VueTorrent",
|
||||
"short_name": "VueTorrent",
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"background_color": "#000",
|
||||
"lang": "en",
|
||||
"scope": "./",
|
||||
"theme_color": "#597566",
|
||||
"icons": [
|
||||
{
|
||||
"src": "./icon-192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "./icon-512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
]
|
||||
}
|
1
public/registerSW.js
Normal file
1
public/registerSW.js
Normal file
|
@ -0,0 +1 @@
|
|||
"serviceWorker"in navigator&&window.addEventListener("load",(async()=>{await navigator.serviceWorker.register("/sw.js")}));
|
1
public/sw.js
Normal file
1
public/sw.js
Normal file
|
@ -0,0 +1 @@
|
|||
self.addEventListener("install",(()=>{})),self.addEventListener("fetch",(()=>{}));
|
|
@ -3,7 +3,6 @@ import vue from '@vitejs/plugin-vue'
|
|||
import { fileURLToPath, URL } from 'node:url'
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import vuetify from 'vite-plugin-vuetify'
|
||||
import { VitePWA } from 'vite-plugin-pwa'
|
||||
import { resolve } from 'node:path'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
|
@ -33,30 +32,7 @@ export default defineConfig(({ mode }) => {
|
|||
},
|
||||
plugins: [
|
||||
vue(),
|
||||
vuetify(),
|
||||
VitePWA({
|
||||
includeAssets: ['favicon.ico', 'icon.svg', 'icon-192.png', 'icon-512.png', 'robots.txt'],
|
||||
manifest: {
|
||||
name: 'VueTorrent',
|
||||
short_name: 'VueTorrent',
|
||||
theme_color: '#597566',
|
||||
start_url: '.',
|
||||
background_color: '#000',
|
||||
icons: [
|
||||
{ src: './icon-192.png', type: 'image/png', sizes: '192x192' },
|
||||
{ src: './icon-512.png', type: 'image/png', sizes: '512x512' }
|
||||
]
|
||||
},
|
||||
// Other options
|
||||
registerType: 'autoUpdate',
|
||||
base: './',
|
||||
useCredentials: true,
|
||||
workbox: {
|
||||
maximumFileSizeToCacheInBytes: 10_000_000,
|
||||
skipWaiting: true,
|
||||
globPatterns: ['**/*.{js,css,html,ico,png,svg,woff,woff2}']
|
||||
}
|
||||
})
|
||||
vuetify()
|
||||
],
|
||||
publicDir: './public',
|
||||
resolve: {
|
||||
|
|
Loading…
Reference in a new issue