From cb16e5781ec9620ea179931888ef052aa99d757f Mon Sep 17 00:00:00 2001
From: Daniel <845765@qq.com>
Date: Thu, 31 Oct 2024 11:02:14 +0800
Subject: [PATCH 1/8] :art: Add logging
https://github.com/siyuan-note/siyuan/issues/12960
---
kernel/util/ocr.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/util/ocr.go b/kernel/util/ocr.go
index f7d2db15d..24be30bb2 100644
--- a/kernel/util/ocr.go
+++ b/kernel/util/ocr.go
@@ -228,7 +228,7 @@ func Tesseract(imgAbsPath string) (ret []map[string]interface{}) {
}
tsv := string(output)
- logging.LogInfof("tesseract [path=%s, size=%d] success", imgAbsPath, info.Size())
+ logging.LogInfof("tesseract [path=%s] success [%s]", imgAbsPath, tsv)
// 按行分割 TSV 数据
lines := strings.Split(tsv, "\r\n")
From 59bb202b13275c797af70262378aceda2ec25ff7 Mon Sep 17 00:00:00 2001
From: Daniel <845765@qq.com>
Date: Thu, 31 Oct 2024 11:08:25 +0800
Subject: [PATCH 2/8] :art: Add logging
https://github.com/siyuan-note/siyuan/issues/12960
---
kernel/util/ocr.go | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/util/ocr.go b/kernel/util/ocr.go
index 24be30bb2..ab045c136 100644
--- a/kernel/util/ocr.go
+++ b/kernel/util/ocr.go
@@ -231,7 +231,7 @@ func Tesseract(imgAbsPath string) (ret []map[string]interface{}) {
logging.LogInfof("tesseract [path=%s] success [%s]", imgAbsPath, tsv)
// 按行分割 TSV 数据
- lines := strings.Split(tsv, "\r\n")
+ lines := strings.Split(tsv, "\n")
// 解析 TSV 数据 跳过标题行,从第二行开始处理
for _, line := range lines[1:] {
@@ -262,7 +262,7 @@ func GetOcrJsonText(jsonData []map[string]interface{}) (ret string) {
if text, ok := dataMap["text"]; ok {
// 确保 text 是字符串类型
if textStr, ok := text.(string); ok {
- ret += " " + textStr
+ ret += " " + strings.ReplaceAll(textStr, "\r", "")
}
}
}
From 92504ab28099e4f5ba9f99c98c82205a3d5ac3e3 Mon Sep 17 00:00:00 2001
From: Daniel <845765@qq.com>
Date: Thu, 31 Oct 2024 11:52:41 +0800
Subject: [PATCH 3/8] :bug: OCR function cannot be used normally on Linux
https://github.com/siyuan-note/siyuan/issues/12960
---
kernel/util/ocr.go | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/util/ocr.go b/kernel/util/ocr.go
index ab045c136..8dadbf402 100644
--- a/kernel/util/ocr.go
+++ b/kernel/util/ocr.go
@@ -228,9 +228,10 @@ func Tesseract(imgAbsPath string) (ret []map[string]interface{}) {
}
tsv := string(output)
- logging.LogInfof("tesseract [path=%s] success [%s]", imgAbsPath, tsv)
+ //logging.LogInfof("tesseract [path=%s] success [%s]", imgAbsPath, tsv)
// 按行分割 TSV 数据
+ tsv = strings.ReplaceAll(tsv, "\r", "")
lines := strings.Split(tsv, "\n")
// 解析 TSV 数据 跳过标题行,从第二行开始处理
From fb38e16915fd9c875ea3b0a1330b6389257e7bc2 Mon Sep 17 00:00:00 2001
From: bestlaw66 <94432849+bestlaw66@users.noreply.github.com>
Date: Thu, 31 Oct 2024 17:30:12 +0800
Subject: [PATCH 4/8] :memo: Add BaoTa Panel Deployment Method (#12980)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* docs: add BaoTa Panel Deployment Method
在国内有大部分用户都在使用宝塔面板管理服务器,因此增加使用宝塔面板部署的教程,可视化的部署文档可以帮助用户更加便捷的部署思源笔记
* 📝Add BaoTa Panel Deployment Method
* Modify format
* Modify format
* Modify format
---
README_zh_CN.md | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/README_zh_CN.md b/README_zh_CN.md
index 7d712fb37..b7b891941 100644
--- a/README_zh_CN.md
+++ b/README_zh_CN.md
@@ -42,6 +42,7 @@
* [安装包](#安装包)
* [Docker 部署](#docker-部署)
* [Unraid 部署](#unraid-部署)
+ * [宝塔面板 部署](#宝塔面板部署)
* [内部预览版](#内部预览版)
* [🏘️ 社区](#️-社区)
* [🛠️ 开发指南](#️-开发指南)
@@ -300,6 +301,39 @@ Publish parameters: --accessAuthCode=******(访问授权码)
+### 宝塔面板部署
+
+
+宝塔面板 部署文档
+
+#### 前提
+
+* 仅适用于宝塔面板9.2.0及以上版本
+* 安装宝塔面板,前往[宝塔面板](https://www.bt.cn/new/download.html)官网,选择正式版的脚本下载安装
+
+#### 部署
+
+1. 登录宝塔面板,在左侧菜单栏中点击 `Docker`
+2. 首次会提示安装`Docker`和`Docker Compose`服务,点击立即安装,若已安装请忽略。
+3. 安装完成后在`Docker-应用商店-实用工具`中找到 `思源笔记`,点击`安装`,也可以在搜索框直接搜索。
+4. 设置域名等基本信息,点击`确定`
+* 说明:
+ * 名称:应用名称,默认`siyuan_随机字符`
+ * 版本选择:默认`latest`
+ * 域名:如您需要通过域名访问,请在此处填写您的域名
+ * 允许外部访问:如您需通过`IP+Port`直接访问,请勾选,如您已经设置了域名,请不要勾选此处
+ * 端口:默认`6806`,可自行修改
+ * 访问授权码:默认随机生成
+ * 内存限制:0为不限制,根据实际需要设置
+5. 提交后面板会自动进行应用初始化,大概需要`1-3`分钟,初始化完成后即可访问。
+
+#### 访问思源笔记
+
+* 如果您填写域名,请在浏览器输入您的域名访问,如`http://demo.siyuan`,即可访问 `思源笔记` 页面。
+* 如您选择`IP+端口访问`请在浏览器地址栏中输入域名访问 `http://<宝塔面板IP>:6806`,即可访问 `思源笔记` 页面。
+
+
+
### 内部预览版
我们会在有重大更新前发布内部预览版,请访问 [https://github.com/siyuan-note/insider](https://github.com/siyuan-note/insider)。
From 37fa0594034d12e48a96a63ae0c416bbbf8b4c88 Mon Sep 17 00:00:00 2001
From: Daniel <845765@qq.com>
Date: Thu, 31 Oct 2024 17:37:14 +0800
Subject: [PATCH 5/8] :art: Update README Add BaoTa Panel Deployment Method
https://github.com/siyuan-note/siyuan/pull/12980
---
README_zh_CN.md | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/README_zh_CN.md b/README_zh_CN.md
index b7b891941..c20fcdc74 100644
--- a/README_zh_CN.md
+++ b/README_zh_CN.md
@@ -314,23 +314,22 @@ Publish parameters: --accessAuthCode=******(访问授权码)
#### 部署
1. 登录宝塔面板,在左侧菜单栏中点击 `Docker`
-2. 首次会提示安装`Docker`和`Docker Compose`服务,点击立即安装,若已安装请忽略。
-3. 安装完成后在`Docker-应用商店-实用工具`中找到 `思源笔记`,点击`安装`,也可以在搜索框直接搜索。
-4. 设置域名等基本信息,点击`确定`
-* 说明:
- * 名称:应用名称,默认`siyuan_随机字符`
- * 版本选择:默认`latest`
- * 域名:如您需要通过域名访问,请在此处填写您的域名
- * 允许外部访问:如您需通过`IP+Port`直接访问,请勾选,如您已经设置了域名,请不要勾选此处
- * 端口:默认`6806`,可自行修改
- * 访问授权码:默认随机生成
- * 内存限制:0为不限制,根据实际需要设置
-5. 提交后面板会自动进行应用初始化,大概需要`1-3`分钟,初始化完成后即可访问。
+2. 首次会提示安装 `Docker` 和 `Docker Compose` 服务,点击立即安装,若已安装请忽略
+3. 安装完成后在 `Docker-应用商店-实用工具` 中找到 `思源笔记`,点击`安装`,也可以在搜索框直接搜索
+4. 设置域名等基本信息,点击 `确定`
+ * 名称:应用名称,默认 `siyuan_随机字符`
+ * 版本选择:默认 `latest`
+ * 域名:如你需要通过域名访问,请在此处填写你的域名
+ * 允许外部访问:如你需通过 `IP+Port` 直接访问,请勾选,如你已经设置了域名,请不要勾选此处
+ * 端口:默认 `6806`,可自行修改
+ * 访问授权码:默认随机生成
+ * 内存限制:0为不限制,根据实际需要设置
+5. 提交后面板会自动进行应用初始化,大概需要`1-3`分钟,初始化完成后即可访问
#### 访问思源笔记
-* 如果您填写域名,请在浏览器输入您的域名访问,如`http://demo.siyuan`,即可访问 `思源笔记` 页面。
-* 如您选择`IP+端口访问`请在浏览器地址栏中输入域名访问 `http://<宝塔面板IP>:6806`,即可访问 `思源笔记` 页面。
+* 如果你填写了域名,请在浏览器输入域名访问
+* 如你选择了 `IP+端口`,请在浏览器地输入 `http://<宝塔面板IP>:6806` 访问
From 56d7a3e2b879f562223e1cf264c60b34aedbd916 Mon Sep 17 00:00:00 2001
From: Daniel <845765@qq.com>
Date: Thu, 31 Oct 2024 22:39:33 +0800
Subject: [PATCH 6/8] :zap: Improve outline panel loading performance
https://github.com/siyuan-note/siyuan/issues/12981
---
kernel/model/outline.go | 5 +----
kernel/util/runtime.go | 3 ---
2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/kernel/model/outline.go b/kernel/model/outline.go
index 5e45b1f34..4e819d511 100644
--- a/kernel/model/outline.go
+++ b/kernel/model/outline.go
@@ -17,10 +17,8 @@
package model
import (
- "github.com/88250/lute/html"
- "time"
-
"github.com/88250/lute/ast"
+ "github.com/88250/lute/html"
"github.com/88250/lute/parse"
"github.com/emirpasic/gods/stacks/linkedliststack"
"github.com/siyuan-note/siyuan/kernel/treenode"
@@ -209,7 +207,6 @@ func (tx *Transaction) doMoveOutlineHeading(operation *Operation) (ret *TxErr) {
}
func Outline(rootID string, preview bool) (ret []*Path, err error) {
- time.Sleep(util.FrontendQueueInterval)
FlushTxQueue()
ret = []*Path{}
diff --git a/kernel/util/runtime.go b/kernel/util/runtime.go
index 30adbea1e..4182d7042 100644
--- a/kernel/util/runtime.go
+++ b/kernel/util/runtime.go
@@ -132,9 +132,6 @@ func SetNetworkProxy(proxyURL string) {
}
const (
- // FrontendQueueInterval 为前端请求队列轮询间隔。
- FrontendQueueInterval = 512 * time.Millisecond
-
// SQLFlushInterval 为数据库事务队列写入间隔。
SQLFlushInterval = 3000 * time.Millisecond
)
From 0c0cc55820f2c0a9ca12387cdae022340545ce6a Mon Sep 17 00:00:00 2001
From: Daniel <845765@qq.com>
Date: Thu, 31 Oct 2024 22:56:48 +0800
Subject: [PATCH 7/8] :zap: Improve load tree performance
---
kernel/filesys/tree.go | 50 ++++++++++++++++++++++++++++--------------
kernel/model/file.go | 25 ++-------------------
2 files changed, 35 insertions(+), 40 deletions(-)
diff --git a/kernel/filesys/tree.go b/kernel/filesys/tree.go
index 24aa96953..ccc3d7371 100644
--- a/kernel/filesys/tree.go
+++ b/kernel/filesys/tree.go
@@ -150,29 +150,22 @@ func LoadTreeByData(data []byte, boxID, p string, luteEngine *lute.Lute) (ret *p
parentAbsPath += ".sy"
parentPath := parentAbsPath
parentAbsPath = filepath.Join(util.DataDir, boxID, parentAbsPath)
- parentData, readErr := filelock.ReadFile(parentAbsPath)
- if nil != readErr {
- if os.IsNotExist(readErr) {
- // 子文档缺失父文档时自动补全 https://github.com/siyuan-note/siyuan/issues/7376
- parentTree := treenode.NewTree(boxID, parentPath, hPathBuilder.String()+"Untitled", "Untitled")
- if _, writeErr := WriteTree(parentTree); nil != writeErr {
- logging.LogErrorf("rebuild parent tree [%s] failed: %s", parentAbsPath, writeErr)
- } else {
- logging.LogInfof("rebuilt parent tree [%s]", parentAbsPath)
- treenode.UpsertBlockTree(parentTree)
- }
+
+ parentDocIAL := DocIAL(parentAbsPath)
+ if 1 > len(parentDocIAL) {
+ // 子文档缺失父文档时自动补全 https://github.com/siyuan-note/siyuan/issues/7376
+ parentTree := treenode.NewTree(boxID, parentPath, hPathBuilder.String()+"Untitled", "Untitled")
+ if _, writeErr := WriteTree(parentTree); nil != writeErr {
+ logging.LogErrorf("rebuild parent tree [%s] failed: %s", parentAbsPath, writeErr)
} else {
- logging.LogWarnf("read parent tree data [%s] failed: %s", parentAbsPath, readErr)
+ logging.LogInfof("rebuilt parent tree [%s]", parentAbsPath)
+ treenode.UpsertBlockTree(parentTree)
}
hPathBuilder.WriteString("Untitled/")
continue
}
- ial := ReadDocIAL(parentData)
- if 1 > len(ial) {
- logging.LogWarnf("tree [%s] is corrupted", filepath.Join(boxID, p))
- }
- title := ial["title"]
+ title := parentDocIAL["title"]
if "" == title {
title = "Untitled"
}
@@ -185,6 +178,29 @@ func LoadTreeByData(data []byte, boxID, p string, luteEngine *lute.Lute) (ret *p
return
}
+func DocIAL(absPath string) (ret map[string]string) {
+ filelock.Lock(absPath)
+ file, err := os.Open(absPath)
+ if err != nil {
+ logging.LogErrorf("open file [%s] failed: %s", absPath, err)
+ filelock.Unlock(absPath)
+ return nil
+ }
+
+ iter := jsoniter.Parse(jsoniter.ConfigCompatibleWithStandardLibrary, file, 512)
+ for field := iter.ReadObject(); field != ""; field = iter.ReadObject() {
+ if field == "Properties" {
+ iter.ReadVal(&ret)
+ break
+ } else {
+ iter.Skip()
+ }
+ }
+ file.Close()
+ filelock.Unlock(absPath)
+ return
+}
+
func WriteTree(tree *parse.Tree) (size uint64, err error) {
data, filePath, err := prepareWriteTree(tree)
if err != nil {
diff --git a/kernel/model/file.go b/kernel/model/file.go
index d0be5ba06..b65909b71 100644
--- a/kernel/model/file.go
+++ b/kernel/model/file.go
@@ -37,7 +37,6 @@ import (
"github.com/88250/lute/html"
"github.com/88250/lute/parse"
util2 "github.com/88250/lute/util"
- jsoniter "github.com/json-iterator/go"
"github.com/siyuan-note/filelock"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/riff"
@@ -116,29 +115,9 @@ func (box *Box) docIAL(p string) (ret map[string]string) {
}
filePath := filepath.Join(util.DataDir, box.ID, p)
-
- filelock.Lock(filePath)
- file, err := os.Open(filePath)
- if err != nil {
- logging.LogErrorf("open file [%s] failed: %s", p, err)
- filelock.Unlock(filePath)
- return nil
- }
-
- iter := jsoniter.Parse(jsoniter.ConfigCompatibleWithStandardLibrary, file, 512)
- for field := iter.ReadObject(); field != ""; field = iter.ReadObject() {
- if field == "Properties" {
- iter.ReadVal(&ret)
- break
- } else {
- iter.Skip()
- }
- }
- file.Close()
- filelock.Unlock(filePath)
-
+ ret = filesys.DocIAL(filePath)
if 1 > len(ret) {
- logging.LogWarnf("properties not found in file [%s]", p)
+ logging.LogWarnf("properties not found in file [%s]", filePath)
box.moveCorruptedData(filePath)
return nil
}
From 4e15568b2e944bf9ad8b5bcffb861fa8f8e9fbe3 Mon Sep 17 00:00:00 2001
From: Jeffrey Chen <78434827+TCOTC@users.noreply.github.com>
Date: Fri, 1 Nov 2024 08:31:07 +0800
Subject: [PATCH 8/8]
https://ld246.com/article/1715069193698/comment/1730346295085#comments
(#12982)
https://ld246.com/article/1715069193698/comment/1730346295085#comments
---
app/src/block/popover.ts | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/app/src/block/popover.ts b/app/src/block/popover.ts
index 37c9abb89..ba917e5e3 100644
--- a/app/src/block/popover.ts
+++ b/app/src/block/popover.ts
@@ -37,6 +37,7 @@ export const initBlockPopover = (app: App) => {
if (aElement.firstElementChild?.getAttribute("data-type") === "url") {
if (aElement.firstElementChild.textContent.indexOf("...") > -1) {
tip = Lute.EscapeHTMLStr(aElement.firstElementChild.getAttribute("data-href"));
+ tooltipClass = "href";
}
}
if (!tip && aElement.dataset.wrap !== "true" && event.target.dataset.type !== "block-more" && !hasClosestByClassName(event.target, "block__icon")) {
@@ -49,6 +50,7 @@ export const initBlockPopover = (app: App) => {
}
} else if (aElement.classList.contains("av__celltext--url")) {
tip = tip ? `${tip.substring(0, Constants.SIZE_TITLE)}
${aElement.getAttribute("data-name")}` : aElement.getAttribute("data-name");
+ tooltipClass = "href";
} else if (aElement.classList.contains("av__calc--ashow") && aElement.clientWidth + 2 < aElement.scrollWidth) {
tip = aElement.lastChild.textContent + " " + aElement.firstElementChild.textContent;
}
@@ -76,7 +78,7 @@ export const initBlockPopover = (app: App) => {
} else {
assetTip += ` ${response.data.hSize}${title ? '' + title : ""}
${window.siyuan.languages.modifiedAt} ${response.data.hUpdated}
${window.siyuan.languages.createdAt} ${response.data.hCreated}`;
}
- showTooltip(assetTip, aElement);
+ showTooltip(assetTip, aElement, tooltipClass);
});
tip = "";
} else if (title) {