mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-02 20:42:06 +08:00
🎨 闪卡配置
This commit is contained in:
parent
5608e28030
commit
60f390d9e0
@ -263,6 +263,7 @@ func ServeAPI(ginServer *gin.Engine) {
|
||||
ginServer.Handle("POST", "/api/setting/getCustomCSS", model.CheckAuth, getCustomCSS)
|
||||
ginServer.Handle("POST", "/api/setting/setCustomCSS", model.CheckAuth, model.CheckReadonly, setCustomCSS)
|
||||
ginServer.Handle("POST", "/api/setting/setEmoji", model.CheckAuth, model.CheckReadonly, setEmoji)
|
||||
ginServer.Handle("POST", "/api/setting/setFlashcard", model.CheckAuth, model.CheckReadonly, setFlashcard)
|
||||
|
||||
ginServer.Handle("POST", "/api/graph/resetGraph", model.CheckAuth, model.CheckReadonly, resetGraph)
|
||||
ginServer.Handle("POST", "/api/graph/resetLocalGraph", model.CheckAuth, model.CheckReadonly, resetLocalGraph)
|
||||
|
@ -29,6 +29,43 @@ import (
|
||||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func setFlashcard(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
param, err := gulu.JSON.MarshalJSON(arg)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
|
||||
flashcard := &conf.Flashcard{}
|
||||
if err = gulu.JSON.UnmarshalJSON(param, flashcard); nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
|
||||
if 1 > flashcard.DailyNewCardLimit {
|
||||
flashcard.DailyNewCardLimit = 1
|
||||
}
|
||||
|
||||
if 1 > flashcard.DailyReviewCardLimit {
|
||||
flashcard.DailyReviewCardLimit = 1
|
||||
}
|
||||
|
||||
model.Conf.Flashcard = flashcard
|
||||
model.Conf.Save()
|
||||
|
||||
ret.Data = flashcard
|
||||
}
|
||||
|
||||
func setAccount(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
Loading…
Reference in New Issue
Block a user