mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 16:58:49 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
c949441bfb
5 changed files with 37 additions and 1 deletions
|
|
@ -25,6 +25,25 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func removeRiffCard(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
deckName := arg["deck"].(string)
|
||||
blockID := arg["blockID"].(string)
|
||||
err := model.RemoveFlashcard(blockID, deckName)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func addRiffCard(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
|
|
|||
|
|
@ -301,6 +301,7 @@ func ServeAPI(ginServer *gin.Engine) {
|
|||
|
||||
ginServer.Handle("POST", "/api/riff/createRiffDeck", model.CheckAuth, createRiffDeck)
|
||||
ginServer.Handle("POST", "/api/riff/addRiffCard", model.CheckAuth, addRiffCard)
|
||||
ginServer.Handle("POST", "/api/riff/removeRiffCard", model.CheckAuth, removeRiffCard)
|
||||
|
||||
ginServer.Handle("POST", "/api/notification/pushMsg", model.CheckAuth, pushMsg)
|
||||
ginServer.Handle("POST", "/api/notification/pushErrMsg", model.CheckAuth, pushErrMsg)
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ require (
|
|||
github.com/siyuan-note/filelock v0.0.0-20221117095924-e1947438a35e
|
||||
github.com/siyuan-note/httpclient v0.0.0-20221213030227-fa8d21fd9cf8
|
||||
github.com/siyuan-note/logging v0.0.0-20221031125421-9b7234d79d8a
|
||||
github.com/siyuan-note/riff v0.0.0-20221221064021-0e7597311cb0
|
||||
github.com/siyuan-note/riff v0.0.0-20221221071610-c02c46f4ae00
|
||||
github.com/steambap/captcha v1.4.1
|
||||
github.com/studio-b12/gowebdav v0.0.0-20221109171924-60ec5ad56012
|
||||
github.com/vmihailenco/msgpack/v5 v5.3.5
|
||||
|
|
|
|||
|
|
@ -387,6 +387,8 @@ github.com/siyuan-note/logging v0.0.0-20221031125421-9b7234d79d8a h1:b9VJCE8IccY
|
|||
github.com/siyuan-note/logging v0.0.0-20221031125421-9b7234d79d8a/go.mod h1:t1zRGxK13L/9ZFoGyTD39IbFCbee3CsypDj4b5dt4qM=
|
||||
github.com/siyuan-note/riff v0.0.0-20221221064021-0e7597311cb0 h1:i2vxI2USCiNqyExpsy96TuvTO6Yhk7s+4hrPJ5MDOhI=
|
||||
github.com/siyuan-note/riff v0.0.0-20221221064021-0e7597311cb0/go.mod h1:A3G3qOTyGVOu17ui9Qg9DNkAWOgwVMxHDzHYG8sQxHc=
|
||||
github.com/siyuan-note/riff v0.0.0-20221221071610-c02c46f4ae00 h1:oJHGup7FFSUNxQpnwqDjUnEbvAf18UbaJygGJpEXrUk=
|
||||
github.com/siyuan-note/riff v0.0.0-20221221071610-c02c46f4ae00/go.mod h1:A3G3qOTyGVOu17ui9Qg9DNkAWOgwVMxHDzHYG8sQxHc=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
github.com/smartystreets/goconvey v1.6.7 h1:I6tZjLXD2Q1kjvNbIzB1wvQBsXmKXiVrhpRE8ZjP5jY=
|
||||
|
|
|
|||
|
|
@ -32,6 +32,20 @@ import (
|
|||
var Decks = map[string]*riff.Deck{}
|
||||
var deckLock = sync.Mutex{}
|
||||
|
||||
func RemoveFlashcard(blockID string, deckName string) (err error) {
|
||||
deckLock.Lock()
|
||||
deck := Decks[deckName]
|
||||
deckLock.Unlock()
|
||||
|
||||
deck.RemoveCard(blockID)
|
||||
err = deck.Save()
|
||||
if nil != err {
|
||||
logging.LogErrorf("save deck [%s] failed: %s", deckName, err)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func AddFlashcard(blockID string, deckName string) (err error) {
|
||||
deckLock.Lock()
|
||||
deck := Decks[deckName]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue