mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-01-08 12:56:58 +08:00
Merge branch 'OpenIMSDK:main' into main
This commit is contained in:
commit
1498c40574
4
.env
4
.env
@ -1,5 +1,5 @@
|
|||||||
USER=root
|
USER=root
|
||||||
PASSWORD=openIM123
|
PASSWORD=openIM123
|
||||||
MINIO_ENDPOINT=http://113.99.98.99:10005
|
MINIO_ENDPOINT=http://127.0.0.1:10005
|
||||||
API_URL=http://113.99.98.99:10002/object/
|
API_URL=http://127.0.0.1:10002/object/
|
||||||
DATA_DIR=./
|
DATA_DIR=./
|
||||||
@ -23,7 +23,7 @@ RUN /bin/sh -c "make build"
|
|||||||
FROM alpine
|
FROM alpine
|
||||||
|
|
||||||
RUN echo "https://mirrors.aliyun.com/alpine/v3.4/main" > /etc/apk/repositories && \
|
RUN echo "https://mirrors.aliyun.com/alpine/v3.4/main" > /etc/apk/repositories && \
|
||||||
apk --no-cache add tzdata ca-certificates
|
apk --no-cache add tzdata ca-certificates bash
|
||||||
|
|
||||||
# Set directory to map logs, config files, scripts, and SDK
|
# Set directory to map logs, config files, scripts, and SDK
|
||||||
VOLUME ["/Open-IM-Server/logs", "/Open-IM-Server/config", "/Open-IM-Server/scripts", "/Open-IM-Server/db/sdk"]
|
VOLUME ["/Open-IM-Server/logs", "/Open-IM-Server/config", "/Open-IM-Server/scripts", "/Open-IM-Server/db/sdk"]
|
||||||
@ -34,4 +34,4 @@ COPY --from=builder /Open-IM-Server/_output/bin/platforms/linux/amd64 /Open-IM-S
|
|||||||
|
|
||||||
WORKDIR /Open-IM-Server/scripts
|
WORKDIR /Open-IM-Server/scripts
|
||||||
|
|
||||||
CMD ["docker_start_all.sh"]
|
CMD ["./docker_start_all.sh"]
|
||||||
@ -100,7 +100,7 @@ services:
|
|||||||
|
|
||||||
|
|
||||||
openim_server:
|
openim_server:
|
||||||
image: ghcr.io/openimsdk/openim-server:v3.0
|
image: ghcr.io/openimsdk/openim-server:v3.1.0
|
||||||
container_name: openim-server
|
container_name: openim-server
|
||||||
volumes:
|
volumes:
|
||||||
- ./logs:/Open-IM-Server/logs
|
- ./logs:/Open-IM-Server/logs
|
||||||
@ -124,7 +124,7 @@ services:
|
|||||||
max-file: "2"
|
max-file: "2"
|
||||||
|
|
||||||
openim_chat:
|
openim_chat:
|
||||||
image: ghcr.io/openimsdk/openim-chat:v1.0.0
|
image: ghcr.io/openimsdk/openim-chat:v1.1.0
|
||||||
container_name: openim_chat
|
container_name: openim_chat
|
||||||
restart: always
|
restart: always
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
@ -14,6 +14,10 @@ In the OpenIM repository, the versioning adheres to the `MAJOR.MINOR.PATCH` form
|
|||||||
|
|
||||||
## Milestones and Branching
|
## Milestones and Branching
|
||||||
|
|
||||||
|
+ [OpenIM Milestones](https://github.com/OpenIMSDK/Open-IM-Server/milestones)
|
||||||
|
+ [OpenIM Tags](https://github.com/OpenIMSDK/Open-IM-Server/tags)
|
||||||
|
+ [OpenIM Branches](https://github.com/OpenIMSDK/Open-IM-Server/branches)
|
||||||
|
|
||||||
When a significant milestone like v3.1.0 is achieved, a new branch `release-v3.1` is created. This branch contains all the code pertaining to this stable release. All bug fixes and features intended for the next version, v3.2.0, are merged into this branch.
|
When a significant milestone like v3.1.0 is achieved, a new branch `release-v3.1` is created. This branch contains all the code pertaining to this stable release. All bug fixes and features intended for the next version, v3.2.0, are merged into this branch.
|
||||||
|
|
||||||
The release of `PATCH` versions (Z in `X.Y.Z`) are driven by bug fixes, and these can be rolled out depending on the bug's priority or over a scheduled time. On the other hand, `MINOR` versions (Y in `X.Y.Z`) are released based on the project's roadmap, milestone completion, or on a scheduled timeline. Importantly, the API of minor versions is always backward-compatible.
|
The release of `PATCH` versions (Z in `X.Y.Z`) are driven by bug fixes, and these can be rolled out depending on the bug's priority or over a scheduled time. On the other hand, `MINOR` versions (Y in `X.Y.Z`) are released based on the project's roadmap, milestone completion, or on a scheduled timeline. Importantly, the API of minor versions is always backward-compatible.
|
||||||
@ -59,3 +63,4 @@ Remember, communication with your team is key throughout this process, keeping e
|
|||||||
|
|
||||||
## Docker images version management
|
## Docker images version management
|
||||||
|
|
||||||
|
+ [OpenIM Docker Images Administration](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/images.md)
|
||||||
|
|||||||
2
go.mod
2
go.mod
@ -37,7 +37,7 @@ require (
|
|||||||
require github.com/google/uuid v1.3.0
|
require github.com/google/uuid v1.3.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/OpenIMSDK/protocol v0.0.2
|
github.com/OpenIMSDK/protocol v0.0.3
|
||||||
github.com/OpenIMSDK/tools v0.0.5
|
github.com/OpenIMSDK/tools v0.0.5
|
||||||
github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible
|
github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible
|
||||||
github.com/go-redis/redis v6.15.9+incompatible
|
github.com/go-redis/redis v6.15.9+incompatible
|
||||||
|
|||||||
4
go.sum
4
go.sum
@ -16,8 +16,8 @@ cloud.google.com/go/storage v1.28.1/go.mod h1:Qnisd4CqDdo6BGs2AD5LLnEsmSQ80wQ5og
|
|||||||
firebase.google.com/go v3.13.0+incompatible h1:3TdYC3DDi6aHn20qoRkxwGqNgdjtblwVAyRLQwGn/+4=
|
firebase.google.com/go v3.13.0+incompatible h1:3TdYC3DDi6aHn20qoRkxwGqNgdjtblwVAyRLQwGn/+4=
|
||||||
firebase.google.com/go v3.13.0+incompatible/go.mod h1:xlah6XbEyW6tbfSklcfe5FHJIwjt8toICdV5Wh9ptHs=
|
firebase.google.com/go v3.13.0+incompatible/go.mod h1:xlah6XbEyW6tbfSklcfe5FHJIwjt8toICdV5Wh9ptHs=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/OpenIMSDK/protocol v0.0.2 h1:O53/WiqLCHF9aWPLI32GPF82hn7suM8PkhrtL89Klrw=
|
github.com/OpenIMSDK/protocol v0.0.3 h1:CFQtmnyW+1dYKVFaVaHcJ6oYuMiMdNfU2gC1xz3K/9I=
|
||||||
github.com/OpenIMSDK/protocol v0.0.2/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y=
|
github.com/OpenIMSDK/protocol v0.0.3/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y=
|
||||||
github.com/OpenIMSDK/tools v0.0.5 h1:yBVHJ3EpIDcp8VFKPjuGr6MQvFa3t4JByZ+vmeC06/Q=
|
github.com/OpenIMSDK/tools v0.0.5 h1:yBVHJ3EpIDcp8VFKPjuGr6MQvFa3t4JByZ+vmeC06/Q=
|
||||||
github.com/OpenIMSDK/tools v0.0.5/go.mod h1:eg+q4A34Qmu73xkY0mt37FHGMCMfC6CtmOnm0kFEGFI=
|
github.com/OpenIMSDK/tools v0.0.5/go.mod h1:eg+q4A34Qmu73xkY0mt37FHGMCMfC6CtmOnm0kFEGFI=
|
||||||
github.com/QcloudApi/qcloud_sign_golang v0.0.0-20141224014652-e4130a326409/go.mod h1:1pk82RBxDY/JZnPQrtqHlUFfCctgdorsd9M06fMynOM=
|
github.com/QcloudApi/qcloud_sign_golang v0.0.0-20141224014652-e4130a326409/go.mod h1:1pk82RBxDY/JZnPQrtqHlUFfCctgdorsd9M06fMynOM=
|
||||||
|
|||||||
@ -51,7 +51,7 @@ func (u *UserApi) GetUsersPublicInfo(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserApi) GetAllUsersID(c *gin.Context) {
|
func (u *UserApi) GetAllUsersID(c *gin.Context) {
|
||||||
a2r.Call(user.UserClient.GetDesignateUsers, u.Client, c)
|
a2r.Call(user.UserClient.GetAllUserID, u.Client, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserApi) AccountCheck(c *gin.Context) {
|
func (u *UserApi) AccountCheck(c *gin.Context) {
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
|
||||||
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
@ -74,6 +75,7 @@ type WsServer struct {
|
|||||||
hubServer *Server
|
hubServer *Server
|
||||||
validate *validator.Validate
|
validate *validator.Validate
|
||||||
cache cache.MsgModel
|
cache cache.MsgModel
|
||||||
|
userClient *rpcclient.UserRpcClient
|
||||||
Compressor
|
Compressor
|
||||||
Encoder
|
Encoder
|
||||||
MessageHandler
|
MessageHandler
|
||||||
@ -86,6 +88,28 @@ type kickHandler struct {
|
|||||||
|
|
||||||
func (ws *WsServer) SetDiscoveryRegistry(client discoveryregistry.SvcDiscoveryRegistry) {
|
func (ws *WsServer) SetDiscoveryRegistry(client discoveryregistry.SvcDiscoveryRegistry) {
|
||||||
ws.MessageHandler = NewGrpcHandler(ws.validate, client)
|
ws.MessageHandler = NewGrpcHandler(ws.validate, client)
|
||||||
|
u := rpcclient.NewUserRpcClient(client)
|
||||||
|
ws.userClient = &u
|
||||||
|
}
|
||||||
|
func (ws *WsServer) SetUserOnlineStatus(ctx context.Context, client *Client, status int32) {
|
||||||
|
err := ws.userClient.SetUserStatus(ctx, client.UserID, status, client.PlatformID)
|
||||||
|
if err != nil {
|
||||||
|
log.ZWarn(ctx, "SetUserStatus err", err)
|
||||||
|
}
|
||||||
|
switch status {
|
||||||
|
case constant.Online:
|
||||||
|
err := CallbackUserOnline(ctx, client.UserID, client.PlatformID, client.IsBackground, client.ctx.GetConnID())
|
||||||
|
if err != nil {
|
||||||
|
log.ZWarn(ctx, "CallbackUserOnline err", err)
|
||||||
|
}
|
||||||
|
case constant.Offline:
|
||||||
|
err := CallbackUserOffline(ctx, client.UserID, client.PlatformID, client.ctx.GetConnID())
|
||||||
|
if err != nil {
|
||||||
|
log.ZWarn(ctx, "CallbackUserOffline err", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ws *WsServer) SetCacheHandler(cache cache.MsgModel) {
|
func (ws *WsServer) SetCacheHandler(cache cache.MsgModel) {
|
||||||
@ -186,6 +210,7 @@ func (ws *WsServer) registerClient(client *Client) {
|
|||||||
atomic.AddInt64(&ws.onlineUserConnNum, 1)
|
atomic.AddInt64(&ws.onlineUserConnNum, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ws.SetUserOnlineStatus(client.ctx, client, constant.Online)
|
||||||
log.ZInfo(
|
log.ZInfo(
|
||||||
client.ctx,
|
client.ctx,
|
||||||
"user online",
|
"user online",
|
||||||
@ -292,14 +317,8 @@ func (ws *WsServer) unregisterClient(client *Client) {
|
|||||||
atomic.AddInt64(&ws.onlineUserNum, -1)
|
atomic.AddInt64(&ws.onlineUserNum, -1)
|
||||||
}
|
}
|
||||||
atomic.AddInt64(&ws.onlineUserConnNum, -1)
|
atomic.AddInt64(&ws.onlineUserConnNum, -1)
|
||||||
log.ZInfo(
|
ws.SetUserOnlineStatus(client.ctx, client, constant.Offline)
|
||||||
client.ctx,
|
log.ZInfo(client.ctx, "user offline", "close reason", client.closedErr, "online user Num", ws.onlineUserNum, "online user conn Num",
|
||||||
"user offline",
|
|
||||||
"close reason",
|
|
||||||
client.closedErr,
|
|
||||||
"online user Num",
|
|
||||||
ws.onlineUserNum,
|
|
||||||
"online user conn Num",
|
|
||||||
ws.onlineUserConnNum,
|
ws.onlineUserConnNum,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1040,7 +1040,7 @@ func (s *groupServer) GetUserReqApplicationList(ctx context.Context, req *pbGrou
|
|||||||
groupIDs := utils.Distinct(utils.Slice(requests, func(e *relationTb.GroupRequestModel) string {
|
groupIDs := utils.Distinct(utils.Slice(requests, func(e *relationTb.GroupRequestModel) string {
|
||||||
return e.GroupID
|
return e.GroupID
|
||||||
}))
|
}))
|
||||||
groups, err := s.GroupDatabase.FindGroup(ctx, groupIDs)
|
groups, err := s.GroupDatabase.FindNotDismissedGroup(ctx, groupIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,6 +39,7 @@ type GroupDatabase interface {
|
|||||||
CreateGroup(ctx context.Context, groups []*relationTb.GroupModel, groupMembers []*relationTb.GroupMemberModel) error
|
CreateGroup(ctx context.Context, groups []*relationTb.GroupModel, groupMembers []*relationTb.GroupMemberModel) error
|
||||||
TakeGroup(ctx context.Context, groupID string) (group *relationTb.GroupModel, err error)
|
TakeGroup(ctx context.Context, groupID string) (group *relationTb.GroupModel, err error)
|
||||||
FindGroup(ctx context.Context, groupIDs []string) (groups []*relationTb.GroupModel, err error)
|
FindGroup(ctx context.Context, groupIDs []string) (groups []*relationTb.GroupModel, err error)
|
||||||
|
FindNotDismissedGroup(ctx context.Context, groupIDs []string) (groups []*relationTb.GroupModel, err error)
|
||||||
SearchGroup(
|
SearchGroup(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
keyword string,
|
keyword string,
|
||||||
@ -581,3 +582,7 @@ func (g *groupDatabase) CountRangeEverydayTotal(ctx context.Context, start time.
|
|||||||
func (g *groupDatabase) FindGroupRequests(ctx context.Context, groupID string, userIDs []string) (int64, []*relationTb.GroupRequestModel, error) {
|
func (g *groupDatabase) FindGroupRequests(ctx context.Context, groupID string, userIDs []string) (int64, []*relationTb.GroupRequestModel, error) {
|
||||||
return g.groupRequestDB.FindGroupRequests(ctx, groupID, userIDs)
|
return g.groupRequestDB.FindGroupRequests(ctx, groupID, userIDs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (g *groupDatabase) FindNotDismissedGroup(ctx context.Context, groupIDs []string) (groups []*relationTb.GroupModel, err error) {
|
||||||
|
return g.groupDB.FindNotDismissedGroup(ctx, groupIDs)
|
||||||
|
}
|
||||||
|
|||||||
@ -99,3 +99,7 @@ func (g *GroupGorm) CountRangeEverydayTotal(ctx context.Context, start time.Time
|
|||||||
}
|
}
|
||||||
return v, nil
|
return v, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (g *GroupGorm) FindNotDismissedGroup(ctx context.Context, groupIDs []string) (groups []*relation.GroupModel, err error) {
|
||||||
|
return groups, utils.Wrap(g.DB.Where("group_id in (?) and status != ?", groupIDs, constant.GroupStatusDismissed).Find(&groups).Error, "")
|
||||||
|
}
|
||||||
|
|||||||
@ -51,6 +51,7 @@ type GroupModelInterface interface {
|
|||||||
UpdateMap(ctx context.Context, groupID string, args map[string]interface{}) (err error)
|
UpdateMap(ctx context.Context, groupID string, args map[string]interface{}) (err error)
|
||||||
UpdateStatus(ctx context.Context, groupID string, status int32) (err error)
|
UpdateStatus(ctx context.Context, groupID string, status int32) (err error)
|
||||||
Find(ctx context.Context, groupIDs []string) (groups []*GroupModel, err error)
|
Find(ctx context.Context, groupIDs []string) (groups []*GroupModel, err error)
|
||||||
|
FindNotDismissedGroup(ctx context.Context, groupIDs []string) (groups []*GroupModel, err error)
|
||||||
Take(ctx context.Context, groupID string) (group *GroupModel, err error)
|
Take(ctx context.Context, groupID string) (group *GroupModel, err error)
|
||||||
Search(
|
Search(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
|
|||||||
@ -154,3 +154,7 @@ func (u *UserRpcClient) GetAllUserIDs(ctx context.Context, pageNumber, showNumbe
|
|||||||
}
|
}
|
||||||
return resp.UserIDs, nil
|
return resp.UserIDs, nil
|
||||||
}
|
}
|
||||||
|
func (u *UserRpcClient) SetUserStatus(ctx context.Context, userID string, status int32, platformID int) error {
|
||||||
|
_, err := u.Client.SetUserStatus(ctx, &user.SetUserStatusReq{StatusList: []*user.OnlineStatus{{UserID: userID, Status: status, PlatformID: int32(platformID)}}})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|||||||
@ -131,11 +131,11 @@ go.build.%:
|
|||||||
$(BIN_DIR)/platforms/$(OS)/$(ARCH)/$(COMMAND)$(GO_OUT_EXT) $(ROOT_DIR)/cmd/$(COMMAND)/main.go; \
|
$(BIN_DIR)/platforms/$(OS)/$(ARCH)/$(COMMAND)$(GO_OUT_EXT) $(ROOT_DIR)/cmd/$(COMMAND)/main.go; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## go.install: Install deployment openim
|
# ## go.install: Install deployment openim
|
||||||
.PHONY: go.install
|
# .PHONY: go.install
|
||||||
go.install:
|
# go.install:
|
||||||
@echo "===========> Installing deployment openim"
|
# @echo "===========> Installing deployment openim"
|
||||||
@$(ROOT_DIR)/scripts/install_im_server.sh
|
# @$(ROOT_DIR)/scripts/install_im_server.sh
|
||||||
|
|
||||||
## go.check: Check OpenIM deployment
|
## go.check: Check OpenIM deployment
|
||||||
.PHONY: go.check
|
.PHONY: go.check
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user