forked from sawyerf/Castafiore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworkbox-config.js
More file actions
61 lines (61 loc) · 1.76 KB
/
workbox-config.js
File metadata and controls
61 lines (61 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
module.exports = {
globDirectory: './dist/',
swDest: 'dist/serviceWorker.js',
globPatterns: ["**/*.{html,js,css,png,jpg,jpeg,gif,svg,json,woff2,woff,eot,ttf}",],
dontCacheBustURLsMatching: /\.[0-9a-f]{8}\./,
globIgnores: [
'asset-manifest.json$',
'**/*.map$',
'**/LICENSE',
'**/*.js.gz$',
'**/(apple-touch-startup-image|chrome-icon|apple-touch-icon).*.png$',
],
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024,
runtimeCaching: [
{
urlPattern: ({ url }) => url.origin === self.location.origin && url.pathname.endsWith('.png'),
handler: 'CacheFirst',
options: {
cacheName: 'images',
expiration: {
maxAgeSeconds: 60 * 60 * 24 * 7,
},
},
},
{
urlPattern: ({ url }) => url.pathname.match(/\/rest\/getCoverArt$/),
handler: 'StaleWhileRevalidate',
options: {
cacheName: 'coverArt',
},
},
{
urlPattern: ({ url }) => url.pathname.match(/\/rest\/(getAlbumList2|getAlbum|favorited|getAlbum|getStarred2|getPlaylists|getArtist|getPlaylist|getTopSongs|getArtistInfo|getRandomSongs|search3)$/),
handler: 'NetworkFirst',
options: {
cacheName: 'api',
},
},
{
urlPattern: ({ url }) => url.pathname.match(/\/rest\/getSimilarSongs$/),
handler: 'StaleWhileRevalidate',
options: {
cacheName: 'apiLongResponse',
},
},
{
urlPattern: ({ url }) => url.pathname.match(/\/rest\/stream$/),
handler: 'CacheFirst',
options: {
cacheName: 'song',
},
},
{
urlPattern: ({ url }) => url.hostname === 'lrclib.net' || url.pathname.match(/\/rest\/getLyricsBySongId$/),
handler: 'CacheFirst',
options: {
cacheName: 'lyrics',
},
},
],
};