Skip to content

Commit

Permalink
bump to version 20240104
Browse files Browse the repository at this point in the history
  • Loading branch information
baiyuanneko committed Jan 4, 2024
1 parent 876152e commit 6a88563
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 15 deletions.
2 changes: 1 addition & 1 deletion App/App.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"VersionNumber": 20231016,
"VersionNumber": 20240104,
"AppName": "Baiyuanneko's Blog Generator",
"officialWebsite": "https://bbg.nekomoe.xyz",
"contributors": [
Expand Down
17 changes: 17 additions & 0 deletions App/migrate_core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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地址
Expand Down Expand Up @@ -266,6 +279,10 @@ module.exports = function () {
addSupportForAdjustingLinkColor();
}

if (currentBlogVersion <= 20240103) {
addSupportForWalineAndDisqus();
}

check_third_party_theme_compatiblity();
updateBlogIndexHtml();

Expand Down
6 changes: 3 additions & 3 deletions App/render_article_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ module.exports = function () {
<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>
<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>
<button class="btn btn-outline-danger" onclick="delete_article(${i})"><i class="fa fa-trash-o"></i> ${langdata.DELETE_ARTICLE[lang_name]}</button>
<span class="encryption_related_func"></span>
<span id="encryption_related_func_${i}"></span>
<br /><br />
<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>
<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>
`);
if (blog["文章列表"][i]["是否加密"]){
document.querySelector(`#article-item-${i} > span.encryption_related_func`).insertAdjacentHTML("beforeend",`
document.querySelector(`#encryption_related_func_${i}`).insertAdjacentHTML("beforeend",`
<button class="btn btn-outline-warning" onclick="ui_decrypt_article(${i})"><i class="fa fa-unlock"></i> ${langdata.DECRYPT_ARTICLE[lang_name]}</button>
`);
} else {
document.querySelector(`#article-item-${i} > span.encryption_related_func`).insertAdjacentHTML("beforeend",`
document.querySelector(`#encryption_related_func_${i}`).insertAdjacentHTML("beforeend",`
<button class="btn btn-outline-success" onclick="ui_encrypt_article(${i})"><i class="fa fa-lock"></i> ${langdata.ENCRYPT_ARTICLE[lang_name]}</button>
`);
}
Expand Down
8 changes: 5 additions & 3 deletions App/render_blog_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 6 additions & 4 deletions App/render_markdown_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -30,6 +31,8 @@ module.exports = function () {
keyboard: false,
});
encryptionOptionsModal.show();
encrypted_orginal_content_if_encrypted = original_content;
original_content = "";
document.getElementById("encryptionOptionsModalBody").innerHTML = `<div class="mb-3">
<label class="form-label"><i class="fa fa-password"></i> ${langdata.INPUT_A_PASSWORD[lang_name]}</label>
<input class="form-control" placeholder="${langdata.INPUT_A_PASSWORD[lang_name]}" value="" id="article_password_modal_value">
Expand All @@ -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();
Expand Down Expand Up @@ -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";
}

Expand All @@ -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 = "";
}

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

document.getElementById("btn_save_changes").onclick=markdown_editor_save_changes;

/*

Check failure on line 396 in App/render_markdown_editor.js

View workflow job for this annotation

GitHub Actions / run-eslint

Expected indentation of 2 spaces but found 0
document.getElementById("btn_change_to_default_editor").onclick=function(){
function to_default() {
writeFileSync(`${rootDir}/${path}`, document.getElementById("editor_textarea").value);
Expand Down Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions App/ui/markdown_editor_title_ui.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ <h5 id="markdown_filename">
<button id="btn_help" class="btn btn-sm btn-outline-primary">
<i class="fa fa-info-circle"></i> ${langdata["MARKDOWN_EDITOR_USAGE"][lang_name]}
</button>
<button id="btn_change_to_default_editor" class="btn btn-sm btn-outline-primary">
<i class="fa fa-external-link"></i> <span id="editor_switch">${langdata["SWITCH_TO_SYSTEM_DEFAULT_EDITOR"][lang_name]}</span>
</button>
<span id="ai_related_functions_in_editor" style="display: none;">
<button id="btn_ai_text_completion" class="btn btn-sm btn-outline-primary">
<i class="fa fa-pencil"></i> ${langdata["AI_TEXT_COMPLETION"][lang_name]}
Expand Down
5 changes: 5 additions & 0 deletions docs/zh-cn/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# 更新日志

## 20240104

- 支持 Disqus 和 Waline
- 支持给文章设置密码

## 20231016

- 优化默认主题的显示效果
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": "bbg",
"version": "20231016.0.0",
"version": "20240104.0.0",
"packageManager": "[email protected]",
"description": "A static blog generator based on Electron Technology.",
"license": "UNLICENSED",
Expand Down

0 comments on commit 6a88563

Please sign in to comment.