Skip to content

Commit

Permalink
🐞 fix(yuque): cache
Browse files Browse the repository at this point in the history
  • Loading branch information
CCKNBC committed Mar 12, 2023
1 parent 4900c0a commit 7366380
Show file tree
Hide file tree
Showing 23 changed files with 89 additions and 109 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## [CC的部落格](https://blog.ccknbc.cc)

路过点个star吧,不为什么就是求求了
一个全是Bug的部落格

## 镜像站点

{% note success flat %} 以下排名不分先后,请选择适合自己访问较快的即可</br> **[GitHub](https://github.blog.ccknbc.cc) | [GitLab](https://gitlab.blog.ccknbc.cc) | [Gitee](https://ccknbc.gitee.io) | [Bitbucket](https://ccknbc.bitbucket.io) | [Vercel](https://vercel.blog.ccknbc.cc) | [Netlify](https://netlify.blog.ccknbc.cc) | [CloudFlare](https://cloudflare.blog.ccknbc.cc)** {% endnote %}
以下排名不分先后,请选择适合自己访问较快的即可</br> **[GitHub](https://github.blog.ccknbc.cc) | [GitLab](https://gitlab.blog.ccknbc.cc) | [Gitee](https://ccknbc.gitee.io) | [Bitbucket](https://ccknbc.bitbucket.io) | [Vercel](https://vercel.blog.ccknbc.cc) | [Netlify](https://netlify.blog.ccknbc.cc) | [CloudFlare](https://cloudflare.blog.ccknbc.cc)**

## 站点源码

Expand Down
17 changes: 10 additions & 7 deletions _config.butterfly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1094,9 +1094,10 @@ CDN:
# translate:
# local_search:
# algolia_js:

# algolia_search_v4:
# instantsearch_v4:
# algolia_search:
# instantsearch:
# docsearch_js:
# docsearch_css:
# pjax:
# gitalk:
# gitalk_css:
Expand All @@ -1112,7 +1113,6 @@ CDN:
# mathjax:
# katex:
# katex_copytex:
# katex_copytex_css:
# mermaid:
# canvas_ribbon:
# canvas_fluttering_ribbon:
Expand All @@ -1121,16 +1121,16 @@ CDN:
# instantpage:
# typed:
# pangu:
# fancybox_css_v4:
# fancybox_v4:
# fancybox_css:
# fancybox:
# medium_zoom:
# snackbar_css:
# snackbar:
# activate_power_mode:
# fireworks:
# click_heart:
# ClickShowText:
# fontawesomeV6:
# fontawesome:
# flickr_justified_gallery_js:
# flickr_justified_gallery_css:
# aplayer_css:
Expand All @@ -1139,6 +1139,9 @@ CDN:
# prismjs_js:
# prismjs_lineNumber_js:
# prismjs_autoloader:
# artalk_js:
# artalk_css:
# busuanzi:

# other
ccknbc: https://cdn.jsdelivr.ren/gh/ccknbc-backup/cdn/js/ccknbc.js
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"login": "ccknbc",
"repo": "blog",
"onlyPublished": true,
"onlyPublic": true
"onlyPublic": false
},
"hexo": {
"version": "6.3.0"
Expand Down
2 changes: 1 addition & 1 deletion themes/butterfly/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ npm i hexo-theme-butterfly
- [x] Share (AddThis/Sharejs/Addtoany)
- [X] Comment (Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus/Remark42/artalk)
- [x] Multiple Comment System Support
- [x] Online Chats (Chatra/Tidio/Daovoice/Gitter/Crisp/messenger)
- [x] Online Chats (Chatra/Tidio/Daovoice/Crisp/messenger)
- [x] Web analytics
- [x] Google AdSense
- [x] Webmaster Verification
Expand Down
2 changes: 1 addition & 1 deletion themes/butterfly/README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ theme: butterfly
- [x] 多種分享系統(AddThis/Sharejs/Addtoany)
- [X] 多種評論系統(Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus/Remark42/artalk)
- [x] 支持雙評論部署
- [x] 多種在線聊天(Chatra/Tidio/Daovoice/Gitter/Crisp/messenger)
- [x] 多種在線聊天(Chatra/Tidio/Daovoice/Crisp/messenger)
- [x] 多種分析系統
- [x] 谷歌廣告/手動廣告位置
- [x] 各種站長驗證(Google/Bing/Baidu/360/Yandex)
Expand Down
18 changes: 6 additions & 12 deletions themes/butterfly/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -416,12 +416,6 @@ daovoice:
enable: false
app_id:

# gitter
# https://gitter.im/
gitter:
enable: false
room:

# crisp
# https://crisp.chat/en/
crisp:
Expand Down Expand Up @@ -907,7 +901,7 @@ CDN:
# when set it to local, you need to install hexo-butterfly-extjs
third_party_provider: jsdelivr

# Add version number to CDN, true or false
# Add version number to url, true or false
version: false

# Custom format
Expand All @@ -921,8 +915,8 @@ CDN:
# translate:
# local_search:
# algolia_js:
# algolia_search_v4:
# instantsearch_v4:
# algolia_search:
# instantsearch:
# docsearch_js:
# docsearch_css:
# pjax:
Expand All @@ -948,16 +942,16 @@ CDN:
# instantpage:
# typed:
# pangu:
# fancybox_css_v4:
# fancybox_v4:
# fancybox_css:
# fancybox:
# medium_zoom:
# snackbar_css:
# snackbar:
# activate_power_mode:
# fireworks:
# click_heart:
# ClickShowText:
# fontawesomeV6:
# fontawesome:
# flickr_justified_gallery_js:
# flickr_justified_gallery_css:
# aplayer_css:
Expand Down
2 changes: 1 addition & 1 deletion themes/butterfly/layout/includes/additional-js.pug
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ div
if theme.medium_zoom
script(src=url_for(theme.asset.medium_zoom))
else if theme.fancybox
script(src=url_for(theme.asset.fancybox_v4))
script(src=url_for(theme.asset.fancybox))

if theme.instantpage
script(src=url_for(theme.asset.instantpage), type='module')
Expand Down
4 changes: 2 additions & 2 deletions themes/butterfly/layout/includes/head.pug
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ if (theme.pwa && theme.pwa.enable)

//- main css
link(rel='stylesheet', href=url_for(theme.asset.main_css))
link(rel='stylesheet', href=url_for(theme.asset.fontawesomeV6) media="print" onload="this.media='all'")
link(rel='stylesheet', href=url_for(theme.asset.fontawesome) media="print" onload="this.media='all'")

if (theme.snackbar && theme.snackbar.enable)
link(rel='stylesheet', href=url_for(theme.asset.snackbar_css) media="print" onload="this.media='all'")

if theme.fancybox
link(rel='stylesheet' href=url_for(theme.asset.fancybox_css_v4) media="print" onload="this.media='all'")
link(rel='stylesheet' href=url_for(theme.asset.fancybox_css) media="print" onload="this.media='all'")

//- google_adsense
!=partial('includes/head/google_adsense', {}, {cache: true})
Expand Down
9 changes: 9 additions & 0 deletions themes/butterfly/layout/includes/loading/pace.pug
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
script.
window.paceOptions = {
restartOnPushState: false
}

document.addEventListener('pjax:send', () => {
Pace.restart()
})

link(rel="stylesheet", href=url_for(theme.preloader.pace_css_url || theme.asset.pace_default_css))
script(data-pace-options='{ "restartOnRequestAfter":false,"eventLag":false}', src=url_for(theme.asset.pace_js))
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- const fbSDKVer = 'v15.0'
- const fbSDKVer = 'v16.0'
- const fbSDK = theme.messenger.enable ? `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk/xfbml.customerchat.js#xfbml=1&version=${fbSDKVer}` : `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk.js#xfbml=1&version=${fbSDKVer}`

script.
Expand Down
43 changes: 0 additions & 43 deletions themes/butterfly/layout/includes/third-party/chat/gitter.pug

This file was deleted.

2 changes: 0 additions & 2 deletions themes/butterfly/layout/includes/third-party/chat/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ else if theme.tidio && theme.tidio.enable
include ./tidio.pug
else if theme.daovoice && theme.daovoice.enable
include ./daovoice.pug
else if theme.gitter && theme.gitter.enable
include ./gitter.pug
else if theme.crisp && theme.crisp.enable
include ./crisp.pug
else if theme.messenger && theme.messenger.enable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ script.
window.fbAsyncInit = function() {
FB.init({
xfbml: true,
version: 'v15.0'
version: 'v16.0'
});
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- const fbSDKVer = 'v15.0'
- const fbSDKVer = 'v16.0'
- const fbSDK = theme.messenger.enable ? `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk/xfbml.customerchat.js#xfbml=1&version=${fbSDKVer}` : `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk.js#xfbml=1&version=${fbSDKVer}`

script.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@

#search-mask

script(src=url_for(theme.asset.algolia_search_v4))
script(src=url_for(theme.asset.instantsearch_v4))
script(src=url_for(theme.asset.algolia_search))
script(src=url_for(theme.asset.instantsearch))
script(src=url_for(theme.asset.algolia_js))
2 changes: 1 addition & 1 deletion themes/butterfly/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hexo-theme-butterfly",
"version": "4.7.0",
"version": "4.8.0-b1",
"description": "A Simple and Card UI Design theme for Hexo",
"main": "package.json",
"scripts": {
Expand Down
20 changes: 10 additions & 10 deletions themes/butterfly/plugins.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
algolia_search_v4:
algolia_search:
name: algoliasearch
file: dist/algoliasearch-lite.umd.js
version: 4.14.3
instantsearch_v4:
instantsearch:
name: instantsearch.js
file: dist/instantsearch.production.min.js
version: 4.51.0
version: 4.51.1
pjax:
name: pjax
file: pjax.min.js
Expand Down Expand Up @@ -123,15 +123,15 @@ pangu:
name: pangu
file: dist/browser/pangu.min.js
version: 4.0.7
fancybox_css_v4:
fancybox_css:
name: '@fancyapps/ui'
file: dist/fancybox.css
version: 4.0.31
file: dist/fancybox/fancybox.css
version: 5.0.3
other_name: fancyapps-ui
fancybox_v4:
fancybox:
name: '@fancyapps/ui'
file: dist/fancybox.umd.js
version: 4.0.31
file: dist/fancybox/fancybox.umd.js
version: 5.0.3
other_name: fancyapps-ui
medium_zoom:
name: medium-zoom
Expand All @@ -145,7 +145,7 @@ snackbar:
name: node-snackbar
file: dist/snackbar.min.js
version: 0.1.16
fontawesomeV6:
fontawesome:
name: '@fortawesome/fontawesome-free'
file: css/all.min.css
other_name: font-awesome
Expand Down
15 changes: 9 additions & 6 deletions themes/butterfly/scripts/events/cdn.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ hexo.extend.filter.register('before_generate', () => {
}
}

const minFile = (file) => {
const minFile = file => {
return file.replace(/(?<!\.min)\.(js|css)$/g, ext => '.min' + ext)
}

Expand All @@ -54,7 +54,7 @@ hexo.extend.filter.register('before_generate', () => {
const cdnjs_file = file.replace(/^[lib|dist]*\/|browser\//g, '')
const min_cdnjs_file = minFile(cdnjs_file)
if (cond === 'internal') file = `source/${file}`
const verType = CDN.version ? `@${version}` : ''
const verType = CDN.version ? (type === 'local' ? `?v=${version}` : `@${version}`) : ''

const value = {
version,
Expand All @@ -67,7 +67,7 @@ hexo.extend.filter.register('before_generate', () => {
}

const cdnSource = {
local: cond === 'internal' ? cdnjs_file : `/pluginsSrc/${name}/${file}`,
local: cond === 'internal' ? `${cdnjs_file + verType}` : `/pluginsSrc/${name}/${file + verType}`,
jsdelivr: `https://cdn.jsdelivr.net/npm/${name}${verType}/${min_file}`,
unpkg: `https://unpkg.com/${name}${verType}/${file}`,
cdnjs: `https://cdnjs.cloudflare.com/ajax/libs/${cdnjs_name}/${version}/${min_cdnjs_file}`,
Expand All @@ -77,7 +77,7 @@ hexo.extend.filter.register('before_generate', () => {
data[key] = cdnSource[type]
})

if (cond === 'internal') data.main_css = 'css/index.css'
if (cond === 'internal') data.main_css = 'css/index.css' + (CDN.version ? `?v=${version}` : '')
return data
}

Expand All @@ -90,6 +90,9 @@ hexo.extend.filter.register('before_generate', () => {
return obj
}

themeConfig.asset = Object.assign(createCDNLink(internalSrc, CDN.internal_provider, 'internal'),
createCDNLink(thirdPartySrc, CDN.third_party_provider), deleteNullValue(CDN.option))
themeConfig.asset = Object.assign(
createCDNLink(internalSrc, CDN.internal_provider, 'internal'),
createCDNLink(thirdPartySrc, CDN.third_party_provider),
deleteNullValue(CDN.option)
)
})
2 changes: 1 addition & 1 deletion themes/butterfly/scripts/filters/random_cover.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'use strict'

hexo.extend.filter.register('before_post_render', function (data) {
const imgTestReg = /\.(png|jpe?g|gif|svg|webp)(\?.*)?$/
const imgTestReg = /\.(png|jpe?g|gif|svg|webp)(\?.*)?$/i
let randomCover
let coverVal = data.cover

Expand Down
2 changes: 1 addition & 1 deletion themes/butterfly/scripts/helpers/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ hexo.extend.helper.register('findArchivesTitle', function (page, menu, date) {
})

hexo.extend.helper.register('isImgOrUrl', function (path) {
const imgTestReg = /\.(png|jpe?g|gif|svg|webp)(\?.*)?$/
const imgTestReg = /\.(png|jpe?g|gif|svg|webp)(\?.*)?$/i
if (path.indexOf('//') !== -1 || imgTestReg.test(path)) {
return true
}
Expand Down
Loading

0 comments on commit 7366380

Please sign in to comment.