🎨 移动端支持重新打开已经移除的工作空间 https://github.com/siyuan-note/siyuan/issues/7353

This commit is contained in:
Liang Ding 2023-02-12 22:51:04 +08:00
parent 0d0cea11c9
commit e8c90a2c80
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 31 additions and 0 deletions

View file

@ -117,6 +117,36 @@ type Workspace struct {
Closed bool `json:"closed"`
}
func getMobileWorkspaces(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
if util.ContainerIOS != util.Container && util.ContainerAndroid != util.Container {
return
}
root := filepath.Dir(util.WorkspaceDir)
dirs, err := os.ReadDir(root)
if nil != err {
logging.LogErrorf("read dir [%s] failed: %s", root, err)
ret.Code = -1
ret.Msg = err.Error()
return
}
var names []string
for _, dir := range dirs {
if dir.IsDir() {
if isInvalidWorkspacePath(filepath.Join(root, dir.Name())) {
continue
}
names = append(names, dir.Name())
}
}
ret.Data = names
}
func getWorkspaces(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)