From e1c2e94ec92db799bdefbbdd6272721884d84c04 Mon Sep 17 00:00:00 2001 From: Xinwei Xiong <3293172751@qq.com> Date: Thu, 4 Jan 2024 14:15:14 +0800 Subject: [PATCH 1/5] Update env-template.yaml (#1670) * Update env-template.yaml * Update env-template.yaml * Update env-template.yaml --- deployments/templates/env-template.yaml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/deployments/templates/env-template.yaml b/deployments/templates/env-template.yaml index e0fd7bc9f..1772af644 100644 --- a/deployments/templates/env-template.yaml +++ b/deployments/templates/env-template.yaml @@ -177,7 +177,6 @@ OPENIM_WS_PORT=${OPENIM_WS_PORT} # Default: API_OPENIM_PORT=10002 API_OPENIM_PORT=${API_OPENIM_PORT} - # ====================================== # ========== OpenIM Chat =============== # ====================================== @@ -188,8 +187,14 @@ CHAT_IMAGE_VERSION=${CHAT_IMAGE_VERSION} # Port for the OpenIM chat API. # Default: OPENIM_CHAT_API_PORT=10008 +# !!! TODO: Do not change the chat port https://github.com/openimsdk/chat/issues/365 OPENIM_CHAT_API_PORT=${OPENIM_CHAT_API_PORT} +# Port for the OpenIM admin API. +# Default: OPENIM_ADMIN_API_PORT=10009 +# !!! TODO: Do not change the chat port https://github.com/openimsdk/chat/issues/365 +OPENIM_ADMIN_API_PORT=${OPENIM_ADMIN_API_PORT} + # Directory path for storing data files or related information for OpenIM chat. # Default: OPENIM_CHAT_DATA_DIR=./openim-chat/main OPENIM_CHAT_DATA_DIR=${OPENIM_CHAT_DATA_DIR} @@ -201,10 +206,6 @@ OPENIM_CHAT_DATA_DIR=${OPENIM_CHAT_DATA_DIR} # Branch name for OpenIM server. # Default: SERVER_IMAGE_VERSION=main SERVER_IMAGE_VERSION=${SERVER_IMAGE_VERSION} - -# Port for the OpenIM admin API. -# Default: OPENIM_ADMIN_API_PORT=10009 -OPENIM_ADMIN_API_PORT=${OPENIM_ADMIN_API_PORT} # Port for the node exporter. # Default: NODE_EXPORTER_PORT=19100 @@ -224,4 +225,4 @@ OPENIM_ADMIN_FRONT_PORT=${OPENIM_ADMIN_FRONT_PORT} # Port for the alertmanager. # Default: ALERT_MANAGER_PORT=19093 -ALERT_MANAGER_PORT=${ALERT_MANAGER_PORT} \ No newline at end of file +ALERT_MANAGER_PORT=${ALERT_MANAGER_PORT} From 09c3229d9d5819732c87938ce55438ec22de1c15 Mon Sep 17 00:00:00 2001 From: Xinwei Xiong <3293172751@qq.com> Date: Thu, 4 Jan 2024 16:01:32 +0800 Subject: [PATCH 2/5] feat(main): fix openim docker start openim server internal port lock (#1673) * fix: fix the bug * fix: fix the imAdmin permission and searchNoficitaion resp * 2023 Annual Summary Reflections and Aspirations Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> --------- Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> Co-authored-by: luhaoling <2198702716@qq.com> --- pkg/authverify/token.go | 1 - scripts/docker-start-all.sh | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/pkg/authverify/token.go b/pkg/authverify/token.go index e810dfecf..4c71224ee 100644 --- a/pkg/authverify/token.go +++ b/pkg/authverify/token.go @@ -76,7 +76,6 @@ func ParseRedisInterfaceToken(redisToken any) (*tokenverify.Claims, error) { func IsManagerUserID(opUserID string) bool { return utils.IsContain(opUserID, config.Config.Manager.UserID) || utils.IsContain(opUserID, config.Config.IMAdmin.UserID) - } func WsVerifyToken(token, userID string, platformID int) error { diff --git a/scripts/docker-start-all.sh b/scripts/docker-start-all.sh index 3c83b02bb..85954a677 100755 --- a/scripts/docker-start-all.sh +++ b/scripts/docker-start-all.sh @@ -21,6 +21,25 @@ set -o pipefail #fixme This scripts is the total startup scripts #fixme The full name of the shell scripts that needs to be started is placed in the need_to_start_server_shell array +# Fixed ports inside the docker startup container +export OPENIM_WS_PORT=10001 +export API_OPENIM_PORT=10002 +export API_PROM_PORT=20100 +export USER_PROM_PORT=20110 +export FRIEND_PROM_PORT=20120 +export MESSAGE_PROM_PORT=20130 +export MSG_GATEWAY_PROM_PORT=20140 +export GROUP_PROM_PORT=20150 +export AUTH_PROM_PORT=20160 +export PUSH_PROM_PORT=20170 +export CONVERSATION_PROM_PORT=20230 +export RTC_PROM_PORT=21300 +export THIRD_PROM_PORT=21301 +export MSG_TRANSFER_PROM_PORT=21400 +export MSG_TRANSFER_PROM_PORT=21401 +export MSG_TRANSFER_PROM_PORT=21402 +export MSG_TRANSFER_PROM_PORT=21403 + OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. source "${OPENIM_ROOT}/scripts/install/common.sh" From d3047d73b69b505203edad3c1ba109e56d2873ef Mon Sep 17 00:00:00 2001 From: Brabem <69128477+luhaoling@users.noreply.github.com> Date: Thu, 4 Jan 2024 16:04:15 +0800 Subject: [PATCH 3/5] fix: dissmissGroup and lack of keyword bug (#1672) * feat: add GetConversationsUnreadSeqAndMaxSeq func * feat: add GetConversationsUnreadSeqAndMaxSeq func * feat: add GetConversationsUnreadSeqAndMaxSeq func * fix: fix the conflect * feat: add GetConversationList Api * fix: fix the error * fix: move the GetConversationList to conversation folder * fix: fix the go.mod * fix: add InitiateFormData and CompleteFormData * fix: fix the error * fix: find error * fix: test * feat: add notification API * fix: find error * fix: fix the error * fix: fix the PinFriend error * fix: fix the Ex error * fix: find the error * fix: fix the rpc error * fix: fix the error * fix: fix the log error * fix: fix the error1 * fix: fix the error * fix: fix the script * fix: fix the error * fix: fix the error * fix: fix the error of tag * fix: fix the protocol * fix: fix the error * fix: fix the error * fix: fix the err not wrap * fix: fix the error * fix: fix GetGroupMembers by nickname * fix: support search userInfo by nickname or userID * fix: fix the search by nickname error * fix: fix the mod --- go.mod | 2 +- go.sum | 4 +-- internal/rpc/group/group.go | 50 ++++++++++++++++++++++++++++++++----- 3 files changed, 47 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index f1b3239c3..f10e123a0 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( firebase.google.com/go v3.13.0+incompatible - github.com/OpenIMSDK/protocol v0.0.43 + github.com/OpenIMSDK/protocol v0.0.44 github.com/OpenIMSDK/tools v0.0.21 github.com/bwmarrin/snowflake v0.3.0 // indirect github.com/dtm-labs/rockscache v0.1.1 diff --git a/go.sum b/go.sum index e72d862e6..34f5d3ae9 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ firebase.google.com/go v3.13.0+incompatible/go.mod h1:xlah6XbEyW6tbfSklcfe5FHJIw github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/IBM/sarama v1.41.3 h1:MWBEJ12vHC8coMjdEXFq/6ftO6DUZnQlFYcxtOJFa7c= github.com/IBM/sarama v1.41.3/go.mod h1:Xxho9HkHd4K/MDUo/T/sOqwtX/17D33++E9Wib6hUdQ= -github.com/OpenIMSDK/protocol v0.0.43 h1:8B921vEyO7r0AfQfZd7kCycYja+hJ2vuIZsKge/WRhU= -github.com/OpenIMSDK/protocol v0.0.43/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y= +github.com/OpenIMSDK/protocol v0.0.44 h1:P+9gJ9EW3y+VmzrjPludzn/5r1fjubaC19mKYJ7Oiew= +github.com/OpenIMSDK/protocol v0.0.44/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y= github.com/OpenIMSDK/tools v0.0.21 h1:iTapc2mIEVH/xl5Nd6jfwPub11Pgp44tVcE1rjB3a48= github.com/OpenIMSDK/tools v0.0.21/go.mod h1:eg+q4A34Qmu73xkY0mt37FHGMCMfC6CtmOnm0kFEGFI= github.com/QcloudApi/qcloud_sign_golang v0.0.0-20141224014652-e4130a326409/go.mod h1:1pk82RBxDY/JZnPQrtqHlUFfCctgdorsd9M06fMynOM= diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index ba129d7e9..b1ea0aa03 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -476,13 +476,42 @@ func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbgroup.GetGro func (s *groupServer) GetGroupMemberList(ctx context.Context, req *pbgroup.GetGroupMemberListReq) (*pbgroup.GetGroupMemberListResp, error) { resp := &pbgroup.GetGroupMemberListResp{} - total, members, err := s.db.PageGetGroupMember(ctx, req.GroupID, req.Pagination) + var ( + total int64 + members []*relationtb.GroupMemberModel + err error + ) + if req.Keyword == "" { + total, members, err = s.db.PageGetGroupMember(ctx, req.GroupID, req.Pagination) + } else { + members, err = s.db.FindGroupMemberAll(ctx, req.GroupID) + } if err != nil { return nil, err } if err := s.PopulateGroupMember(ctx, members...); err != nil { return nil, err } + if req.Keyword != "" { + groupMembers := make([]*relationtb.GroupMemberModel, 0) + for _, member := range members { + if member.UserID == req.Keyword { + groupMembers = append(groupMembers, member) + total++ + continue + } + if member.Nickname == req.Keyword { + groupMembers = append(groupMembers, member) + total++ + continue + } + } + + GMembers := utils.Paginate(groupMembers, int(req.Pagination.GetPageNumber()), int(req.Pagination.GetShowNumber())) + resp.Members = utils.Batch(convert.Db2PbGroupMember, GMembers) + resp.Total = uint32(total) + return resp, nil + } resp.Total = uint32(total) resp.Members = utils.Batch(convert.Db2PbGroupMember, members) return resp, nil @@ -1042,20 +1071,29 @@ func (s *groupServer) TransferGroupOwner(ctx context.Context, req *pbgroup.Trans func (s *groupServer) GetGroups(ctx context.Context, req *pbgroup.GetGroupsReq) (*pbgroup.GetGroupsResp, error) { resp := &pbgroup.GetGroupsResp{} var ( - groups []*relationtb.GroupModel - err error + group []*relationtb.GroupModel + err error ) if req.GroupID != "" { - groups, err = s.db.FindGroup(ctx, []string{req.GroupID}) - resp.Total = uint32(len(groups)) + group, err = s.db.FindGroup(ctx, []string{req.GroupID}) + resp.Total = uint32(len(group)) } else { var total int64 - total, groups, err = s.db.SearchGroup(ctx, req.GroupName, req.Pagination) + total, group, err = s.db.SearchGroup(ctx, req.GroupName, req.Pagination) resp.Total = uint32(total) } if err != nil { return nil, err } + + var groups []*relationtb.GroupModel + for _, v := range group { + if v.Status == constant.GroupStatusDismissed { + resp.Total-- + continue + } + groups = append(groups, v) + } groupIDs := utils.Slice(groups, func(e *relationtb.GroupModel) string { return e.GroupID }) From b19d1f1726b32a7c704817d2a3d7a9e7ecbf9aa2 Mon Sep 17 00:00:00 2001 From: Xinwei Xiong <3293172751@qq.com> Date: Thu, 4 Jan 2024 17:39:32 +0800 Subject: [PATCH 4/5] Update docker-start-all.sh --- scripts/docker-start-all.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/scripts/docker-start-all.sh b/scripts/docker-start-all.sh index 85954a677..d3eb67979 100755 --- a/scripts/docker-start-all.sh +++ b/scripts/docker-start-all.sh @@ -35,10 +35,6 @@ export PUSH_PROM_PORT=20170 export CONVERSATION_PROM_PORT=20230 export RTC_PROM_PORT=21300 export THIRD_PROM_PORT=21301 -export MSG_TRANSFER_PROM_PORT=21400 -export MSG_TRANSFER_PROM_PORT=21401 -export MSG_TRANSFER_PROM_PORT=21402 -export MSG_TRANSFER_PROM_PORT=21403 OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. source "${OPENIM_ROOT}/scripts/install/common.sh" @@ -55,4 +51,4 @@ sleep 5 "${OPENIM_ROOT}"/scripts/check-all.sh -tail -f ${LOG_FILE} \ No newline at end of file +tail -f ${LOG_FILE} From 58ab340d1ea1293370ce2b301ad226b47f8f5c58 Mon Sep 17 00:00:00 2001 From: OpenIM Bot <124379614+kubbot@users.noreply.github.com> Date: Thu, 4 Jan 2024 17:42:57 +0800 Subject: [PATCH 5/5] Update env-template.yaml --- deployments/templates/env-template.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/deployments/templates/env-template.yaml b/deployments/templates/env-template.yaml index 1772af644..d501bbbc4 100644 --- a/deployments/templates/env-template.yaml +++ b/deployments/templates/env-template.yaml @@ -187,18 +187,12 @@ CHAT_IMAGE_VERSION=${CHAT_IMAGE_VERSION} # Port for the OpenIM chat API. # Default: OPENIM_CHAT_API_PORT=10008 -# !!! TODO: Do not change the chat port https://github.com/openimsdk/chat/issues/365 OPENIM_CHAT_API_PORT=${OPENIM_CHAT_API_PORT} # Port for the OpenIM admin API. # Default: OPENIM_ADMIN_API_PORT=10009 -# !!! TODO: Do not change the chat port https://github.com/openimsdk/chat/issues/365 OPENIM_ADMIN_API_PORT=${OPENIM_ADMIN_API_PORT} -# Directory path for storing data files or related information for OpenIM chat. -# Default: OPENIM_CHAT_DATA_DIR=./openim-chat/main -OPENIM_CHAT_DATA_DIR=${OPENIM_CHAT_DATA_DIR} - # ====================================== # ========== OpenIM Admin ============== # ======================================