diff --git a/control/rule.go b/control/rule.go index ad31e59..299de56 100644 --- a/control/rule.go +++ b/control/rule.go @@ -167,7 +167,7 @@ func init() { } condition := strings.Contains(ctx.Event.RawMessage, "启用") || strings.Contains(ctx.Event.RawMessage, "enable") if condition { - managers.ForEach(func(key string, manager *ctrl.Control[*zero.Ctx]) bool { + managers.ForEach(func(_ string, manager *ctrl.Control[*zero.Ctx]) bool { if manager.Options.DisableOnDefault == condition { return true } @@ -176,7 +176,7 @@ func init() { }) ctx.SendChain(message.Text("此处启用所有插件成功")) } else { - managers.ForEach(func(key string, manager *ctrl.Control[*zero.Ctx]) bool { + managers.ForEach(func(_ string, manager *ctrl.Control[*zero.Ctx]) bool { manager.Disable(grp) return true }) @@ -234,7 +234,7 @@ func init() { argsparsed := make([]int64, 0, len(args)) var uid int64 var err error - haspermission := zero.GroupHigherPermission(func(ctx *zero.Ctx) int64 { return uid }) + haspermission := zero.GroupHigherPermission(func(_ *zero.Ctx) int64 { return uid }) for _, usr := range args[1:] { uid, err = strconv.ParseInt(usr, 10, 64) if err == nil && haspermission(ctx) { diff --git a/control/servicepic.go b/control/servicepic.go index bd50e37..0954d60 100644 --- a/control/servicepic.go +++ b/control/servicepic.go @@ -273,7 +273,10 @@ func renderserverlistlogo() (img image.Image, err error) { mask := canvas.AsMask() stroked := gg.NewContext(w, h) - stroked.SetMask(mask) + err = stroked.SetMask(mask) + if err != nil { + return + } stroked.SetRGBA255(255, 255, 255, 255) stroked.DrawRectangle(0, 0, float64(stroked.W()), float64(stroked.H())) stroked.Fill() diff --git a/control/web/controller/manage.go b/control/web/controller/manage.go index fcab5e9..4ce9a2c 100644 --- a/control/web/controller/manage.go +++ b/control/web/controller/manage.go @@ -38,7 +38,7 @@ var ( // 存储请求事件,flag作为键,一个request对象作为值 requestData syncx.Map[string, *zero.Event] upgrader = websocket.Upgrader{ - CheckOrigin: func(r *http.Request) bool { + CheckOrigin: func(_ *http.Request) bool { return true }, } diff --git a/go.mod b/go.mod index f9827aa..af5776c 100644 --- a/go.mod +++ b/go.mod @@ -5,15 +5,13 @@ go 1.20 require ( github.com/FloatTech/ZeroBot-Plugin-Webui v1.0.1-0.20230412164529-cfe878675931 github.com/FloatTech/floatbox v0.0.0-20240505082030-226ec6713e14 - github.com/FloatTech/gg v1.1.2 + github.com/FloatTech/gg v1.1.3 github.com/FloatTech/imgfactory v0.2.2-0.20230315152233-49741fc994f9 github.com/FloatTech/rendercard v0.0.10-0.20230223064326-45d29fa4ede9 github.com/FloatTech/sqlite v1.6.3 - github.com/FloatTech/ttl v0.0.0-20230307105452-d6f7b2b647d1 github.com/FloatTech/zbpctrl v1.6.1 github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7 github.com/RomiChan/websocket v1.4.3-0.20220227141055-9b2c6168c9c5 - github.com/disintegration/imaging v1.6.2 github.com/fumiama/cron v1.3.0 github.com/fumiama/go-base16384 v1.7.0 github.com/fumiama/go-registry v0.2.6 @@ -31,9 +29,11 @@ require ( ) require ( + github.com/FloatTech/ttl v0.0.0-20230307105452-d6f7b2b647d1 // indirect github.com/KyleBanks/depth v1.2.1 // indirect github.com/PuerkitoBio/purell v1.1.1 // indirect github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect + github.com/disintegration/imaging v1.6.2 // indirect github.com/ericpauley/go-quantize v0.0.0-20200331213906-ae555eb2afa4 // indirect github.com/fumiama/go-simple-protobuf v0.1.0 // indirect github.com/fumiama/gofastTEA v0.0.10 // indirect @@ -62,7 +62,7 @@ require ( github.com/tidwall/pretty v1.2.0 // indirect github.com/ugorji/go/codec v1.2.7 // indirect golang.org/x/crypto v0.22.0 // indirect - golang.org/x/image v0.3.0 // indirect + golang.org/x/image v0.15.0 // indirect golang.org/x/net v0.24.0 // indirect golang.org/x/sys v0.19.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/go.sum b/go.sum index 90e1c60..0f19309 100644 --- a/go.sum +++ b/go.sum @@ -3,8 +3,8 @@ github.com/FloatTech/ZeroBot-Plugin-Webui v1.0.1-0.20230412164529-cfe878675931 h github.com/FloatTech/ZeroBot-Plugin-Webui v1.0.1-0.20230412164529-cfe878675931/go.mod h1:Se2A9vnC4eSYF7vR2LNSayV7rvbFcpgVs1ZN4sEYMyg= github.com/FloatTech/floatbox v0.0.0-20240505082030-226ec6713e14 h1:8O0Iq9MnKsKowltY9txhOqcJdmGTjxHPQ4gEYzbJc9A= github.com/FloatTech/floatbox v0.0.0-20240505082030-226ec6713e14/go.mod h1:OzGLhvmtz1TKIdGaJDd8pQumvD36UqK+dWsiCISmzQQ= -github.com/FloatTech/gg v1.1.2 h1:YolgOYg3uDHc1+g0bLtt6QuRA/pvLn+b9IBCIhOOX88= -github.com/FloatTech/gg v1.1.2/go.mod h1:uzPzAeT35egARdRuu+1oyjU3CmTwCceoq3Vvje7LpcI= +github.com/FloatTech/gg v1.1.3 h1:+GlL02lTKsxJQr4WCuNwVxC1/eBZrCvypCIBtxuOFb4= +github.com/FloatTech/gg v1.1.3/go.mod h1:/9oLP54CMfq4r+71XL26uaFTJ1uL1boAyX67680/1HE= github.com/FloatTech/imgfactory v0.2.2-0.20230315152233-49741fc994f9 h1:IzZLuM/fgKclyMaU/Qb1qlLdGrs2FTietkqOWhh07Gw= github.com/FloatTech/imgfactory v0.2.2-0.20230315152233-49741fc994f9/go.mod h1:el5hGpj1C1bDRxcTXYRwEivDCr40zZeJpcrLrB1fajs= github.com/FloatTech/rendercard v0.0.10-0.20230223064326-45d29fa4ede9 h1:hffajvmQFfP68U6wUwHemPuuwCUoss+SEFfoLYwbGwE= @@ -184,8 +184,8 @@ golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.3.0 h1:HTDXbdK9bjfSWkPzDJIw89W8CAtfFGduujWs33NLLsg= -golang.org/x/image v0.3.0/go.mod h1:fXd9211C/0VTlYuAcOhW8dY/RtEJqODXOWBDpmYBf+A= +golang.org/x/image v0.15.0 h1:kOELfmgrmJlw4Cdb7g/QGuB3CvDrXbqEIww/pNtNBm8= +golang.org/x/image v0.15.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= @@ -229,7 +229,6 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/img/pool/hook.go b/img/pool/hook.go index cf36123..b4db349 100644 --- a/img/pool/hook.go +++ b/img/pool/hook.go @@ -8,8 +8,10 @@ import ( zero "github.com/wdvxdr1123/ZeroBot" ) +// NTImage ... type NTImage nturl +// NewNTImage ... func NewNTImage(u string) (nti NTImage, err error) { subs := ntcachere.FindStringSubmatch(u) if len(subs) != 3 { diff --git a/img/pool/nt.go b/img/pool/nt.go index 05f75e0..9d1d736 100644 --- a/img/pool/nt.go +++ b/img/pool/nt.go @@ -20,7 +20,9 @@ const ( var ntcachere = regexp.MustCompile(`^https://multimedia.nt.qq.com.cn/download\?appid=1407&fileid=([0-9a-zA-Z_-]+)&spec=0&rkey=([0-9a-zA-Z_-]+)$`) var ( + // ErrInvalidNTURL ... ErrInvalidNTURL = errors.New("invalid nt url") + // ErrInvalidNTRaw ... ErrInvalidNTRaw = errors.New("invalid nt raw") ) diff --git a/img/text/font.go b/img/text/font.go index f4b7f8a..b896f29 100644 --- a/img/text/font.go +++ b/img/text/font.go @@ -33,7 +33,7 @@ const ( QiantuXiaotuFontFile = FontPath + "QiantuXiaotuTi.ttf" // GNUUnifontFontFile GNU Unifont https://unifoundry.com/unifont/index.html GNUUnifontFontFile = FontPath + "unifont-15.0.06.ttf" - // AiralFontFile ... + // ArialFontFile ... ArialFontFile = FontPath + "arial.ttf" // TorusFontFile ... TorusFontFile = FontPath + "Torus-Regular.otf" diff --git a/job/web.go b/job/web.go index 0c37f5e..ab9ec6e 100644 --- a/job/web.go +++ b/job/web.go @@ -74,7 +74,7 @@ type Job struct { // List 任务列表 func List() (jobList []Job, err error) { jobList = make([]Job, 0, 16) - zero.RangeBot(func(id int64, ctx *zero.Ctx) bool { + zero.RangeBot(func(id int64, _ *zero.Ctx) bool { c := &cmd{} ids := strconv.FormatInt(id, 36) _ = db.FindFor(ids, c, "", func() error {