mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-02 20:11:53 +08:00
🎨 移动端支持重新打开已经移除的工作空间 https://github.com/siyuan-note/siyuan/issues/7353
This commit is contained in:
parent
0d0cea11c9
commit
e8c90a2c80
@ -46,6 +46,7 @@ func ServeAPI(ginServer *gin.Engine) {
|
||||
ginServer.Handle("POST", "/api/system/setNetworkProxy", model.CheckAuth, setNetworkProxy)
|
||||
ginServer.Handle("POST", "/api/system/setWorkspaceDir", model.CheckAuth, setWorkspaceDir)
|
||||
ginServer.Handle("POST", "/api/system/getWorkspaces", model.CheckAuth, getWorkspaces)
|
||||
ginServer.Handle("POST", "/api/system/getMobileWorkspaces", model.CheckAuth, getMobileWorkspaces)
|
||||
ginServer.Handle("POST", "/api/system/createWorkspaceDir", model.CheckAuth, createWorkspaceDir)
|
||||
ginServer.Handle("POST", "/api/system/removeWorkspaceDir", model.CheckAuth, removeWorkspaceDir)
|
||||
ginServer.Handle("POST", "/api/system/setAppearanceMode", model.CheckAuth, setAppearanceMode)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user