From 6a885630bbd4dcf9ba129528c4667bc1fcf3e227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=8F=E5=9B=AD=E7=8C=AB?= Date: Thu, 4 Jan 2024 16:42:01 +0800 Subject: [PATCH] bump to version 20240104 --- App/App.json | 2 +- App/migrate_core.js | 17 +++++++++++++++++ App/render_article_manager.js | 6 +++--- App/render_blog_settings.js | 8 +++++--- App/render_markdown_editor.js | 10 ++++++---- App/ui/markdown_editor_title_ui.html | 3 --- docs/zh-cn/CHANGELOG.md | 5 +++++ package.json | 2 +- 8 files changed, 38 insertions(+), 15 deletions(-) diff --git a/App/App.json b/App/App.json index 8a127eb..606eb9c 100644 --- a/App/App.json +++ b/App/App.json @@ -1,5 +1,5 @@ { - "VersionNumber": 20231016, + "VersionNumber": 20240104, "AppName": "Baiyuanneko's Blog Generator", "officialWebsite": "https://bbg.nekomoe.xyz", "contributors": [ diff --git a/App/migrate_core.js b/App/migrate_core.js index d5df1d5..5b36211 100644 --- a/App/migrate_core.js +++ b/App/migrate_core.js @@ -140,6 +140,19 @@ function addSupportForOptionsOfMarkdownRendering() { blog["Markdown渲染配置"]["根据用户屏幕尺寸渲染图片尺寸"] = true; } +function addSupportForWalineAndDisqus() { + if (blog["全局评论设置"]["启用waline评论"] === undefined || blog["全局评论设置"]["启用waline评论"] === null) { + blog["全局评论设置"]["启用waline评论"] = false; + blog["全局评论设置"]["waline设置"] = new Object(); + blog["全局评论设置"]["waline设置"]["serverurl"] = ""; + } + if (blog["全局评论设置"]["启用disqus评论"] === undefined || blog["全局评论设置"]["启用disqus评论"] === null) { + blog["全局评论设置"]["启用disqus评论"] = false; + blog["全局评论设置"]["disqus设置"] = new Object(); + blog["全局评论设置"]["disqus设置"]["shortname"] = ""; + } +} + function improveBackgroundImageSettings() { if(blog["全局主题设置"]["是否使用背景图像"] && blog["全局主题设置"]["若使用背景图像,设置为"]["使用随机二次元图片作为背景图像(浅色背景)"]) { // 如果之前版本中启用了“将网站背景设置为随机二次元图片”则将背景图片配置转换为“将某个url作为背景图像”,url自动填入之前所使用的默认二次元图片api地址 @@ -266,6 +279,10 @@ module.exports = function () { addSupportForAdjustingLinkColor(); } + if (currentBlogVersion <= 20240103) { + addSupportForWalineAndDisqus(); + } + check_third_party_theme_compatiblity(); updateBlogIndexHtml(); diff --git a/App/render_article_manager.js b/App/render_article_manager.js index 85fd68b..f3c5ea7 100644 --- a/App/render_article_manager.js +++ b/App/render_article_manager.js @@ -66,17 +66,17 @@ module.exports = function () { - +

`); if (blog["文章列表"][i]["是否加密"]){ - document.querySelector(`#article-item-${i} > span.encryption_related_func`).insertAdjacentHTML("beforeend",` + document.querySelector(`#encryption_related_func_${i}`).insertAdjacentHTML("beforeend",` `); } else { - document.querySelector(`#article-item-${i} > span.encryption_related_func`).insertAdjacentHTML("beforeend",` + document.querySelector(`#encryption_related_func_${i}`).insertAdjacentHTML("beforeend",` `); } diff --git a/App/render_blog_settings.js b/App/render_blog_settings.js index fe4a83e..96a4d20 100644 --- a/App/render_blog_settings.js +++ b/App/render_blog_settings.js @@ -33,10 +33,12 @@ function render_comment_related(trigger_by_change = false){ } if(current_selection === "valine"){ + if(trigger_by_change){ + document.getElementById("blog_settings_valine_appid").value = ""; + document.getElementById("blog_settings_valine_appkey").value = ""; + save_blog_settings(); + } show_specified_detail("valine"); - document.getElementById("blog_settings_valine_appid").value = ""; - document.getElementById("blog_settings_valine_appkey").value = ""; - save_blog_settings(); } else if(current_selection === "valine_with_public_apikey"){ let whether_confirm_to_use_valine_with_public_apikey; if (trigger_by_change) { diff --git a/App/render_markdown_editor.js b/App/render_markdown_editor.js index 6d0e0f0..8dcb3f4 100644 --- a/App/render_markdown_editor.js +++ b/App/render_markdown_editor.js @@ -16,6 +16,7 @@ module.exports = function () { var ai_task_list = new Object(); var is_cnt_article_encrypted = false; var password_if_enabled_encryption_for_article = ""; + let encrypted_orginal_content_if_encrypted; if (path.indexOf("/data/articles/") !== -1) { // article @@ -30,6 +31,8 @@ module.exports = function () { keyboard: false, }); encryptionOptionsModal.show(); + encrypted_orginal_content_if_encrypted = original_content; + original_content = ""; document.getElementById("encryptionOptionsModalBody").innerHTML = `
@@ -41,6 +44,7 @@ module.exports = function () { document.getElementById("encryptionOptionsModalStartEditingBtn").addEventListener("click", () => { password_if_enabled_encryption_for_article = document.getElementById("article_password_modal_value").value; + original_content = encrypted_orginal_content_if_encrypted; original_content = decrypt_content(original_content, password_if_enabled_encryption_for_article); document.getElementById("editor_textarea").value = original_content; encryptionOptionsModal.hide(); @@ -123,7 +127,6 @@ ${langdata["CURRENTLY_EDITING"][lang_name]}“${title}”`+document.getElementBy document.getElementById("third-wrapper").style.display = ""; document.getElementById("ai_related_functions_in_editor").style.display = "none"; document.getElementById("btn_help").style.display = "none"; - document.getElementById("btn_change_to_default_editor").style.display = "none"; document.getElementById("btn_save_changes").style.display = "none"; } @@ -133,7 +136,6 @@ ${langdata["CURRENTLY_EDITING"][lang_name]}“${title}”`+document.getElementBy document.getElementById("third-wrapper").style.display = "none"; document.getElementById("ai_related_functions_in_editor").style.display = ""; document.getElementById("btn_help").style.display = ""; - document.getElementById("btn_change_to_default_editor").style.display = ""; document.getElementById("btn_save_changes").style.display = ""; } @@ -391,7 +393,7 @@ ${langdata["CURRENTLY_EDITING"][lang_name]}“${title}”`+document.getElementBy }; document.getElementById("btn_save_changes").onclick=markdown_editor_save_changes; - +/* document.getElementById("btn_change_to_default_editor").onclick=function(){ function to_default() { writeFileSync(`${rootDir}/${path}`, document.getElementById("editor_textarea").value); @@ -431,7 +433,7 @@ ${langdata["CURRENTLY_EDITING"][lang_name]}“${title}”`+document.getElementBy } default_editor = !default_editor; }; - +*/ document.onkeydown = function(event){ let toReturn = true; if(event.ctrlKey || event.metaKey){ // detect ctrl or cmd diff --git a/App/ui/markdown_editor_title_ui.html b/App/ui/markdown_editor_title_ui.html index 2585977..42586c5 100644 --- a/App/ui/markdown_editor_title_ui.html +++ b/App/ui/markdown_editor_title_ui.html @@ -15,9 +15,6 @@
-