From af291a91f88db3267a019d00a944e62711aa111a Mon Sep 17 00:00:00 2001 From: LinkinStars Date: Thu, 3 Aug 2023 16:00:38 +0800 Subject: [PATCH 1/2] fix(goreleaser): update goreleaser GOPROXY --- .goreleaser.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 7daa1c71..1f11eda7 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,7 +1,7 @@ env: - GO11MODULE=on - GO111MODULE=on - - GOPROXY=https://goproxy.io + - GOPROXY=https://goproxy.io,direct - CGO_ENABLED=0 before: @@ -15,7 +15,7 @@ builds: - id: build main: ./cmd/answer/. binary: answer - ldflags: -s -w -X main.Version={{.Version}} -X main.Revision={{.ShortCommit}} -X main.Time={{.Date}} -X main.BuildUser=goreleaser + ldflags: -s -w -X github.com/answerdev/answer/cmd.Version={{.Version}} -X github.com/answerdev/answer/cmd.Revision={{.ShortCommit}} -X github.com/answerdev/answer/cmd.Time={{.Date}} -X github.com/answerdev/answer/cmd.BuildUser=goreleaser flags: -v goos: - linux @@ -26,7 +26,7 @@ builds: - id: build-windows main: ./cmd/answer/. binary: answer - ldflags: -s -w -X main.Version={{.Version}} -X main.Revision={{.ShortCommit}} -X main.Time={{.Date}} -X main.BuildUser=goreleaser + ldflags: -s -w -X github.com/answerdev/answer/cmd.Version={{.Version}} -X github.com/answerdev/answer/cmd.Revision={{.ShortCommit}} -X github.com/answerdev/answer/cmd.Time={{.Date}} -X github.com/answerdev/answer/cmd.BuildUser=goreleaser flags: -v goos: - windows From f4e4e0b93cbab72f2ec50c2711e1e124d39505bc Mon Sep 17 00:00:00 2001 From: LinkinStars Date: Fri, 18 Aug 2023 10:58:57 +0800 Subject: [PATCH 2/2] fix(login): move action record api to may auth router --- internal/base/server/http.go | 2 +- internal/router/answer_api_router.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/base/server/http.go b/internal/base/server/http.go index faa9e046..c5a5697a 100644 --- a/internal/base/server/http.go +++ b/internal/base/server/http.go @@ -48,7 +48,7 @@ func NewHTTPServer(debug bool, // The route must be available without logging in mustUnAuthV1 := r.Group("/answer/api/v1") - answerRouter.RegisterMustUnAuthAnswerAPIRouter(mustUnAuthV1) + answerRouter.RegisterMustUnAuthAnswerAPIRouter(authUserMiddleware, mustUnAuthV1) // register api that no need to login unAuthV1 := r.Group("/answer/api/v1") diff --git a/internal/router/answer_api_router.go b/internal/router/answer_api_router.go index e02994a2..7fc30b6c 100644 --- a/internal/router/answer_api_router.go +++ b/internal/router/answer_api_router.go @@ -94,7 +94,7 @@ func NewAnswerAPIRouter( } } -func (a *AnswerAPIRouter) RegisterMustUnAuthAnswerAPIRouter(r *gin.RouterGroup) { +func (a *AnswerAPIRouter) RegisterMustUnAuthAnswerAPIRouter(authUserMiddleware *middleware.AuthUserMiddleware, r *gin.RouterGroup) { // i18n r.GET("/language/config", a.langController.GetLangMapping) r.GET("/language/options", a.langController.GetUserLangOptions) @@ -105,6 +105,7 @@ func (a *AnswerAPIRouter) RegisterMustUnAuthAnswerAPIRouter(r *gin.RouterGroup) // user r.GET("/user/info", a.userController.GetUserInfoByUserID) + r.GET("/user/action/record", authUserMiddleware.Auth(), a.userController.ActionRecord) routerGroup := r.Group("", middleware.BanAPIForUserCenter) routerGroup.POST("/user/login/email", a.userController.UserEmailLogin) routerGroup.POST("/user/register/email", a.userController.UserRegisterByEmail) @@ -123,7 +124,6 @@ func (a *AnswerAPIRouter) RegisterUnAuthAnswerAPIRouter(r *gin.RouterGroup) { r.POST("/user/email/verification/send", middleware.BanAPIForUserCenter, a.userController.UserVerifyEmailSend) r.GET("/personal/user/info", a.userController.GetOtherUserInfoByUsername) r.GET("/user/ranking", a.userController.UserRanking) - r.GET("/user/action/record", a.userController.ActionRecord) //answer r.GET("/answer/info", a.answerController.Get)