From 1f69c8d3307eeb5d5ac8648a23bce4858bd23ea8 Mon Sep 17 00:00:00 2001 From: Hangzhi Yu <hangzhi@protonmail.com> Date: Sat, 14 Jan 2023 03:18:13 +0100 Subject: [PATCH] PWA fixes --- aleksis/core/vite.config.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/aleksis/core/vite.config.js b/aleksis/core/vite.config.js index f33c3d631..18a29bcd3 100644 --- a/aleksis/core/vite.config.js +++ b/aleksis/core/vite.config.js @@ -141,7 +141,7 @@ export default defineConfig({ base: "/", workbox: { navigateFallback: "/", - navigateFallbackAllowlist: [new RegExp("^/(?!django)[^.]*$")], + navigateFallbackAllowlist: [new RegExp("^/(?!(django|admin|graphql|__icons__))[^.]*$")], additionalManifestEntries: ["/", "/django/offline/"], inlineWorkboxRuntime: true, modifyURLPrefix: { @@ -149,6 +149,10 @@ export default defineConfig({ }, globPatterns: ["**/*.{js,css,eot,woff,woff2,ttf}"], runtimeCaching: [ + { + urlPattern: new RegExp("^/(?!(django|admin|graphql|__icons__))[^.]*$"), + handler: "CacheFirst", + }, { urlPattern: new RegExp("/django/.*"), handler: "NetworkFirst", @@ -158,16 +162,12 @@ export default defineConfig({ expiration: { maxAgeSeconds: 60 * 60 * 24, }, - broadcastUpdate: { - channelName: "cache-or-not", // TODO: Check whether this actually works - options: {}, - }, precacheFallback: { fallbackURL: "/django/offline/", }, cacheableResponse: { headers: { - "PWA-Is-Cacheable": "true", // FIXME: Header is apparently not checked + "PWA-Is-Cacheable": "true", }, }, }, -- GitLab