mirror of
https://github.com/koel/koel
synced 2024-11-24 05:03:05 +00:00
Add support for desktop PWA
This commit is contained in:
parent
433586e1ac
commit
1782f8910a
3 changed files with 21 additions and 2 deletions
|
@ -16,7 +16,7 @@
|
|||
RewriteRule ^(.*)/$ /$1 [L,R=301]
|
||||
|
||||
# Whitelist only index.php, robots.txt, and some special routes
|
||||
RewriteRule ^(?!($|index\.php|robots\.txt|(public|api)/|remote|api-docs)) - [R=404,L]
|
||||
RewriteRule ^(?!($|index\.php|robots\.txt|(public|api)/|remote|api-docs|sw\.js)) - [R=404,L]
|
||||
|
||||
# Handle Front Controller...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "Koel",
|
||||
"start_url": "/",
|
||||
"display": "standalone",
|
||||
"orientation": "portrait",
|
||||
"orientation": "landscape",
|
||||
"icons": [{
|
||||
"src": "/public/img/icon.png",
|
||||
"sizes": "192x192",
|
||||
|
|
19
sw.js
Normal file
19
sw.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
importScripts('https://storage.googleapis.com/workbox-cdn/releases/4.0.0/workbox-sw.js')
|
||||
|
||||
workbox.routing.registerRoute(
|
||||
new RegExp('.*\.js'),
|
||||
new workbox.strategies.NetworkFirst()
|
||||
)
|
||||
|
||||
workbox.routing.registerRoute(
|
||||
/\.(?:png|jpg|jpeg|svg|gif|eot|ttf|woff2?|otf)$/,
|
||||
new workbox.strategies.CacheFirst({
|
||||
cacheName: 'image-font-cache',
|
||||
plugins: [
|
||||
new workbox.expiration.Plugin({
|
||||
maxEntries: 20,
|
||||
maxAgeSeconds: 7 * 24 * 60 * 60
|
||||
})
|
||||
]
|
||||
})
|
||||
)
|
Loading…
Reference in a new issue