smaller avatar cache, exclude gifs from img cache

This commit is contained in:
Martti Malmi 2024-01-10 23:01:11 +02:00
parent 8c8a7c7e88
commit d3c9fef9af

View File

@ -55,7 +55,7 @@ registerRoute(
cacheName: "avatar-cache", cacheName: "avatar-cache",
plugins: [ plugins: [
new ExpirationPlugin({ new ExpirationPlugin({
maxEntries: 1000, maxEntries: 200, // gif avatars can still be large
matchOptions: { matchOptions: {
ignoreVary: true, ignoreVary: true,
}, },
@ -69,8 +69,8 @@ registerRoute(
// Cache images from any domain // Cache images from any domain
registerRoute( registerRoute(
// Match any image request regardless of the origin // match images except gif
({ request }) => request.destination === "image", ({ request, url }) => request.destination === "image" && !url.pathname.endsWith(".gif"),
new CacheFirst({ new CacheFirst({
cacheName: "image-cache", cacheName: "image-cache",
plugins: [ plugins: [