mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-09 11:35:59 +08:00
Feat: Refactor project's references to shared modules (#672)
* fix: to start im or chat, ZooKeeper must be started first. * fix: msg gateway start output err info Signed-off-by: Gordon <1432970085@qq.com> * fix: msg gateway start output err info Signed-off-by: Gordon <1432970085@qq.com> * chore: package path changes Signed-off-by: withchao <993506633@qq.com> * fix: go mod update Signed-off-by: Gordon <1432970085@qq.com> * fix: token update Signed-off-by: Gordon <1432970085@qq.com> * chore: package path changes Signed-off-by: withchao <993506633@qq.com> * chore: package path changes Signed-off-by: withchao <993506633@qq.com> * fix: token update Signed-off-by: Gordon <1432970085@qq.com> * fix: token update Signed-off-by: Gordon <1432970085@qq.com> * fix: token update Signed-off-by: Gordon <1432970085@qq.com> * fix: token update Signed-off-by: Gordon <1432970085@qq.com> * fix: token update Signed-off-by: Gordon <1432970085@qq.com> --------- Signed-off-by: Gordon <1432970085@qq.com> Signed-off-by: withchao <993506633@qq.com> Co-authored-by: withchao <993506633@qq.com>
This commit is contained in:
@@ -19,9 +19,9 @@ import (
|
||||
|
||||
"github.com/redis/go-redis/v9"
|
||||
|
||||
"github.com/OpenIMSDK/protocol/constant"
|
||||
"github.com/OpenIMSDK/protocol/msg"
|
||||
"github.com/OpenIMSDK/protocol/sdkws"
|
||||
"github.com/OpenIMSDK/tools/constant"
|
||||
"github.com/OpenIMSDK/tools/errs"
|
||||
"github.com/OpenIMSDK/tools/log"
|
||||
)
|
||||
|
||||
@@ -20,10 +20,10 @@ import (
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
cbapi "github.com/OpenIMSDK/Open-IM-Server/pkg/callbackstruct"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/http"
|
||||
"github.com/OpenIMSDK/protocol/constant"
|
||||
pbChat "github.com/OpenIMSDK/protocol/msg"
|
||||
"github.com/OpenIMSDK/tools/config"
|
||||
"github.com/OpenIMSDK/tools/constant"
|
||||
"github.com/OpenIMSDK/tools/errs"
|
||||
"github.com/OpenIMSDK/tools/log"
|
||||
"github.com/OpenIMSDK/tools/mcontext"
|
||||
|
||||
@@ -16,13 +16,13 @@ package msg
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
|
||||
|
||||
"github.com/OpenIMSDK/protocol/constant"
|
||||
"github.com/OpenIMSDK/protocol/conversation"
|
||||
"github.com/OpenIMSDK/protocol/msg"
|
||||
"github.com/OpenIMSDK/protocol/sdkws"
|
||||
"github.com/OpenIMSDK/tools/constant"
|
||||
"github.com/OpenIMSDK/tools/log"
|
||||
"github.com/OpenIMSDK/tools/tokenverify"
|
||||
"github.com/OpenIMSDK/tools/utils"
|
||||
)
|
||||
|
||||
@@ -45,7 +45,7 @@ func (m *msgServer) ClearConversationsMsg(
|
||||
ctx context.Context,
|
||||
req *msg.ClearConversationsMsgReq,
|
||||
) (*msg.ClearConversationsMsgResp, error) {
|
||||
if err := tokenverify.CheckAccessV3(ctx, req.UserID); err != nil {
|
||||
if err := authverify.CheckAccessV3(ctx, req.UserID); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := m.clearConversation(ctx, req.ConversationIDs, req.UserID, req.DeleteSyncOpt); err != nil {
|
||||
@@ -58,7 +58,7 @@ func (m *msgServer) UserClearAllMsg(
|
||||
ctx context.Context,
|
||||
req *msg.UserClearAllMsgReq,
|
||||
) (*msg.UserClearAllMsgResp, error) {
|
||||
if err := tokenverify.CheckAccessV3(ctx, req.UserID); err != nil {
|
||||
if err := authverify.CheckAccessV3(ctx, req.UserID); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
conversationIDs, err := m.ConversationLocalCache.GetConversationIDs(ctx, req.UserID)
|
||||
@@ -73,7 +73,7 @@ func (m *msgServer) UserClearAllMsg(
|
||||
}
|
||||
|
||||
func (m *msgServer) DeleteMsgs(ctx context.Context, req *msg.DeleteMsgsReq) (*msg.DeleteMsgsResp, error) {
|
||||
if err := tokenverify.CheckAccessV3(ctx, req.UserID); err != nil {
|
||||
if err := authverify.CheckAccessV3(ctx, req.UserID); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
isSyncSelf, isSyncOther := m.validateDeleteSyncOpt(req.DeleteSyncOpt)
|
||||
@@ -121,7 +121,7 @@ func (m *msgServer) DeleteMsgPhysical(
|
||||
ctx context.Context,
|
||||
req *msg.DeleteMsgPhysicalReq,
|
||||
) (*msg.DeleteMsgPhysicalResp, error) {
|
||||
if err := tokenverify.CheckAdmin(ctx); err != nil {
|
||||
if err := authverify.CheckAdmin(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
remainTime := utils.GetCurrentTimestampBySecond() - req.Timestamp
|
||||
|
||||
@@ -17,10 +17,10 @@ package msg
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
||||
"github.com/OpenIMSDK/protocol/constant"
|
||||
"github.com/OpenIMSDK/protocol/msg"
|
||||
"github.com/OpenIMSDK/protocol/sdkws"
|
||||
"github.com/OpenIMSDK/tools/config"
|
||||
"github.com/OpenIMSDK/tools/constant"
|
||||
"github.com/OpenIMSDK/tools/errs"
|
||||
)
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ package msg
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/OpenIMSDK/protocol/constant"
|
||||
pbMsg "github.com/OpenIMSDK/protocol/msg"
|
||||
"github.com/OpenIMSDK/tools/constant"
|
||||
"github.com/OpenIMSDK/tools/mcontext"
|
||||
)
|
||||
|
||||
|
||||
@@ -17,15 +17,15 @@ package msg
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
|
||||
"time"
|
||||
|
||||
unRelationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
|
||||
"github.com/OpenIMSDK/protocol/constant"
|
||||
"github.com/OpenIMSDK/protocol/msg"
|
||||
"github.com/OpenIMSDK/protocol/sdkws"
|
||||
"github.com/OpenIMSDK/tools/constant"
|
||||
"github.com/OpenIMSDK/tools/errs"
|
||||
"github.com/OpenIMSDK/tools/log"
|
||||
"github.com/OpenIMSDK/tools/tokenverify"
|
||||
"github.com/OpenIMSDK/tools/utils"
|
||||
)
|
||||
|
||||
@@ -40,7 +40,7 @@ func (m *msgServer) RevokeMsg(ctx context.Context, req *msg.RevokeMsgReq) (*msg.
|
||||
if req.Seq < 0 {
|
||||
return nil, errs.ErrArgs.Wrap("seq is invalid")
|
||||
}
|
||||
if err := tokenverify.CheckAccessV3(ctx, req.UserID); err != nil {
|
||||
if err := authverify.CheckAccessV3(ctx, req.UserID); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
user, err := m.User.GetUserInfo(ctx, req.UserID)
|
||||
@@ -60,10 +60,10 @@ func (m *msgServer) RevokeMsg(ctx context.Context, req *msg.RevokeMsgReq) (*msg.
|
||||
data, _ := json.Marshal(msgs[0])
|
||||
log.ZInfo(ctx, "GetMsgBySeqs", "conversationID", req.ConversationID, "seq", req.Seq, "msg", string(data))
|
||||
var role int32
|
||||
if !tokenverify.IsAppManagerUid(ctx) {
|
||||
if !authverify.IsAppManagerUid(ctx) {
|
||||
switch msgs[0].SessionType {
|
||||
case constant.SingleChatType:
|
||||
if err := tokenverify.CheckAccessV3(ctx, msgs[0].SendID); err != nil {
|
||||
if err := authverify.CheckAccessV3(ctx, msgs[0].SendID); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
role = user.AppMangerLevel
|
||||
|
||||
@@ -16,13 +16,14 @@ package msg
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor"
|
||||
|
||||
promePkg "github.com/OpenIMSDK/Open-IM-Server/pkg/common/prome"
|
||||
"github.com/OpenIMSDK/protocol/constant"
|
||||
pbConversation "github.com/OpenIMSDK/protocol/conversation"
|
||||
pbMsg "github.com/OpenIMSDK/protocol/msg"
|
||||
"github.com/OpenIMSDK/protocol/sdkws"
|
||||
"github.com/OpenIMSDK/protocol/wrapperspb"
|
||||
"github.com/OpenIMSDK/tools/constant"
|
||||
"github.com/OpenIMSDK/tools/errs"
|
||||
"github.com/OpenIMSDK/tools/log"
|
||||
"github.com/OpenIMSDK/tools/mcontext"
|
||||
@@ -90,7 +91,7 @@ func (m *msgServer) setConversationAtInfo(nctx context.Context, msg *sdkws.MsgDa
|
||||
ctx := mcontext.NewCtx("@@@" + mcontext.GetOperationID(nctx))
|
||||
var atUserID []string
|
||||
conversation := &pbConversation.ConversationReq{
|
||||
ConversationID: utils.GetConversationIDByMsg(msg),
|
||||
ConversationID: msgprocessor.GetConversationIDByMsg(msg),
|
||||
ConversationType: msg.SessionType,
|
||||
GroupID: msg.GroupID,
|
||||
}
|
||||
@@ -148,8 +149,8 @@ func (m *msgServer) sendMsgSingleChat(ctx context.Context, req *pbMsg.SendMsgReq
|
||||
if err := m.messageVerification(ctx, req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var isSend bool = true
|
||||
isNotification := utils.IsNotificationByMsg(req.MsgData)
|
||||
var isSend = true
|
||||
isNotification := msgprocessor.IsNotificationByMsg(req.MsgData)
|
||||
if !isNotification {
|
||||
isSend, err = m.modifyMessageByUserMessageReceiveOpt(
|
||||
ctx,
|
||||
|
||||
@@ -25,9 +25,9 @@ import (
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/unrelation"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/prome"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
|
||||
"github.com/OpenIMSDK/protocol/constant"
|
||||
"github.com/OpenIMSDK/protocol/conversation"
|
||||
"github.com/OpenIMSDK/protocol/msg"
|
||||
"github.com/OpenIMSDK/tools/constant"
|
||||
"github.com/OpenIMSDK/tools/discoveryregistry"
|
||||
)
|
||||
|
||||
|
||||
@@ -16,13 +16,14 @@ package msg
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor"
|
||||
|
||||
"github.com/OpenIMSDK/protocol/constant"
|
||||
"github.com/OpenIMSDK/protocol/msg"
|
||||
"github.com/OpenIMSDK/tools/constant"
|
||||
|
||||
"github.com/OpenIMSDK/protocol/sdkws"
|
||||
"github.com/OpenIMSDK/tools/log"
|
||||
"github.com/OpenIMSDK/tools/tokenverify"
|
||||
"github.com/OpenIMSDK/tools/utils"
|
||||
)
|
||||
|
||||
@@ -34,7 +35,7 @@ func (m *msgServer) PullMessageBySeqs(
|
||||
resp.Msgs = make(map[string]*sdkws.PullMsgs)
|
||||
resp.NotificationMsgs = make(map[string]*sdkws.PullMsgs)
|
||||
for _, seq := range req.SeqRanges {
|
||||
if !utils.IsNotification(seq.ConversationID) {
|
||||
if !msgprocessor.IsNotification(seq.ConversationID) {
|
||||
conversation, err := m.Conversation.GetConversation(ctx, req.UserID, seq.ConversationID)
|
||||
if err != nil {
|
||||
log.ZError(ctx, "GetConversation error", err, "conversationID", seq.ConversationID)
|
||||
@@ -85,7 +86,7 @@ func (m *msgServer) PullMessageBySeqs(
|
||||
}
|
||||
|
||||
func (m *msgServer) GetMaxSeq(ctx context.Context, req *sdkws.GetMaxSeqReq) (*sdkws.GetMaxSeqResp, error) {
|
||||
if err := tokenverify.CheckAccessV3(ctx, req.UserID); err != nil {
|
||||
if err := authverify.CheckAccessV3(ctx, req.UserID); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
conversationIDs, err := m.ConversationLocalCache.GetConversationIDs(ctx, req.UserID)
|
||||
|
||||
@@ -18,9 +18,9 @@ import (
|
||||
"github.com/redis/go-redis/v9"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
||||
"github.com/OpenIMSDK/protocol/constant"
|
||||
"github.com/OpenIMSDK/protocol/sdkws"
|
||||
"github.com/OpenIMSDK/tools/config"
|
||||
"github.com/OpenIMSDK/tools/constant"
|
||||
"github.com/OpenIMSDK/tools/utils"
|
||||
)
|
||||
|
||||
|
||||
@@ -20,10 +20,10 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
||||
"github.com/OpenIMSDK/protocol/constant"
|
||||
"github.com/OpenIMSDK/protocol/msg"
|
||||
"github.com/OpenIMSDK/protocol/sdkws"
|
||||
"github.com/OpenIMSDK/tools/config"
|
||||
"github.com/OpenIMSDK/tools/constant"
|
||||
"github.com/OpenIMSDK/tools/errs"
|
||||
"github.com/OpenIMSDK/tools/utils"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user