hexo-swpp 2.8.5 → 2.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,7 +33,6 @@ module.exports = (hexo, hexoConfig, swRules, ejectValues) => {
33
33
  buildUpdateJson(updatePath, dif, oldUpdate, updateValid ? expand : undefined)
34
34
  })
35
35
 
36
-
37
36
  /** 遍历指定目录下的所有文件 */
38
37
  const eachAllFile = (root, cb) => {
39
38
  const stats = fs.statSync(root)
@@ -66,9 +66,11 @@
66
66
  // [modifyRequest call]
67
67
  const url = new URL(request.url)
68
68
  // [blockRequest call]
69
- if (findCache(url)) {
70
- let key = `${url.protocol}//${url.host}${url.pathname}`
69
+ const cacheRule = findCache(url)
70
+ if (cacheRule) {
71
+ let key = `https//${url.host}${url.pathname}`
71
72
  if (key.endsWith('/index.html')) key = key.substring(0, key.length - 10)
73
+ if (cacheRule.search) key += url.search
72
74
  event.respondWith(caches.match(key)
73
75
  .then(cache => cache ?? fetchFile(request, true)
74
76
  .then(response => {
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "hexo-swpp",
3
- "version": "2.8.5",
3
+ "version": "2.8.6",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
+ "cheerio": "^1.0.0-rc.12",
6
7
  "hexo-log": "^3.0.0",
7
8
  "node-fetch": "^2.6.9",
8
- "cheerio": "^1.0.0-rc.12",
9
9
  "postcss": "^8.4.27"
10
10
  },
11
11
  "files": [