Skip to content

Commit 73e2d82

Browse files
committed
bump to version 20240519
1 parent 06b42e5 commit 73e2d82

5 files changed

Lines changed: 60 additions & 3 deletions

File tree

App/App.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"VersionNumber": 20240104,
2+
"VersionNumber": 20240519,
33
"AppName": "Baiyuanneko's Blog Generator",
44
"officialWebsite": "https://bbg.nekomoe.xyz",
55
"contributors": [

App/check_migrate.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,14 @@ module.exports = function () {
3131
});
3232

3333
if (submitDialog === 0) {
34-
migrate();
34+
if(currentBlogVersion <= 20240518){
35+
if(window.confirm("请注意,本次更新会将博客数据文件文章元信息中的创建日期和修改日期均转换为时间戳形式,由于原先默认存储中的日期信息仅为日期信息而不包含时间信息,即无法获知具体在那一天的几时几分创建/修改的,因此本次转换的逻辑为先使用js的Date对象上的getTime方法将原日期转换为时间戳,然后加上28800000毫秒数的偏移(按照原先默认存储的日期格式的话,这样做会让时间变为原日期的当天上午8:00)。请注意在更新博客后重新调整相关时间(如果你觉得不满意的话)。如果你没有使用默认的日期存储格式,转换有可能失败或不准确,一旦某次转换出现失败,对于该次转换,原有创建日期字段不会被删除,新的时间戳将为0(即显示为1970-01-01 8:00),此种情况下你可以从博客数据文件(data/index.json)中找回你原先填写的内容。是否确认继续更新?一旦你点击继续,则表示你已完全了解此转换过程可能存在的风险。请牢记:本程序不含任何担保,BBG 开发人员不会对包括程序 Bug、逻辑错误在内的任何原因的数据丢失或损坏负责,如果你认为你的数据比较重要,建议你提前备份相关数据。 \n Attention! Please note that this update will convert the creation and modification dates in the blog data file's article metadata into timestamp format. Since the original date information stored by default only includes the date without the time (i.e., it is not possible to know the specific time of creation/modification on that day), the conversion logic is to use the getTime method of JavaScript's Date object to convert the original date to a timestamp, and then add an offset of 28,800,000 milliseconds (this will make the time 8:00 AM on the original date according to the default date format). Please adjust the relevant times after updating the blog if you find them unsatisfactory. If you have not used the default date storage format, the conversion may fail or be inaccurate. If a conversion fails, the original creation date field will not be deleted, and the new timestamp will be 0 (i.e., it will show as 1970-01-01 8:00 AM). In such cases, you can retrieve your original content from the blog data file (data/index.json). Do you confirm to proceed with the update? By clicking continue, you acknowledge that you fully understand the risks of this conversion process. Please remember: this program comes with no guarantees, and BBG developers are not responsible for any data loss or damage, including due to program bugs or logic errors. If you consider your data important, it is recommended that you back it up beforehand.")){
36+
migrate();
37+
}
38+
} else {
39+
migrate();
40+
}
41+
3542

3643
window.alert("博客数据更新成功。");
3744
} else {

App/migrate_core.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,41 @@ function addSupportForAdjustingLinkColor() {
191191
blog["全局主题设置"]["链接颜色"] = "#0d6efd";
192192
}
193193

194+
function addTimestampPropertyToEveryArticle() {
195+
for (let i = 0; i < blog["文章列表"].length; i++) {
196+
try {
197+
blog["文章列表"][i]["创建时间(时间戳)"] = new Date(blog["文章列表"][i]["创建日期"]).getTime() + 28800000;
198+
delete blog["文章列表"][i]["创建日期"];
199+
} catch (e) {
200+
blog["文章列表"][i]["创建时间(时间戳)"] = 0;
201+
}
202+
203+
try {
204+
blog["文章列表"][i]["修改时间(时间戳)"] = new Date(blog["文章列表"][i]["修改日期"]).getTime() + 28800000;
205+
delete blog["文章列表"][i]["修改日期"];
206+
} catch (e) {
207+
blog["文章列表"][i]["修改时间(时间戳)"] = 0;
208+
}
209+
}
210+
}
211+
212+
function addLive2DWidgetSupport() {
213+
blog["全局主题设置"]["是否启用live2d-widget"] = false;
214+
blog["全局主题设置"]["live2d-widget设置"] = {
215+
"widget路径": "https://fastly.jsdelivr.net/gh/stevenjoezhang/live2d-widget@latest/",
216+
"tips路径": "",
217+
"api路径": "",
218+
"功能设置": {
219+
"hitokoto": true,
220+
"asteroids": false,
221+
"switch-model": false,
222+
"switch-texture": false,
223+
"photo": false,
224+
"info": true,
225+
"quit": true
226+
}};
227+
}
228+
194229
module.exports = function () {
195230
const currentBlogVersion = parseInt(
196231
blog["博客程序版本(禁止修改此值,否则会导致跨版本升级异常)"],
@@ -283,6 +318,11 @@ module.exports = function () {
283318
addSupportForWalineAndDisqus();
284319
}
285320

321+
if (currentBlogVersion <= 20240518) {
322+
addTimestampPropertyToEveryArticle();
323+
addLive2DWidgetSupport();
324+
}
325+
286326
check_third_party_theme_compatiblity();
287327
updateBlogIndexHtml();
288328

docs/zh-cn/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# 更新日志
22

3+
## 20240519
4+
5+
- 归档和标签支持按年份检索
6+
- 修复了生成的rss可能不能被部分软件正确识别的错误
7+
- 支持博客访客为自己设置是否使用衬线字体以及暗色模式
8+
- 修复了代码没有高亮的问题
9+
- 支持为博客添加live2d看板娘
10+
- 修复了LaTex公式有时渲染异常的问题
11+
- 优化了ui以及其它体验
12+
313
## 20240104
414

515
- 支持 [Disqus](https://disqus.com/)[Waline](https://waline.js.org/)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bbg",
3-
"version": "20240104.0.0",
3+
"version": "20240519.0.0",
44
"packageManager": "yarn@1.22.19",
55
"description": "A static blog generator based on Electron Technology.",
66
"license": "UNLICENSED",

0 commit comments

Comments
 (0)