mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-30 18:53:41 +08:00
Merge remote-tracking branch 'origin/v2.3.0release' into v2.3.0release
This commit is contained in:
commit
cda0fb6a10
@ -2,7 +2,7 @@
|
|||||||
# The class cannot be named by Pascal or camel case.
|
# The class cannot be named by Pascal or camel case.
|
||||||
# If it is not used, the corresponding structure will not be set,
|
# If it is not used, the corresponding structure will not be set,
|
||||||
# and it will not be read naturally.
|
# and it will not be read naturally.
|
||||||
serverversion: 2.3.0-rc2
|
serverversion: 2.3.0
|
||||||
#---------------Infrastructure configuration---------------------#
|
#---------------Infrastructure configuration---------------------#
|
||||||
etcd:
|
etcd:
|
||||||
etcdSchema: openim #默认即可
|
etcdSchema: openim #默认即可
|
||||||
|
@ -126,7 +126,7 @@ services:
|
|||||||
# STORE_PORT: 3306
|
# STORE_PORT: 3306
|
||||||
|
|
||||||
open_im_server:
|
open_im_server:
|
||||||
image: openim/open_im_server:v2.3.0-rc2
|
image: openim/open_im_server:v2.3.0
|
||||||
container_name: open_im_server
|
container_name: open_im_server
|
||||||
volumes:
|
volumes:
|
||||||
- ./logs:/Open-IM-Server/logs
|
- ./logs:/Open-IM-Server/logs
|
||||||
|
@ -12,6 +12,7 @@ import (
|
|||||||
"Open_IM/pkg/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"github.com/golang/protobuf/ptypes/wrappers"
|
"github.com/golang/protobuf/ptypes/wrappers"
|
||||||
|
"google.golang.org/grpc"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|
||||||
@ -227,8 +228,9 @@ func GetGroupAllMemberList(c *gin.Context) {
|
|||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
maxSizeOption := grpc.MaxCallRecvMsgSize(1024 * 1024 * constant.GroupRPCRecvSize)
|
||||||
client := rpc.NewGroupClient(etcdConn)
|
client := rpc.NewGroupClient(etcdConn)
|
||||||
RpcResp, err := client.GetGroupAllMember(context.Background(), req)
|
RpcResp, err := client.GetGroupAllMember(context.Background(), req, maxSizeOption)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(req.OperationID, "GetGroupAllMember failed err", err.Error(), req.String())
|
log.NewError(req.OperationID, "GetGroupAllMember failed err", err.Error(), req.String())
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
|
||||||
|
@ -61,8 +61,8 @@ func (s *groupServer) Run() {
|
|||||||
log.NewInfo("", "listen network success, ", address, listener)
|
log.NewInfo("", "listen network success, ", address, listener)
|
||||||
defer listener.Close()
|
defer listener.Close()
|
||||||
//grpc server
|
//grpc server
|
||||||
recvSize := 1024 * 1024 * 30
|
recvSize := 1024 * 1024 * constant.GroupRPCRecvSize
|
||||||
sendSize := 1024 * 1024 * 30
|
sendSize := 1024 * 1024 * constant.GroupRPCSendSize
|
||||||
var options = []grpc.ServerOption{
|
var options = []grpc.ServerOption{
|
||||||
grpc.MaxRecvMsgSize(recvSize),
|
grpc.MaxRecvMsgSize(recvSize),
|
||||||
grpc.MaxSendMsgSize(sendSize),
|
grpc.MaxSendMsgSize(sendSize),
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
"Open_IM/pkg/common/constant"
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/db"
|
"Open_IM/pkg/common/db"
|
||||||
|
rocksCache "Open_IM/pkg/common/db/rocks_cache"
|
||||||
"Open_IM/pkg/common/log"
|
"Open_IM/pkg/common/log"
|
||||||
"Open_IM/pkg/common/token_verify"
|
"Open_IM/pkg/common/token_verify"
|
||||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||||
@ -69,14 +70,14 @@ func isMessageHasReadEnabled(pb *pbChat.SendMsgReq) (bool, int32, string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func messageVerification(data *pbChat.SendMsgReq) (bool, int32, string, []string) {
|
func messageVerification(data *pbChat.SendMsgReq) (bool, int32, string, []string) {
|
||||||
|
if utils.IsContain(data.MsgData.SendID, config.Config.Manager.AppManagerUid) {
|
||||||
|
return true, 0, "", nil
|
||||||
|
}
|
||||||
|
if data.MsgData.ContentType <= constant.NotificationEnd && data.MsgData.ContentType >= constant.NotificationBegin {
|
||||||
|
return true, 0, "", nil
|
||||||
|
}
|
||||||
switch data.MsgData.SessionType {
|
switch data.MsgData.SessionType {
|
||||||
case constant.SingleChatType:
|
case constant.SingleChatType:
|
||||||
if utils.IsContain(data.MsgData.SendID, config.Config.Manager.AppManagerUid) {
|
|
||||||
return true, 0, "", nil
|
|
||||||
}
|
|
||||||
if data.MsgData.ContentType <= constant.NotificationEnd && data.MsgData.ContentType >= constant.NotificationBegin {
|
|
||||||
return true, 0, "", nil
|
|
||||||
}
|
|
||||||
log.NewDebug(data.OperationID, config.Config.MessageVerify.FriendVerify)
|
log.NewDebug(data.OperationID, config.Config.MessageVerify.FriendVerify)
|
||||||
reqGetBlackIDListFromCache := &cacheRpc.GetBlackIDListFromCacheReq{UserID: data.MsgData.RecvID, OperationID: data.OperationID}
|
reqGetBlackIDListFromCache := &cacheRpc.GetBlackIDListFromCacheReq{UserID: data.MsgData.RecvID, OperationID: data.OperationID}
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, data.OperationID)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, data.OperationID)
|
||||||
@ -128,34 +129,41 @@ func messageVerification(data *pbChat.SendMsgReq) (bool, int32, string, []string
|
|||||||
case constant.GroupChatType:
|
case constant.GroupChatType:
|
||||||
fallthrough
|
fallthrough
|
||||||
case constant.SuperGroupChatType:
|
case constant.SuperGroupChatType:
|
||||||
getGroupMemberIDListFromCacheReq := &pbCache.GetGroupMemberIDListFromCacheReq{OperationID: data.OperationID, GroupID: data.MsgData.GroupID}
|
groupInfo, err := rocksCache.GetGroupInfoFromCache(data.MsgData.GroupID)
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, data.OperationID)
|
|
||||||
if etcdConn == nil {
|
|
||||||
errMsg := data.OperationID + "getcdv3.GetConn == nil"
|
|
||||||
log.NewError(data.OperationID, errMsg)
|
|
||||||
//return returnMsg(&replay, pb, 201, errMsg, "", 0)
|
|
||||||
return false, 201, errMsg, nil
|
|
||||||
}
|
|
||||||
client := pbCache.NewCacheClient(etcdConn)
|
|
||||||
cacheResp, err := client.GetGroupMemberIDListFromCache(context.Background(), getGroupMemberIDListFromCacheReq)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError(data.OperationID, "GetGroupMemberIDListFromCache rpc call failed ", err.Error())
|
|
||||||
//return returnMsg(&replay, pb, 201, "GetGroupMemberIDListFromCache failed", "", 0)
|
|
||||||
return false, 201, err.Error(), nil
|
return false, 201, err.Error(), nil
|
||||||
}
|
}
|
||||||
if cacheResp.CommonResp.ErrCode != 0 {
|
if groupInfo.GroupType == constant.SuperGroup {
|
||||||
log.NewError(data.OperationID, "GetGroupMemberIDListFromCache rpc logic call failed ", cacheResp.String())
|
return true, 0, "", nil
|
||||||
//return returnMsg(&replay, pb, 201, "GetGroupMemberIDListFromCache logic failed", "", 0)
|
} else {
|
||||||
return false, cacheResp.CommonResp.ErrCode, cacheResp.CommonResp.ErrMsg, nil
|
getGroupMemberIDListFromCacheReq := &pbCache.GetGroupMemberIDListFromCacheReq{OperationID: data.OperationID, GroupID: data.MsgData.GroupID}
|
||||||
}
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, data.OperationID)
|
||||||
if !token_verify.IsManagerUserID(data.MsgData.SendID) {
|
if etcdConn == nil {
|
||||||
if !utils.IsContain(data.MsgData.SendID, cacheResp.UserIDList) {
|
errMsg := data.OperationID + "getcdv3.GetConn == nil"
|
||||||
//return returnMsg(&replay, pb, 202, "you are not in group", "", 0)
|
log.NewError(data.OperationID, errMsg)
|
||||||
return false, 202, "you are not in group", nil
|
//return returnMsg(&replay, pb, 201, errMsg, "", 0)
|
||||||
|
return false, 201, errMsg, nil
|
||||||
}
|
}
|
||||||
|
client := pbCache.NewCacheClient(etcdConn)
|
||||||
|
cacheResp, err := client.GetGroupMemberIDListFromCache(context.Background(), getGroupMemberIDListFromCacheReq)
|
||||||
|
if err != nil {
|
||||||
|
log.NewError(data.OperationID, "GetGroupMemberIDListFromCache rpc call failed ", err.Error())
|
||||||
|
//return returnMsg(&replay, pb, 201, "GetGroupMemberIDListFromCache failed", "", 0)
|
||||||
|
return false, 201, err.Error(), nil
|
||||||
|
}
|
||||||
|
if cacheResp.CommonResp.ErrCode != 0 {
|
||||||
|
log.NewError(data.OperationID, "GetGroupMemberIDListFromCache rpc logic call failed ", cacheResp.String())
|
||||||
|
//return returnMsg(&replay, pb, 201, "GetGroupMemberIDListFromCache logic failed", "", 0)
|
||||||
|
return false, cacheResp.CommonResp.ErrCode, cacheResp.CommonResp.ErrMsg, nil
|
||||||
|
}
|
||||||
|
if !token_verify.IsManagerUserID(data.MsgData.SendID) {
|
||||||
|
if !utils.IsContain(data.MsgData.SendID, cacheResp.UserIDList) {
|
||||||
|
//return returnMsg(&replay, pb, 202, "you are not in group", "", 0)
|
||||||
|
return false, 202, "you are not in group", nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true, 0, "", cacheResp.UserIDList
|
||||||
}
|
}
|
||||||
return true, 0, "", cacheResp.UserIDList
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return true, 0, "", nil
|
return true, 0, "", nil
|
||||||
}
|
}
|
||||||
|
@ -287,6 +287,11 @@ const (
|
|||||||
Directly = 2 //直接进群
|
Directly = 2 //直接进群
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
GroupRPCRecvSize = 30
|
||||||
|
GroupRPCSendSize = 30
|
||||||
|
)
|
||||||
|
|
||||||
const FriendAcceptTip = "You have successfully become friends, so start chatting"
|
const FriendAcceptTip = "You have successfully become friends, so start chatting"
|
||||||
|
|
||||||
func GroupIsBanChat(status int32) bool {
|
func GroupIsBanChat(status int32) bool {
|
||||||
|
@ -1074,7 +1074,8 @@ func (d *DataBases) GetSuperGroupByUserID(userID string) (UserToSuperGroup, erro
|
|||||||
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
|
ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second)
|
||||||
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cUserToSuperGroup)
|
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cUserToSuperGroup)
|
||||||
var user UserToSuperGroup
|
var user UserToSuperGroup
|
||||||
return user, c.FindOne(ctx, bson.M{"user_id": userID}).Decode(&user)
|
_ = c.FindOne(ctx, bson.M{"user_id": userID}).Decode(&user)
|
||||||
|
return user, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DataBases) DeleteSuperGroup(groupID string) error {
|
func (d *DataBases) DeleteSuperGroup(groupID string) error {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -262,6 +262,8 @@ message MsgData {
|
|||||||
OfflinePushInfo offlinePushInfo = 19;
|
OfflinePushInfo offlinePushInfo = 19;
|
||||||
repeated string atUserIDList = 20;
|
repeated string atUserIDList = 20;
|
||||||
bytes msgDataList = 21;
|
bytes msgDataList = 21;
|
||||||
|
string attachedInfo = 22;
|
||||||
|
string ex = 23;
|
||||||
|
|
||||||
}
|
}
|
||||||
message OfflinePushInfo{
|
message OfflinePushInfo{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user