Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:sparkles: 分享文档到链滴 https://github.com/siyuan-note/siyuan/issues/2004

Liang Dingad60a2827890
diff --git a/kernel/api/export.go b/kernel/api/export.go
index 73c0d1e643..8b6a5b2836 100644
--- a/kernel/api/export.go
+++ b/kernel/api/export.go
@@ -31,6 +31,24 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
+func export2Liandi(c *gin.Context) {
+ ret := gulu.Ret.NewResult()
+ defer c.JSON(http.StatusOK, ret)
+
+ arg, ok := util.JsonArg(c, ret)
+ if !ok {
+ return
+ }
+
+ id := arg["id"].(string)
+ err := model.Export2Liandi(id)
+ if nil != err {
+ ret.Code = -1
+ ret.Msg = err.Error()
+ return
+ }
+}
+
func exportDataInFolder(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
diff --git a/kernel/api/router.go b/kernel/api/router.go
index cb3bf3d5dd..f1052b81a3 100644
--- a/kernel/api/router.go
+++ b/kernel/api/router.go
@@ -236,6 +236,7 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/export/exportData", model.CheckAuth, exportData)
ginServer.Handle("POST", "/api/export/exportDataInFolder", model.CheckAuth, exportDataInFolder)
ginServer.Handle("POST", "/api/export/exportTempContent", model.CheckAuth, exportTempContent)
+ ginServer.Handle("POST", "/api/export/export2Liandi", model.CheckAuth, export2Liandi)
ginServer.Handle("POST", "/api/import/importStdMd", model.CheckAuth, model.CheckReadonly, importStdMd)
ginServer.Handle("POST", "/api/import/importData", model.CheckAuth, model.CheckReadonly, importData)
diff --git a/kernel/model/export.go b/kernel/model/export.go
index 2ab934275a..87432d7779 100644
--- a/kernel/model/export.go
+++ b/kernel/model/export.go
@@ -58,6 +58,9 @@ func Export2Liandi(id string) (err error) {
return
}
+ sqlAssets := sql.QueryRootBlockAssets(id)
+ err = uploadCloud(sqlAssets)
+
// 判断帖子是否已经存在,存在则使用更新接口
foundArticle := false
articleId := tree.Root.IALAttr("liandiArticleId")