diff --git a/go.mod b/go.mod index b66f01b2..2b84c4af 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( github.com/livekit/protocol v1.10.1 github.com/mitchellh/mapstructure v1.5.0 github.com/openimsdk/gomake v0.0.14-alpha.5 - github.com/openimsdk/protocol v0.0.72-alpha.38 + github.com/openimsdk/protocol v0.0.72 github.com/openimsdk/tools v0.0.50-alpha.15 github.com/redis/go-redis/v9 v9.5.1 github.com/spf13/cobra v1.8.0 diff --git a/go.sum b/go.sum index 2af777e3..a4f7c8ac 100644 --- a/go.sum +++ b/go.sum @@ -187,8 +187,8 @@ github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OS github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/openimsdk/gomake v0.0.14-alpha.5 h1:VY9c5x515lTfmdhhPjMvR3BBRrRquAUCFsz7t7vbv7Y= github.com/openimsdk/gomake v0.0.14-alpha.5/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI= -github.com/openimsdk/protocol v0.0.72-alpha.38 h1:v0GLgS9cNm627NSG3B2k2VF2AMoo90DSKixxiBMKPS4= -github.com/openimsdk/protocol v0.0.72-alpha.38/go.mod h1:OZQA9FR55lseYoN2Ql1XAHYKHJGu7OMNkUbuekrKCM8= +github.com/openimsdk/protocol v0.0.72 h1:K+vslwaR7lDXyBzb07UuEQITaqsgighz7NyXVIWsu6A= +github.com/openimsdk/protocol v0.0.72/go.mod h1:OZQA9FR55lseYoN2Ql1XAHYKHJGu7OMNkUbuekrKCM8= github.com/openimsdk/tools v0.0.50-alpha.15 h1:HV9aKZ4vvCZCGG4wFDsgUONkkdJeCcrFNn3BT52nUVQ= github.com/openimsdk/tools v0.0.50-alpha.15/go.mod h1:h1cYmfyaVtgFbKmb1Cfsl8XwUOMTt8ubVUQrdGtsUh4= github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= diff --git a/internal/api/admin/admin.go b/internal/api/admin/admin.go index 28031ee0..7e0a4489 100644 --- a/internal/api/admin/admin.go +++ b/internal/api/admin/admin.go @@ -72,7 +72,7 @@ func (o *Api) AdminLogin(c *gin.Context) { return } imAdminUserID := o.GetDefaultIMAdminUserID() - imToken, err := o.imApiCaller.AdminToken(c, imAdminUserID) + imToken, err := o.imApiCaller.GetAdminToken(c, imAdminUserID) if err != nil { apiresp.GinError(c, err) return @@ -127,7 +127,7 @@ func (o *Api) AdminUpdateInfo(c *gin.Context) { } imAdminUserID := o.GetDefaultIMAdminUserID() - imToken, err := o.imApiCaller.AdminToken(c, imAdminUserID) + imToken, err := o.imApiCaller.GetAdminToken(c, imAdminUserID) if err != nil { log.ZError(c, "AdminUpdateInfo ImAdminTokenWithDefaultAdmin", err, "imAdminUserID", imAdminUserID) return @@ -207,7 +207,7 @@ func (o *Api) AddDefaultGroup(c *gin.Context) { apiresp.GinError(c, err) return } - imToken, err := o.imApiCaller.AdminToken(c, o.GetDefaultIMAdminUserID()) + imToken, err := o.imApiCaller.GetAdminToken(c, o.GetDefaultIMAdminUserID()) if err != nil { apiresp.GinError(c, err) return @@ -255,7 +255,7 @@ func (o *Api) SearchDefaultGroup(c *gin.Context) { Groups: make([]*sdkws.GroupInfo, 0, len(searchResp.GroupIDs)), } if len(searchResp.GroupIDs) > 0 { - imToken, err := o.imApiCaller.AdminToken(c, o.GetDefaultIMAdminUserID()) + imToken, err := o.imApiCaller.GetAdminToken(c, o.GetDefaultIMAdminUserID()) if err != nil { apiresp.GinError(c, err) return @@ -337,7 +337,7 @@ func (o *Api) BlockUser(c *gin.Context) { apiresp.GinError(c, err) return } - imToken, err := o.imApiCaller.AdminToken(c, o.GetDefaultIMAdminUserID()) + imToken, err := o.imApiCaller.GetAdminToken(c, o.GetDefaultIMAdminUserID()) if err != nil { apiresp.GinError(c, err) return @@ -396,7 +396,7 @@ func (o *Api) NewUserCount(c *gin.Context) { apiresp.GinError(c, err) return } - imToken, err := o.imApiCaller.AdminToken(c, o.GetDefaultIMAdminUserID()) + imToken, err := o.imApiCaller.GetAdminToken(c, o.GetDefaultIMAdminUserID()) if err != nil { apiresp.GinError(c, err) return diff --git a/internal/api/chat/chat.go b/internal/api/chat/chat.go index 131c8539..eca5e3bb 100644 --- a/internal/api/chat/chat.go +++ b/internal/api/chat/chat.go @@ -244,7 +244,7 @@ func (o *Api) UpdateUserInfo(c *gin.Context) { if opUserType == constant.NormalUser { imToken, err = o.imApiCaller.ImAdminTokenWithDefaultAdmin(c) } else if opUserType == constant.AdminUser { - imToken, err = o.imApiCaller.AdminToken(c, o.GetDefaultIMAdminUserID()) + imToken, err = o.imApiCaller.GetAdminToken(c, o.GetDefaultIMAdminUserID()) } else { apiresp.GinError(c, errs.ErrArgs.WrapMsg("opUserType unknown")) return diff --git a/pkg/common/imapi/api.go b/pkg/common/imapi/api.go index 3586a960..60891be0 100644 --- a/pkg/common/imapi/api.go +++ b/pkg/common/imapi/api.go @@ -24,7 +24,7 @@ import ( // im caller. var ( importFriend = NewApiCaller[relation.ImportFriendReq, relation.ImportFriendResp]("/friend/import_friend") - userToken = NewApiCaller[auth.UserTokenReq, auth.UserTokenResp]("/auth/user_token") + getAdminToken = NewApiCaller[auth.GetAdminTokenReq, auth.GetAdminTokenResp]("/auth/get_admin_token") getuserToken = NewApiCaller[auth.GetUserTokenReq, auth.GetUserTokenResp]("/auth/get_user_token") inviteToGroup = NewApiCaller[group.InviteUserToGroupReq, group.InviteUserToGroupResp]("/group/invite_user_to_group") updateUserInfo = NewApiCaller[user.UpdateUserInfoReq, user.UpdateUserInfoResp]("/user/update_user_info") diff --git a/pkg/common/imapi/caller.go b/pkg/common/imapi/caller.go index e0573fae..0a3923cb 100644 --- a/pkg/common/imapi/caller.go +++ b/pkg/common/imapi/caller.go @@ -35,7 +35,7 @@ type CallerInterface interface { ImAdminTokenWithDefaultAdmin(ctx context.Context) (string, error) ImportFriend(ctx context.Context, ownerUserID string, friendUserID []string) error GetUserToken(ctx context.Context, userID string, platform int32) (string, error) - AdminToken(ctx context.Context, userID string) (string, error) + GetAdminToken(ctx context.Context, userID string) (string, error) InviteToGroup(ctx context.Context, userID string, groupIDs []string) error UpdateUserInfo(ctx context.Context, userID string, nickName string, faceURL string) error ForceOffLine(ctx context.Context, userID string) error @@ -79,7 +79,7 @@ func (c *Caller) ImAdminTokenWithDefaultAdmin(ctx context.Context) (string, erro defer c.lock.Unlock() if c.token == "" || c.timeout.Before(time.Now()) { userID := c.defaultIMUserID - token, err := c.AdminToken(ctx, userID) + token, err := c.GetAdminToken(ctx, userID) if err != nil { log.ZError(ctx, "get im admin token", err, "userID", userID) return "", err @@ -91,8 +91,8 @@ func (c *Caller) ImAdminTokenWithDefaultAdmin(ctx context.Context) (string, erro return c.token, nil } -func (c *Caller) AdminToken(ctx context.Context, userID string) (string, error) { - resp, err := userToken.Call(ctx, c.imApi, &auth.UserTokenReq{ +func (c *Caller) GetAdminToken(ctx context.Context, userID string) (string, error) { + resp, err := getAdminToken.Call(ctx, c.imApi, &auth.GetAdminTokenReq{ Secret: c.imSecret, UserID: userID, }) diff --git a/tools/check-component/main.go b/tools/check-component/main.go index 00ccd43b..ab7676a1 100644 --- a/tools/check-component/main.go +++ b/tools/check-component/main.go @@ -57,7 +57,7 @@ func CheckRedis(ctx context.Context, config *config.Redis) error { func CheckOpenIM(ctx context.Context, apiURL, secret, adminUserID string) error { imAPI := imapi.New(apiURL, secret, adminUserID) - _, err := imAPI.AdminToken(mcontext.SetOperationID(ctx, "CheckOpenIM"+idutil.OperationIDGenerator()), adminUserID) + _, err := imAPI.GetAdminToken(mcontext.SetOperationID(ctx, "CheckOpenIM"+idutil.OperationIDGenerator()), adminUserID) return err }