Skip to content

Commit

Permalink
Merge branch 'dev' into cdn
Browse files Browse the repository at this point in the history
  • Loading branch information
MHuiG committed Aug 15, 2022
2 parents a58167d + 02ffa97 commit 63ca5c0
Show file tree
Hide file tree
Showing 16 changed files with 104 additions and 61 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: A job to Test deploying for dev.
strategy:
matrix:
node_version: ['14', '16']
node_version: ['18', '16']
steps:
- name: Setup Node.js
uses: actions/setup-node@v1
Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:
name: A job to Test deploying for test.
strategy:
matrix:
node_version: ['14', '16']
node_version: ['18', '16']
steps:
- name: Setup Node.js
uses: actions/setup-node@v1
Expand Down
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# Changelog

## [5.7.4](https://github.com/volantis-x/hexo-theme-volantis/compare/v5.7.3...v5.7.4) (2022-08-15)


### Bug Fixes

* **#793:** 修复空值 ([302c98f](https://github.com/volantis-x/hexo-theme-volantis/commit/302c98fc5b0c725fb77c6bb33d7537f8f1f2062f))

## [5.7.3](https://github.com/volantis-x/hexo-theme-volantis/compare/v5.7.2...v5.7.3) (2022-08-15)


### Bug Fixes

* **#781:** content_visibility: false ([0c719be](https://github.com/volantis-x/hexo-theme-volantis/commit/0c719be17e8affb28dd42c9c8bfb52e3e21d9790))
* **#793:** cdn_version: false ([cf60678](https://github.com/volantis-x/hexo-theme-volantis/commit/cf6067860312fbd6afd4ba6c14867d9ef86832fd))
* **#793:** 移除默认配置 ([4d82dff](https://github.com/volantis-x/hexo-theme-volantis/commit/4d82dff4d41c513cfa0124cbed7e42b60236d9de))
* **#798:** footer version link 404 ([a2a2d90](https://github.com/volantis-x/hexo-theme-volantis/commit/a2a2d90dc96fd00bb14cd742e0f05d253ef4ebed))

## [5.7.2](https://github.com/volantis-x/hexo-theme-volantis/compare/v5.7.1...v5.7.2) (2022-08-01)


### Bug Fixes

