diff --git a/plugins/meme/meme.go b/plugins/meme/meme.go index 319eabf..b819a1c 100644 --- a/plugins/meme/meme.go +++ b/plugins/meme/meme.go @@ -370,8 +370,8 @@ func (p *MemePlugin) defaultFormatConfig() []memeText { } ret: return []memeText{ - {XPerc: 0.5, YPerc: 0.1, Caps: true}, - {XPerc: 0.5, YPerc: 0.9, Caps: true}, + {XPerc: 0.5, YPerc: 0.05, Caps: true}, + {XPerc: 0.5, YPerc: 0.95, Caps: true}, } } diff --git a/plugins/meme/webHandlers.go b/plugins/meme/webHandlers.go index f671b02..1734e17 100644 --- a/plugins/meme/webHandlers.go +++ b/plugins/meme/webHandlers.go @@ -2,6 +2,7 @@ package meme import ( "encoding/json" + "errors" "fmt" "github.com/ggicci/httpin" "net/http" @@ -89,7 +90,7 @@ func (p *MemePlugin) rmMeme(w http.ResponseWriter, r *http.Request) { } type SaveReq struct { - Name string `in:"path=name"` + Name string `in:"path=name;form=name"` Config string `in:"form=config"` URL string `in:"form=url"` } @@ -98,6 +99,14 @@ func (p *MemePlugin) saveMeme(w http.ResponseWriter, r *http.Request) { input := r.Context().Value(httpin.Input).(*SaveReq) checkError := mkCheckError(w) + log.Debug().Interface("save input", input).Send() + if input.Name == "" { + checkError(errors.New("no name")) + } + if input.URL == "" { + checkError(errors.New("no URL")) + } + formats := p.c.GetMap("meme.memes", defaultFormats) formats[input.Name] = input.URL err := p.c.SetMap("meme.memes", formats)