diff --git a/build/images/openim-rpc-encryption/Dockerfile b/build/images/openim-rpc-encryption/Dockerfile deleted file mode 100644 index e3f232eaf..000000000 --- a/build/images/openim-rpc-encryption/Dockerfile +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright © 2023 OpenIM. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# OpenIM base image: https://github.com/openim-sigs/openim-base-image - -# Set go mod installation source and proxy - -FROM golang:1.20 AS builder - -ARG GO111MODULE=on -ARG GOPROXY=https://goproxy.cn,direct - -WORKDIR /openim/openim-server - -ENV GO111MODULE=$GO111MODULE -ENV GOPROXY=$GOPROXY - -COPY go.mod go.sum ./ -RUN go mod download - -COPY . . - -RUN make build BINS=openim-rpc-encryption - -RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-encryption /usr/bin/openim-rpc-encryption - -# FROM ghcr.io/openim-sigs/openim-bash-image:latest -FROM ghcr.io/openim-sigs/openim-bash-image:latest - -WORKDIR /openim/openim-server - -COPY --from=builder /usr/bin/openim-rpc-encryption ./bin/openim-rpc-encryption - -ENTRYPOINT ["./bin/openim-rpc-encryption"] \ No newline at end of file diff --git a/build/images/openim-rpc-extend-msg/Dockerfile b/build/images/openim-rpc-extend-msg/Dockerfile deleted file mode 100644 index 3ed94019b..000000000 --- a/build/images/openim-rpc-extend-msg/Dockerfile +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright © 2023 OpenIM. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# OpenIM base image: https://github.com/openim-sigs/openim-base-image - -# Set go mod installation source and proxy - -FROM golang:1.20 AS builder - -ARG GO111MODULE=on -ARG GOPROXY=https://goproxy.cn,direct - -WORKDIR /openim/openim-server - -ENV GO111MODULE=$GO111MODULE -ENV GOPROXY=$GOPROXY - -COPY go.mod go.sum ./ -RUN go mod download - -COPY . . - -RUN make build BINS=openim-rpc-extend-msg - -RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-extend-msg /usr/bin/openim-rpc-extend-msg - -# FROM ghcr.io/openim-sigs/openim-bash-image:latest -FROM ghcr.io/openim-sigs/openim-bash-image:latest - -WORKDIR /openim/openim-server - -COPY --from=builder /usr/bin/openim-rpc-extend-msg ./bin/openim-rpc-extend-msg - -ENTRYPOINT ["./bin/openim-rpc-extend-msg"] \ No newline at end of file diff --git a/deployments/templates/config.yaml b/deployments/templates/config.yaml index b76a1371d..8bf197566 100644 --- a/deployments/templates/config.yaml +++ b/deployments/templates/config.yaml @@ -243,9 +243,10 @@ push: # # Built-in app manager user IDs # Built-in app manager nicknames +# Attention, this configure is discarded. If you have used him before, configure your own manager: - userID: [ "${MANAGER_USERID_1}", "${MANAGER_USERID_2}", "${MANAGER_USERID_3}" ] - nickname: [ "${NICKNAME_1}", "${NICKNAME_2}", "${NICKNAME_3}" ] + userID: + nickname: # chatAdmin, use for send notification # @@ -329,7 +330,7 @@ callback: timeout: ${CALLBACK_TIMEOUT} failedContinue: ${CALLBACK_FAILED_CONTINUE} afterSendSingleMsg: - enable: true + enable: ${CALLBACK_ENABLE} timeout: ${CALLBACK_TIMEOUT} failedContinue: ${CALLBACK_FAILED_CONTINUE} beforeSendGroupMsg: diff --git a/deployments/templates/env-template.yaml b/deployments/templates/env-template.yaml index 9b21c8c65..1044dd6bc 100644 --- a/deployments/templates/env-template.yaml +++ b/deployments/templates/env-template.yaml @@ -100,7 +100,7 @@ ZOOKEEPER_PORT=${ZOOKEEPER_PORT} # MongoDB service port configuration. # Default: MONGO_PORT=37017 -# MONGO_PORT=${MONGO_PORT} +MONGO_PORT=${MONGO_PORT} # Password for MongoDB admin user. Used for service authentication. # Default: MONGO_PASSWORD=openIM123 diff --git a/docs/contrib/environment.md b/docs/contrib/environment.md index 366a1d94f..fb696eb54 100644 --- a/docs/contrib/environment.md +++ b/docs/contrib/environment.md @@ -477,12 +477,6 @@ This section involves setting up additional configuration variables for Websocke | JPNS_MASTER_SECRET | [User Defined] | JPNS Master Secret | | JPNS_PUSH_URL | [User Defined] | JPNS Push Notification URL | | JPNS_PUSH_INTENT | [User Defined] | JPNS Push Intent | -| MANAGER_USERID_1 | "openIM123456" | Administrator ID 1 | -| MANAGER_USERID_2 | "openIM654321" | Administrator ID 2 | -| MANAGER_USERID_3 | "openIMAdmin" | Administrator ID 3 | -| NICKNAME_1 | "system1" | Nickname 1 | -| NICKNAME_2 | "system2" | Nickname 2 | -| NICKNAME_3 | "system3" | Nickname 3 | | IM_ADMIN_USERID | "imAdmin" | IM Administrator ID | | IM_ADMIN_NAME | "imAdmin" | IM Administrator Nickname | | MULTILOGIN_POLICY | "1" | Multi-login Policy | diff --git a/docs/contrib/offline-deployment.md b/docs/contrib/offline-deployment.md index a96f82d4a..5e44318c4 100644 --- a/docs/contrib/offline-deployment.md +++ b/docs/contrib/offline-deployment.md @@ -1,5 +1,3 @@ - - # OpenIM Offline Deployment Design ## 1. Base Images @@ -10,7 +8,7 @@ Below are the base images and their versions you'll need: - [ ] redis:7.0.0 - [ ] mongo:6.0.2 - [ ] bitnami/zookeeper:3.8 -- [ ] minio/minio:latest +- [ ] minio/minio:RELEASE.2024-01-11T07-46-16Z > [!IMPORTANT] > It is important to note that OpenIM removed mysql components from versions v3.5.0 (release-v3.5) and above, so mysql can be deployed without this requirement or above @@ -22,10 +20,10 @@ OpenIM: > [!TIP] > If you need to install more IM components or monitoring products [images.md](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/images.md) -- [ ] ghcr.io/openimsdk/openim-web:latest -- [ ] ghcr.io/openimsdk/openim-admin:latest -- [ ] ghcr.io/openimsdk/openim-chat:latest -- [ ] ghcr.io/openimsdk/openim-server:latest +- [ ] ghcr.io/openimsdk/openim-web: +- [ ] ghcr.io/openimsdk/openim-admin: +- [ ] ghcr.io/openimsdk/openim-chat: +- [ ] ghcr.io/openimsdk/openim-server: Monitoring: @@ -42,9 +40,9 @@ Use the following commands to pull these base images: docker pull bitnami/kafka:3.5.1 docker pull redis:7.0.0 docker pull mongo:6.0.2 -docker pull mysql:5.7 +docker pull mariadb:10.6 docker pull bitnami/zookeeper:3.8 -docker pull minio/minio:latest +docker pull minio/minio:2024-01-11T07-46-16Z ``` If you need to install more IM components or monitoring products: @@ -177,4 +175,4 @@ docker compose ps # Verify - [openimsdk Issue #432](https://github.com/openimsdk/open-im-server/issues/432) - [Notion Link](https://nsddd.notion.site/435ee747c0bc44048da9300a2d745ad3?pvs=25) -- [openimsdk Issue #474](https://github.com/openimsdk/open-im-server/issues/474) \ No newline at end of file +- [openimsdk Issue #474](https://github.com/openimsdk/open-im-server/issues/474) diff --git a/internal/push/push_to_client.go b/internal/push/push_to_client.go new file mode 100644 index 000000000..e69de29bb diff --git a/internal/rpc/msg/revoke.go b/internal/rpc/msg/revoke.go index 8640524ec..c7257215a 100644 --- a/internal/rpc/msg/revoke.go +++ b/internal/rpc/msg/revoke.go @@ -106,6 +106,13 @@ func (m *msgServer) RevokeMsg(ctx context.Context, req *msg.RevokeMsgReq) (*msg. return nil, err } revokerUserID := mcontext.GetOpUserID(ctx) + var flag bool + if len(config.Config.Manager.UserID) > 0 { + flag = utils.Contain(revokerUserID, config.Config.Manager.UserID...) + } + if len(config.Config.Manager.UserID) == 0 && len(config.Config.IMAdmin.UserID) > 0 { + flag = utils.Contain(revokerUserID, config.Config.IMAdmin.UserID...) + } tips := sdkws.RevokeMsgTips{ RevokerUserID: revokerUserID, ClientMsgID: msgs[0].ClientMsgID, @@ -113,7 +120,7 @@ func (m *msgServer) RevokeMsg(ctx context.Context, req *msg.RevokeMsgReq) (*msg. Seq: req.Seq, SesstionType: msgs[0].SessionType, ConversationID: req.ConversationID, - IsAdminRevoke: utils.Contain(revokerUserID, config.Config.Manager.UserID...), + IsAdminRevoke: flag, } var recvID string if msgs[0].SessionType == constant.SuperGroupChatType { diff --git a/internal/rpc/msg/verify.go b/internal/rpc/msg/verify.go index 50b7718ce..710e95411 100644 --- a/internal/rpc/msg/verify.go +++ b/internal/rpc/msg/verify.go @@ -52,7 +52,10 @@ type MessageRevoked struct { func (m *msgServer) messageVerification(ctx context.Context, data *msg.SendMsgReq) error { switch data.MsgData.SessionType { case constant.SingleChatType: - if utils.IsContain(data.MsgData.SendID, config.Config.Manager.UserID) { + if len(config.Config.Manager.UserID) > 0 && utils.IsContain(data.MsgData.SendID, config.Config.Manager.UserID) { + return nil + } + if utils.IsContain(data.MsgData.SendID, config.Config.IMAdmin.UserID) { return nil } if data.MsgData.ContentType <= constant.NotificationEnd && @@ -89,7 +92,10 @@ func (m *msgServer) messageVerification(ctx context.Context, data *msg.SendMsgRe if groupInfo.GroupType == constant.SuperGroup { return nil } - if utils.IsContain(data.MsgData.SendID, config.Config.Manager.UserID) { + if len(config.Config.Manager.UserID) > 0 && utils.IsContain(data.MsgData.SendID, config.Config.Manager.UserID) { + return nil + } + if utils.IsContain(data.MsgData.SendID, config.Config.IMAdmin.UserID) { return nil } if data.MsgData.ContentType <= constant.NotificationEnd && diff --git a/internal/rpc/user/user.go b/internal/rpc/user/user.go index 0be5f97f4..e5567f436 100644 --- a/internal/rpc/user/user.go +++ b/internal/rpc/user/user.go @@ -71,12 +71,6 @@ func Start(client registry.SvcDiscoveryRegistry, server *grpc.Server) error { return err } users := make([]*tablerelation.UserModel, 0) - if len(config.Config.Manager.UserID) != len(config.Config.Manager.Nickname) { - return errors.New("len(config.Config.Manager.AppManagerUid) != len(config.Config.Manager.Nickname)") - } - for k, v := range config.Config.Manager.UserID { - users = append(users, &tablerelation.UserModel{UserID: v, Nickname: config.Config.Manager.Nickname[k], AppMangerLevel: constant.AppAdmin}) - } if len(config.Config.IMAdmin.UserID) != len(config.Config.IMAdmin.Nickname) { return errors.New("len(config.Config.AppNotificationAdmin.AppManagerUid) != len(config.Config.AppNotificationAdmin.Nickname)") } diff --git a/pkg/authverify/token.go b/pkg/authverify/token.go index 4c71224ee..97bb03391 100644 --- a/pkg/authverify/token.go +++ b/pkg/authverify/token.go @@ -35,7 +35,7 @@ func Secret() jwt.Keyfunc { func CheckAccessV3(ctx context.Context, ownerUserID string) (err error) { opUserID := mcontext.GetOpUserID(ctx) - if utils.IsContain(opUserID, config.Config.Manager.UserID) { + if len(config.Config.Manager.UserID) > 0 && utils.IsContain(opUserID, config.Config.Manager.UserID) { return nil } if utils.IsContain(opUserID, config.Config.IMAdmin.UserID) { @@ -48,11 +48,12 @@ func CheckAccessV3(ctx context.Context, ownerUserID string) (err error) { } func IsAppManagerUid(ctx context.Context) bool { - return utils.IsContain(mcontext.GetOpUserID(ctx), config.Config.Manager.UserID) || utils.IsContain(mcontext.GetOpUserID(ctx), config.Config.IMAdmin.UserID) + return (len(config.Config.Manager.UserID) > 0 && utils.IsContain(mcontext.GetOpUserID(ctx), config.Config.Manager.UserID)) || + utils.IsContain(mcontext.GetOpUserID(ctx), config.Config.IMAdmin.UserID) } func CheckAdmin(ctx context.Context) error { - if utils.IsContain(mcontext.GetOpUserID(ctx), config.Config.Manager.UserID) { + if len(config.Config.Manager.UserID) > 0 && utils.IsContain(mcontext.GetOpUserID(ctx), config.Config.Manager.UserID) { return nil } if utils.IsContain(mcontext.GetOpUserID(ctx), config.Config.IMAdmin.UserID) { @@ -64,7 +65,7 @@ func CheckIMAdmin(ctx context.Context) error { if utils.IsContain(mcontext.GetOpUserID(ctx), config.Config.IMAdmin.UserID) { return nil } - if utils.IsContain(mcontext.GetOpUserID(ctx), config.Config.Manager.UserID) { + if len(config.Config.Manager.UserID) > 0 && utils.IsContain(mcontext.GetOpUserID(ctx), config.Config.Manager.UserID) { return nil } return errs.ErrNoPermission.Wrap(fmt.Sprintf("user %s is not CheckIMAdmin userID", mcontext.GetOpUserID(ctx))) @@ -75,7 +76,7 @@ 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) + return (len(config.Config.Manager.UserID) > 0 && 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/install/environment.sh b/scripts/install/environment.sh index aeb4fcc36..b1d2354b9 100755 --- a/scripts/install/environment.sh +++ b/scripts/install/environment.sh @@ -349,12 +349,6 @@ def "JPNS_APP_KEY" "" # JPNS应用密钥 def "JPNS_MASTER_SECRET" "" # JPNS主密钥 def "JPNS_PUSH_URL" "" # JPNS推送URL def "JPNS_PUSH_INTENT" "" # JPNS推送意图 -def "MANAGER_USERID_1" "openIM123456" # 管理员ID 1 -def "MANAGER_USERID_2" "openIM654321" # 管理员ID 2 -def "MANAGER_USERID_3" "openIMAdmin" # 管理员ID 3 -def "NICKNAME_1" "system1" # 昵称1 -def "NICKNAME_2" "system2" # 昵称2 -def "NICKNAME_3" "system3" # 昵称3 def "IM_ADMIN_USERID" "imAdmin" # IM管理员ID def "IM_ADMIN_NAME" "imAdmin" # IM管理员昵称 def "MULTILOGIN_POLICY" "1" # 多登录策略 diff --git a/tools/data-conversion/go.mod b/tools/data-conversion/go.mod index 37d1776c2..963755923 100644 --- a/tools/data-conversion/go.mod +++ b/tools/data-conversion/go.mod @@ -63,7 +63,7 @@ require ( go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.24.0 // indirect golang.org/x/arch v0.3.0 // indirect - golang.org/x/crypto v0.16.0 // indirect + golang.org/x/crypto v0.17.0 // indirect golang.org/x/image v0.13.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/tools/data-conversion/go.sum b/tools/data-conversion/go.sum index 66f85785b..d6dc23742 100644 --- a/tools/data-conversion/go.sum +++ b/tools/data-conversion/go.sum @@ -146,8 +146,8 @@ golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= -golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/image v0.13.0 h1:3cge/F/QTkNLauhf2QoE9zp+7sr+ZcL4HnoZmdwg9sg= golang.org/x/image v0.13.0/go.mod h1:6mmbMOeV28HuMTgA6OSRkdXKYw/t5W9Uwn2Yv1r3Yxk= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= diff --git a/tools/url2im/go.mod b/tools/url2im/go.mod index 236af91c7..b6011909d 100644 --- a/tools/url2im/go.mod +++ b/tools/url2im/go.mod @@ -15,6 +15,6 @@ require ( golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect - google.golang.org/grpc v1.56.2 // indirect + google.golang.org/grpc v1.56.3 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/tools/url2im/go.sum b/tools/url2im/go.sum index 071d9c3aa..1970dce2c 100644 --- a/tools/url2im/go.sum +++ b/tools/url2im/go.sum @@ -24,8 +24,8 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= -google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= -google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.56.3 h1:8I4C0Yq1EjstUzUJzpcRVbuYA2mODtEmpWiQoN/b2nc= +google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=