This commit is contained in:
Liang Ding 2023-03-10 09:47:34 +08:00
parent a11e3d9871
commit a021097b06
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 20 additions and 2 deletions

View file

@ -102,6 +102,15 @@ func removeNotebook(c *gin.Context) {
return
}
if util.ReadOnly && !model.IsUserGuide(notebook) {
result := util.NewResult()
result.Code = -1
result.Msg = model.Conf.Language(34)
result.Data = map[string]interface{}{"closeTimeout": 5000}
c.JSON(200, result)
return
}
err := model.RemoveBox(notebook)
if nil != err {
ret.Code = -1
@ -167,6 +176,15 @@ func openNotebook(c *gin.Context) {
return
}
if util.ReadOnly && !model.IsUserGuide(notebook) {
result := util.NewResult()
result.Code = -1
result.Msg = model.Conf.Language(34)
result.Data = map[string]interface{}{"closeTimeout": 5000}
c.JSON(200, result)
return
}
msgId := util.PushMsg(model.Conf.Language(45), 1000*60*15)
defer util.PushClearMsg(msgId)
existed, err := model.Mount(notebook)

View file

@ -73,12 +73,12 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/account/startFreeTrial", model.CheckAuth, model.CheckReadonly, startFreeTrial)
ginServer.Handle("POST", "/api/notebook/lsNotebooks", model.CheckAuth, lsNotebooks)
ginServer.Handle("POST", "/api/notebook/openNotebook", model.CheckAuth, model.CheckReadonly, openNotebook)
ginServer.Handle("POST", "/api/notebook/openNotebook", model.CheckAuth, openNotebook)
ginServer.Handle("POST", "/api/notebook/closeNotebook", model.CheckAuth, model.CheckReadonly, closeNotebook)
ginServer.Handle("POST", "/api/notebook/getNotebookConf", model.CheckAuth, getNotebookConf)
ginServer.Handle("POST", "/api/notebook/setNotebookConf", model.CheckAuth, model.CheckReadonly, setNotebookConf)
ginServer.Handle("POST", "/api/notebook/createNotebook", model.CheckAuth, model.CheckReadonly, createNotebook)
ginServer.Handle("POST", "/api/notebook/removeNotebook", model.CheckAuth, model.CheckReadonly, removeNotebook)
ginServer.Handle("POST", "/api/notebook/removeNotebook", model.CheckAuth, removeNotebook)
ginServer.Handle("POST", "/api/notebook/renameNotebook", model.CheckAuth, model.CheckReadonly, renameNotebook)
ginServer.Handle("POST", "/api/notebook/changeSortNotebook", model.CheckAuth, model.CheckReadonly, changeSortNotebook)
ginServer.Handle("POST", "/api/notebook/setNotebookIcon", model.CheckAuth, model.CheckReadonly, setNotebookIcon)