* fix Chinese urlencode displaying problem in permalink ([#794](https://github.com/volantis-x/hexo-theme-volantis/issues/794)) ([677b820](https://github.com/volantis-x/hexo-theme-volantis/commit/677b8207f7e0863470ffcb8fd9f287ca7ec1e9cf))
* 加引号处理herf属性中空格导致的地址错误 ([#796](https://github.com/volantis-x/hexo-theme-volantis/issues/796)) ([2bb4043](https://github.com/volantis-x/hexo-theme-volantis/commit/2bb4043bbf58eb6080e3e5743817ad4420409937))

## [5.7.1](https://github.com/volantis-x/hexo-theme-volantis/compare/v5.7.0...v5.7.1) (2022-07-26)


### Bug Fixes

* drop node 14 ([694046b](https://github.com/volantis-x/hexo-theme-volantis/commit/694046b934be663001226fedd4fb6b2535ec9d59))

## [5.7.0](https://github.com/volantis-x/hexo-theme-volantis/compare/v5.6.0...v5.7.0) (2022-07-15)


Expand Down
14 changes: 9 additions & 5 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,21 @@ cdn:
# 以下配置可以覆盖 cdn.prefix,配置项的值可以为空,但是要使用CDN必须依据路径填写配置项的键
set:
js:
app: /js/app.js
#app: /js/app.js
css:
style: /css/style.css # (异步加载样式)
#style: /css/style.css # (异步加载样式)
# 静态资源版本控制
# 本地文件使用文件内容的hash值作为版本号(app.8c1e7c88.js) 其他为时间戳 (?time=1648684470140)
# 建议静态资源设置标头 浏览器缓存一年边缘缓存一个月 cache-control: max-age=86400, s-maxage=31536000 如果有更新记得刷新缓存
cdn_version: true
cdn_version: false
# volantis static 静态资源文件 npm 包 CDN 地址 (后面加 "/" )
# https://github.com/volantis-x/volantis-static
volantis_static_cdn: https://unpkg.com/[email protected]/
########################################################################
# https://web.dev/content-visibility/
# https://www.caniuse.com/?search=content-visibility
content_visibility: false

# 全局页面字符串替换 A => B (可用于临时修改错字等)
replace:
- https://cdn.jsdelivr.net/npm/ => https://unpkg.com/
Expand Down Expand Up @@ -545,7 +549,7 @@ comments:
# Discuss
# https://discuss.js.org
discuss:
js: https://cdn.jsdelivr.net/npm/discuss/dist/Discuss.js # 建议锁定版本
js: https://cdn.jsdelivr.net/npm/discuss/dist/discuss.js # 建议锁定版本
serverURLs: # Discuss server address url
# https://discuss.js.org/Quick-Start.html#path

Expand Down Expand Up @@ -803,7 +807,7 @@ plugins:

# https://scrollrevealjs.org/api/reveal.html
scrollreveal:
enable: true
enable: #true
js: volantis-static/libs/scrollreveal/dist/scrollreveal.min.js # https://unpkg.com/[email protected]/dist/scrollreveal.min.js
distance: 32px
duration: 800 # ms
Expand Down
6 changes: 3 additions & 3 deletions layout/_partial/article.ejs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<article itemscope itemtype="http://schema.org/Article" class="article post white-box reveal md <%- theme.custom_css.body.effect.join(' ') %> article-type-<%= post.layout %>" id="<%= post.layout %>" itemscope itemprop="blogPost">
<link itemprop="mainEntityOfPage" href="<%- post.permalink %>">
<link itemprop="mainEntityOfPage" href="<%- decodeURI(post.permalink) %>">
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="<%- config.title %>">
</span>
Expand Down Expand Up @@ -69,7 +69,7 @@
%>
<div class="copyright license">
<div class="license-title"><%- post.title %></div>
<div class="license-link"><a href="<%- page.permalink %>"><%- page.permalink %></a>
<div class="license-link"><a href="<%- decodeURI(page.permalink) %>"><%- decodeURI(page.permalink) %></a>
</div>
<div class="license-meta">
<div class="license-meta-item">
Expand Down Expand Up @@ -106,7 +106,7 @@
<blockquote>
<% (footer_widget.copyright.content||[]).forEach(function(row){ %>
<% if (row == 'permalink') { %>
<p><%- footer_widget.copyright.permalink %><a href=<%- page.permalink %>><%- page.permalink %></a></p>
<p><%- footer_widget.copyright.permalink %><a href="<%- decodeURI(page.permalink) %>"><%- decodeURI(page.permalink) %></a></p>
<% } else { %>
<%- markdown(row) %>
<% } %>
Expand Down
16 changes: 10 additions & 6 deletions layout/_partial/footer.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
layout = config.theme_config.footer.layout;
}
let theme_version = theme.info.theme_version
// 未发布的 alpha 版本
if (theme_version.indexOf("alpha")!=-1) {
theme_version = "dev"
}
// // 未发布的 alpha 版本
// if (theme_version.indexOf("alpha")!=-1) {
// theme_version = "dev"
// }
// // 从 5.7.2 以后的版本以 v开头(release-please的奇怪设定)
// else if (theme_version.indexOf("beta")==-1||theme_version.indexOf("rc")==-1) {
// theme_version = "v" + theme_version
// }
%>
<footer class="footer clearfix" itemscope itemtype="http://schema.org/WPFooter">
<br><br>
Expand Down Expand Up @@ -39,13 +43,13 @@
<div><%- markdown(__('footer.license')) %></div>
<% } else if (item == 'info') { %>
<%- __('footer.use') %>
<a href="https://github.com/volantis-x/hexo-theme-volantis/tree/<%- theme_version %>" target="_blank" class="codename">Volantis</a>
<a href="https://github.com/volantis-x/hexo-theme-volantis/#<%- theme_version %>" target="_blank" class="codename">Volantis</a>
<%- __('footer.theme') %><% if (theme.analytics.busuanzi) { %><%- __('symbol.comma') %><%- __('footer.total_views') %>
<span id="busuanzi_value_site_pv"><i class="fa-solid fa-loader fa-spin fa-fw" aria-hidden="true"></i></span>
<%- __('footer.times') %>
<% } %>
<% } else if (item == 'source') { %>
<%- markdown(__('footer.site_source', '[Volantis](https://github.com/volantis-x/hexo-theme-volantis/tree/'+theme_version+')', 'GitHub', 'https://github.com/volantis-x/volantis-docs')) %>
<%- markdown(__('footer.site_source', '[Volantis](https://github.com/volantis-x/hexo-theme-volantis/#'+theme_version+')', 'GitHub', 'https://github.com/volantis-x/volantis-docs')) %>
<% } else if (item == 'copyright') { %>
<div class='copyright'>
<%- markdown(theme.site_footer.copyright) %>
Expand Down
2 changes: 1 addition & 1 deletion layout/_partial/head.ejs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<head hexo-theme='https://github.com/volantis-x/hexo-theme-volantis/tree/<%- theme.info.theme_version %>'>
<head hexo-theme='https://github.com/volantis-x/hexo-theme-volantis/#<%- theme.info.theme_version %>'>
<%- meta_generator() %>
<meta name="Volantis" content="<%- theme.info.theme_version %>">
<meta charset="utf-8">
Expand Down
2 changes: 1 addition & 1 deletion layout/_partial/post.ejs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="post post-v3 white-box reveal <%- theme.custom_css.body.effect.join(' ') %>" itemscope itemtype="http://schema.org/Article" >
<link itemprop="mainEntityOfPage" href="<%- post.permalink %>">
<link itemprop="mainEntityOfPage" href="<%- decodeURI(post.permalink) %>">
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="<%- config.title %>">
</span>
Expand Down
3 changes: 2 additions & 1 deletion layout/_partial/scripts/_ctrl/cdnCtrl.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
const element = n[key];
if(element && typeof element !="string"){
dfs(element,path.concat(key))
}else{
}else if(element){
let op=path.concat(key)
let source=""
for (let index = 1; index < op.length; index++) {
Expand Down Expand Up @@ -122,5 +122,6 @@
// ?time=' + Date.now() 替换为 theme.getStartTime 保证相同资源 hash 不变
// 更新:
// 本地文件使用文件内容的hash值作为版本号 app.8c1e7c88.js see: /scripts/helpers/revisioned.js
dfs(theme.cdn.set,[])
_%>
4 changes: 3 additions & 1 deletion layout/_partial/scripts/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@

<%- partial('toc') %>

<%- partial('content-visibility-scroll-fix') %>
<% if (theme.content_visibility) { %>
<%- partial('content-visibility-scroll-fix') %>
<% } %>

<%- partial('../../_plugins/slow-network/script') %>

Expand Down
4 changes: 2 additions & 2 deletions layout/_plugins/comments/discuss/script.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
path = defaultPath || decodeURI(window.location.pathname);
}
Discuss.init(Object.assign(Object.assign(<%- JSON.stringify(theme.comments.discuss) %>, {
discuss.init(Object.assign(Object.assign(<%- JSON.stringify(theme.comments.discuss) %>, {
el: '#discuss_container',
path: path,
ph: placeholder
}),pdata.commentConfig))
}
load_discuss();
volantis.pjax.push(()=>{
if (typeof Discuss == "undefined") {
if (typeof discuss == "undefined") {
load_discuss();
} else {
pjax_discuss();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hexo-theme-volantis",
"version": "5.7.0",
"version": "5.7.4",
"description": "Elegant and powerful theme for Hexo.",
"main": "package.json",
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions scripts/events/lib/check-environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ module.exports =(hexo) => {
CheckError(hexo,`node.js: ${err}`);
}
let nodeVersion = stdout.match(/v(\d*)/)[1];
if (nodeVersion<14) {
if (nodeVersion<16) {
hexo.log.info(`node.js 版本:${stdout}`);
CheckError(hexo,`node.js 版本过低,请升级至 v14.x 以上版本!`);
CheckError(hexo,`node.js 版本过低,请升级至 v16.x 及以上版本!`);
}else{
exec('hexo -v', (err, stdout, stderr) => {
if (err) {
Expand Down Expand Up @@ -69,4 +69,4 @@ function CheckConfError(hexo,msg) {
${msg}
============================================================`);
throw new Error('配置文件检查失败!| Configuration check failed!');
}
}
38 changes: 20 additions & 18 deletions scripts/filters/content-visibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@
// https://www.caniuse.com/?search=content-visibility
// 在文章内容渲染时将每两个 <h2> 之间的内容分为一块 用 <div class="post-story"></div> 包裹起来。然后为 .post-story 声明 content-visibility: auto
hexo.extend.filter.register('after_post_render', function (data) {
let dataList = data.content.split('\n')
let mydata = ``
let flag = 1
dataList.forEach(e => {
let yy = e.replace(/<h2.*?>.*?<\/h2>/, function (str) {
if (flag) {
flag = 0
return `<div class="story post-story">` + str
} else {
return `</div><div class="story post-story">` + str
}
})
mydata += yy
mydata += "\n"
});
if (!flag) {
mydata += `</div>`
if (this.theme.config.content_visibility) {
let dataList = data.content.split('\n')
let mydata = ``
let flag = 1
dataList.forEach(e => {
let yy = e.replace(/<h2.*?>.*?<\/h2>/, function (str) {
if (flag) {
flag = 0
return `<div class="story post-story">` + str
} else {
return `</div><div class="story post-story">` + str
}
})
mydata += yy
mydata += "\n"
});
if (!flag) {
mydata += `</div>`
}
data.content = mydata
}
data.content = mydata
return data;
});
4 changes: 2 additions & 2 deletions scripts/helpers/revisioned.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const getRevisionedFilePath = (filePath, revision) => {

const revisioned = (filePath) => {
if (!hexo.theme.config.cdn_version) {
return;
return filePath;
}
let arg = process.argv[2];
if (arg == "s" || arg == "server") {
Expand Down Expand Up @@ -160,7 +160,7 @@ const replaceRevisionPlaceholder = async () => {
})
);
} catch (error) {

hexo.log.error("cdn_version ERROR: " + error);
}
};

Expand Down
4 changes: 0 additions & 4 deletions source/css/_style/_plugins/_dark/dark_plugins.styl
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ if hexo-config('comments.service')=='twikoo'
.OwO-items-image
.OwO-item:hover
background-color: #252627 !important

if hexo-config('comments.service')=='discuss'
#Discuss .D-emot
background: #333841

// Custom Files
for $injects_dark in hexo-config('injects.dark')
Expand Down
24 changes: 13 additions & 11 deletions source/css/first.styl
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
#safearea {
display: none
}
// https://web.dev/content-visibility/
// https://www.caniuse.com/?search=content-visibility
/*
* Workaround for Chrome bug, part 1
* Chunk rendering for all but the first article.
* /layout/_partial/scripts/content-visibility-scroll-fix.ejs
*/
.post-story + .post-story{
content-visibility: auto;
contain-intrinsic-size: 10px 500px;
}

if hexo-config('content_visibility')
// https://web.dev/content-visibility/
// https://www.caniuse.com/?search=content-visibility
/*
* Workaround for Chrome bug, part 1
* Chunk rendering for all but the first article.
* /layout/_partial/scripts/content-visibility-scroll-fix.ejs
*/
.post-story + .post-story{
content-visibility: auto;
contain-intrinsic-size: 10px 500px;
}

@import '_defines/*'

Expand Down

0 comments on commit 63ca5c0

Please sign in to comment.