hexo-swpp 1.1.4 → 1.1.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.
- package/index.js +1 -1
- package/package.json +1 -1
- package/sw-template.js +10 -1
package/index.js
CHANGED
|
@@ -197,7 +197,7 @@ const buildUpdateJson = (name, dif, oldUpdate) => {
|
|
|
197
197
|
// 读取拓展 json
|
|
198
198
|
const expand = fs.existsSync(name) ? JSON.parse(fs.readFileSync(name, 'utf-8')) : undefined
|
|
199
199
|
// 获取上次最新的版本
|
|
200
|
-
let oldVersion = oldUpdate?.info
|
|
200
|
+
let oldVersion = oldUpdate?.info?.at(0)?.version ?? 0
|
|
201
201
|
if (typeof oldVersion !== 'number') {
|
|
202
202
|
// 当上次最新的版本号不是数字是尝试对其进行转换,如果无法转换则直接置零
|
|
203
203
|
if (oldVersion.match('\D')) oldVersion = 0
|
package/package.json
CHANGED
package/sw-template.js
CHANGED
|
@@ -181,7 +181,11 @@
|
|
|
181
181
|
} else list.refresh = true
|
|
182
182
|
}
|
|
183
183
|
resolve({list: list, version: newVersion})
|
|
184
|
-
}).catch(
|
|
184
|
+
}).catch(e => {
|
|
185
|
+
console.error(e)
|
|
186
|
+
console.error('更新过程中发生异常,已经还原版本信息!')
|
|
187
|
+
dbVersion.write('{"global":-1, "local": -1}')
|
|
188
|
+
})
|
|
185
189
|
})
|
|
186
190
|
const url = `/update.json` //需要修改JSON地址的在这里改
|
|
187
191
|
return new Promise(resolve => fetchNoCache(url)
|
|
@@ -262,6 +266,11 @@
|
|
|
262
266
|
case 'html':
|
|
263
267
|
this.match = url => url.href.match(/(\/|\/index\.html)$/)
|
|
264
268
|
break
|
|
269
|
+
case 'page':
|
|
270
|
+
this.match = url => forEachValues(
|
|
271
|
+
value => url.endsWith(`/${value}/`) || url.endsWith(`/${value}/index.html`)
|
|
272
|
+
)
|
|
273
|
+
break
|
|
265
274
|
case 'file':
|
|
266
275
|
this.match = url => forEachValues(value => url.endsWith(value))
|
|
267
276
|
break
|