Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2022-10-31 00:21:02 +08:00
commit 41d0fa9257
3 changed files with 54 additions and 2 deletions

View file

@ -162,6 +162,10 @@
## ❓ 常见问题和解答
### 听说思源笔记会通过用户电脑挖矿?
详情请看[如何评价思源笔记? - 知乎](https://www.zhihu.com/question/434530733/answer/2644563326)。
### 思源适合我吗?或者说我应该如何选择笔记软件?
这个问题因人而异,很难统一回答。如果你不太确定思源是否适合你,请看如下建议:

View file

@ -7,9 +7,48 @@
"id": "20200813093015-u6bopdt",
"title": "常见问题",
"type": "doc",
"updated": "20220909100829"
"updated": "20221031001420"
},
"Children": [
{
"ID": "20221031001313-rk7sd0e",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20221031001313-rk7sd0e",
"updated": "20221031001313"
},
"Children": [
{
"Type": "NodeText",
"Data": "听说思源笔记会通过用户电脑挖矿?"
}
]
},
{
"ID": "20221031001314-v5a3pa8",
"Type": "NodeParagraph",
"Properties": {
"id": "20221031001314-v5a3pa8",
"updated": "20221031001420"
},
"Children": [
{
"Type": "NodeText",
"Data": "详情请看"
},
{
"Type": "NodeTextMark",
"TextMarkType": "a",
"TextMarkAHref": "https://www.zhihu.com/question/434530733/answer/2644563326",
"TextMarkTextContent": "如何评价思源笔记? - 知乎"
},
{
"Type": "NodeText",
"Data": "。"
}
]
},
{
"ID": "20220617160928-fw4ixa3",
"Type": "NodeHeading",

View file

@ -76,6 +76,15 @@ func NetImg2LocalAssets(rootID string) (err error) {
var files int
msgId := gulu.Rand.String(7)
docDirLocalPath := filepath.Join(util.DataDir, tree.Box, path.Dir(tree.Path))
assetsDirPath := getAssetsDir(filepath.Join(util.DataDir, tree.Box), docDirLocalPath)
if !gulu.File.IsExist(assetsDirPath) {
if err = os.MkdirAll(assetsDirPath, 0755); nil != err {
return
}
}
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
if !entering {
return ast.WalkContinue
@ -140,7 +149,7 @@ func NetImg2LocalAssets(rootID string) (err error) {
name = gulu.Str.SubStr(name, 64)
name = util.FilterFileName(name)
name = "net-img-" + name + "-" + ast.NewNodeID() + ext
writePath := filepath.Join(util.DataDir, "assets", name)
writePath := filepath.Join(assetsDirPath, name)
if err = filelock.WriteFile(writePath, data); nil != err {
logging.LogErrorf("write downloaded net img [%s] to local assets [%s] failed: %s", u, writePath, err)
return ast.WalkSkipChildren