From ef399caa4d0cded39913ce969c42ea1e1f8e2eb7 Mon Sep 17 00:00:00 2001 From: Xinwei Xiong <3293172751NSS@gmail.com> Date: Sat, 19 Aug 2023 19:25:43 +0800 Subject: [PATCH 1/5] docs: update sync file (#900) --- .github/sync.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/sync.yml b/.github/sync.yml index 413e5fcc7..12b1c021f 100644 --- a/.github/sync.yml +++ b/.github/sync.yml @@ -75,6 +75,17 @@ OpenIMSDK/OpenKF: dest: .github/.codecov.yml replace: false +openim-sigs/openim-docker: + - source: ./config + dest: ./openim-server/config + replace: true + - source: ./docs + dest: ./openim-server/docs + replace: true + - source: ./scripts + dest: ./openim-server/scripts + replace: true + group: # first group:common to all warehouses # TODO: add the required warehouse here @@ -116,4 +127,4 @@ group: replace: false - source: ./scripts/githooks/ dest: ./scripts/githooks/ - replace: true \ No newline at end of file + replace: true From 90659a30b67b6b7f3c78eaecf5557d32eec2652f Mon Sep 17 00:00:00 2001 From: Gordon <46924906+FGadvancer@users.noreply.github.com> Date: Mon, 21 Aug 2023 14:16:33 +0800 Subject: [PATCH 2/5] fix: pull message set isRead only message come from single. (#902) * 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> * fix: token update Signed-off-by: Gordon <1432970085@qq.com> * fix: get all userID Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: msggateway add online status call Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * refactor: log change Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * refactor: log change Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * chore: network mode change Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * feat: add api of get server time Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * feat: remove go work sum Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: pull message add isRead field Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: check msg-transfer script Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: script update Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: start don't kill old process Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: check component Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: pull message set isRead only message come from single. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> --------- Signed-off-by: Gordon <1432970085@qq.com> Signed-off-by: withchao <993506633@qq.com> Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: withchao <993506633@qq.com> Co-authored-by: Xinwei Xiong <3293172751NSS@gmail.com> Co-authored-by: FGadvancer --- pkg/common/convert/msg.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/common/convert/msg.go b/pkg/common/convert/msg.go index 59070d338..d3d2d25e7 100644 --- a/pkg/common/convert/msg.go +++ b/pkg/common/convert/msg.go @@ -15,6 +15,7 @@ package convert import ( + "github.com/OpenIMSDK/protocol/constant" "github.com/OpenIMSDK/protocol/sdkws" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation" @@ -78,7 +79,9 @@ func MsgDB2Pb(msgModel *unrelation.MsgDataModel) *sdkws.MsgData { msg.SendTime = msgModel.SendTime msg.CreateTime = msgModel.CreateTime msg.Status = msgModel.Status - msg.IsRead = msgModel.IsRead + if msgModel.SessionType == constant.SingleChatType { + msg.IsRead = msgModel.IsRead + } msg.Options = msgModel.Options if msgModel.OfflinePush != nil { msg.OfflinePushInfo = &sdkws.OfflinePushInfo{ From ff9b2582291d29c500e45d0ffbe92b837b5e199e Mon Sep 17 00:00:00 2001 From: WangchuXiao Date: Tue, 22 Aug 2023 18:46:08 +0800 Subject: [PATCH 3/5] fix: admin revoke msg (#910) --- go.mod | 2 +- go.sum | 4 ++-- go.work.sum | 3 ++- internal/rpc/msg/revoke.go | 6 +++++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index bdcf4ba01..01ff50b18 100644 --- a/go.mod +++ b/go.mod @@ -37,7 +37,7 @@ require ( require github.com/google/uuid v1.3.0 require ( - github.com/OpenIMSDK/protocol v0.0.12 + github.com/OpenIMSDK/protocol v0.0.14 github.com/OpenIMSDK/tools v0.0.13 github.com/aliyun/aliyun-oss-go-sdk v2.2.8+incompatible github.com/go-redis/redis v6.15.9+incompatible diff --git a/go.sum b/go.sum index bc56bf686..26e009e28 100644 --- a/go.sum +++ b/go.sum @@ -17,8 +17,8 @@ cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7Biccwk firebase.google.com/go v3.13.0+incompatible h1:3TdYC3DDi6aHn20qoRkxwGqNgdjtblwVAyRLQwGn/+4= 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/OpenIMSDK/protocol v0.0.12 h1:79rBgpKBF4TMy5tkLH3DQNiZFVmxKMP7VyX+kmJh4d8= -github.com/OpenIMSDK/protocol v0.0.12/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y= +github.com/OpenIMSDK/protocol v0.0.14 h1:cvQ3f8MTcyYygAnZ7Exq6zIbvHGCEV0fWdpzjQEDDBQ= +github.com/OpenIMSDK/protocol v0.0.14/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y= github.com/OpenIMSDK/tools v0.0.13 h1:rcw4HS8S2DPZR9UOBxD8/ol9UBMzXBypzOVEytDRIMo= github.com/OpenIMSDK/tools v0.0.13/go.mod h1:eg+q4A34Qmu73xkY0mt37FHGMCMfC6CtmOnm0kFEGFI= github.com/QcloudApi/qcloud_sign_golang v0.0.0-20141224014652-e4130a326409/go.mod h1:1pk82RBxDY/JZnPQrtqHlUFfCctgdorsd9M06fMynOM= diff --git a/go.work.sum b/go.work.sum index bf1661eb9..89e737b5c 100644 --- a/go.work.sum +++ b/go.work.sum @@ -221,7 +221,8 @@ cloud.google.com/go/websecurityscanner v1.6.1/go.mod h1:Njgaw3rttgRHXzwCB8kgCYqv cloud.google.com/go/workflows v1.11.1 h1:2akeQ/PgtRhrNuD/n1WvJd5zb7YyuDZrlOanBj2ihPg= cloud.google.com/go/workflows v1.11.1/go.mod h1:Z+t10G1wF7h8LgdY/EmRcQY8ptBD/nvofaL6FqlET6g= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= -github.com/OpenIMSDK/protocol v0.0.12/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y= +github.com/OpenIMSDK/protocol v0.0.14 h1:cvQ3f8MTcyYygAnZ7Exq6zIbvHGCEV0fWdpzjQEDDBQ= +github.com/OpenIMSDK/protocol v0.0.14/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y= github.com/QcloudApi/qcloud_sign_golang v0.0.0-20141224014652-e4130a326409 h1:DTQ/38ao/CfXsrK0cSAL+h4R/u0VVvfWLZEOlLwEROI= github.com/alecthomas/kingpin/v2 v2.3.1 h1:ANLJcKmQm4nIaog7xdr/id6FM6zm5hHnfZrvtKPxqGg= github.com/alecthomas/kingpin/v2 v2.3.1/go.mod h1:oYL5vtsvEHZGHxU7DMp32Dvx+qL+ptGn6lWaot2vCNE= diff --git a/internal/rpc/msg/revoke.go b/internal/rpc/msg/revoke.go index d700e2df1..8a5943bb4 100644 --- a/internal/rpc/msg/revoke.go +++ b/internal/rpc/msg/revoke.go @@ -26,8 +26,10 @@ import ( "github.com/OpenIMSDK/protocol/sdkws" "github.com/OpenIMSDK/tools/errs" "github.com/OpenIMSDK/tools/log" + "github.com/OpenIMSDK/tools/mcontext" "github.com/OpenIMSDK/tools/utils" + "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" unRelationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation" ) @@ -107,13 +109,15 @@ func (m *msgServer) RevokeMsg(ctx context.Context, req *msg.RevokeMsgReq) (*msg. if err != nil { return nil, err } + revokerUserID := mcontext.GetOpUserID(ctx) tips := sdkws.RevokeMsgTips{ - RevokerUserID: req.UserID, + RevokerUserID: revokerUserID, ClientMsgID: msgs[0].ClientMsgID, RevokeTime: now, Seq: req.Seq, SesstionType: msgs[0].SessionType, ConversationID: req.ConversationID, + IsAdminRevoke: utils.Contain(revokerUserID, config.Config.Manager.UserID...), } var recvID string if msgs[0].SessionType == constant.SuperGroupChatType { From a60bce5cf7fa889ba602e940876e284e7d52729f Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw-openim)" <3293172751nss@gmail.com> Date: Sat, 19 Aug 2023 16:26:45 +0800 Subject: [PATCH 4/5] feat: add docker compose fix Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> --- scripts/start_component_check.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/start_component_check.sh diff --git a/scripts/start_component_check.sh b/scripts/start_component_check.sh old mode 100644 new mode 100755 From d0bd1f9923ae9b2bdfe15b491fdb0c3603ffe31e Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw-openim)" <3293172751nss@gmail.com> Date: Sat, 19 Aug 2023 16:26:49 +0800 Subject: [PATCH 5/5] feat: add docker compose fix Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> --- scripts/check-all.sh | 52 ++++++++++++++++++++ scripts/install/install-protobuf.sh | 73 +++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100755 scripts/check-all.sh create mode 100644 scripts/install/install-protobuf.sh diff --git a/scripts/check-all.sh b/scripts/check-all.sh new file mode 100755 index 000000000..ea00db032 --- /dev/null +++ b/scripts/check-all.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash +# 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. + +# This script is check openim service is running normally +# +# Usage: `scripts/check-all.sh`. +# Encapsulated as: `make check`. +# READ: https://github.com/OpenIMSDK/Open-IM-Server/tree/main/scripts/install/environment.sh + +set -o errexit +set -o nounset +set -o pipefail + +OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. +source "${OPENIM_ROOT}/scripts/install/common.sh" + +OPENIM_VERBOSE=4 + +echo "++++ The port being checked: ${OPENIM_SERVER_PORT_LISTARIES[@]}" + +echo "++++ Check all dependent service ports" +echo "+ The port being checked: ${OPENIM_DEPENDENCY_PORT_LISTARIES[@]}" +openim::util::check_ports ${OPENIM_DEPENDENCY_PORT_LISTARIES[@]} + +if [[ $? -ne 0 ]]; then + openim::log::error_exit "The service does not start properly, please check the port, query variable definition!" + echo "+++ https://github.com/OpenIMSDK/Open-IM-Server/tree/main/scripts/install/environment.sh +++" +else + echo "++++ Check all dependent service ports successfully !" +fi + +echo "++++ Check all OpenIM service ports" +echo "+ The port being checked: ${OPENIM_SERVER_PORT_LISTARIES[@]}" +openim::util::check_ports ${OPENIM_SERVER_PORT_LISTARIES[@]} +if [[ $? -ne 0 ]]; then + echo "+++ cat openim log file >>> ${LOG_FILE}" + openim::log::error_exit "The service does not start properly, please check the port, query variable definition!" +else + echo "++++ Check all openim service ports successfully !" +fi \ No newline at end of file diff --git a/scripts/install/install-protobuf.sh b/scripts/install/install-protobuf.sh new file mode 100644 index 000000000..a9a1ef7a0 --- /dev/null +++ b/scripts/install/install-protobuf.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +# -------------------------------------------------------------- +# OpenIM Protoc Tool v1.0.0 +# -------------------------------------------------------------- +# OpenIM has released its custom Protoc tool version v1.0.0. +# This tool is customized to meet the specific needs of OpenIM and resides in its separate repository. +# It can be downloaded from the following link: +# https://github.com/OpenIMSDK/Open-IM-Protoc/releases/tag/v1.0.0 +# +# Download link (Windows): https://github.com/OpenIMSDK/Open-IM-Protoc/releases/download/v1.0.0/windows.zip +# Download link (Linux): https://github.com/OpenIMSDK/Open-IM-Protoc/releases/download/v1.0.0/linux.zip +# +# Installation steps (taking Windows as an example): +# 1. Visit the above link and download the version suitable for Windows. +# 2. Extract the downloaded file. +# 3. Add the extracted tool to your PATH environment variable so that it can be run directly from the command line. +# +# Note: The specific installation and usage instructions may vary based on the tool's actual implementation. It's advised to refer to official documentation. +# -------------------------------------------------------------- + +function help_message { + echo "Usage: ./install-protobuf.sh [option]" + echo "Options:" + echo "-i, --install Install the OpenIM Protoc tool." + echo "-u, --uninstall Uninstall the OpenIM Protoc tool." + echo "-r, --reinstall Reinstall the OpenIM Protoc tool." + echo "-c, --check Check if the OpenIM Protoc tool is installed." + echo "-h, --help Display this help message." +} + +function install_protobuf { + echo "Installing OpenIM Protoc tool..." + # Logic for installation based on the OS + # e.g., download, unzip, and add to PATH +} + +function uninstall_protobuf { + echo "Uninstalling OpenIM Protoc tool..." + # Logic for uninstallation + # e.g., remove from PATH and delete files +} + +function reinstall_protobuf { + echo "Reinstalling OpenIM Protoc tool..." + uninstall_protobuf + install_protobuf +} + +function check_protobuf { + echo "Checking for OpenIM Protoc tool installation..." + # Logic to check if the tool is installed + # e.g., which protoc or checking PATH +} + +while [ "$1" != "" ]; do + case $1 in + -i | --install ) install_protobuf + ;; + -u | --uninstall ) uninstall_protobuf + ;; + -r | --reinstall ) reinstall_protobuf + ;; + -c | --check ) check_protobuf + ;; + -h | --help ) help_message + exit + ;; + * ) help_message + exit 1 + esac + shift +done \ No newline at end of file