diff --git a/README.md b/README.md index 3c52475f3..5ed6664db 100644 --- a/README.md +++ b/README.md @@ -89,9 +89,12 @@ make check ### Compile from source Ur need `Go 1.18` or higher version, and `make`. + +Version Details: https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md + ```bash # choose what you need -BRANCH=release-v3.0 +BRANCH=release-v3.1 git clone -b $BRANCH https://github.com/OpenIMSDK/Open-IM-Server openim && export openim=$(pwd)/openim && cd $openim && make build ``` Read about the [OpenIM Version Policy](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md) diff --git a/config/open-im-ng-example.conf b/config/open-im-ng-example.conf index a817f7357..e5e584ff8 100644 --- a/config/open-im-ng-example.conf +++ b/config/open-im-ng-example.conf @@ -4,38 +4,28 @@ upstream im_msg_gateway{ upstream im_api{ server 127.0.0.1:10002; #IM群组用户api服务器地址 根据部署情况可指定多台 } -upstream im_jssdk_gateway{ - server 127.0.0.1:10003; #IM jssdk服务器地址 根据部署情况可指定多台 - } upstream storage { server 127.0.0.1:10005; #MinIO服务器地址 暂时支持1台 } -upstream im_admin{ - server 127.0.0.1:10006; #IM admin服务器地址 根据部署情况可指定多台 - } upstream im_grafana{ server 127.0.0.1:10007; #IM 统计服务器地址 docker-compose启动所在机器 } -upstream im_chat{ +upstream im_chat_api{ server 127.0.0.1:10008; #IM 商业版登录注册服务器地址 根据部署情况可指定多台 } -upstream im_complete_admin{ +upstream im_admin_api{ server 127.0.0.1:10009; #IM 商业版admin地址 根据部署情况可指定多台 } -upstream im_organization{ - server 127.0.0.1:10010; #IM 商业版组织架构服务器地址 根据部署情况可指定多台 - } upstream im_open_rtc{ server 127.0.0.1:7880; #rtc 音视频通话 服务器地址 根据部署情况可指定多台 } - server { listen 443; - server_name web.rentsoft.cn; #1 web im 端 域名 + server_name test-web.rentsoft.cn; #1 web im 端 域名 ssl on; - ssl_certificate /etc/nginx/conf.d/ssl/web.rentsoft.cn.crt; #2 证书 - ssl_certificate_key /etc/nginx/conf.d/ssl/web.rentsoft.cn.key; #3 证书 + ssl_certificate /etc/nginx/conf.d/ssl/test-web.rentsoft.cn.crt; #2 证书 + ssl_certificate_key /etc/nginx/conf.d/ssl/test-web.rentsoft.cn.key; #3 证书 ssl_session_timeout 5m; gzip on; gzip_min_length 1k; @@ -72,22 +62,6 @@ server { proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://im_api/; } - location /jssdk_gateway { #10003 jssdk - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "Upgrade"; - proxy_set_header X-real-ip $remote_addr; - proxy_set_header X-Forwarded-For $remote_addr; - proxy_pass http://im_jssdk_gateway/; - } - location ^~/admin/ { #10006 admin - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "Upgrade"; - proxy_set_header X-real-ip $remote_addr; - proxy_set_header X-Forwarded-For $remote_addr; - proxy_pass http://im_admin/; - } location ^~/grafana/ { #10007 prometheus proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; @@ -96,29 +70,21 @@ server { proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://im_grafana/; } - location ^~/chat/ { #10008 chat login - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "Upgrade"; - proxy_set_header X-real-ip $remote_addr; - proxy_set_header X-Forwarded-For $remote_addr; - proxy_pass http://im_chat/; - } + location ^~/chat/ { #10008 im_chat_api + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header X-real-ip $remote_addr; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_pass http://im_chat_api/; + } location ^~/complete_admin/ { #10009 admin proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header X-real-ip $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; - proxy_pass http://im_complete_admin/; - } - location ^~/organization/ { #10010 organization - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "Upgrade"; - proxy_set_header X-real-ip $remote_addr; - proxy_set_header X-Forwarded-For $remote_addr; - proxy_pass http://im_organization/; + proxy_pass http://im_admin_api/; } location ^~/open_rtc/ { #7880 rtc proxy_http_version 1.1; @@ -132,17 +98,17 @@ server { server { listen 80; - server_name web.rentsoft.cn ; #1 web im 端 域名 + server_name test-web.rentsoft.cn ; #1 web im 端 域名 rewrite ^(.*)$ https://${server_name}$1 permanent; } server { ssl_session_timeout 5m; listen 443; - server_name storage.rentsoft.cn; #1 MinIO存储域名 + server_name test-storage.rentsoft.cn; #1 MinIO存储域名 ssl on; - ssl_certificate /etc/nginx/conf.d/ssl/storage.rentsoft.cn.crt; #证书 - ssl_certificate_key /etc/nginx/conf.d/ssl/storage.rentsoft.cn.key; #证书 + ssl_certificate /etc/nginx/conf.d/ssl/test-storage.rentsoft.cn.crt; #证书 + ssl_certificate_key /etc/nginx/conf.d/ssl/test-storage.rentsoft.cn.key; #证书 gzip on; gzip_min_length 1k; gzip_buffers 4 16k; @@ -160,35 +126,3 @@ server { client_max_body_size 8000M; } } - - -server { - listen 443; - server_name admin.rentsoft.cn; #后台管理域名 - ssl on; - ssl_certificate /etc/nginx/conf.d/ssl/admin.rentsoft.cn.crt; # 证书 - ssl_certificate_key /etc/nginx/conf.d/ssl/admin.rentsoft.cn.key; #证书 - ssl_session_timeout 5m; - gzip on; - gzip_min_length 1k; - gzip_buffers 4 16k; - gzip_comp_level 2; - gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png; - gzip_vary off; - gzip_disable "MSIE [1-6]\."; - location / { - proxy_set_header Host $host; - proxy_set_header X-Real-Ip $remote_addr; - proxy_set_header X-Forwarded-For $remote_addr; - proxy_set_header X-NginX-Proxy true; - root /data1/online/Open-IM-Admin/dist/; #管理后台web静态资源存放路径 - index index.html; - try_files $uri $uri/ /index.html; - } -} - -server { - listen 80; - server_name admin.rentsoft.cn; #管理后台 域名 - rewrite ^(.*)$ https://${server_name}$1 permanent; -} diff --git a/docker-compose.yaml b/docker-compose.yaml index 394232df3..c28c8bc96 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -100,7 +100,7 @@ services: openim_server: - image: ghcr.io/openimsdk/openim-server:latest + image: ghcr.io/openimsdk/openim-server:main container_name: openim-server volumes: - ./logs:/Open-IM-Server/logs @@ -124,7 +124,7 @@ services: max-file: "2" openim_chat: - image: ghcr.io/openimsdk/openim-chat:latest + image: ghcr.io/openimsdk/openim-chat:main container_name: openim_chat restart: always depends_on: diff --git a/docs/conversions/images.md b/docs/conversions/images.md index f2072dea2..70401ec07 100644 --- a/docs/conversions/images.md +++ b/docs/conversions/images.md @@ -54,22 +54,19 @@ When pulling OpenIM's Docker images, you can choose the most suitable source bas - Pull from GitHub: - ``` - bashCopy code + ```bash docker pull ghcr.io/openimsdk/openim-server:latest ``` - Pull from Alibaba Cloud: - ``` - bashCopy code + ```bash docker pull registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server:latest ``` - Pull from Docker Hub: - ``` - bashCopy code + ```bash docker pull docker.io/openim/openim-server:latest ``` @@ -77,22 +74,19 @@ When pulling OpenIM's Docker images, you can choose the most suitable source bas - Pull from GitHub: - ``` - bashCopy code + ```bash docker pull ghcr.io/openimsdk/openim-chat:latest ``` - Pull from Alibaba Cloud: - ``` - bashCopy code + ```bash docker pull registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-chat:latest ``` - Pull from Docker Hub: - ``` - bashCopy code + ```bash docker pull docker.io/openim/openim-chat:latest ``` diff --git a/docs/conversions/version.md b/docs/conversions/version.md index 06e34543b..c8a3dbd1c 100644 --- a/docs/conversions/version.md +++ b/docs/conversions/version.md @@ -6,21 +6,36 @@ OpenIM, the open source project, employs a comprehensive version management syst ## Main Branch -The `main` branch is where all the latest code resides. It's the hub of activity, embodying all the cutting-edge features that are currently being developed or updated. However, since it's subject to frequent changes and updates, it may not always represent the most stable version of the software. Access the `main` branch [here](https://github.com/openimsdk/openim-server/tree/main). +The `main` branch is where all the latest code resides. It's the hub of activity, embodying all the cutting-edge features that are currently being developed or updated. However, since it's subject to frequent changes and updates, it may not always represent the most stable version of the software. Access the `main` branch [here](https://github.com/OpenIMSDK/Open-IM-Server/tree/main). ## Release Branch -On the other hand, we have the `release` branch. For instance, in the context of version 3.1, we maintain a `release-v3.1` branch. Unlike the `main` branch, the release branch is designed to be a continuously stable and updated version of the software. This provides a reliable option for users who prefer stability over the latest, but potentially unstable, features. Access the `release-v3.1` branch [here](https://github.com/openimsdk/openim-server/tree/release-v3.1). +On the other hand, we have the `release` branch. For instance, in the context of version 3.1, we maintain a `release-v3.1` branch. Unlike the `main` branch, the release branch is designed to be a continuously stable and updated version of the software. This provides a reliable option for users who prefer stability over the latest, but potentially unstable, features. Access the `release-v3.1` branch [here](https://github.com/OpenIMSDK/Open-IM-Server/tree/release-v3.1). ## Tag Management -Finally, there's `tag` management. Despite having both `main` and `release` branches, `tag` serves a crucial role. Tags are immutable, i.e., they remain unchanged once created. Therefore, if you need a specific version of the software, you can use the corresponding tag. Check out the available tags [here](https://github.com/openimsdk/openim-server/tags). +In addition to the `main` and `release` branches, `tag` also plays a pivotal role in version control. Tags are immutable, meaning once they're created, they remain unchanged. Therefore, if you need a specific version of the software, you can use the corresponding tag. All of our available tags can be viewed [here](https://github.com/OpenIMSDK/Open-IM-Server/tags). -Moreover, our Docker image versions are closely tied with these three components. For instance, a tag might correspond to the Docker image `ghcr.io/openimsdk/openim-server:v3.1.0`, a release would be `ghcr.io/openimsdk/openim-server:release-v3.0`, and the main branch might be represented as `ghcr.io/openimsdk/openim-server:main` or `ghcr.io/openimsdk/openim-server:latest`. +Moreover, our Docker image versions are closely tied with these three components. For example, a tag might correspond to the Docker image `ghcr.io/openimsdk/openim-server:v3.1.0`, a release might be represented as `ghcr.io/openimsdk/openim-server:release-v3.0`, and the main branch could be represented as `ghcr.io/openimsdk/openim-server:main` or `ghcr.io/openimsdk/openim-server:latest`. -To find out more, or to contribute to our project, please visit our GitHub repository at [OpenIM Server](https://github.com/openimsdk/openim-server). +Here is the specification of our version numbers: -We believe that this approach offers a balanced blend of innovation and stability, enabling us to provide the best possible software to our users. +- **Revision version number**: The third digit of the version number, representing bug fixes or code optimizations, usually no new features are added and it is backward compatible with older versions. + +- **Build version number**: Usually automatically generated by the system, every code submission will result in an automatic increment by 1. + +- Version modifiers + + : These can represent the development stage and stability of the software. Common ones include: + + - `alpha`: An internal testing version with many bugs, generally used for communication among developers. + - `beta`: A test version with many bugs, generally used for testing by eager community members, who provide feedback to the developers. + - `rc`: Release candidate, to be released as the official version, it's the last test version before the official version. + - `ga`: General Availability, the first stable release. + - `r/release/or nothing`: The final release version, intended for general users. + - `lts`: Long Term Support, the official will specify the maintenance year for this version and will fix all bugs found in this version. + +When adding partial functions to the project, the minor version number increases by 1, and the revision version number resets to 0. When there are major changes in the project, the major version number increases by 1. The build number is generally automatically generated by the compiler during the compilation process, only the format needs to be defined, and it does not need to be manually controlled. ## OpenIM version diff --git a/go.mod b/go.mod index e016ff06f..cbaca83b8 100644 --- a/go.mod +++ b/go.mod @@ -8,11 +8,11 @@ require ( github.com/bwmarrin/snowflake v0.3.0 // indirect github.com/dtm-labs/rockscache v0.1.1 github.com/gin-gonic/gin v1.9.1 - github.com/go-playground/validator/v10 v10.14.0 + github.com/go-playground/validator/v10 v10.14.1 github.com/gogo/protobuf v1.3.2 github.com/golang-jwt/jwt/v4 v4.5.0 github.com/golang/protobuf v1.5.3 - github.com/gorilla/websocket v1.4.2 + github.com/gorilla/websocket v1.5.0 github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 github.com/jinzhu/copier v0.3.5 github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible // indirect @@ -23,11 +23,11 @@ require ( github.com/prometheus/client_golang v1.16.0 github.com/robfig/cron/v3 v3.0.1 github.com/sirupsen/logrus v1.9.3 // indirect - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 go.mongodb.org/mongo-driver v1.12.0 golang.org/x/image v0.9.0 // indirect google.golang.org/api v0.134.0 - google.golang.org/grpc v1.56.2 + google.golang.org/grpc v1.57.0 google.golang.org/protobuf v1.31.0 gopkg.in/yaml.v3 v3.0.1 gorm.io/driver/mysql v1.5.1 @@ -38,7 +38,7 @@ require github.com/google/uuid v1.3.0 require ( github.com/OpenIMSDK/protocol v0.0.3 - github.com/OpenIMSDK/tools v0.0.5 + github.com/OpenIMSDK/tools v0.0.13 github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible github.com/go-redis/redis v6.15.9+incompatible github.com/go-sql-driver/mysql v1.7.1 @@ -77,7 +77,7 @@ require ( github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect github.com/googleapis/gax-go/v2 v2.12.0 // indirect github.com/hashicorp/go-uuid v1.0.2 // indirect - github.com/inconshreveable/mousetrap v1.0.1 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jcmturner/aescts/v2 v2.0.0 // indirect github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect github.com/jcmturner/gofork v1.0.0 // indirect @@ -134,7 +134,7 @@ require ( github.com/goccy/go-json v0.10.2 // indirect github.com/lestrrat-go/strftime v1.0.6 // indirect github.com/mattn/go-isatty v0.0.19 // indirect - github.com/spf13/cobra v1.6.1 + github.com/spf13/cobra v1.7.0 github.com/ugorji/go/codec v1.2.11 // indirect go.uber.org/zap v1.24.0 // indirect golang.org/x/crypto v0.11.0 // indirect diff --git a/go.sum b/go.sum index 067ef5301..0e6352156 100644 --- a/go.sum +++ b/go.sum @@ -19,8 +19,8 @@ firebase.google.com/go v3.13.0+incompatible/go.mod h1:xlah6XbEyW6tbfSklcfe5FHJIw github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/OpenIMSDK/protocol v0.0.3 h1:CFQtmnyW+1dYKVFaVaHcJ6oYuMiMdNfU2gC1xz3K/9I= 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/go.mod h1:eg+q4A34Qmu73xkY0mt37FHGMCMfC6CtmOnm0kFEGFI= +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= github.com/Shopify/sarama v1.29.0 h1:ARid8o8oieau9XrHI55f/L3EoRAhm9px6sonbD7yuUE= github.com/Shopify/sarama v1.29.0/go.mod h1:2QpgD79wpdAESqNQMxNc0KYMkycd4slxGdV3TWSVqrU= @@ -100,8 +100,8 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js= -github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= +github.com/go-playground/validator/v10 v10.14.1 h1:9c50NUPC30zyuKprjL3vNZ0m5oG+jU0zvx4AqHGnv4k= +github.com/go-playground/validator/v10 v10.14.1/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg= github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= @@ -171,8 +171,8 @@ github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56 github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= @@ -180,8 +180,8 @@ github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2I github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= -github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jcmturner/aescts/v2 v2.0.0 h1:9YKLH6ey7H4eDBXW8khjYslgyqG2xZikXP0EQFKrle8= github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= github.com/jcmturner/dnsutils/v2 v2.0.0 h1:lltnkeZGL0wILNvrNiVCR6Ro5PGU/SeBvVO/8c/iPbo= @@ -298,8 +298,8 @@ github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= -github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= +github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= +github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -314,8 +314,9 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.563/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/kms v1.0.563/go.mod h1:uom4Nvi9W+Qkom0exYiJ9VWJjXwyxtPYTkKkaLMlfE0= github.com/tencentyun/cos-go-sdk-v5 v0.7.42 h1:Up1704BJjI5orycXKjpVpvuOInt9GC5pqY4knyE9Uds= @@ -486,8 +487,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= -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.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= +google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/internal/api/friend.go b/internal/api/friend.go index f64a99ef3..91fc30347 100644 --- a/internal/api/friend.go +++ b/internal/api/friend.go @@ -83,3 +83,7 @@ func (o *FriendApi) ImportFriends(c *gin.Context) { func (o *FriendApi) IsFriend(c *gin.Context) { a2r.Call(friend.FriendClient.IsFriend, o.Client, c) } + +func (o *FriendApi) GetFriendIDs(c *gin.Context) { + a2r.Call(friend.FriendClient.GetFriendIDs, o.Client, c) +} diff --git a/internal/api/group.go b/internal/api/group.go index ab397a8ac..ad640e74f 100644 --- a/internal/api/group.go +++ b/internal/api/group.go @@ -139,3 +139,7 @@ func (o *GroupApi) GroupCreateCount(c *gin.Context) { func (o *GroupApi) GetGroups(c *gin.Context) { a2r.Call(group.GroupClient.GetGroups, o.Client, c) } + +func (o *GroupApi) GetGroupMemberUserIDs(c *gin.Context) { + a2r.Call(group.GroupClient.GetGroupMemberUserIDs, o.Client, c) +} diff --git a/internal/api/msg.go b/internal/api/msg.go index e4a8fda17..e7f06dffa 100644 --- a/internal/api/msg.go +++ b/internal/api/msg.go @@ -16,6 +16,8 @@ package api import ( "github.com/OpenIMSDK/Open-IM-Server/pkg/authverify" + "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" + "github.com/OpenIMSDK/tools/mcontext" "github.com/gin-gonic/gin" "github.com/go-playground/validator/v10" "github.com/mitchellh/mapstructure" @@ -234,6 +236,51 @@ func (m *MessageApi) SendMessage(c *gin.Context) { apiresp.GinSuccess(c, respPb) } +func (m *MessageApi) SendBusinessNotification(c *gin.Context) { + req := struct { + Key string `json:"key"` + Data string `json:"data"` + SendUserID string `json:"sendUserID"` + RecvUserID string `json:"recvUserID"` + }{} + if err := c.BindJSON(&req); err != nil { + apiresp.GinError(c, errs.ErrArgs.WithDetail(err.Error()).Wrap()) + return + } + if !authverify.IsAppManagerUid(c) { + apiresp.GinError(c, errs.ErrNoPermission.Wrap("only app manager can send message")) + return + } + sendMsgReq := msg.SendMsgReq{ + MsgData: &sdkws.MsgData{ + SendID: req.SendUserID, + RecvID: req.RecvUserID, + Content: []byte(utils.StructToJsonString(&sdkws.NotificationElem{ + Detail: utils.StructToJsonString(&struct { + Key string `json:"key"` + Data string `json:"data"` + }{Key: req.Key, Data: req.Data}), + })), + MsgFrom: constant.SysMsgType, + ContentType: constant.BusinessNotification, + SessionType: constant.SingleChatType, + CreateTime: utils.GetCurrentTimestampByMill(), + ClientMsgID: utils.GetMsgID(mcontext.GetOpUserID(c)), + Options: config.GetOptionsByNotification(config.NotificationConf{ + IsSendMsg: false, + ReliabilityLevel: 1, + UnreadCount: false, + }), + }, + } + respPb, err := m.Client.SendMsg(c, &sendMsgReq) + if err != nil { + apiresp.GinError(c, err) + return + } + apiresp.GinSuccess(c, respPb) +} + func (m *MessageApi) BatchSendMsg(c *gin.Context) { var ( req apistruct.BatchSendMsgReq diff --git a/internal/api/route.go b/internal/api/route.go index 1926b55f1..5fd3f115a 100644 --- a/internal/api/route.go +++ b/internal/api/route.go @@ -102,6 +102,7 @@ func NewGinRouter(discov discoveryregistry.SvcDiscoveryRegistry, rdb redis.Unive friendRouterGroup.POST("/remove_black", f.RemoveBlack) friendRouterGroup.POST("/import_friend", f.ImportFriends) friendRouterGroup.POST("/is_friend", f.IsFriend) + friendRouterGroup.POST("/get_friend_id", f.GetFriendIDs) } g := NewGroupApi(*groupRpc) groupRouterGroup := r.Group("/group", ParseToken) @@ -129,6 +130,7 @@ func NewGinRouter(discov discoveryregistry.SvcDiscoveryRegistry, rdb redis.Unive groupRouterGroup.POST("/set_group_member_info", g.SetGroupMemberInfo) groupRouterGroup.POST("/get_group_abstract_info", g.GetGroupAbstractInfo) groupRouterGroup.POST("/get_groups", g.GetGroups) + groupRouterGroup.POST("/get_group_member_user_id", g.GetGroupMemberUserIDs) } superGroupRouterGroup := r.Group("/super_group", ParseToken) { @@ -166,6 +168,7 @@ func NewGinRouter(discov discoveryregistry.SvcDiscoveryRegistry, rdb redis.Unive msgGroup.POST("/newest_seq", m.GetSeq) msgGroup.POST("/search_msg", m.SearchMsg) msgGroup.POST("/send_msg", m.SendMessage) + msgGroup.POST("/send_business_notification", m.SendBusinessNotification) msgGroup.POST("/pull_msg_by_seq", m.PullMsgBySeqs) msgGroup.POST("/revoke_msg", m.RevokeMsg) msgGroup.POST("/mark_msgs_as_read", m.MarkMsgsAsRead)