From d0dc38d10de7e1e60295b0e0d89ad059962eae75 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Wed, 17 Jul 2024 23:22:42 +0800 Subject: [PATCH] refactor: update sw.js --- _javascript/pwa/sw.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/_javascript/pwa/sw.js b/_javascript/pwa/sw.js index d005c520fbc..94b64bf7c8a 100644 --- a/_javascript/pwa/sw.js +++ b/_javascript/pwa/sw.js @@ -3,6 +3,7 @@ import { baseurl } from '../../_config.yml'; importScripts(`${baseurl}/assets/js/data/swconf.js`); const purge = swconf.purge; +const interceptor = swconf.interceptor; function verifyUrl(url) { const requestUrl = new URL(url); @@ -12,13 +13,13 @@ function verifyUrl(url) { return false; } - for (const denyUrl of swconf.denyUrls) { - if (requestUrl.href.startsWith(denyUrl)) { + for (const prefix of interceptor.urlPrefixes) { + if (requestUrl.href.startsWith(prefix)) { return false; } } - for (const path of swconf.denyPaths) { + for (const path of interceptor.paths) { if (requestPath.startsWith(path)) { return false; }