From 50f103ab0c8490fd977986e819c0d5f5df7bc45e Mon Sep 17 00:00:00 2001 From: what Date: Tue, 30 Jan 2024 16:50:17 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=20=E8=B0=83=E6=95=B4=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- captcha.go | 8 +------- routing.go | 4 ++++ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/captcha.go b/captcha.go index 80f55e7..bda1600 100644 --- a/captcha.go +++ b/captcha.go @@ -1,13 +1,7 @@ package contracts -import ( - "net/http" - - "github.com/samber/do" -) - type Captcha interface { - HttpMiddleware(container *do.Injector) func(next http.Handler) http.Handler + RouteMiddleware Verify(id int64, answer string, clear bool) error Generate(captchaUuid, recipient, ip string, u User) (body string, id int64, err error) } diff --git a/routing.go b/routing.go index 847db61..31fd316 100644 --- a/routing.go +++ b/routing.go @@ -70,6 +70,10 @@ type Route interface { MakeRequest(r *http.Request, params map[string]any) (*http.Request, error) } +type RouteMiddleware interface { + HttpMiddleware(r Route) func(next http.Handler) http.Handler +} + type WsClientGroup string type WsClientID uint