Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
mjsoftking committed Dec 19, 2024
2 parents 49431c2 + a5cce0f commit c8226c0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/js/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
// 后端 api 不进行缓存
const notHandleList = [
location.origin + '/api',
location.origin + '/apis',
]

// 需要走cdn和缓存的请求(cdn优先于缓存)
Expand Down Expand Up @@ -167,6 +168,10 @@
|| isExitInUrlList(notHandleList, event.request.url)) {
return false
}
// 检查请求协议是否为 http 或 https
if (!event.request.url.startsWith('http://') && !event.request.url.startsWith('https://')) {
return false
}
const isCdnAndCache = isExitInUrlList(cdnAndCacheList, event.request.url)
const isOnlyCacheList = isExitInUrlList(onlyCacheList, event.request.url)
// cdn并发请求未开启 或 请求没有被任何路由命中
Expand Down
2 changes: 1 addition & 1 deletion templates/assets/js/sw.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion templates/common/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
th:with="description=${isPost ? post != null ? post.status.excerpt : singlePage != null ? singlePage.status.excerpt : site.seo.description : site.seo.description}">
<meta charset="utf-8"/>
<title th:text="${title + (#strings.isEmpty(site.subtitle) ? '' : '|' + site.subtitle)}"></title>
<script th:if="${theme.config.enhance.enable_sw}" th:src="${(theme.config.enhance.enable_sw == 'uninstall')? #theme.assets('/assets/js/sw.min.js?uninstall=true') + '&mew=1.2.1' : '/sw.min.js?mew=1.2.1' + theme.config.enhance.enable_sw + '&cdn=' + theme.config.enhance.sw_cdn_source.replaceAll('\n', ',')}"></script>
<script th:if="${theme.config.enhance.enable_sw}" th:src="${(theme.config.enhance.enable_sw == 'uninstall')? #theme.assets('/assets/js/sw.min.js?uninstall=true') + '&mew=1.2.2' : '/sw.min.js?mew=1.2.2' + theme.config.enhance.enable_sw + '&cdn=' + theme.config.enhance.sw_cdn_source.replaceAll('\n', ',')}"></script>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="applicable-device" content="pc,mobile">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down

0 comments on commit c8226c0

Please sign in to comment.