mirror of
https://github.com/suitenumerique/docs
synced 2026-04-21 13:37:20 +00:00
⚡️(sw) stop to cache external resources likes videos
Some videos from external sources can be very large and slow to cache. To improve performance, we decided to stop caching these resources in the service worker. We will cache only images and fonts from external sources. The videos will maybe not be available when offline mode.
This commit is contained in:
parent
3fee1f2081
commit
785c9b21cf
2 changed files with 22 additions and 27 deletions
|
|
@ -11,6 +11,10 @@ and this project adheres to
|
|||
- ✨ Add comments feature to the editor #1330
|
||||
- ✨(backend) Comments on text editor #1330
|
||||
|
||||
### Changed
|
||||
|
||||
- ⚡️(sw) stop to cache external resources likes videos #1655
|
||||
|
||||
### Fixed
|
||||
|
||||
- ♿(frontend) improve accessibility:
|
||||
|
|
|
|||
|
|
@ -157,33 +157,6 @@ registerRoute(
|
|||
}),
|
||||
);
|
||||
|
||||
/**
|
||||
* External urls cache strategy
|
||||
*/
|
||||
registerRoute(
|
||||
({ url }) => !url.href.includes(self.location.origin),
|
||||
new NetworkFirst({
|
||||
cacheName: getCacheNameVersion('default-external'),
|
||||
plugins: [
|
||||
new CacheableResponsePlugin({ statuses: [0, 200] }),
|
||||
new ExpirationPlugin({
|
||||
maxAgeSeconds: 24 * 60 * 60 * DAYS_EXP,
|
||||
}),
|
||||
new OfflinePlugin(),
|
||||
],
|
||||
}),
|
||||
'GET',
|
||||
);
|
||||
|
||||
/**
|
||||
* Admin cache strategy
|
||||
*/
|
||||
registerRoute(
|
||||
({ url }) =>
|
||||
url.href.includes(self.location.origin) && url.href.includes('/admin/'),
|
||||
new NetworkOnly(),
|
||||
);
|
||||
|
||||
/**
|
||||
* Cache strategy static files images (images / svg)
|
||||
*/
|
||||
|
|
@ -217,6 +190,24 @@ registerRoute(
|
|||
}),
|
||||
);
|
||||
|
||||
/**
|
||||
* External urls cache strategy
|
||||
*/
|
||||
registerRoute(
|
||||
({ url }) => !url.href.includes(self.location.origin),
|
||||
new NetworkOnly(),
|
||||
'GET',
|
||||
);
|
||||
|
||||
/**
|
||||
* Admin cache strategy
|
||||
*/
|
||||
registerRoute(
|
||||
({ url }) =>
|
||||
url.href.includes(self.location.origin) && url.href.includes('/admin/'),
|
||||
new NetworkOnly(),
|
||||
);
|
||||
|
||||
/**
|
||||
* Cache strategy static files (css, js, workers)
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue