浏览代码

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

Vanessa 2 年之前
父节点
当前提交
41d0fa9257
共有 3 个文件被更改,包括 54 次插入2 次删除
  1. 4 0
      README_zh_CN.md
  2. 40 1
      app/guide/20210808180117-czj9bvb/20200813093015-u6bopdt.sy
  3. 10 1
      kernel/model/assets.go

+ 4 - 0
README_zh_CN.md

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

+ 40 - 1
app/guide/20210808180117-czj9bvb/20200813093015-u6bopdt.sy

@@ -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",

+ 10 - 1
kernel/model/assets.go

@@ -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