Skip to content

Commit 6a88563

Browse files
committed
bump to version 20240104
1 parent 876152e commit 6a88563

8 files changed

Lines changed: 38 additions & 15 deletions

App/App.json

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

App/migrate_core.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,19 @@ function addSupportForOptionsOfMarkdownRendering() {
140140
blog["Markdown渲染配置"]["根据用户屏幕尺寸渲染图片尺寸"] = true;
141141
}
142142

143+
function addSupportForWalineAndDisqus() {
144+
if (blog["全局评论设置"]["启用waline评论"] === undefined || blog["全局评论设置"]["启用waline评论"] === null) {
145+
blog["全局评论设置"]["启用waline评论"] = false;
146+
blog["全局评论设置"]["waline设置"] = new Object();
147+
blog["全局评论设置"]["waline设置"]["serverurl"] = "";
148+
}
149+
if (blog["全局评论设置"]["启用disqus评论"] === undefined || blog["全局评论设置"]["启用disqus评论"] === null) {
150+
blog["全局评论设置"]["启用disqus评论"] = false;
151+
blog["全局评论设置"]["disqus设置"] = new Object();
152+
blog["全局评论设置"]["disqus设置"]["shortname"] = "";
153+
}
154+
}
155+
143156
function improveBackgroundImageSettings() {
144157
if(blog["全局主题设置"]["是否使用背景图像"] && blog["全局主题设置"]["若使用背景图像,设置为"]["使用随机二次元图片作为背景图像(浅色背景)"]) {
145158
// 如果之前版本中启用了“将网站背景设置为随机二次元图片”则将背景图片配置转换为“将某个url作为背景图像”,url自动填入之前所使用的默认二次元图片api地址
@@ -266,6 +279,10 @@ module.exports = function () {
266279
addSupportForAdjustingLinkColor();
267280
}
268281

282+
if (currentBlogVersion <= 20240103) {
283+
addSupportForWalineAndDisqus();
284+
}
285+
269286
check_third_party_theme_compatiblity();
270287
updateBlogIndexHtml();
271288

App/render_article_manager.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,17 @@ module.exports = function () {
6666
<button class="btn btn-outline-primary" onclick="edit_article('${blog["文章列表"][i]["文件名"]}', ${i})"><i class="fa fa-edit"></i> ${langdata.EDIT_AND_PREVIEW_ARTICLE_CONTENT[lang_name]}</button>
6767
<button class="btn btn-outline-primary" onclick="edit_article_meta(${i})"><i class="fa fa-info-circle"></i> ${langdata.EDIT_ARTICLE_META[lang_name]}</button>
6868
<button class="btn btn-outline-danger" onclick="delete_article(${i})"><i class="fa fa-trash-o"></i> ${langdata.DELETE_ARTICLE[lang_name]}</button>
69-
<span class="encryption_related_func"></span>
69+
<span id="encryption_related_func_${i}"></span>
7070
<br /><br />
7171
<button class="btn btn-outline-primary" onclick="let_article_up(${i})"><i class="fa fa-arrow-up"></i> ${langdata.LET_ARTICLE_GO_UP[lang_name]}</button>
7272
<button class="btn btn-outline-primary" onclick="let_article_down(${i})"><i class="fa fa-arrow-down"></i> ${langdata.LET_ARTICLE_GO_DOWN[lang_name]}</button>
7373
`);
7474
if (blog["文章列表"][i]["是否加密"]){
75-
document.querySelector(`#article-item-${i} > span.encryption_related_func`).insertAdjacentHTML("beforeend",`
75+
document.querySelector(`#encryption_related_func_${i}`).insertAdjacentHTML("beforeend",`
7676
<button class="btn btn-outline-warning" onclick="ui_decrypt_article(${i})"><i class="fa fa-unlock"></i> ${langdata.DECRYPT_ARTICLE[lang_name]}</button>
7777
`);
7878
} else {
79-
document.querySelector(`#article-item-${i} > span.encryption_related_func`).insertAdjacentHTML("beforeend",`
79+
document.querySelector(`#encryption_related_func_${i}`).insertAdjacentHTML("beforeend",`
8080
<button class="btn btn-outline-success" onclick="ui_encrypt_article(${i})"><i class="fa fa-lock"></i> ${langdata.ENCRYPT_ARTICLE[lang_name]}</button>
8181
`);
8282
}

App/render_blog_settings.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ function render_comment_related(trigger_by_change = false){
3333
}
3434

3535
if(current_selection === "valine"){
36+
if(trigger_by_change){
37+
document.getElementById("blog_settings_valine_appid").value = "";
38+
document.getElementById("blog_settings_valine_appkey").value = "";
39+
save_blog_settings();
40+
}
3641
show_specified_detail("valine");
37-
document.getElementById("blog_settings_valine_appid").value = "";
38-
document.getElementById("blog_settings_valine_appkey").value = "";
39-
save_blog_settings();
4042
} else if(current_selection === "valine_with_public_apikey"){
4143
let whether_confirm_to_use_valine_with_public_apikey;
4244
if (trigger_by_change) {

App/render_markdown_editor.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module.exports = function () {
1616
var ai_task_list = new Object();
1717
var is_cnt_article_encrypted = false;
1818
var password_if_enabled_encryption_for_article = "";
19+
let encrypted_orginal_content_if_encrypted;
1920

2021
if (path.indexOf("/data/articles/") !== -1) {
2122
// article
@@ -30,6 +31,8 @@ module.exports = function () {
3031
keyboard: false,
3132
});
3233
encryptionOptionsModal.show();
34+
encrypted_orginal_content_if_encrypted = original_content;
35+
original_content = "";
3336
document.getElementById("encryptionOptionsModalBody").innerHTML = `<div class="mb-3">
3437
<label class="form-label"><i class="fa fa-password"></i> ${langdata.INPUT_A_PASSWORD[lang_name]}</label>
3538
<input class="form-control" placeholder="${langdata.INPUT_A_PASSWORD[lang_name]}" value="" id="article_password_modal_value">
@@ -41,6 +44,7 @@ module.exports = function () {
4144

4245
document.getElementById("encryptionOptionsModalStartEditingBtn").addEventListener("click", () => {
4346
password_if_enabled_encryption_for_article = document.getElementById("article_password_modal_value").value;
47+
original_content = encrypted_orginal_content_if_encrypted;
4448
original_content = decrypt_content(original_content, password_if_enabled_encryption_for_article);
4549
document.getElementById("editor_textarea").value = original_content;
4650
encryptionOptionsModal.hide();
@@ -123,7 +127,6 @@ ${langdata["CURRENTLY_EDITING"][lang_name]}“${title}”`+document.getElementBy
123127
document.getElementById("third-wrapper").style.display = "";
124128
document.getElementById("ai_related_functions_in_editor").style.display = "none";
125129
document.getElementById("btn_help").style.display = "none";
126-
document.getElementById("btn_change_to_default_editor").style.display = "none";
127130
document.getElementById("btn_save_changes").style.display = "none";
128131
}
129132

@@ -133,7 +136,6 @@ ${langdata["CURRENTLY_EDITING"][lang_name]}“${title}”`+document.getElementBy
133136
document.getElementById("third-wrapper").style.display = "none";
134137
document.getElementById("ai_related_functions_in_editor").style.display = "";
135138
document.getElementById("btn_help").style.display = "";
136-
document.getElementById("btn_change_to_default_editor").style.display = "";
137139
document.getElementById("btn_save_changes").style.display = "";
138140
}
139141

@@ -391,7 +393,7 @@ ${langdata["CURRENTLY_EDITING"][lang_name]}“${title}”`+document.getElementBy
391393
};
392394

393395
document.getElementById("btn_save_changes").onclick=markdown_editor_save_changes;
394-
396+
/*
395397
document.getElementById("btn_change_to_default_editor").onclick=function(){
396398
function to_default() {
397399
writeFileSync(`${rootDir}/${path}`, document.getElementById("editor_textarea").value);
@@ -431,7 +433,7 @@ ${langdata["CURRENTLY_EDITING"][lang_name]}“${title}”`+document.getElementBy
431433
}
432434
default_editor = !default_editor;
433435
};
434-
436+
*/
435437
document.onkeydown = function(event){
436438
let toReturn = true;
437439
if(event.ctrlKey || event.metaKey){ // detect ctrl or cmd

App/ui/markdown_editor_title_ui.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ <h5 id="markdown_filename">
1515
<button id="btn_help" class="btn btn-sm btn-outline-primary">
1616
<i class="fa fa-info-circle"></i> ${langdata["MARKDOWN_EDITOR_USAGE"][lang_name]}
1717
</button>
18-
<button id="btn_change_to_default_editor" class="btn btn-sm btn-outline-primary">
19-
<i class="fa fa-external-link"></i> <span id="editor_switch">${langdata["SWITCH_TO_SYSTEM_DEFAULT_EDITOR"][lang_name]}</span>
20-
</button>
2118
<span id="ai_related_functions_in_editor" style="display: none;">
2219
<button id="btn_ai_text_completion" class="btn btn-sm btn-outline-primary">
2320
<i class="fa fa-pencil"></i> ${langdata["AI_TEXT_COMPLETION"][lang_name]}

docs/zh-cn/CHANGELOG.md

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

3+
## 20240104
4+
5+
- 支持 Disqus 和 Waline
6+
- 支持给文章设置密码
7+
38
## 20231016
49

510
- 优化默认主题的显示效果

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": "20231016.0.0",
3+
"version": "20240104.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)