An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Physically delete a workspace on the mobile https://github.com/siyuan-note/siyuan/issues/9134
Daniel5a9a4a1ece89
diff --git a/kernel/api/router.go b/kernel/api/router.goindex 0bb5e76f14..4a27bdd717 100644--- a/kernel/api/router.go+++ b/kernel/api/router.go@@ -51,6 +51,7 @@ func ServeAPI(ginServer *gin.Engine) {ginServer.Handle("POST", "/api/system/checkWorkspaceDir", model.CheckAuth, model.CheckReadonly, checkWorkspaceDir)ginServer.Handle("POST", "/api/system/createWorkspaceDir", model.CheckAuth, model.CheckReadonly, createWorkspaceDir)ginServer.Handle("POST", "/api/system/removeWorkspaceDir", model.CheckAuth, model.CheckReadonly, removeWorkspaceDir)+ ginServer.Handle("POST", "/api/system/removeWorkspaceDirPhysically", model.CheckAuth, model.CheckReadonly, removeWorkspaceDirPhysically)ginServer.Handle("POST", "/api/system/setAppearanceMode", model.CheckAuth, setAppearanceMode)ginServer.Handle("POST", "/api/system/getSysFonts", model.CheckAuth, getSysFonts)ginServer.Handle("POST", "/api/system/exit", model.CheckAuth, exit)diff --git a/kernel/api/workspace.go b/kernel/api/workspace.goindex 3a5df4f71c..951b62db56 100644--- a/kernel/api/workspace.go+++ b/kernel/api/workspace.go@@ -163,6 +163,31 @@ func removeWorkspaceDir(c *gin.Context) {}}+func removeWorkspaceDirPhysically(c *gin.Context) {+ ret := gulu.Ret.NewResult()+ defer c.JSON(http.StatusOK, ret)++ arg, ok := util.JsonArg(c, ret)+ if !ok {+ return+ }++ path := arg["path"].(string)++ if gulu.File.IsDir(path) {+ err := os.RemoveAll(path)+ if nil != err {+ ret.Code = -1+ ret.Msg = err.Error()+ return+ }+ }++ if util.WorkspaceDir == path {+ os.Exit(logging.ExitCodeOk)+ }+}+type Workspace struct {Path string `json:"path"`Closed bool `json:"closed"`diff --git a/kernel/go.mod b/kernel/go.modindex 3fd35d9795..dd9f8e636d 100644--- a/kernel/go.mod+++ b/kernel/go.mod@@ -48,11 +48,11 @@ require (github.com/radovskyb/watcher v1.0.7github.com/sashabaranov/go-openai v1.14.2github.com/shirou/gopsutil/v3 v3.23.7- github.com/siyuan-note/dejavu v0.0.0-20230907034025-e0913b2dc340+ github.com/siyuan-note/dejavu v0.0.0-20230908070113-b6da540c16bfgithub.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75github.com/siyuan-note/eventbus v0.0.0-20230804030110-cf250f838c80github.com/siyuan-note/filelock v0.0.0-20230615140405-d05a21d49524- github.com/siyuan-note/httpclient v0.0.0-20230907033738-6e93eb0c15a1+ github.com/siyuan-note/httpclient v0.0.0-20230908014917-f63abd3164c8github.com/siyuan-note/logging v0.0.0-20230327073243-ebe83aec1493github.com/siyuan-note/riff v0.0.0-20230728105206-f7c344346d61github.com/steambap/captcha v1.4.1diff --git a/kernel/go.sum b/kernel/go.sumindex 69e3e5d861..a81b340a52 100644--- a/kernel/go.sum+++ b/kernel/go.sum@@ -517,16 +517,16 @@ github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRgithub.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d h1:lvCTyBbr36+tqMccdGMwuEU+hjux/zL6xSmf5S9ITaA=github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw=github.com/simplereach/timeutils v1.2.0/go.mod h1:VVbQDfN/FHRZa1LSqcwo4kNZ62OOyqLLGQKYB3pB0Q8=-github.com/siyuan-note/dejavu v0.0.0-20230907034025-e0913b2dc340 h1:FnLS6z9eYS4d8luQBBb+fS7QsgSSenUUl0KHqyG5jxg=-github.com/siyuan-note/dejavu v0.0.0-20230907034025-e0913b2dc340/go.mod h1:Xoq/tR3bfZ8ptjXFAjQuUJmLbBSc3VUOX9SkhxrhzDw=+github.com/siyuan-note/dejavu v0.0.0-20230908070113-b6da540c16bf h1:Vm9kx7rOpq8cgksLLSLawDeoNc+BDxIGmMaEwm+iWqc=+github.com/siyuan-note/dejavu v0.0.0-20230908070113-b6da540c16bf/go.mod h1:8081f/CTXwGipQQW72rsnjSnPKVvdEqtpySe0tTlpWg=github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE=github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=github.com/siyuan-note/eventbus v0.0.0-20230804030110-cf250f838c80 h1:XghjHKJd+SiL0DkGYFVC+UGUDFtnR4v9gkAbPeh9Eq8=github.com/siyuan-note/eventbus v0.0.0-20230804030110-cf250f838c80/go.mod h1:Sqo4FYX5lAXu7gWkbEdJF0e6P57tNNVV4WDKYDctokI=github.com/siyuan-note/filelock v0.0.0-20230615140405-d05a21d49524 h1:ZuxN5gwqtUOd1NkOkNhM4OlVWfjujY98zsR+zFi4x9g=github.com/siyuan-note/filelock v0.0.0-20230615140405-d05a21d49524/go.mod h1:jK5lCYfPbFOrW23/HMeU7kmpLdEd5GkennF+kUpy7Vs=-github.com/siyuan-note/httpclient v0.0.0-20230907033738-6e93eb0c15a1 h1:0pLW28vqtJCrdNLbsd6lzKE1ebpdsXtoNRp2g4tA87o=-github.com/siyuan-note/httpclient v0.0.0-20230907033738-6e93eb0c15a1/go.mod h1:5yGlVBDCANvsp1t7hOjgQNsa2wu3Yba82juEJC60TJQ=+github.com/siyuan-note/httpclient v0.0.0-20230908014917-f63abd3164c8 h1:AavCeAPNhLYUTDx4HsB/bvpUVdGa93tZGCXndeeUPqQ=+github.com/siyuan-note/httpclient v0.0.0-20230908014917-f63abd3164c8/go.mod h1:ario+4RMvFDgEJh73TUIxzh3zDgBWfRL0cpGmcKsoSI=github.com/siyuan-note/logging v0.0.0-20230327073243-ebe83aec1493 h1:oaN5b0WDFkjdBgGxmmBnMrtZxaJ76LZLwhQSZnznJMI=github.com/siyuan-note/logging v0.0.0-20230327073243-ebe83aec1493/go.mod h1:6mRFtAAvYPn3cDzqvyv+t8BVPGqpONDMMb5ywOhY1D4=github.com/siyuan-note/riff v0.0.0-20230728105206-f7c344346d61 h1:67G1+JSlkcbRsCig83khfK7e96DxrsVnha87Tm/xgdo=