Compare commits
61 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 093b3f640c | |||
| 90428ee76b | |||
| 60368e429c | |||
| 8161eab91b | |||
| 2efa041664 | |||
| a2da40ceab | |||
| add05a5f26 | |||
| 776081b35d | |||
| 77f0b2460b | |||
| 8e5e792a60 | |||
| 4c593d2436 | |||
| 14838b0ac8 | |||
| 2fb6674fc9 | |||
| 3025c61a7a | |||
| 077df0486e | |||
| 820bf83102 | |||
| 6027d2dfa3 | |||
| e6371f804d | |||
| de54be961f | |||
| 4cc3e0b194 | |||
| c7a884511b | |||
| e5083d5809 | |||
| 266237861b | |||
| 0aae970298 | |||
| 3be16ce3e8 | |||
| c4a140043c | |||
| 66bf8496b8 | |||
| ce32c8d9c1 | |||
| 760a119015 | |||
| d236f4070c | |||
| a412ab33a6 | |||
| ef19cf4f8d | |||
| 07dfde965c | |||
| afac910ecf | |||
| c2b8279ddc | |||
| 0c745782b0 | |||
| 2ba45691c4 | |||
| 8d5d54af33 | |||
| 571e239992 | |||
| 159822e207 | |||
| 89b59eb82e | |||
| 76b35210aa | |||
| 093f9a3b34 | |||
| 7ad8a7241d | |||
| c71bcefcbe | |||
| c4a8602428 | |||
| b17b364b02 | |||
| 7e2c535f37 | |||
| a3acba5eea | |||
| baf0d1888c | |||
| 5b99eb21e7 | |||
| 58ab340d1e | |||
| d8eec588de | |||
| b19d1f1726 | |||
| d446bdb943 | |||
| 4abddd8247 | |||
| c70ee5cbfb | |||
| 7bb44b8b88 | |||
| 019ef60616 | |||
| 16bc053d09 | |||
| 61f83212b2 |
@@ -1,140 +0,0 @@
|
|||||||
# OpenIM - OSS Development Container
|
|
||||||
|
|
||||||
[](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/openimsdk/open-im-server)
|
|
||||||
|
|
||||||
This repository includes configuration for a development container for working with OpenIM - OSS in a local container or using [GitHub Codespaces](https://github.com/features/codespaces).
|
|
||||||
|
|
||||||
> **Tip:** The default VNC password is `openIM123`. The VNC server runs on port `5901` and a web client is available on port `11001`, openim-admin on port `11002`.
|
|
||||||
|
|
||||||
## Quick start - local
|
|
||||||
|
|
||||||
If you already have VS Code and Docker installed, you can click the badge above or [here](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/openimsdk/open-im-server) to get started. Clicking these links will cause VS Code to automatically install the Dev Containers extension if needed, clone the source code into a container volume, and spin up a dev container for use.
|
|
||||||
|
|
||||||
1. Install Docker Desktop or Docker for Linux on your local machine. (See [docs](https://aka.ms/vscode-remote/containers/getting-started) for additional details.)
|
|
||||||
|
|
||||||
2. **Important**: Docker needs at least **4 Cores and 8 GB of RAM** to run a full build with **9 GB of RAM** being recommended. If you are on macOS, or are using the old Hyper-V engine for Windows, update these values for Docker Desktop by right-clicking on the Docker status bar item and going to **Preferences/Settings > Resources > Advanced**.
|
|
||||||
|
|
||||||
> **Note:** The [Resource Monitor](https://marketplace.visualstudio.com/items?itemName=mutantdino.resourcemonitor) extension is included in the container so you can keep an eye on CPU/Memory in the status bar.
|
|
||||||
|
|
||||||
3. Install [Visual Studio Code Stable](https://code.visualstudio.com/) or [Insiders](https://code.visualstudio.com/insiders/) and the [Dev Containers](https://aka.ms/vscode-remote/download/containers) extension.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
> **Note:** The Dev Containers extension requires the Visual Studio Code distribution of OpenIM - OSS. See the [FAQ](https://aka.ms/vscode-remote/faq/license) for details.
|
|
||||||
|
|
||||||
4. Press <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> or <kbd>F1</kbd> and select **Dev Containers: Clone Repository in Container Volume...**.
|
|
||||||
|
|
||||||
> **Tip:** While you can use your local source tree instead, operations like `yarn install` can be slow on macOS or when using the Hyper-V engine on Windows. We recommend using the WSL filesystem on Windows or the "clone repository in container" approach on Windows and macOS instead since it uses "named volume" rather than the local filesystem.
|
|
||||||
|
|
||||||
5. Type `https://github.com/openimsdk/open-im-server` (or a branch or PR URL) in the input box and press <kbd>Enter</kbd>.
|
|
||||||
|
|
||||||
6. After the container is running:
|
|
||||||
1. If you have the `DISPLAY` or `WAYLAND_DISPLAY` environment variables set locally (or in WSL on Windows), desktop apps in the container will be shown in local windows.
|
|
||||||
2. If these are not set, open a web browser and go to [http://localhost:11001](http://localhost:11001), or use a [VNC Viewer][def] to connect to `localhost:11001` and enter `vscode` as the password. Anything you start in VS Code, or the integrated terminal, will appear here.
|
|
||||||
|
|
||||||
Next: **[Try it out!](#try-it)**
|
|
||||||
|
|
||||||
## Quick start - GitHub Codespaces
|
|
||||||
|
|
||||||
1. From the [openimsdk/open-im-server GitHub repository](https://github.com/openimsdk/open-im-server), click on the **Code** dropdown, select **Open with Codespaces**, and then click on **New codespace**. If prompted, select the **Standard** machine size (which is also the default).
|
|
||||||
|
|
||||||
> **Note:** You will not see these options within GitHub if you are not in the Codespaces beta.
|
|
||||||
|
|
||||||
2. After the codespace is up and running in your browser, press <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> or <kbd>F1</kbd> and select **Ports: Focus on Ports View**.
|
|
||||||
|
|
||||||
3. You should see **VNC web client (11001)** under in the list of ports. Select the line and click on the globe icon to open it in a browser tab.
|
|
||||||
|
|
||||||
> **Tip:** If you do not see the port, <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> or <kbd>F1</kbd>, select **Forward a Port** and enter port `11001`.
|
|
||||||
|
|
||||||
4. In the new tab, you should see noVNC. Click **Connect** and enter `vscode` as the password.
|
|
||||||
|
|
||||||
Anything you start in VS Code, or the integrated terminal, will appear here.
|
|
||||||
|
|
||||||
Next: **[Try it out!](#try-it)**
|
|
||||||
|
|
||||||
### Using VS Code with GitHub Codespaces
|
|
||||||
|
|
||||||
You may see improved VNC responsiveness when accessing a codespace from VS Code client since you can use a [VNC Viewer][def]. Here's how to do it.
|
|
||||||
|
|
||||||
1. Install [Visual Studio Code Stable](https://code.visualstudio.com/) or [Insiders](https://code.visualstudio.com/insiders/) and the the [GitHub Codespaces extension](https://marketplace.visualstudio.com/items?itemName=GitHub.codespaces).
|
|
||||||
|
|
||||||
> **Note:** The GitHub Codespaces extension requires the Visual Studio Code distribution of OpenIM - OSS.
|
|
||||||
|
|
||||||
2. After the VS Code is up and running, press <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> or <kbd>F1</kbd>, choose **Codespaces: Create New Codespace**, and use the following settings:
|
|
||||||
|
|
||||||
- `openimsdk/open-im-server` for the repository.
|
|
||||||
- Select any branch (e.g. **main**) - you can select a different one later.
|
|
||||||
- Choose **Standard** (4-core, 8GB) as the size.
|
|
||||||
|
|
||||||
3. After you have connected to the codespace, you can use a [VNC Viewer][def] to connect to `localhost:5901` and enter `vscode` as the password.
|
|
||||||
|
|
||||||
> **Tip:** You may also need change your VNC client's **Picture Quality** setting to **High** to get a full color desktop.
|
|
||||||
|
|
||||||
4. Anything you start in VS Code, or the integrated terminal, will appear here.
|
|
||||||
|
|
||||||
Next: **[Try it out!](#try-it)**
|
|
||||||
|
|
||||||
## Try it
|
|
||||||
|
|
||||||
This container uses the [Fluxbox](http://fluxbox.org/) window manager to keep things lean. **Right-click on the desktop** to see menu options. It works with GNOME and GTK applications, so other tools can be installed if needed.
|
|
||||||
|
|
||||||
> **Note:** You can also set the resolution from the command line by typing `set-resolution`.
|
|
||||||
|
|
||||||
To start working with OpenIM - OSS, follow these steps:
|
|
||||||
|
|
||||||
1. In your local VS Code client, open a terminal (<kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>\`</kbd>) and type the following commands:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
yarn install
|
|
||||||
bash scripts/code.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
2. After the build is complete, open a web browser or a [VNC Viewer][def] to connect to the desktop environment as described in the quick start and enter `vscode` as the password.
|
|
||||||
|
|
||||||
3. You should now see OpenIM - OSS!
|
|
||||||
|
|
||||||
Next, let's try debugging.
|
|
||||||
|
|
||||||
1. Shut down OpenIM - OSS by clicking the box in the upper right corner of the OpenIM - OSS window through your browser or VNC viewer.
|
|
||||||
|
|
||||||
2. Go to your local VS Code client, and use the **Run / Debug** view to launch the **VS Code** configuration. (Typically the default, so you can likely just press <kbd>F5</kbd>).
|
|
||||||
|
|
||||||
> **Note:** If launching times out, you can increase the value of `timeout` in the "VS Code", "Attach Main Process", "Attach Extension Host", and "Attach to Shared Process" configurations in [launch.json](../../.vscode/launch.json). However, running `./scripts/code.sh` first will set up Electron which will usually solve timeout issues.
|
|
||||||
|
|
||||||
3. After a bit, OpenIM - OSS will appear with the debugger attached!
|
|
||||||
|
|
||||||
Enjoy!
|
|
||||||
|
|
||||||
|
|
||||||
### Dotfiles
|
|
||||||
|
|
||||||
Dotfiles are files and folders on Unix-like systems starting with `.` that control the configuration of applications and shells on your system. You can store and manage your dotfiles in a repository on GitHub. For advice and tutorials about what to include in your dotfiles repository, see [GitHub does dotfiles](https://dotfiles.github.io/).
|
|
||||||
|
|
||||||
Your dotfiles repository might include your shell aliases and preferences, any tools you want to install, or any other codespace personalization you want to make.
|
|
||||||
|
|
||||||
You can configure GitHub Codespaces to use dotfiles from any repository you own by selecting that repository in your [personal GitHub Codespaces settings](https://github.com/settings/codespaces).
|
|
||||||
|
|
||||||
When you create a new codespace, GitHub clones your selected dotfiles repository to the codespace environment, and looks for one of the following files to set up the environment.
|
|
||||||
|
|
||||||
- *install.sh*
|
|
||||||
- *install*
|
|
||||||
- *bootstrap.sh*
|
|
||||||
- *bootstrap*
|
|
||||||
- *script/bootstrap*
|
|
||||||
- *setup.sh*
|
|
||||||
- *setup*
|
|
||||||
- *script/setup*
|
|
||||||
|
|
||||||
If none of these files are found, then any files or folders in your selected dotfiles repository starting with `.` are symlinked to the codespace's `~` or `$HOME` directory.
|
|
||||||
|
|
||||||
Any changes to your selected dotfiles repository will apply only to each new codespace, and do not affect any existing codespace.
|
|
||||||
|
|
||||||
**Note:** Currently, Codespaces does not support personalizing the User-scoped settings for VS Code with your `dotfiles` repository. You can set default Workspace and Remote [Codespaces] settings for a specific project in the project's repository. For more information, see "[Introduction to dev containers](https://docs.github.com/en/codespaces/setting-up-your-project-for-codespaces/adding-a-dev-container-configuration/introduction-to-dev-containers#creating-a-custom-dev-container-configuration)."
|
|
||||||
|
|
||||||
In addition, you can also configure Codespaces secrets on your personal profile page at [github.com/settings/codespaces](https://github.com/settings/codespaces). Development environment secrets are environment variables that are encrypted, and they are accessible to any codespace you create using repositories that have access to these secrets.
|
|
||||||
|
|
||||||
### Notes
|
|
||||||
|
|
||||||
The container comes with VS Code Insiders installed. To run it from an Integrated Terminal use `VSCODE_IPC_HOOK_CLI= /usr/bin/code-insiders .`.
|
|
||||||
|
|
||||||
[def]: https://www.realvnc.com/en/connect/download/viewer/
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
{
|
|
||||||
// Reference Doc: https://code.visualstudio.com/remote/advancedcontainers/overview
|
|
||||||
"name": "OpenIM Dev Environment",
|
|
||||||
// Update the container version when you publish dev-container
|
|
||||||
"build": { "dockerfile": "Dockerfile" },
|
|
||||||
// Replace with uncommented line below to build your own local copy of the image
|
|
||||||
// "dockerFile": "../docker/Dockerfile-dev",
|
|
||||||
"remoteEnv": {
|
|
||||||
"GO111MODULE": "on",
|
|
||||||
"GOPROXY": "https://goproxy.cn",
|
|
||||||
"GOSUMDB": "sum.golang.org",
|
|
||||||
"GONOPROXY": "github.com/openimsdk",
|
|
||||||
"GONOSUMDB": "github.com/openimsdk",
|
|
||||||
"GOPRIVATE": "github.com/openimsdk"
|
|
||||||
},
|
|
||||||
"customizations": {
|
|
||||||
"vscode": {
|
|
||||||
"extensions": [
|
|
||||||
"davidanson.vscode-markdownlint",
|
|
||||||
"golang.go",
|
|
||||||
"ms-azuretools.vscode-dapr",
|
|
||||||
"ms-azuretools.vscode-docker",
|
|
||||||
"ms-kubernetes-tools.vscode-kubernetes-tools"
|
|
||||||
],
|
|
||||||
"settings": {
|
|
||||||
"go.toolsManagement.checkForUpdates": "local",
|
|
||||||
"go.useLanguageServer": true,
|
|
||||||
"go.gopath": "/go"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"mounts": [
|
|
||||||
// Mount docker-in-docker library volume
|
|
||||||
"type=volume,source=dind-var-lib-docker,target=/var/lib/docker",
|
|
||||||
|
|
||||||
// Bind mount docker socket under an alias to support docker-from-docker
|
|
||||||
"type=bind,source=/var/run/docker.sock,target=/var/run/docker-host.sock",
|
|
||||||
|
|
||||||
// Bind mount docker socket under an alias to support docker-from-docker
|
|
||||||
// "type=bind,source=${env:HOME}${env:USERPROFILE}/.minikube/cache,target=/home/openim/.minikube/cache",
|
|
||||||
|
|
||||||
// Uncomment to clone local .kube/config into devcontainer
|
|
||||||
"type=bind,source=${env:HOME}${env:USERPROFILE}/.kube,target=/home/openim/.kube-localhost"
|
|
||||||
|
|
||||||
// Uncomment to additionally clone minikube certs into devcontainer for use with .kube/config
|
|
||||||
// "type=bind,source=${env:HOME}${env:USERPROFILE}/.minikube,target=/home/openim/.minikube-localhost"
|
|
||||||
],
|
|
||||||
// Always run image-defined default command
|
|
||||||
"overrideCommand": false,
|
|
||||||
// On Linux, this will prevent new files getting created as root, but you
|
|
||||||
// may need to update the USER_UID and USER_GID in docker/Dockerfile-dev
|
|
||||||
// to match your user if not 1000.
|
|
||||||
// "remoteUser": "openimsdk",
|
|
||||||
"runArgs": [
|
|
||||||
// Enable ptrace-based debugging for go
|
|
||||||
"--cap-add=SYS_PTRACE",
|
|
||||||
"--security-opt",
|
|
||||||
"seccomp=unconfined",
|
|
||||||
|
|
||||||
// Uncomment to bind to host network for local devcontainer; this is necessary if using the
|
|
||||||
// bind-mounted /var/run/docker-host.sock directly.
|
|
||||||
"--net=host",
|
|
||||||
|
|
||||||
// Enable docker-in-docker configuration. Comment out if not using for better security.
|
|
||||||
"--privileged",
|
|
||||||
|
|
||||||
// Run the entrypoint defined in container image.
|
|
||||||
"--init"
|
|
||||||
],
|
|
||||||
"workspaceFolder": "/workspaces/openim",
|
|
||||||
"workspaceMount": "type=bind,source=${localWorkspaceFolder},target=/workspaces/openim"
|
|
||||||
}
|
|
||||||
@@ -23,6 +23,8 @@ on:
|
|||||||
- "docs/**"
|
- "docs/**"
|
||||||
- "README.md"
|
- "README.md"
|
||||||
- "README_zh-CN.md"
|
- "README_zh-CN.md"
|
||||||
|
- "**.md"
|
||||||
|
- "docs/**"
|
||||||
- "CONTRIBUTING.md"
|
- "CONTRIBUTING.md"
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
@@ -31,7 +33,8 @@ on:
|
|||||||
paths-ignore:
|
paths-ignore:
|
||||||
- "README.md"
|
- "README.md"
|
||||||
- "README_zh-CN.md"
|
- "README_zh-CN.md"
|
||||||
- "CONTRIBUTING.md"
|
- "CONTRIBUTING/**"
|
||||||
|
- "**.md"
|
||||||
- "docs/**"
|
- "docs/**"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
@@ -67,6 +70,9 @@ jobs:
|
|||||||
version: '3.x' # If available, use the latest major version that's compatible
|
version: '3.x' # If available, use the latest major version that's compatible
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: OpenIM Scripts Verification(make verify)
|
||||||
|
run: sudo make verify
|
||||||
|
|
||||||
- name: Module Operations
|
- name: Module Operations
|
||||||
run: |
|
run: |
|
||||||
sudo make tidy
|
sudo make tidy
|
||||||
@@ -91,13 +97,6 @@ jobs:
|
|||||||
- name: Cleanup Build
|
- name: Cleanup Build
|
||||||
run: sudo make clean
|
run: sudo make clean
|
||||||
|
|
||||||
- name: Push Changes to Main
|
|
||||||
uses: stefanzweifel/git-auto-commit-action@v5
|
|
||||||
with:
|
|
||||||
commit_message: "cicd: robot automated Change"
|
|
||||||
branch: main
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
- name: Set Current Directory
|
- name: Set Current Directory
|
||||||
id: set_directory
|
id: set_directory
|
||||||
run: echo "::set-output name=directory::$(pwd)"
|
run: echo "::set-output name=directory::$(pwd)"
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ deployments/charts/generated-configs/
|
|||||||
### OpenIM Config ###
|
### OpenIM Config ###
|
||||||
.env
|
.env
|
||||||
config/config.yaml
|
config/config.yaml
|
||||||
config/openim.yaml
|
|
||||||
config/alertmanager.yml
|
config/alertmanager.yml
|
||||||
config/prometheus.yml
|
config/prometheus.yml
|
||||||
config/email.tmpl
|
config/email.tmpl
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
# Version logging for OpenIM
|
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_TOC -->
|
|
||||||
|
|
||||||
<!-- END MUNGE: GENERATED_TOC -->
|
|
||||||
|
|
||||||
<a name="unreleased"></a>
|
|
||||||
## [Unreleased]
|
|
||||||
|
|
||||||
|
|
||||||
<a name="v3.4.2"></a>
|
|
||||||
## [v3.4.2] - 2023-12-14
|
|
||||||
|
|
||||||
<a name="v3.4.0"></a>
|
|
||||||
## [v3.4.0] - 2023-11-10
|
|
||||||
|
|
||||||
<a name="v3.4.0-rc.1"></a>
|
|
||||||
## [v3.4.0-rc.1] - 2023-11-09
|
|
||||||
|
|
||||||
<a name="v3.4.0-rc.0"></a>
|
|
||||||
## v3.4.0-rc.0 - 2023-11-09
|
|
||||||
### Reverts
|
|
||||||
- update etcd to v3.5.2 ([#206](https://github.com/openimsdk/open-im-server/issues/206))
|
|
||||||
|
|
||||||
### Pull Requests
|
|
||||||
- Merge branch 'tuoyun'
|
|
||||||
|
|
||||||
|
|
||||||
[Unreleased]: https://github.com/openimsdk/open-im-server/compare/v3.4.2...HEAD
|
|
||||||
[v3.4.2]: https://github.com/openimsdk/open-im-server/compare/v3.4.0...v3.4.2
|
|
||||||
[v3.4.0]: https://github.com/openimsdk/open-im-server/compare/v3.4.0-rc.1...v3.4.0
|
|
||||||
[v3.4.0-rc.1]: https://github.com/openimsdk/open-im-server/compare/v3.4.0-rc.0...v3.4.0-rc.1
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
# Version logging for OpenIM
|
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_TOC -->
|
|
||||||
|
|
||||||
<!-- END MUNGE: GENERATED_TOC -->
|
|
||||||
|
|
||||||
<a name="unreleased"></a>
|
|
||||||
## [Unreleased]
|
|
||||||
|
|
||||||
|
|
||||||
<a name="v3.5.1-alpha.1"></a>
|
|
||||||
## [v3.5.1-alpha.1] - 2024-01-09
|
|
||||||
|
|
||||||
<a name="v3.5.0"></a>
|
|
||||||
## [v3.5.0] - 2024-01-02
|
|
||||||
|
|
||||||
<a name="v3.5.1"></a>
|
|
||||||
## [v3.5.1] - 2024-01-02
|
|
||||||
|
|
||||||
<a name="v3.5.1-bate.1"></a>
|
|
||||||
## [v3.5.1-bate.1] - 2024-01-02
|
|
||||||
|
|
||||||
<a name="v3.5.1-rc.0"></a>
|
|
||||||
## [v3.5.1-rc.0] - 2023-12-30
|
|
||||||
|
|
||||||
<a name="v3.5.0-rc.8"></a>
|
|
||||||
## [v3.5.0-rc.8] - 2023-12-28
|
|
||||||
|
|
||||||
<a name="v3.5.0-rc.7"></a>
|
|
||||||
## [v3.5.0-rc.7] - 2023-12-18
|
|
||||||
|
|
||||||
<a name="v3.5.0-rc.6"></a>
|
|
||||||
## [v3.5.0-rc.6] - 2023-12-15
|
|
||||||
|
|
||||||
<a name="v3.5.0-rc.5"></a>
|
|
||||||
## [v3.5.0-rc.5] - 2023-12-15
|
|
||||||
|
|
||||||
<a name="v3.5.0-rc.4"></a>
|
|
||||||
## [v3.5.0-rc.4] - 2023-12-14
|
|
||||||
|
|
||||||
<a name="v3.5.0-rc.3"></a>
|
|
||||||
## [v3.5.0-rc.3] - 2023-12-14
|
|
||||||
|
|
||||||
<a name="v3.5.0-rc.2"></a>
|
|
||||||
## [v3.5.0-rc.2] - 2023-12-14
|
|
||||||
|
|
||||||
<a name="v3.5.0-rc.1"></a>
|
|
||||||
## [v3.5.0-rc.1] - 2023-12-14
|
|
||||||
|
|
||||||
<a name="v3.5.0-rc.0"></a>
|
|
||||||
## [v3.5.0-rc.0] - 2023-12-14
|
|
||||||
|
|
||||||
<a name="v3.5.0-beta.1"></a>
|
|
||||||
## v3.5.0-beta.1 - 2023-11-29
|
|
||||||
### Reverts
|
|
||||||
- update etcd to v3.5.2 ([#206](https://github.com/openimsdk/open-im-server/issues/206))
|
|
||||||
|
|
||||||
### Pull Requests
|
|
||||||
- Merge branch 'tuoyun'
|
|
||||||
|
|
||||||
|
|
||||||
[Unreleased]: https://github.com/openimsdk/open-im-server/compare/v3.5.1-alpha.1...HEAD
|
|
||||||
[v3.5.1-alpha.1]: https://github.com/openimsdk/open-im-server/compare/v3.5.0...v3.5.1-alpha.1
|
|
||||||
[v3.5.0]: https://github.com/openimsdk/open-im-server/compare/v3.5.1...v3.5.0
|
|
||||||
[v3.5.1]: https://github.com/openimsdk/open-im-server/compare/v3.5.1-bate.1...v3.5.1
|
|
||||||
[v3.5.1-bate.1]: https://github.com/openimsdk/open-im-server/compare/v3.5.1-rc.0...v3.5.1-bate.1
|
|
||||||
[v3.5.1-rc.0]: https://github.com/openimsdk/open-im-server/compare/v3.5.0-rc.8...v3.5.1-rc.0
|
|
||||||
[v3.5.0-rc.8]: https://github.com/openimsdk/open-im-server/compare/v3.5.0-rc.7...v3.5.0-rc.8
|
|
||||||
[v3.5.0-rc.7]: https://github.com/openimsdk/open-im-server/compare/v3.5.0-rc.6...v3.5.0-rc.7
|
|
||||||
[v3.5.0-rc.6]: https://github.com/openimsdk/open-im-server/compare/v3.5.0-rc.5...v3.5.0-rc.6
|
|
||||||
[v3.5.0-rc.5]: https://github.com/openimsdk/open-im-server/compare/v3.5.0-rc.4...v3.5.0-rc.5
|
|
||||||
[v3.5.0-rc.4]: https://github.com/openimsdk/open-im-server/compare/v3.5.0-rc.3...v3.5.0-rc.4
|
|
||||||
[v3.5.0-rc.3]: https://github.com/openimsdk/open-im-server/compare/v3.5.0-rc.2...v3.5.0-rc.3
|
|
||||||
[v3.5.0-rc.2]: https://github.com/openimsdk/open-im-server/compare/v3.5.0-rc.1...v3.5.0-rc.2
|
|
||||||
[v3.5.0-rc.1]: https://github.com/openimsdk/open-im-server/compare/v3.5.0-rc.0...v3.5.0-rc.1
|
|
||||||
[v3.5.0-rc.0]: https://github.com/openimsdk/open-im-server/compare/v3.5.0-beta.1...v3.5.0-rc.0
|
|
||||||
+23
-33
@@ -35,62 +35,52 @@
|
|||||||
|
|
||||||
## Ⓜ️ 关于 OpenIM
|
## Ⓜ️ 关于 OpenIM
|
||||||
|
|
||||||
OpenIM 是一个专门设计用于在应用程序中集成聊天、音视频通话、通知以及AI聊天机器人等通信功能的服务平台。它通过提供一系列强大的API和Webhooks,使开发者可以轻松地在他们的应用中加入这些交互特性。OpenIM 本身并不是一个独立运行的聊天应用,而是作为一个平台,为其他应用提供支持,实现丰富的通信功能。下图展示 AppServer、AppClient、OpenIMServer 和 OpenIMSDK 之间的交互关系来具体说明。
|
OpenIM 不仅仅是一个开源的即时消息组件,它是你的应用程序生态系统的一个不可或缺的部分。查看下面的图表,了解 AppServer、AppClient、OpenIMServer 和 OpenIMSDK 是如何交互的。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## 🚀 关于 OpenIMSDK
|
## 🚀 关于 OpenIMSDK
|
||||||
|
|
||||||
**OpenIMSDK** 是为 **OpenIMServer** 设计的IM SDK,专为嵌入客户端应用而生。其主要功能及模块如下:
|
**OpenIMSDK** 无缝集成到您的应用中,提供丰富、实时的消息体验,无需复杂的 UI 集成。它提供:
|
||||||
|
|
||||||
+ 🌟 主要功能:
|
+ **本地存储**:用于快速数据检索和消息同步。
|
||||||
|
+ **监听器回调**:确保实时消息交互性。
|
||||||
|
+ **API 封装**:简化开发流程。
|
||||||
|
+ **连接管理**:保证可靠的消息传递。
|
||||||
|
|
||||||
- 📦 本地存储
|
它使用 Golang 构建,并支持跨平台部署,确保在所有平台上提供一致的消息体验。
|
||||||
- 🔔 监听器回调
|
|
||||||
- 🛡️ API封装
|
|
||||||
- 🌐 连接管理
|
|
||||||
|
|
||||||
## 📚 主要模块:
|
|
||||||
|
|
||||||
1. 🚀 初始化及登录
|
|
||||||
2. 👤 用户管理
|
|
||||||
3. 👫 好友管理
|
|
||||||
4. 🤖 群组功能
|
|
||||||
5. 💬 会话处理
|
|
||||||
|
|
||||||
它使用 Golang 构建,并支持跨平台部署,确保在所有平台上提供一致的接入体验。
|
|
||||||
|
|
||||||
👉 **[探索 GO SDK](https://github.com/openimsdk/openim-sdk-core)**
|
👉 **[探索 GO SDK](https://github.com/openimsdk/openim-sdk-core)**
|
||||||
|
|
||||||
## 🌐 关于 OpenIMServer
|
## 🌐 关于 OpenIMServer
|
||||||
|
|
||||||
+ **OpenIMServer** 具有以下特点:
|
精心用 Golang 开发的 **OpenIMServer** 通过多重方式确保了卓越的即时消息服务器能力:
|
||||||
- 🌐 微服务架构:支持集群模式,包括网关(gateway)和多个rpc服务。
|
|
||||||
- 🚀 部署方式多样:支持源代码、kubernetes或docker部署。
|
+ **模块组成**:它由多个模块组成,例如网关和多个 RPC 服务,提供一个多功能的消息环境。
|
||||||
- 海量用户支持:十万超级大群,千万用户,及百亿消息
|
+ **微服务架构**:支持集群模式,确保出色的性能和可伸缩性,以有效管理各个实例间的通信。
|
||||||
|
+ **多样的部署选项**:适应你的操作偏好,通过源代码、Kubernetes 或 Docker 提供部署选项。
|
||||||
|
|
||||||
### 增强的业务功能:
|
### 增强的业务功能:
|
||||||
|
|
||||||
+ **REST API**:OpenIMServer 提供了REST API供业务系统使用,旨在赋予业务更多功能,例如通过后台接口建立群组、发送推送消息等。
|
+ **REST API**:OpenIMServer 为业务系统提供 REST API,旨在通过后端接口为您的操作提供附加功能,如群组创建和消息推送。
|
||||||
+ **Webhooks**:OpenIMServer提供了回调能力以扩展更多的业务形态,所谓回调,即OpenIMServer会在某一事件发生之前或者之后,向业务服务器发送请求,如发送消息之前或之后的回调。
|
+ **回调**:为了扩展其在各种业务形式中的实用性,OpenIMServer 提供了回调能力。即,在事件发生之前或之后,它向业务服务器发送请求,比如发送消息,丰富通信过程中的交互和数据交换流。
|
||||||
|
|
||||||
👉 **[了解更多](https://docs.openim.io/guides/introduction/product)**
|
👉 **[了解更多](https://doc.rentsoft.cn/guides/introduction/product)**
|
||||||
|
|
||||||
## :rocket: 快速开始
|
## :rocket: 快速开始
|
||||||
|
|
||||||
在线体验iOS/Android/H5/PC/Web:
|
你只需要一个简单的命令,就可以快速学习 OpenIM 的工程解决方案:
|
||||||
|
|
||||||
👉 **[OpenIM online demo](https://www.openim.io/zh/commercial)**
|
```
|
||||||
|
bashCopy code
|
||||||
|
$ make demo
|
||||||
|
```
|
||||||
|
|
||||||
🤲 为了方便用户体验,我们提供了多种部署解决方案,您可以根据下面的列表选择自己的部署方法:
|
🤲 为了方便用户体验,我们提供了多种部署解决方案,您可以根据下面的列表选择自己的部署方法:
|
||||||
|
|
||||||
+ **[源代码部署指南](https://docs.openim.io/guides/gettingStarted/imSourceCodeDeployment)**
|
+ **[源代码部署指南](https://doc.rentsoft.cn/guides/gettingStarted/imSourceCodeDeployment)**
|
||||||
+ **[Docker 部署指南](https://docs.openim.io/guides/gettingStarted/dockerCompose)**
|
+ **[Docker 部署指南](https://doc.rentsoft.cn/guides/gettingStarted/dockerCompose)**
|
||||||
+ **[Kubernetes 部署指南](https://docs.openim.io/guides/gettingStarted/k8s-deployment)**
|
+ **[Kubernetes 部署指南](https://github.com/openimsdk/open-im-server/tree/main/deployments)**
|
||||||
|
|
||||||
## :hammer_and_wrench: 开始开发 OpenIM
|
## :hammer_and_wrench: 开始开发 OpenIM
|
||||||
|
|
||||||
|
|||||||
@@ -25,58 +25,180 @@
|
|||||||
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
## Ⓜ️ About OpenIM
|
## Ⓜ️ About OpenIM
|
||||||
|
|
||||||
OpenIM is a service platform specifically designed for integrating chat, audio-video calls, notifications, and AI chatbots into applications. It provides a range of powerful APIs and Webhooks, enabling developers to easily incorporate these interactive features into their applications. OpenIM is not a standalone chat application, but rather serves as a platform to support other applications in achieving rich communication functionalities. The following diagram illustrates the interaction between AppServer, AppClient, OpenIMServer, and OpenIMSDK to explain in detail.
|
OpenIM isn't just an open-source instant messaging component, it's an integral part of your application ecosystem. Check out this diagram to understand how AppServer, AppClient, OpenIMServer, and OpenIMSDK interact.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## 🚀 About OpenIMSDK
|
## 🚀 About OpenIMSDK
|
||||||
|
|
||||||
**OpenIMSDK** is an IM SDK designed for **OpenIMServer**, created specifically for embedding in client applications. Its main features and modules are as follows:
|
**OpenIMSDK** seamlessly integrates into your application, delivering a rich, real-time messaging experience without requiring intricate UI integration. It provides:
|
||||||
|
|
||||||
+ 🌟 Main Features:
|
+ **Local Storage**: For quick data retrieval and message synchronization.
|
||||||
|
+ **Listener Callbacks**: Ensuring real-time message interactivity.
|
||||||
|
+ **API Encapsulation**: Streamlining development processes.
|
||||||
|
+ **Connection Management**: Guaranteeing reliable message delivery.
|
||||||
|
|
||||||
- 📦 Local storage
|
It's crafted in Golang and supports cross-platform deployment, ensuring a coherent messaging experience across all platforms.
|
||||||
- 🔔 Listener callbacks
|
|
||||||
- 🛡️ API wrapping
|
|
||||||
- 🌐 Connection management
|
|
||||||
|
|
||||||
## 📚 Main Modules:
|
|
||||||
|
|
||||||
1. 🚀 Initialization and Login
|
|
||||||
2. 👤 User Management
|
|
||||||
3. 👫 Friend Management
|
|
||||||
4. 🤖 Group Functions
|
|
||||||
5. 💬 Conversation Handling
|
|
||||||
|
|
||||||
It is built using Golang and supports cross-platform deployment, ensuring a consistent access experience across all platforms.
|
|
||||||
|
|
||||||
👉 **[Explore GO SDK](https://github.com/openimsdk/openim-sdk-core)**
|
👉 **[Explore GO SDK](https://github.com/openimsdk/openim-sdk-core)**
|
||||||
|
|
||||||
## 🌐 About OpenIMServer
|
## 🌐 About OpenIMServer
|
||||||
|
|
||||||
+ **OpenIMServer** has the following characteristics:
|
**OpenIMServer**, meticulously developed in Golang, ensures a stellar instant messaging server capability with a multifold approach:
|
||||||
- 🌐 Microservice architecture: Supports cluster mode, including a gateway and multiple rpc services.
|
|
||||||
- 🚀 Diverse deployment methods: Supports deployment via source code, Kubernetes, or Docker.
|
|
||||||
- Support for massive user base: Super large groups with hundreds of thousands of users, tens of millions of users, and billions of messages.
|
|
||||||
|
|
||||||
### Enhanced Business Functionality:
|
+ **Modular Composition**: It's comprised of several modules, such as the gateway and multiple RPC services, offering a versatile messaging environment.
|
||||||
|
+ **Microservices Architecture**: Supporting cluster modes, it assures outstanding performance and scalability to manage communication effectively across various instances.
|
||||||
|
+ **Diverse Deployment Options**: Adapts to your operational preferences, offering deployment via source code, Kubernetes, or Docker.
|
||||||
|
|
||||||
+ **REST API**: OpenIMServer offers REST APIs for business systems, aimed at empowering businesses with more functionalities, such as creating groups and sending push messages through backend interfaces.
|
### Enhanced Business Functionalities:
|
||||||
+ **Webhooks**: OpenIMServer provides callback capabilities to extend more business forms. A callback means that OpenIMServer sends a request to the business server before or after a certain event, like callbacks before or after sending a message.
|
|
||||||
|
+ **REST API**: OpenIMServer provides REST API for business systems, aiming to empower your operations with additional functionalities like group creation and message push via backend interfaces.
|
||||||
|
+ **Callbacks**: To expand its utility across varied business forms, OpenIMServer offers callback capabilities. That is, it sends a request to the business server before or after an event occurs, such as sending a message, enriching the interaction and data exchange flow in the communication processes.
|
||||||
|
|
||||||
|
👉 **[Learn More](https://docs.openim.io/guides/introduction/product)**
|
||||||
|
|
||||||
|
<!--
|
||||||
|
|
||||||
|
## :star2: Why OpenIM
|
||||||
|
|
||||||
|
**🔍 Function screenshot display**
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
|
||||||
|
| 💻🔄📱 Multi Terminal Synchronization 🔄🖥️ | 📅⚡ Efficient Meetings 🚀💼 |
|
||||||
|
| :----------------------------------------------------------: | :---------------------------------------------------------: |
|
||||||
|
|  |  |
|
||||||
|
| 📲🔄 **One-to-one and Group Chats** 👥🗣️ | 🎁💻 **Special Features - Custom Messages** ✉️🎨|
|
||||||
|
|  |  |
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
**OpenIM** offers a powerful and reliable instant messaging platform, ensuring versatile communication across multiple platforms with the following key features:
|
||||||
|
|
||||||
|
✅ **Versatile Messaging:** Support for text, images, emojis, voice, video, and more, alongside one-on-one and multi-person audio/video calls.
|
||||||
|
|
||||||
|
✅ **Robust Chat Capabilities:** Including roles (application administrator, group owner, etc.) and features like muting, group announcements, and dynamic message loading.
|
||||||
|
|
||||||
|
✅ **Unique Interaction Features:** Offering read-and-burn private chats and a message editing function to broaden social scenarios.
|
||||||
|
|
||||||
|
✅ **Open Source:** The code of OpenIM is open source and aims to build a leading global IM open source community. [GitHub Repository](https://github.com/OpenIMSDK)
|
||||||
|
|
||||||
|
✅ **Extensibility:** Implemented in Golang, OpenIM introduces an "everything is a message" communication model, simplifying custom messages and feature extension.
|
||||||
|
|
||||||
|
✅ **High Performance:** Supports a hierarchical governance architecture tested and abstracts the storage model of various message types.
|
||||||
|
|
||||||
|
✅ **Full Platform Support:** Native support for iOS, Android, Flutter, uni-app, ReactNative, Electron, and Web.
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
👉 **[Learn more](https://docs.openim.io/guides/introduction/product)**
|
|
||||||
|
|
||||||
## :rocket: Quick Start
|
## :rocket: Quick Start
|
||||||
|
|
||||||
🤲 To facilitate user experience, we offer various deployment solutions. You can choose your deployment method from the list below:
|
We support many platforms. Here are the addresses for quick experience on the web side:
|
||||||
|
|
||||||
|
👉 **[OpenIM online web demo](https://web-enterprise.rentsoft.cn/)**
|
||||||
|
|
||||||
|
You can quickly learn OpenIM engineering solutions, all it takes is one simple command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ make demo
|
||||||
|
```
|
||||||
|
|
||||||
|
🤲 In order to facilitate the user experience, we have provided a variety of deployment solutions, you can choose your own deployment method according to the list below:
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<details> <summary>Deploying with Docker Compose</summary>
|
||||||
|
|
||||||
|
It is recommended to use Docker Compose for deployment, which can easily and quickly deploy the entire OpenIM service on a single node
|
||||||
|
|
||||||
|
+ [https://github.com/openimsdk/openim-docker](https://github.com/openimsdk/openim-docker)
|
||||||
|
|
||||||
|
|
||||||
|
> **Note**
|
||||||
|
>
|
||||||
|
> If you don't know OpenIM's versioning policy, 📚Read our release policy: https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/version.md
|
||||||
|
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details> <summary>Compile from Source</summary>
|
||||||
|
|
||||||
|
|
||||||
|
Ur need `Go 1.20` or higher version, and `make`.
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
go version && make --version || echo "Error: One of the commands failed."
|
||||||
|
```
|
||||||
|
|
||||||
|
Version Details: https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/version.md
|
||||||
|
|
||||||
|
You can get the version number from the command below or from [github releases](https://github.com/openimsdk/open-im-server/tags).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ curl --silent "https://api.github.com/repos/openimsdk/open-im-server/releases" | jq -r '.[].tag_name'
|
||||||
|
```
|
||||||
|
|
||||||
|
We have our own version management policy, if you are interested in our version management, I recommend reading [📚 OpenIM Version](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/version.md), We recommend using stable versions such as `v3.3.0` and `v3.2.0` whenever possible. `v3.1.1-alpha.3` as well as `v3.3.0-beta.0` and `v3.2.0-rc.0` are pre-release or beta versions and are not recommended.
|
||||||
|
|
||||||
|
Set `OPENIM_VERSION` environment variables for the latest `OPENIM_VERSION` number, or replace the `OPENIM_VERSION` for you to install the OpenIM-Server `OPENIM_VERSION`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ OPENIM_VERSION=`curl -s https://api.github.com/repos/openimsdk/open-im-server/releases/latest | grep -oE '"tag_name": "[^"]+"' | head -n1 | cut -d'"' -f4`
|
||||||
|
# OPENIM_VERSION=v3.3.0
|
||||||
|
```
|
||||||
|
|
||||||
|
Deploy basic components at the click of a command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# install openim dependency
|
||||||
|
$ git clone https://github.com/openimsdk/open-im-server openim/openim-server && export openim=$(pwd)/openim/openim-server && cd $openim/openim-server && git checkout $OPENIM_VERSION
|
||||||
|
$ make init && docker compose up -d && make start && make check
|
||||||
|
```
|
||||||
|
|
||||||
|
> `make help` to help you see the instructions supported by OpenIM.
|
||||||
|
|
||||||
|
|
||||||
|
You can use the `make help-all` see OpenIM in action.
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details> <summary>Component Configuration Instructions</summary>
|
||||||
|
|
||||||
|
Read: Configuration center document:https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
|
||||||
|
<details> <summary>Deployed with kubernetes</summary>
|
||||||
|
|
||||||
|
+ https://github.com/openimsdk/open-im-server/blob/main/deployments/README.md
|
||||||
|
|
||||||
|
</details>
|
||||||
|
-->
|
||||||
|
|
||||||
+ **[Source Code Deployment Guide](https://docs.openim.io/guides/gettingStarted/imSourceCodeDeployment)**
|
+ **[Source Code Deployment Guide](https://docs.openim.io/guides/gettingStarted/imSourceCodeDeployment)**
|
||||||
|
+ **[Production deployment of Linux systems](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/install-openim-linux-system.md)**
|
||||||
+ **[Docker Deployment Guide](https://docs.openim.io/guides/gettingStarted/dockerCompose)**
|
+ **[Docker Deployment Guide](https://docs.openim.io/guides/gettingStarted/dockerCompose)**
|
||||||
+ **[Kubernetes Deployment Guide](https://docs.openim.io/guides/gettingStarted/k8s-deployment)**
|
+ **[Kubernetes Deployment Guide](https://github.com/openimsdk/open-im-server/tree/main/deployments)**
|
||||||
|
|
||||||
## :hammer_and_wrench: To Start Developing OpenIM
|
<!--
|
||||||
|
## :link: OpenIM and your application
|
||||||
|
|
||||||
|
OpenIM isn't just an open-source instant messaging component, it's an integral part of your application ecosystem. Check out this diagram to understand how AppServer, AppClient, OpenIMServer, and OpenIMSDK interact.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## :building_construction: Overall Architecture
|
||||||
|
|
||||||
|
Delve into the heart of Open-IM-Server's functionality with our architecture diagram.
|
||||||
|
|
||||||
|
 -->
|
||||||
|
|
||||||
|
## :hammer_and_wrench: To start developing OpenIM
|
||||||
|
|
||||||
[](https://vscode.dev/github/openimsdk/open-im-server)
|
[](https://vscode.dev/github/openimsdk/open-im-server)
|
||||||
|
|
||||||
@@ -114,8 +236,6 @@ Before you start, please make sure your changes are in demand. The best for that
|
|||||||
- [OpenIM Script Utilities](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/util-scripts.md)
|
- [OpenIM Script Utilities](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/util-scripts.md)
|
||||||
- [OpenIM Versioning](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/version.md)
|
- [OpenIM Versioning](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/version.md)
|
||||||
- [Manage backend and monitor deployment](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/prometheus-grafana.md)
|
- [Manage backend and monitor deployment](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/prometheus-grafana.md)
|
||||||
- [Mac Developer Deployment Guide for OpenIM](https://github.com/openimsdk/open-im-server/tree/main/docs/contrib/mac-developer-deployment-guide.md)
|
|
||||||
|
|
||||||
|
|
||||||
## :busts_in_silhouette: Community
|
## :busts_in_silhouette: Community
|
||||||
|
|
||||||
@@ -132,7 +252,7 @@ Our conference is in the [OpenIM Slack](https://join.slack.com/t/openimsdk/share
|
|||||||
|
|
||||||
We take notes of each [biweekly meeting](https://github.com/orgs/OpenIMSDK/discussions/categories/meeting) in [GitHub discussions](https://github.com/openimsdk/open-im-server/discussions/categories/meeting), Our historical meeting notes, as well as replays of the meetings are available at [Google Docs :bookmark_tabs:](https://docs.google.com/document/d/1nx8MDpuG74NASx081JcCpxPgDITNTpIIos0DS6Vr9GU/edit?usp=sharing).
|
We take notes of each [biweekly meeting](https://github.com/orgs/OpenIMSDK/discussions/categories/meeting) in [GitHub discussions](https://github.com/openimsdk/open-im-server/discussions/categories/meeting), Our historical meeting notes, as well as replays of the meetings are available at [Google Docs :bookmark_tabs:](https://docs.google.com/document/d/1nx8MDpuG74NASx081JcCpxPgDITNTpIIos0DS6Vr9GU/edit?usp=sharing).
|
||||||
|
|
||||||
## :eyes: Who Are Using OpenIM
|
## :eyes: Who are using OpenIM
|
||||||
|
|
||||||
Check out our [user case studies](https://github.com/OpenIMSDK/community/blob/main/ADOPTERS.md) page for a list of the project users. Don't hesitate to leave a [📝comment](https://github.com/openimsdk/open-im-server/issues/379) and share your use case.
|
Check out our [user case studies](https://github.com/OpenIMSDK/community/blob/main/ADOPTERS.md) page for a list of the project users. Don't hesitate to leave a [📝comment](https://github.com/openimsdk/open-im-server/issues/379) and share your use case.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ assets/
|
|||||||
|
|
||||||
## Copyright Notice:
|
## Copyright Notice:
|
||||||
|
|
||||||
The OpenIM logo, including its variations and animated versions, displayed in this repository [OpenIM](https://github.com/openimsdk/open-im-server) under the `/assets/logo` and `/assets/logo-gif` directories, are protected by copyright laws.
|
The OpenIM logo, including its variations and animated versions, displayed in this repository [OpenIM](https://github.com/OpenIMSDK/openim) under the `/assets/logo` and `/assets/logo-gif` directories, are protected by copyright laws.
|
||||||
|
|
||||||
The logo design is credited to @Xx(席欣).
|
The logo design is credited to @Xx(席欣).
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
# Official Colors
|
|
||||||
|
|
||||||
The openim logo has an official blue color. When reproducing the logo, please use the official color, when possible.
|
|
||||||
|
|
||||||
## Pantone
|
|
||||||
|
|
||||||
When possible, the Pantone color is preferred for print material. The official Pantone color is *285C*.
|
|
||||||
|
|
||||||
## RGB
|
|
||||||
|
|
||||||
When used digitally, the official RGB color code is *#326CE5*.
|
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
# 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"]
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
# 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"]
|
||||||
@@ -35,7 +35,7 @@ import (
|
|||||||
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/common/db/cache"
|
"github.com/openimsdk/open-im-server/v3/pkg/common/db/cache"
|
||||||
kdisc "github.com/openimsdk/open-im-server/v3/pkg/common/discoveryregister"
|
kdisc "github.com/openimsdk/open-im-server/v3/pkg/common/discoveryregister"
|
||||||
ginprom "github.com/openimsdk/open-im-server/v3/pkg/common/ginprometheus"
|
ginProm "github.com/openimsdk/open-im-server/v3/pkg/common/ginprometheus"
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics"
|
"github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ func run(port int, proPort int) error {
|
|||||||
log.ZInfo(context.Background(), "api register public config to discov success")
|
log.ZInfo(context.Background(), "api register public config to discov success")
|
||||||
router := api.NewGinRouter(client, rdb)
|
router := api.NewGinRouter(client, rdb)
|
||||||
if config.Config.Prometheus.Enable {
|
if config.Config.Prometheus.Enable {
|
||||||
p := ginprom.NewPrometheus("app", prommetrics.GetGinCusMetrics("Api"))
|
p := ginProm.NewPrometheus("app", prommetrics.GetGinCusMetrics("Api"))
|
||||||
p.SetListenAddress(fmt.Sprintf(":%d", proPort))
|
p.SetListenAddress(fmt.Sprintf(":%d", proPort))
|
||||||
p.Use(router)
|
p.Use(router)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
###################### AlertManager Configuration ######################
|
||||||
|
# AlertManager configuration using environment variables
|
||||||
|
#
|
||||||
|
# Resolve timeout
|
||||||
|
# SMTP configuration for sending alerts
|
||||||
|
# Templates for email notifications
|
||||||
|
# Routing configurations for alerts
|
||||||
|
# Receiver configurations
|
||||||
|
global:
|
||||||
|
resolve_timeout: 5m
|
||||||
|
smtp_from: alert@openim.io
|
||||||
|
smtp_smarthost: smtp.163.com:465
|
||||||
|
smtp_auth_username: alert@openim.io
|
||||||
|
smtp_auth_password: YOURAUTHPASSWORD
|
||||||
|
smtp_require_tls: false
|
||||||
|
smtp_hello: xxx监控告警
|
||||||
|
|
||||||
|
templates:
|
||||||
|
- /etc/alertmanager/email.tmpl
|
||||||
|
|
||||||
|
route:
|
||||||
|
group_by: ['alertname']
|
||||||
|
group_wait: 5s
|
||||||
|
group_interval: 5s
|
||||||
|
repeat_interval: 5m
|
||||||
|
receiver: email
|
||||||
|
receivers:
|
||||||
|
- name: email
|
||||||
|
email_configs:
|
||||||
|
- to: 'alert@example.com'
|
||||||
|
html: '{{ template "email.to.html" . }}'
|
||||||
|
headers: { Subject: "[OPENIM-SERVER]Alarm" }
|
||||||
|
send_resolved: true
|
||||||
@@ -0,0 +1,521 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------
|
||||||
|
# TODO: This config file is the template file
|
||||||
|
# --| source: deployments/templates/openim.yaml
|
||||||
|
# --| env: scripts/install/environment
|
||||||
|
# --| target: config/config.yaml
|
||||||
|
# -----------------------------------------------------------------
|
||||||
|
|
||||||
|
envs:
|
||||||
|
discovery: zookeeper
|
||||||
|
|
||||||
|
###################### Zookeeper ######################
|
||||||
|
# Zookeeper configuration
|
||||||
|
# It's not recommended to modify the schema
|
||||||
|
#
|
||||||
|
# Zookeeper address
|
||||||
|
# Zookeeper username
|
||||||
|
# Zookeeper password
|
||||||
|
zookeeper:
|
||||||
|
schema: openim
|
||||||
|
address: [ 172.28.0.1:12181 ]
|
||||||
|
username: ''
|
||||||
|
password: ''
|
||||||
|
|
||||||
|
###################### Mongo ######################
|
||||||
|
# MongoDB configuration
|
||||||
|
|
||||||
|
# If uri is not empty, it will be used directly for the MongoDB connection.
|
||||||
|
# This is a complete MongoDB URI string.
|
||||||
|
# Example: mongodb://user:password@host1:port1,host2:port2/dbname?options
|
||||||
|
mongo:
|
||||||
|
uri: ''
|
||||||
|
|
||||||
|
# List of MongoDB server addresses.
|
||||||
|
# Used for constructing the MongoDB URI if 'uri' above is empty.
|
||||||
|
# For a standalone setup, specify the address of the single server.
|
||||||
|
# For a sharded cluster, specify the addresses of the Mongos servers.
|
||||||
|
# Example: [ '172.28.0.1:37017', '172.28.0.2:37017' ]
|
||||||
|
# Default MongoDB database name
|
||||||
|
# Maximum connection pool size
|
||||||
|
address: [ 172.28.0.1:37017 ]
|
||||||
|
database: openIM_v3
|
||||||
|
username: root
|
||||||
|
password: openIM123
|
||||||
|
maxPoolSize: 100
|
||||||
|
|
||||||
|
###################### Redis configuration information ######################
|
||||||
|
# Redis configuration
|
||||||
|
#
|
||||||
|
# Username is required only for Redis version 6.0+
|
||||||
|
redis:
|
||||||
|
address: [ 172.28.0.1:16379 ]
|
||||||
|
username: ''
|
||||||
|
password: openIM123
|
||||||
|
|
||||||
|
###################### Kafka configuration information ######################
|
||||||
|
# Kafka configuration
|
||||||
|
#
|
||||||
|
# Kafka username
|
||||||
|
# Kafka password
|
||||||
|
# It's not recommended to modify this topic name
|
||||||
|
# Consumer group ID, it's not recommended to modify
|
||||||
|
kafka:
|
||||||
|
username: ''
|
||||||
|
password: ''
|
||||||
|
addr: [ 172.28.0.1:19094 ]
|
||||||
|
latestMsgToRedis:
|
||||||
|
topic: "latestMsgToRedis"
|
||||||
|
offlineMsgToMongo:
|
||||||
|
topic: "offlineMsgToMongoMysql"
|
||||||
|
msgToPush:
|
||||||
|
topic: "msgToPush"
|
||||||
|
consumerGroupID:
|
||||||
|
msgToRedis: redis
|
||||||
|
msgToMongo: mongo
|
||||||
|
msgToMySql: mysql
|
||||||
|
msgToPush: push
|
||||||
|
|
||||||
|
###################### RPC configuration information ######################
|
||||||
|
# RPC configuration
|
||||||
|
#
|
||||||
|
# IP address to register with zookeeper when starting RPC, the IP and corresponding rpcPort should be accessible by api/gateway
|
||||||
|
# Default listen IP is 0.0.0.0
|
||||||
|
rpc:
|
||||||
|
registerIP: ''
|
||||||
|
listenIP: 0.0.0.0
|
||||||
|
|
||||||
|
###################### API configuration information ######################
|
||||||
|
# API configuration
|
||||||
|
#
|
||||||
|
# API service port
|
||||||
|
# Default listen IP is 0.0.0.0
|
||||||
|
api:
|
||||||
|
openImApiPort: [ 10002 ]
|
||||||
|
listenIP: 0.0.0.0
|
||||||
|
|
||||||
|
###################### Object configuration information ######################
|
||||||
|
# Object storage configuration
|
||||||
|
#
|
||||||
|
# Use minio for object storage
|
||||||
|
# API URL should be accessible by the app
|
||||||
|
# It's not recommended to modify the bucket name
|
||||||
|
# Endpoint should be accessible by the app
|
||||||
|
# Session token
|
||||||
|
# Configuration for Tencent COS
|
||||||
|
# Configuration for Aliyun OSS
|
||||||
|
# apiURL is the address of the api, the access address of the app, use s3 must be configured
|
||||||
|
# minio.endpoint can be configured as an intranet address,
|
||||||
|
# minio.signEndpoint is minio public network address
|
||||||
|
object:
|
||||||
|
enable: "minio"
|
||||||
|
apiURL: "http://14.155.64.202:10002"
|
||||||
|
minio:
|
||||||
|
bucket: "openim"
|
||||||
|
endpoint: "http://172.28.0.1:10005"
|
||||||
|
accessKeyID: "root"
|
||||||
|
secretAccessKey: "openIM123"
|
||||||
|
sessionToken: ''
|
||||||
|
signEndpoint: "http://14.155.64.202:10005"
|
||||||
|
publicRead: false
|
||||||
|
cos:
|
||||||
|
bucketURL: https://temp-1252357374.cos.ap-chengdu.myqcloud.com
|
||||||
|
secretID: ''
|
||||||
|
secretKey: ''
|
||||||
|
sessionToken: ''
|
||||||
|
publicRead: false
|
||||||
|
oss:
|
||||||
|
endpoint: "https://oss-cn-chengdu.aliyuncs.com"
|
||||||
|
bucket: "demo-9999999"
|
||||||
|
bucketURL: "https://demo-9999999.oss-cn-chengdu.aliyuncs.com"
|
||||||
|
accessKeyID: ''
|
||||||
|
accessKeySecret: ''
|
||||||
|
sessionToken: ''
|
||||||
|
publicRead: false
|
||||||
|
kodo:
|
||||||
|
endpoint: "http://s3.cn-east-1.qiniucs.com"
|
||||||
|
bucket: "demo-9999999"
|
||||||
|
bucketURL: "http://your.domain.com"
|
||||||
|
accessKeyID: ''
|
||||||
|
accessKeySecret: ''
|
||||||
|
sessionToken: ''
|
||||||
|
publicRead: false
|
||||||
|
|
||||||
|
###################### RPC Port Configuration ######################
|
||||||
|
# RPC service ports
|
||||||
|
# These ports are passed into the program by the script and are not recommended to modify
|
||||||
|
# For launching multiple programs, just fill in multiple ports separated by commas
|
||||||
|
# For example, [10110, 10111]
|
||||||
|
rpcPort:
|
||||||
|
openImUserPort: [ 10110 ]
|
||||||
|
openImFriendPort: [ 10120 ]
|
||||||
|
openImMessagePort: [ 10130 ]
|
||||||
|
openImGroupPort: [ 10150 ]
|
||||||
|
openImAuthPort: [ 10160 ]
|
||||||
|
openImPushPort: [ 10170 ]
|
||||||
|
openImConversationPort: [ 10180 ]
|
||||||
|
openImThirdPort: [ 10190 ]
|
||||||
|
|
||||||
|
###################### RPC Register Name Configuration ######################
|
||||||
|
# RPC service names for registration, it's not recommended to modify these
|
||||||
|
rpcRegisterName:
|
||||||
|
openImUserName: User
|
||||||
|
openImFriendName: Friend
|
||||||
|
openImMsgName: Msg
|
||||||
|
openImPushName: Push
|
||||||
|
openImMessageGatewayName: MessageGateway
|
||||||
|
openImGroupName: Group
|
||||||
|
openImAuthName: Auth
|
||||||
|
openImConversationName: Conversation
|
||||||
|
openImThirdName: Third
|
||||||
|
|
||||||
|
###################### Log Configuration ######################
|
||||||
|
# Log configuration
|
||||||
|
#
|
||||||
|
# Storage directory
|
||||||
|
# Log rotation time
|
||||||
|
# Maximum number of logs to retain
|
||||||
|
# Log level, 6 means all levels
|
||||||
|
# Whether to output to stdout
|
||||||
|
# Whether to output in json format
|
||||||
|
# Whether to include stack trace in logs
|
||||||
|
log:
|
||||||
|
storageLocation: /data/workspaces/open-im-server/logs/
|
||||||
|
rotationTime: 24
|
||||||
|
remainRotationCount: 2
|
||||||
|
remainLogLevel: 6
|
||||||
|
isStdout: false
|
||||||
|
isJson: false
|
||||||
|
withStack: false
|
||||||
|
|
||||||
|
###################### Variables definition ######################
|
||||||
|
# Long connection server configuration
|
||||||
|
#
|
||||||
|
# Websocket port for msg_gateway
|
||||||
|
# Maximum number of websocket connections
|
||||||
|
# Maximum length of websocket request package
|
||||||
|
# Websocket connection handshake timeout
|
||||||
|
longConnSvr:
|
||||||
|
openImWsPort: [ 10001 ]
|
||||||
|
websocketMaxConnNum: 100000
|
||||||
|
openImMessageGatewayPort: [ 10140 ]
|
||||||
|
websocketMaxMsgLen: 4096
|
||||||
|
websocketTimeout: 10
|
||||||
|
|
||||||
|
# Push notification service configuration
|
||||||
|
#
|
||||||
|
# Use GeTui for push notifications
|
||||||
|
# GeTui offline push configuration
|
||||||
|
# FCM offline push configuration
|
||||||
|
# Account file, place it in the config directory
|
||||||
|
# JPush configuration, modify these after applying in JPush backend
|
||||||
|
push:
|
||||||
|
enable: getui
|
||||||
|
geTui:
|
||||||
|
pushUrl: "https://restapi.getui.com/v2/$appId"
|
||||||
|
masterSecret: ''
|
||||||
|
appKey: ''
|
||||||
|
intent: ''
|
||||||
|
channelID: ''
|
||||||
|
channelName: ''
|
||||||
|
fcm:
|
||||||
|
serviceAccount: "x.json"
|
||||||
|
jpns:
|
||||||
|
appKey: ''
|
||||||
|
masterSecret: ''
|
||||||
|
pushUrl: ''
|
||||||
|
pushIntent: ''
|
||||||
|
|
||||||
|
# App manager configuration
|
||||||
|
#
|
||||||
|
# Built-in app manager user IDs
|
||||||
|
# Built-in app manager nicknames
|
||||||
|
manager:
|
||||||
|
userID: [ "openIM123456", "openIM654321", "openIMAdmin" ]
|
||||||
|
nickname: [ "system1", "system2", "system3" ]
|
||||||
|
|
||||||
|
# Multi-platform login policy
|
||||||
|
# For each platform(Android, iOS, Windows, Mac, web), only one can be online at a time
|
||||||
|
multiLoginPolicy: 1
|
||||||
|
|
||||||
|
# Whether to store messages in MySQL, messages in MySQL are only used for management background
|
||||||
|
chatPersistenceMysql: true
|
||||||
|
|
||||||
|
# Message cache timeout in seconds, it's not recommended to modify
|
||||||
|
msgCacheTimeout: 86400
|
||||||
|
|
||||||
|
# Whether to enable read receipts for group chat
|
||||||
|
groupMessageHasReadReceiptEnable: true
|
||||||
|
|
||||||
|
# Whether to enable read receipts for single chat
|
||||||
|
singleMessageHasReadReceiptEnable: true
|
||||||
|
|
||||||
|
# MongoDB offline message retention period in days
|
||||||
|
retainChatRecords: 365
|
||||||
|
|
||||||
|
# Schedule to clear expired messages(older than retainChatRecords days) in MongoDB every Wednesday at 2am
|
||||||
|
# This deletion is just for cleaning up disk usage according to previous configuration retainChatRecords, no notification will be sent
|
||||||
|
chatRecordsClearTime: "0 2 * * 3"
|
||||||
|
|
||||||
|
# Schedule to auto delete messages every day at 2am
|
||||||
|
# This deletion is for messages that have been retained for more than msg_destruct_time (seconds) in the conversation field
|
||||||
|
msgDestructTime: "0 2 * * *"
|
||||||
|
|
||||||
|
# Secret key
|
||||||
|
secret: openIM123
|
||||||
|
|
||||||
|
# Token policy
|
||||||
|
#
|
||||||
|
# Token expiration period in days
|
||||||
|
tokenPolicy:
|
||||||
|
expire: 90
|
||||||
|
|
||||||
|
# Message verification policy
|
||||||
|
#
|
||||||
|
# Whether to verify friendship when sending messages
|
||||||
|
messageVerify:
|
||||||
|
friendVerify: false
|
||||||
|
|
||||||
|
# iOS push notification configuration
|
||||||
|
#
|
||||||
|
# iOS push notification sound
|
||||||
|
# Whether to count badge
|
||||||
|
# Whether it's production environment
|
||||||
|
iosPush:
|
||||||
|
pushSound: "xxx"
|
||||||
|
badgeCount: true
|
||||||
|
production: false
|
||||||
|
|
||||||
|
###################### Third-party service configuration ######################
|
||||||
|
# Callback configuration
|
||||||
|
#
|
||||||
|
# Callback URL
|
||||||
|
# Whether to enable this callback event
|
||||||
|
# Timeout in seconds
|
||||||
|
# Whether to continue execution if callback fails
|
||||||
|
callback:
|
||||||
|
url: ""
|
||||||
|
beforeSendSingleMsg:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
beforeUpdateUserInfoEx:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
afterUpdateUserInfoEx:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
afterSendSingleMsg:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
beforeSendGroupMsg:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
afterSendGroupMsg:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
msgModify:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
userOnline:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
userOffline:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
userKickOff:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
onlinePush:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
superGroupOnlinePush:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
beforeAddFriend:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
beforeUpdateUserInfo:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
beforeCreateGroup:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
afterCreateGroup:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
beforeMemberJoinGroup:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
beforeSetGroupMemberInfo:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
afterSetGroupMemberInfo:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
setMessageReactionExtensions:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
quitGroup:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
killGroupMember:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
dismissGroup:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
joinGroup:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
groupMsgRead:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
singleMsgRead:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
updateUserInfo:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
beforeUserRegister:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
afterUserRegister:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
transferGroupOwner:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
beforeSetFriendRemark:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
afterSetFriendRemark:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
afterGroupMsgRead:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
afterGroupMsgRevoke:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
afterJoinGroup:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
beforeInviteUserToGroup:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
joinGroupAfter:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
setGroupInfoAfter:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
setGroupInfoBefore:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
revokeMsgAfter:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
addBlackBefore:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
addFriendAfter:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
addFriendAgreeBefore:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
deleteFriendAfter:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
importFriendsBefore:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
importFriendsAfter:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
removeBlackAfter:
|
||||||
|
enable: false
|
||||||
|
timeout: 5
|
||||||
|
failedContinue: true
|
||||||
|
###################### Prometheus ######################
|
||||||
|
# Prometheus configuration for various services
|
||||||
|
# The number of Prometheus ports per service needs to correspond to rpcPort
|
||||||
|
# The number of ports needs to be consistent with msg_transfer_service_num in script/path_info.sh
|
||||||
|
prometheus:
|
||||||
|
enable: false
|
||||||
|
grafanaUrl: 172.28.0.1:13000
|
||||||
|
apiPrometheusPort: [20100]
|
||||||
|
userPrometheusPort: [ 20110 ]
|
||||||
|
friendPrometheusPort: [ 20120 ]
|
||||||
|
messagePrometheusPort: [ 20130 ]
|
||||||
|
messageGatewayPrometheusPort: [ 20140 ]
|
||||||
|
groupPrometheusPort: [ 20150 ]
|
||||||
|
authPrometheusPort: [ 20160 ]
|
||||||
|
pushPrometheusPort: [ 20170 ]
|
||||||
|
conversationPrometheusPort: [ 20230 ]
|
||||||
|
rtcPrometheusPort: [ 21300 ]
|
||||||
|
thirdPrometheusPort: [ 21301 ]
|
||||||
|
messageTransferPrometheusPort: [ 21400, 21401, 21402, 21403 ] # List of ports
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
{{ define "email.to.html" }}
|
||||||
|
{{ range .Alerts }}
|
||||||
|
<!-- Begin of OpenIM Alert -->
|
||||||
|
<div style="border:1px solid #ccc; padding:10px; margin-bottom:10px;">
|
||||||
|
<h3>OpenIM Alert</h3>
|
||||||
|
<p><strong>Alert Program:</strong> Prometheus Alert</p>
|
||||||
|
<p><strong>Severity Level:</strong> {{ .Labels.severity }}</p>
|
||||||
|
<p><strong>Alert Type:</strong> {{ .Labels.alertname }}</p>
|
||||||
|
<p><strong>Affected Host:</strong> {{ .Labels.instance }}</p>
|
||||||
|
<p><strong>Affected Service:</strong> {{ .Labels.job }}</p>
|
||||||
|
<p><strong>Alert Subject:</strong> {{ .Annotations.summary }}</p>
|
||||||
|
<p><strong>Trigger Time:</strong> {{ .StartsAt.Format "2006-01-02 15:04:05" }}</p>
|
||||||
|
</div>
|
||||||
|
<!-- End of OpenIM Alert -->
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
@@ -0,0 +1,260 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
# ======================================
|
||||||
|
# ========= Basic Configuration ========
|
||||||
|
# ======================================
|
||||||
|
|
||||||
|
# The user for authentication or system operations.
|
||||||
|
# Default: OPENIM_USER=root
|
||||||
|
USER=root
|
||||||
|
|
||||||
|
# Password associated with the specified user for authentication.
|
||||||
|
# Default: PASSWORD=openIM123
|
||||||
|
PASSWORD=openIM123
|
||||||
|
|
||||||
|
# Base URL for the application programming interface (API).
|
||||||
|
# Default: API_URL=http://172.28.0.1:10002
|
||||||
|
API_URL=http://14.155.64.202:10002
|
||||||
|
|
||||||
|
# Directory path for storing data files or related information.
|
||||||
|
# Default: DATA_DIR=./
|
||||||
|
DATA_DIR=/data/workspaces/open-im-server
|
||||||
|
|
||||||
|
# Choose the appropriate image address, the default is GITHUB image,
|
||||||
|
# you can choose docker hub, for Chinese users can choose Ali Cloud
|
||||||
|
# export IMAGE_REGISTRY="ghcr.io/openimsdk"
|
||||||
|
# export IMAGE_REGISTRY="openim"
|
||||||
|
# export IMAGE_REGISTRY="registry.cn-hangzhou.aliyuncs.com/openimsdk"
|
||||||
|
IMAGE_REGISTRY=ghcr.io/openimsdk
|
||||||
|
|
||||||
|
# ======================================
|
||||||
|
# ========= Network Configuration ======
|
||||||
|
# ======================================
|
||||||
|
|
||||||
|
# Subnet for the Docker network.
|
||||||
|
# Default: DOCKER_BRIDGE_SUBNET=172.28.0.0/16
|
||||||
|
DOCKER_BRIDGE_SUBNET=172.28.0.0/16
|
||||||
|
|
||||||
|
# Gateway for the Docker network.
|
||||||
|
# Default: DOCKER_BRIDGE_GATEWAY=172.28.0.1
|
||||||
|
DOCKER_BRIDGE_GATEWAY=172.28.0.1
|
||||||
|
|
||||||
|
MONGO_NETWORK_ADDRESS=172.28.0.2
|
||||||
|
REDIS_NETWORK_ADDRESS=172.28.0.3
|
||||||
|
KAFKA_NETWORK_ADDRESS=172.28.0.4
|
||||||
|
ZOOKEEPER_NETWORK_ADDRESS=172.28.0.5
|
||||||
|
MINIO_NETWORK_ADDRESS=172.28.0.6
|
||||||
|
OPENIM_WEB_NETWORK_ADDRESS=172.28.0.7
|
||||||
|
OPENIM_SERVER_NETWORK_ADDRESS=172.28.0.8
|
||||||
|
OPENIM_CHAT_NETWORK_ADDRESS=172.28.0.9
|
||||||
|
PROMETHEUS_NETWORK_ADDRESS=172.28.0.10
|
||||||
|
GRAFANA_NETWORK_ADDRESS=172.28.0.11
|
||||||
|
NODE_EXPORTER_NETWORK_ADDRESS=172.28.0.12
|
||||||
|
OPENIM_ADMIN_FRONT_NETWORK_ADDRESS=172.28.0.13
|
||||||
|
ALERT_MANAGER_NETWORK_ADDRESS=172.28.0.14
|
||||||
|
|
||||||
|
# ===============================================
|
||||||
|
# = Component Extension Configuration =
|
||||||
|
# ===============================================
|
||||||
|
|
||||||
|
# ============ Component Extension Configuration ==========
|
||||||
|
# ----- ZooKeeper Configuration -----
|
||||||
|
# Address or hostname for the ZooKeeper service.
|
||||||
|
# Default: ZOOKEEPER_ADDRESS=172.28.0.1
|
||||||
|
ZOOKEEPER_ADDRESS=172.28.0.5
|
||||||
|
|
||||||
|
# Port for ZooKeeper service.
|
||||||
|
# Default: ZOOKEEPER_PORT=12181
|
||||||
|
ZOOKEEPER_PORT=12181
|
||||||
|
|
||||||
|
# ----- MongoDB Configuration -----
|
||||||
|
# Address or hostname for the MongoDB service.
|
||||||
|
# Default: MONGO_ADDRESS=172.28.0.1
|
||||||
|
MONGO_ADDRESS=172.28.0.2
|
||||||
|
|
||||||
|
# Port on which MongoDB service is running.
|
||||||
|
# Default: MONGO_PORT=37017
|
||||||
|
# MONGO_PORT=37017
|
||||||
|
|
||||||
|
# Username to authenticate with the MongoDB service.
|
||||||
|
# Default: MONGO_USERNAME=root
|
||||||
|
# MONGO_USERNAME=root
|
||||||
|
|
||||||
|
# Password to authenticate with the MongoDB service.
|
||||||
|
# Default: MONGO_PASSWORD=openIM123
|
||||||
|
MONGO_PASSWORD=openIM123
|
||||||
|
|
||||||
|
# Name of the database in MongoDB to be used.
|
||||||
|
# Default: MONGO_DATABASE=openIM_v3
|
||||||
|
MONGO_DATABASE=openIM_v3
|
||||||
|
|
||||||
|
# ----- Redis Configuration -----
|
||||||
|
# Address or hostname for the Redis service.
|
||||||
|
# Default: REDIS_ADDRESS=172.28.0.1
|
||||||
|
REDIS_ADDRESS=172.28.0.3
|
||||||
|
|
||||||
|
# Port on which Redis in-memory data structure store is running.
|
||||||
|
# Default: REDIS_PORT=16379
|
||||||
|
REDIS_PORT=16379
|
||||||
|
|
||||||
|
# Password to authenticate with the Redis service.
|
||||||
|
# Default: REDIS_PASSWORD=openIM123
|
||||||
|
REDIS_PASSWORD=openIM123
|
||||||
|
|
||||||
|
# ----- Kafka Configuration -----
|
||||||
|
# Address or hostname for the Kafka service.
|
||||||
|
# Default: KAFKA_ADDRESS=172.28.0.1
|
||||||
|
KAFKA_ADDRESS=172.28.0.4
|
||||||
|
|
||||||
|
# Kakfa username to authenticate with the Kafka service.
|
||||||
|
# KAFKA_USERNAME=''
|
||||||
|
|
||||||
|
# Port on which Kafka distributed streaming platform is running.
|
||||||
|
# Default: KAFKA_PORT=19092
|
||||||
|
KAFKA_PORT=19094
|
||||||
|
|
||||||
|
# Topic in Kafka for storing the latest messages in Redis.
|
||||||
|
# Default: KAFKA_LATESTMSG_REDIS_TOPIC=latestMsgToRedis
|
||||||
|
KAFKA_LATESTMSG_REDIS_TOPIC=latestMsgToRedis
|
||||||
|
|
||||||
|
# Topic in Kafka for pushing messages (e.g. notifications or updates).
|
||||||
|
# Default: KAFKA_MSG_PUSH_TOPIC=msgToPush
|
||||||
|
KAFKA_MSG_PUSH_TOPIC=msgToPush
|
||||||
|
|
||||||
|
# Topic in Kafka for storing offline messages in MongoDB.
|
||||||
|
# Default: KAFKA_OFFLINEMSG_MONGO_TOPIC=offlineMsgToMongoMysql
|
||||||
|
KAFKA_OFFLINEMSG_MONGO_TOPIC=offlineMsgToMongoMysql
|
||||||
|
|
||||||
|
# ----- MinIO Configuration ----
|
||||||
|
# Address or hostname for the MinIO object storage service.
|
||||||
|
# Default: MINIO_ADDRESS=172.28.0.1
|
||||||
|
MINIO_ADDRESS=172.28.0.6
|
||||||
|
|
||||||
|
# Port on which MinIO object storage service is running.
|
||||||
|
# Default: MINIO_PORT=10005
|
||||||
|
MINIO_PORT=10005
|
||||||
|
|
||||||
|
# Access key to authenticate with the MinIO service.
|
||||||
|
# Default: MINIO_ACCESS_KEY=root
|
||||||
|
# MINIO_ACCESS_KEY=root
|
||||||
|
|
||||||
|
# Secret key corresponding to the access key for MinIO authentication.
|
||||||
|
# Default: MINIO_SECRET_KEY=openIM123
|
||||||
|
MINIO_SECRET_KEY=openIM123
|
||||||
|
|
||||||
|
# ----- Prometheus Configuration -----
|
||||||
|
# Address or hostname for the Prometheus service.
|
||||||
|
# Default: PROMETHEUS_ADDRESS=172.28.0.1
|
||||||
|
PROMETHEUS_ADDRESS=172.28.0.10
|
||||||
|
|
||||||
|
# Port on which Prometheus service is running.
|
||||||
|
# Default: PROMETHEUS_PORT=19090
|
||||||
|
PROMETHEUS_PORT=19090
|
||||||
|
|
||||||
|
# ----- Grafana Configuration -----
|
||||||
|
# Address or hostname for the Grafana service.
|
||||||
|
# Default: GRAFANA_ADDRESS=172.28.0.1
|
||||||
|
GRAFANA_ADDRESS=172.28.0.11
|
||||||
|
|
||||||
|
# Port on which Grafana service is running.
|
||||||
|
# Default: GRAFANA_PORT=13000
|
||||||
|
GRAFANA_PORT=13000
|
||||||
|
|
||||||
|
# ======================================
|
||||||
|
# ============ OpenIM Web ===============
|
||||||
|
# ======================================
|
||||||
|
|
||||||
|
# Path to the OpenIM web distribution.
|
||||||
|
# Default: OPENIM_WEB_DIST_PATH=/app/dist
|
||||||
|
OPENIM_WEB_DIST_PATH=/app/dist
|
||||||
|
|
||||||
|
# Port on which OpenIM web service is running.
|
||||||
|
# Default: OPENIM_WEB_PORT=11001
|
||||||
|
OPENIM_WEB_PORT=11001
|
||||||
|
|
||||||
|
# Address or hostname for the OpenIM web service.
|
||||||
|
# Default: OPENIM_WEB_ADDRESS=172.28.0.1
|
||||||
|
OPENIM_WEB_ADDRESS=172.28.0.7
|
||||||
|
|
||||||
|
# ======================================
|
||||||
|
# ========= OpenIM Server ==============
|
||||||
|
# ======================================
|
||||||
|
|
||||||
|
# Address or hostname for the OpenIM server.
|
||||||
|
# Default: OPENIM_SERVER_ADDRESS=172.28.0.1
|
||||||
|
OPENIM_SERVER_ADDRESS=172.28.0.8
|
||||||
|
|
||||||
|
# Port for the OpenIM WebSockets.
|
||||||
|
# Default: OPENIM_WS_PORT=10001
|
||||||
|
OPENIM_WS_PORT=10001
|
||||||
|
|
||||||
|
# Port for the OpenIM API.
|
||||||
|
# Default: API_OPENIM_PORT=10002
|
||||||
|
API_OPENIM_PORT=10002
|
||||||
|
|
||||||
|
|
||||||
|
# ======================================
|
||||||
|
# ========== OpenIM Chat ===============
|
||||||
|
# ======================================
|
||||||
|
|
||||||
|
# Branch name for OpenIM chat.
|
||||||
|
# Default: CHAT_IMAGE_VERSION=main
|
||||||
|
# https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/version.md
|
||||||
|
CHAT_IMAGE_VERSION=main
|
||||||
|
|
||||||
|
# Address or hostname for the OpenIM chat service.
|
||||||
|
# Default: OPENIM_CHAT_ADDRESS=172.28.0.1
|
||||||
|
OPENIM_CHAT_ADDRESS=172.28.0.9
|
||||||
|
|
||||||
|
# Port for the OpenIM chat API.
|
||||||
|
# Default: OPENIM_CHAT_API_PORT=10008
|
||||||
|
OPENIM_CHAT_API_PORT=10008
|
||||||
|
|
||||||
|
# Directory path for storing data files or related information for OpenIM chat.
|
||||||
|
# Default: OPENIM_CHAT_DATA_DIR=./openim-chat/main
|
||||||
|
OPENIM_CHAT_DATA_DIR=./openim-chat/main
|
||||||
|
|
||||||
|
|
||||||
|
# ======================================
|
||||||
|
# ========== OpenIM Admin ==============
|
||||||
|
# ======================================
|
||||||
|
|
||||||
|
# Branch name for OpenIM server.
|
||||||
|
# Default: SERVER_IMAGE_VERSION=main
|
||||||
|
SERVER_IMAGE_VERSION=main
|
||||||
|
|
||||||
|
# Port for the OpenIM admin API.
|
||||||
|
# Default: OPENIM_ADMIN_API_PORT=10009
|
||||||
|
OPENIM_ADMIN_API_PORT=10009
|
||||||
|
|
||||||
|
# Port for the node exporter.
|
||||||
|
# Default: NODE_EXPORTER_PORT=19100
|
||||||
|
NODE_EXPORTER_PORT=19100
|
||||||
|
|
||||||
|
# Port for the prometheus.
|
||||||
|
# Default: PROMETHEUS_PORT=19090
|
||||||
|
PROMETHEUS_PORT=19090
|
||||||
|
|
||||||
|
# Port for the grafana.
|
||||||
|
# Default: GRAFANA_PORT=13000
|
||||||
|
GRAFANA_PORT=13000
|
||||||
|
|
||||||
|
# Port for the admin front.
|
||||||
|
# Default: OPENIM_ADMIN_FRONT_PORT=11002
|
||||||
|
OPENIM_ADMIN_FRONT_PORT=11002
|
||||||
|
|
||||||
|
# Port for the alertmanager.
|
||||||
|
# Default: ALERT_MANAGER_PORT=19093
|
||||||
|
ALERT_MANAGER_PORT=19093
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
groups:
|
||||||
|
- name: instance_down
|
||||||
|
rules:
|
||||||
|
- alert: InstanceDown
|
||||||
|
expr: up == 0
|
||||||
|
for: 1m
|
||||||
|
labels:
|
||||||
|
severity: critical
|
||||||
|
annotations:
|
||||||
|
summary: "Instance {{ $labels.instance }} down"
|
||||||
|
description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 1 minutes."
|
||||||
|
|
||||||
|
- name: database_insert_failure_alerts
|
||||||
|
rules:
|
||||||
|
- alert: DatabaseInsertFailed
|
||||||
|
expr: (increase(msg_insert_redis_failed_total[5m]) > 0) or (increase(msg_insert_mongo_failed_total[5m]) > 0)
|
||||||
|
for: 1m
|
||||||
|
labels:
|
||||||
|
severity: critical
|
||||||
|
annotations:
|
||||||
|
summary: "Increase in MsgInsertRedisFailedCounter or MsgInsertMongoFailedCounter detected"
|
||||||
|
description: "Either MsgInsertRedisFailedCounter or MsgInsertMongoFailedCounter has increased in the last 5 minutes, indicating failures in message insert operations to Redis or MongoDB,maybe the redis or mongodb is crash."
|
||||||
@@ -0,0 +1,354 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
# Determines if a message should be sent. If set to false, it triggers a silent sync without a message. If true, it requires triggering a conversation.
|
||||||
|
# For rpc notification, send twice: once as a message and once as a notification.
|
||||||
|
# The options field 'isNotification' indicates if it's a notification.
|
||||||
|
groupCreated:
|
||||||
|
isSendMsg: true
|
||||||
|
|
||||||
|
# Reliability level of the message sending.
|
||||||
|
# Set to 1 to send only when online, 2 for guaranteed delivery.
|
||||||
|
reliabilityLevel: 1
|
||||||
|
|
||||||
|
# This setting is effective only when 'isSendMsg' is true.
|
||||||
|
# It controls whether to count unread messages.
|
||||||
|
unreadCount: false
|
||||||
|
|
||||||
|
# Configuration for offline push notifications.
|
||||||
|
offlinePush:
|
||||||
|
# Enables or disables offline push notifications.
|
||||||
|
enable: false
|
||||||
|
|
||||||
|
# Title for the notification when a group is created.
|
||||||
|
title: "create group title"
|
||||||
|
|
||||||
|
# Description for the notification.
|
||||||
|
desc: "create group desc"
|
||||||
|
|
||||||
|
# Additional information for the notification.
|
||||||
|
ext: "create group ext"
|
||||||
|
|
||||||
|
# Content type is not added here.
|
||||||
|
# Content should use a JSON structure conforming to the protobuf format.
|
||||||
|
|
||||||
|
groupInfoSet:
|
||||||
|
isSendMsg: false
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
title: "groupInfoSet title"
|
||||||
|
desc: "groupInfoSet desc"
|
||||||
|
ext: "groupInfoSet ext"
|
||||||
|
|
||||||
|
|
||||||
|
joinGroupApplication:
|
||||||
|
isSendMsg: false
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
title: "joinGroupApplication title"
|
||||||
|
desc: "joinGroupApplication desc"
|
||||||
|
ext: "joinGroupApplication ext"
|
||||||
|
|
||||||
|
memberQuit:
|
||||||
|
isSendMsg: true
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
title: "memberQuit title"
|
||||||
|
desc: "memberQuit desc"
|
||||||
|
ext: "memberQuit ext"
|
||||||
|
|
||||||
|
groupApplicationAccepted:
|
||||||
|
isSendMsg: false
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
title: "groupApplicationAccepted title"
|
||||||
|
desc: "groupApplicationAccepted desc"
|
||||||
|
ext: "groupApplicationAccepted ext"
|
||||||
|
|
||||||
|
groupApplicationRejected:
|
||||||
|
isSendMsg: false
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
title: " title"
|
||||||
|
desc: " desc"
|
||||||
|
ext: " ext"
|
||||||
|
|
||||||
|
|
||||||
|
groupOwnerTransferred:
|
||||||
|
isSendMsg: true
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
title: "groupOwnerTransferred title"
|
||||||
|
desc: "groupOwnerTransferred desc"
|
||||||
|
ext: "groupOwnerTransferred ext"
|
||||||
|
|
||||||
|
memberKicked:
|
||||||
|
isSendMsg: true
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
title: "memberKicked title"
|
||||||
|
desc: "memberKicked desc"
|
||||||
|
ext: "memberKicked ext"
|
||||||
|
|
||||||
|
memberInvited:
|
||||||
|
isSendMsg: true
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
title: "memberInvited title"
|
||||||
|
desc: "memberInvited desc"
|
||||||
|
ext: "memberInvited ext"
|
||||||
|
|
||||||
|
memberEnter:
|
||||||
|
isSendMsg: true
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
title: "memberEnter title"
|
||||||
|
desc: "memberEnter desc"
|
||||||
|
ext: "memberEnter ext"
|
||||||
|
|
||||||
|
groupDismissed:
|
||||||
|
isSendMsg: true
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
title: "groupDismissed title"
|
||||||
|
desc: "groupDismissed desc"
|
||||||
|
ext: "groupDismissed ext"
|
||||||
|
|
||||||
|
groupMuted:
|
||||||
|
isSendMsg: true
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
title: "groupMuted title"
|
||||||
|
desc: "groupMuted desc"
|
||||||
|
ext: "groupMuted ext"
|
||||||
|
|
||||||
|
groupCancelMuted:
|
||||||
|
isSendMsg: true
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
title: "groupCancelMuted title"
|
||||||
|
desc: "groupCancelMuted desc"
|
||||||
|
ext: "groupCancelMuted ext"
|
||||||
|
defaultTips:
|
||||||
|
tips: "group Cancel Muted"
|
||||||
|
|
||||||
|
|
||||||
|
groupMemberMuted:
|
||||||
|
isSendMsg: true
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
title: "groupMemberMuted title"
|
||||||
|
desc: "groupMemberMuted desc"
|
||||||
|
ext: "groupMemberMuted ext"
|
||||||
|
|
||||||
|
groupMemberCancelMuted:
|
||||||
|
isSendMsg: true
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
title: "groupMemberCancelMuted title"
|
||||||
|
desc: "groupMemberCancelMuted desc"
|
||||||
|
ext: "groupMemberCancelMuted ext"
|
||||||
|
|
||||||
|
groupMemberInfoSet:
|
||||||
|
isSendMsg: false
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
title: "groupMemberInfoSet title"
|
||||||
|
desc: "groupMemberInfoSet desc"
|
||||||
|
ext: "groupMemberInfoSet ext"
|
||||||
|
|
||||||
|
groupInfoSetAnnouncement:
|
||||||
|
isSendMsg: true
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
title: "groupInfoSetAnnouncement title"
|
||||||
|
desc: "groupInfoSetAnnouncement desc"
|
||||||
|
ext: "groupInfoSetAnnouncement ext"
|
||||||
|
|
||||||
|
|
||||||
|
groupInfoSetName:
|
||||||
|
isSendMsg: true
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
title: "groupInfoSetName title"
|
||||||
|
desc: "groupInfoSetName desc"
|
||||||
|
ext: "groupInfoSetName ext"
|
||||||
|
|
||||||
|
|
||||||
|
#############################friend#################################
|
||||||
|
friendApplicationAdded:
|
||||||
|
isSendMsg: false
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
title: "Somebody applies to add you as a friend"
|
||||||
|
desc: "Somebody applies to add you as a friend"
|
||||||
|
ext: "Somebody applies to add you as a friend"
|
||||||
|
|
||||||
|
friendApplicationApproved:
|
||||||
|
isSendMsg: true
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: true
|
||||||
|
title: "Someone applies to add your friend application"
|
||||||
|
desc: "Someone applies to add your friend application"
|
||||||
|
ext: "Someone applies to add your friend application"
|
||||||
|
|
||||||
|
friendApplicationRejected:
|
||||||
|
isSendMsg: false
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: true
|
||||||
|
title: "Someone rejected your friend application"
|
||||||
|
desc: "Someone rejected your friend application"
|
||||||
|
ext: "Someone rejected your friend application"
|
||||||
|
|
||||||
|
friendAdded:
|
||||||
|
isSendMsg: false
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: true
|
||||||
|
title: "We have become friends"
|
||||||
|
desc: "We have become friends"
|
||||||
|
ext: "We have become friends"
|
||||||
|
|
||||||
|
friendDeleted:
|
||||||
|
isSendMsg: false
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: true
|
||||||
|
title: "deleted a friend"
|
||||||
|
desc: "deleted a friend"
|
||||||
|
ext: "deleted a friend"
|
||||||
|
|
||||||
|
friendRemarkSet:
|
||||||
|
isSendMsg: false
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: true
|
||||||
|
title: "Your friend's profile has been changed"
|
||||||
|
desc: "Your friend's profile has been changed"
|
||||||
|
ext: "Your friend's profile has been changed"
|
||||||
|
|
||||||
|
blackAdded:
|
||||||
|
isSendMsg: false
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: true
|
||||||
|
title: "blocked a user"
|
||||||
|
desc: "blocked a user"
|
||||||
|
ext: "blocked a user"
|
||||||
|
|
||||||
|
blackDeleted:
|
||||||
|
isSendMsg: false
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: true
|
||||||
|
title: "Remove a blocked user"
|
||||||
|
desc: "Remove a blocked user"
|
||||||
|
ext: "Remove a blocked user"
|
||||||
|
|
||||||
|
friendInfoUpdated:
|
||||||
|
isSendMsg: false
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: true
|
||||||
|
title: "friend info updated"
|
||||||
|
desc: "friend info updated"
|
||||||
|
ext: "friend info updated"
|
||||||
|
|
||||||
|
#####################user#########################
|
||||||
|
userInfoUpdated:
|
||||||
|
isSendMsg: false
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: true
|
||||||
|
title: "Remove a blocked user"
|
||||||
|
desc: "Remove a blocked user"
|
||||||
|
ext: "Remove a blocked user"
|
||||||
|
|
||||||
|
userStatusChanged:
|
||||||
|
isSendMsg: false
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: false
|
||||||
|
title: "user status changed"
|
||||||
|
desc: "user status changed"
|
||||||
|
ext: "user status changed"
|
||||||
|
|
||||||
|
#####################conversation#########################
|
||||||
|
conversationChanged:
|
||||||
|
isSendMsg: false
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: true
|
||||||
|
title: "conversation changed"
|
||||||
|
desc: "conversation changed"
|
||||||
|
ext: "conversation changed"
|
||||||
|
|
||||||
|
conversationSetPrivate:
|
||||||
|
isSendMsg: true
|
||||||
|
reliabilityLevel: 1
|
||||||
|
unreadCount: false
|
||||||
|
offlinePush:
|
||||||
|
enable: true
|
||||||
|
title: "burn after reading"
|
||||||
|
desc: "burn after reading"
|
||||||
|
ext: "burn after reading"
|
||||||
@@ -0,0 +1,172 @@
|
|||||||
|
upstream im_msg_gateway{
|
||||||
|
server 127.0.0.1:10001; #IM Message server address Multiple can be specified according to the deployment
|
||||||
|
}
|
||||||
|
upstream im_api{
|
||||||
|
server 127.0.0.1:10002; #IM Group user api server address Multiple can be specified according to the deployment
|
||||||
|
}
|
||||||
|
upstream im_grafana{
|
||||||
|
server 127.0.0.1:10007; #IM Statistical server address The machine where docker-compose starts
|
||||||
|
}
|
||||||
|
upstream im_chat_api{
|
||||||
|
server 127.0.0.1:10008; #IM Business version login registration server address Multiple can be specified according to the deployment
|
||||||
|
}
|
||||||
|
upstream im_admin_api{
|
||||||
|
server 127.0.0.1:10009; #IM The admin address of the commercial version can specify multiple units according to the deployment situation
|
||||||
|
}
|
||||||
|
upstream im_open_rtc{
|
||||||
|
server 127.0.0.1:7880; #rtc Audio and video call server address Multiple devices can be specified according to the deployment
|
||||||
|
}
|
||||||
|
upstream minio_s3_2 {
|
||||||
|
least_conn;
|
||||||
|
server 127.0.0.1:10005;
|
||||||
|
}
|
||||||
|
|
||||||
|
upstream minio_console_2 {
|
||||||
|
least_conn;
|
||||||
|
server 127.0.0.1:9090;
|
||||||
|
}
|
||||||
|
server {
|
||||||
|
listen 443;
|
||||||
|
server_name your-domain.com; #your-domain.com
|
||||||
|
|
||||||
|
ssl on;
|
||||||
|
ssl_certificate /etc/nginx/conf.d/ssl/your-domain.com.crt; #2 Certificate
|
||||||
|
ssl_certificate_key /etc/nginx/conf.d/ssl/your-domain.com.key; #3 Certificate
|
||||||
|
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 application/wasm;
|
||||||
|
gzip_vary off;
|
||||||
|
gzip_disable "MSIE [1-6]\.";
|
||||||
|
error_page 405 =200 $uri;
|
||||||
|
|
||||||
|
default_type application/wasm;
|
||||||
|
location /{ #web demo
|
||||||
|
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/Pc-Web-Demo/build/; # web im static resource storage path
|
||||||
|
index index.html;
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
location /msg_gateway { #10001 ws
|
||||||
|
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_msg_gateway/;
|
||||||
|
}
|
||||||
|
location ^~/api/ { #10002 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_api/;
|
||||||
|
}
|
||||||
|
location ^~/grafana/ { #10007 prometheus
|
||||||
|
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_grafana/;
|
||||||
|
}
|
||||||
|
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_admin_api/;
|
||||||
|
}
|
||||||
|
location ^~/open_rtc/ { #7880 rtc
|
||||||
|
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_open_rtc/;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name test-web.rentsoft.cn ; #1 web im end domain name
|
||||||
|
rewrite ^(.*)$ https://${server_name}$1 permanent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443;
|
||||||
|
|
||||||
|
server_name your-domain.com; #your-domain.com
|
||||||
|
ssl on;
|
||||||
|
ssl_certificate /etc/nginx/conf.d/ssl/your-domain.com.crt; #Certificate
|
||||||
|
ssl_certificate_key /etc/nginx/conf.d/ssl/your-domain.com.key; #Certificate
|
||||||
|
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 application/wasm;
|
||||||
|
gzip_vary off;
|
||||||
|
gzip_disable "MSIE [1-6]\.";
|
||||||
|
# Allow special characters in headers
|
||||||
|
ignore_invalid_headers off;
|
||||||
|
# Allow any size file to be uploaded.
|
||||||
|
# Set to a value such as 1000m; to restrict file size to a specific value
|
||||||
|
client_max_body_size 0;
|
||||||
|
# Disable buffering
|
||||||
|
proxy_buffering off;
|
||||||
|
proxy_request_buffering off;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
|
||||||
|
proxy_connect_timeout 300;
|
||||||
|
# Default is HTTP/1, keepalive is only enabled in HTTP/1.1
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Connection "";
|
||||||
|
chunked_transfer_encoding off;
|
||||||
|
|
||||||
|
proxy_pass http://minio_s3_2; # This uses the upstream directive definition to load balance
|
||||||
|
}
|
||||||
|
|
||||||
|
location /minio/ui {
|
||||||
|
rewrite ^/minio/ui/(.*) /$1 break;
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-NginX-Proxy true;
|
||||||
|
|
||||||
|
# This is necessary to pass the correct IP to be hashed
|
||||||
|
real_ip_header X-Real-IP;
|
||||||
|
|
||||||
|
proxy_connect_timeout 300;
|
||||||
|
|
||||||
|
# To support websockets in MinIO versions released after January 2023
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
|
||||||
|
chunked_transfer_encoding off;
|
||||||
|
|
||||||
|
proxy_pass http://minio_console_2; # This uses the upstream directive definition to load balance
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,99 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
# my global config
|
||||||
|
global:
|
||||||
|
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
|
||||||
|
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
|
||||||
|
# scrape_timeout is set to the global default (10s).
|
||||||
|
|
||||||
|
# Alertmanager configuration
|
||||||
|
alerting:
|
||||||
|
alertmanagers:
|
||||||
|
- static_configs:
|
||||||
|
- targets: ['172.28.0.1:19093']
|
||||||
|
|
||||||
|
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
|
||||||
|
rule_files:
|
||||||
|
- "instance-down-rules.yml"
|
||||||
|
# - "first_rules.yml"
|
||||||
|
# - "second_rules.yml"
|
||||||
|
|
||||||
|
# A scrape configuration containing exactly one endpoint to scrape:
|
||||||
|
# Here it's Prometheus itself.
|
||||||
|
scrape_configs:
|
||||||
|
# The job name is added as a label "job='job_name'"" to any timeseries scraped from this config.
|
||||||
|
# Monitored information captured by prometheus
|
||||||
|
- job_name: 'node-exporter'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '172.28.0.1:19100' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
|
||||||
|
# prometheus fetches application services
|
||||||
|
- job_name: 'openimserver-openim-api'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '172.28.0.1:20100' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-msggateway'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '172.28.0.1:20140' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-msgtransfer'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ 172.28.0.1:21400, 172.28.0.1:21401, 172.28.0.1:21402, 172.28.0.1:21403 ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-push'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '172.28.0.1:20170' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-rpc-auth'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '172.28.0.1:20160' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-rpc-conversation'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '172.28.0.1:20230' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-rpc-friend'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '172.28.0.1:20120' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-rpc-group'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '172.28.0.1:20150' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-rpc-msg'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '172.28.0.1:20130' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-rpc-third'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '172.28.0.1:21301' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
|
- job_name: 'openimserver-openim-rpc-user'
|
||||||
|
static_configs:
|
||||||
|
- targets: [ '172.28.0.1:20110' ]
|
||||||
|
labels:
|
||||||
|
namespace: 'default'
|
||||||
File diff suppressed because it is too large
Load Diff
+2
-27
@@ -27,7 +27,7 @@ services:
|
|||||||
- wiredTigerCacheSizeGB=1
|
- wiredTigerCacheSizeGB=1
|
||||||
- MONGO_INITDB_ROOT_USERNAME=${MONGO_USERNAME:-root}
|
- MONGO_INITDB_ROOT_USERNAME=${MONGO_USERNAME:-root}
|
||||||
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_PASSWORD:-openIM123}
|
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_PASSWORD:-openIM123}
|
||||||
- MONGO_INITDB_DATABASE=${MONGO_DATABASE:-openim_v3}
|
- MONGO_INITDB_DATABASE=${MONGO_DATABASE:-openIM_v3}
|
||||||
- MONGO_OPENIM_USERNAME=${MONGO_OPENIM_USERNAME:-openIM} # Non-root username
|
- MONGO_OPENIM_USERNAME=${MONGO_OPENIM_USERNAME:-openIM} # Non-root username
|
||||||
- MONGO_OPENIM_PASSWORD=${MONGO_OPENIM_PASSWORD:-openIM123456} # Non-root password
|
- MONGO_OPENIM_PASSWORD=${MONGO_OPENIM_PASSWORD:-openIM123456} # Non-root password
|
||||||
restart: always
|
restart: always
|
||||||
@@ -87,7 +87,6 @@ services:
|
|||||||
- KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@<your_host>:9093
|
- KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@<your_host>:9093
|
||||||
- KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093,EXTERNAL://:9094
|
- KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093,EXTERNAL://:9094
|
||||||
- KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092,EXTERNAL://${DOCKER_BRIDGE_GATEWAY:-172.28.0.1}:${KAFKA_PORT:-19094}
|
- KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092,EXTERNAL://${DOCKER_BRIDGE_GATEWAY:-172.28.0.1}:${KAFKA_PORT:-19094}
|
||||||
# - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092,EXTERNAL://127.0.0.1:${KAFKA_PORT:-19094} # Mac Deployment
|
|
||||||
- KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,EXTERNAL:PLAINTEXT,PLAINTEXT:PLAINTEXT
|
- KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,EXTERNAL:PLAINTEXT,PLAINTEXT:PLAINTEXT
|
||||||
- KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER
|
- KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER
|
||||||
networks:
|
networks:
|
||||||
@@ -115,7 +114,6 @@ services:
|
|||||||
openim-web:
|
openim-web:
|
||||||
image: ${IMAGE_REGISTRY:-ghcr.io/openimsdk}/openim-web:${OPENIM_WEB_IMAGE_VERSION:-v3.5.0-docker}
|
image: ${IMAGE_REGISTRY:-ghcr.io/openimsdk}/openim-web:${OPENIM_WEB_IMAGE_VERSION:-v3.5.0-docker}
|
||||||
container_name: openim-web
|
container_name: openim-web
|
||||||
platform: linux/amd64
|
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- "${OPENIM_WEB_PORT:-11001}:80"
|
- "${OPENIM_WEB_PORT:-11001}:80"
|
||||||
@@ -124,7 +122,7 @@ services:
|
|||||||
ipv4_address: ${OPENIM_WEB_NETWORK_ADDRESS:-172.28.0.7}
|
ipv4_address: ${OPENIM_WEB_NETWORK_ADDRESS:-172.28.0.7}
|
||||||
|
|
||||||
### TODO: Uncomment, or deploy using openim docker: https://github.com/openimsdk/openim-docker
|
### TODO: Uncomment, or deploy using openim docker: https://github.com/openimsdk/openim-docker
|
||||||
### Uncomment and configure the following services as needed
|
# Uncomment and configure the following services as needed
|
||||||
|
|
||||||
# openim-server:
|
# openim-server:
|
||||||
# image: ${IMAGE_REGISTRY:-ghcr.io/openimsdk}/openim-server:${SERVER_IMAGE_VERSION:-main}
|
# image: ${IMAGE_REGISTRY:-ghcr.io/openimsdk}/openim-server:${SERVER_IMAGE_VERSION:-main}
|
||||||
@@ -173,23 +171,6 @@ services:
|
|||||||
# server:
|
# server:
|
||||||
# ipv4_address: ${OPENIM_SERVER_NETWORK_ADDRESS:-172.28.0.8}
|
# ipv4_address: ${OPENIM_SERVER_NETWORK_ADDRESS:-172.28.0.8}
|
||||||
|
|
||||||
### TODO: mysql is required to deploy the openim-chat component
|
|
||||||
# mysql:
|
|
||||||
# image: mysql:${MYSQL_IMAGE_VERSION:-5.7}
|
|
||||||
# platform: linux/amd64
|
|
||||||
# ports:
|
|
||||||
# - "${MYSQL_PORT:-13306}:3306"
|
|
||||||
# container_name: mysql
|
|
||||||
# volumes:
|
|
||||||
# - "${DATA_DIR:-./}/components/mysql/data:/var/lib/mysql"
|
|
||||||
# - "/etc/localtime:/etc/localtime"
|
|
||||||
# environment:
|
|
||||||
# MYSQL_ROOT_PASSWORD: "${MYSQL_PASSWORD:-openIM123}"
|
|
||||||
# restart: always
|
|
||||||
# networks:
|
|
||||||
# server:
|
|
||||||
# ipv4_address: ${MYSQL_NETWORK_ADDRESS:-172.28.0.15}
|
|
||||||
|
|
||||||
# openim-chat:
|
# openim-chat:
|
||||||
# image: ${IMAGE_REGISTRY:-ghcr.io/openimsdk}/openim-chat:${CHAT_IMAGE_VERSION:-main}
|
# image: ${IMAGE_REGISTRY:-ghcr.io/openimsdk}/openim-chat:${CHAT_IMAGE_VERSION:-main}
|
||||||
# container_name: openim-chat
|
# container_name: openim-chat
|
||||||
@@ -217,11 +198,6 @@ services:
|
|||||||
# - "${DATA_DIR:-./}/components/openim-chat/config:/openim/openim-chat/config"
|
# - "${DATA_DIR:-./}/components/openim-chat/config:/openim/openim-chat/config"
|
||||||
# restart: always
|
# restart: always
|
||||||
# # user: root:root
|
# # user: root:root
|
||||||
# depends_on:
|
|
||||||
# - mysql
|
|
||||||
# - kafka
|
|
||||||
# - redis
|
|
||||||
# - zookeeper
|
|
||||||
# logging:
|
# logging:
|
||||||
# driver: json-file
|
# driver: json-file
|
||||||
# options:
|
# options:
|
||||||
@@ -235,7 +211,6 @@ services:
|
|||||||
# # https://github.com/openimsdk/open-im-server/issues/1662
|
# # https://github.com/openimsdk/open-im-server/issues/1662
|
||||||
# image: ${IMAGE_REGISTRY:-ghcr.io/openimsdk}/openim-admin:${ADMIN_FRONT_VERSION:-toc-base-open-docker.35}
|
# image: ${IMAGE_REGISTRY:-ghcr.io/openimsdk}/openim-admin:${ADMIN_FRONT_VERSION:-toc-base-open-docker.35}
|
||||||
# container_name: openim-admin
|
# container_name: openim-admin
|
||||||
# platform: linux/amd64
|
|
||||||
# restart: always
|
# restart: always
|
||||||
# ports:
|
# ports:
|
||||||
# - "${OPENIM_ADMIN_FRONT_PORT:-11002}:80"
|
# - "${OPENIM_ADMIN_FRONT_PORT:-11002}:80"
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ go 1.19
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
firebase.google.com/go v3.13.0+incompatible
|
firebase.google.com/go v3.13.0+incompatible
|
||||||
github.com/OpenIMSDK/protocol v0.0.48
|
github.com/OpenIMSDK/protocol v0.0.47
|
||||||
github.com/OpenIMSDK/tools v0.0.23
|
github.com/OpenIMSDK/tools v0.0.29
|
||||||
github.com/bwmarrin/snowflake v0.3.0 // indirect
|
github.com/bwmarrin/snowflake v0.3.0 // indirect
|
||||||
github.com/dtm-labs/rockscache v0.1.1
|
github.com/dtm-labs/rockscache v0.1.1
|
||||||
github.com/gin-gonic/gin v1.9.1
|
github.com/gin-gonic/gin v1.9.1
|
||||||
@@ -127,7 +127,7 @@ require (
|
|||||||
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
|
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
|
||||||
go.opencensus.io v0.24.0 // indirect
|
go.opencensus.io v0.24.0 // indirect
|
||||||
go.uber.org/atomic v1.7.0 // indirect
|
go.uber.org/atomic v1.7.0 // indirect
|
||||||
go.uber.org/multierr v1.6.0 // indirect
|
go.uber.org/multierr v1.11.0 // indirect
|
||||||
golang.org/x/arch v0.3.0 // indirect
|
golang.org/x/arch v0.3.0 // indirect
|
||||||
golang.org/x/net v0.17.0 // indirect
|
golang.org/x/net v0.17.0 // indirect
|
||||||
golang.org/x/oauth2 v0.13.0 // indirect
|
golang.org/x/oauth2 v0.13.0 // indirect
|
||||||
@@ -156,5 +156,3 @@ require (
|
|||||||
golang.org/x/crypto v0.17.0 // indirect
|
golang.org/x/crypto v0.17.0 // indirect
|
||||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
replace github.com/OpenIMSDK/protocol v0.0.47 => github.com/AndrewZuo01/protocol v0.0.0-20240112093520-fd9c53e27b94
|
|
||||||
|
|||||||
@@ -15,13 +15,13 @@ cloud.google.com/go/storage v1.30.1 h1:uOdMxAs8HExqBlnLtnQyP0YkvbiDpdGShGKtx6U/o
|
|||||||
cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7BiccwkR7+P7gN8E=
|
cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7BiccwkR7+P7gN8E=
|
||||||
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/AndrewZuo01/protocol v0.0.0-20240112093520-fd9c53e27b94 h1:o86vkek41ZrQqoBGqyKvS0z6N0uJj64mpzK72OkDZVM=
|
|
||||||
github.com/AndrewZuo01/protocol v0.0.0-20240112093520-fd9c53e27b94/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y=
|
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/IBM/sarama v1.41.3 h1:MWBEJ12vHC8coMjdEXFq/6ftO6DUZnQlFYcxtOJFa7c=
|
github.com/IBM/sarama v1.41.3 h1:MWBEJ12vHC8coMjdEXFq/6ftO6DUZnQlFYcxtOJFa7c=
|
||||||
github.com/IBM/sarama v1.41.3/go.mod h1:Xxho9HkHd4K/MDUo/T/sOqwtX/17D33++E9Wib6hUdQ=
|
github.com/IBM/sarama v1.41.3/go.mod h1:Xxho9HkHd4K/MDUo/T/sOqwtX/17D33++E9Wib6hUdQ=
|
||||||
github.com/OpenIMSDK/tools v0.0.23 h1:xozfrGzhbpNPlDTap5DLVPk+JfgZ/ZyIj4Cuu3/bm9w=
|
github.com/OpenIMSDK/protocol v0.0.48 h1:8MIMjyzJRsruYhVv2ZKArFiOveroaofDOb3dlAdgjsw=
|
||||||
github.com/OpenIMSDK/tools v0.0.23/go.mod h1:eg+q4A34Qmu73xkY0mt37FHGMCMfC6CtmOnm0kFEGFI=
|
github.com/OpenIMSDK/protocol v0.0.48/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y=
|
||||||
|
github.com/OpenIMSDK/tools v0.0.29 h1:NS4PEwYl9sX3SWsMjDOLVxMo3LcTWREMr+2cjzWjcqc=
|
||||||
|
github.com/OpenIMSDK/tools v0.0.29/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=
|
||||||
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 h1:uSoVVbwJiQipAclBbw+8quDsfcvFjOpI5iCf4p/cqCs=
|
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 h1:uSoVVbwJiQipAclBbw+8quDsfcvFjOpI5iCf4p/cqCs=
|
||||||
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs=
|
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs=
|
||||||
@@ -356,8 +356,8 @@ go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
|||||||
go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8=
|
go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8=
|
||||||
go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0=
|
go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0=
|
||||||
go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI=
|
go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI=
|
||||||
go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=
|
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||||
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
|
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||||
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
|
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
|
||||||
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
|
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
|
||||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||||
|
|||||||
@@ -4,15 +4,14 @@ use (
|
|||||||
.
|
.
|
||||||
./test/typecheck
|
./test/typecheck
|
||||||
./tools/changelog
|
./tools/changelog
|
||||||
./tools/component
|
//./tools/imctl
|
||||||
./tools/data-conversion
|
|
||||||
./tools/formitychecker
|
|
||||||
./tools/imctl
|
|
||||||
./tools/infra
|
./tools/infra
|
||||||
./tools/ncpu
|
./tools/ncpu
|
||||||
./tools/openim-web
|
./tools/openim-web
|
||||||
./tools/up35
|
|
||||||
./tools/url2im
|
|
||||||
./tools/versionchecker
|
./tools/versionchecker
|
||||||
./tools/yamlfmt
|
./tools/yamlfmt
|
||||||
|
./tools/component
|
||||||
|
./tools/url2im
|
||||||
|
./tools/data-conversion
|
||||||
|
./tools/up35
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -83,7 +83,6 @@ func NewGinRouter(discov discoveryregistry.SvcDiscoveryRegistry, rdb redis.Unive
|
|||||||
userRouterGroup.POST("/process_user_command_delete", ParseToken, u.ProcessUserCommandDelete)
|
userRouterGroup.POST("/process_user_command_delete", ParseToken, u.ProcessUserCommandDelete)
|
||||||
userRouterGroup.POST("/process_user_command_update", ParseToken, u.ProcessUserCommandUpdate)
|
userRouterGroup.POST("/process_user_command_update", ParseToken, u.ProcessUserCommandUpdate)
|
||||||
userRouterGroup.POST("/process_user_command_get", ParseToken, u.ProcessUserCommandGet)
|
userRouterGroup.POST("/process_user_command_get", ParseToken, u.ProcessUserCommandGet)
|
||||||
userRouterGroup.POST("/process_user_command_get_all", ParseToken, u.ProcessUserCommandGetAll)
|
|
||||||
|
|
||||||
userRouterGroup.POST("/add_notification_account", ParseToken, u.AddNotificationAccount)
|
userRouterGroup.POST("/add_notification_account", ParseToken, u.AddNotificationAccount)
|
||||||
userRouterGroup.POST("/update_notification_account", ParseToken, u.UpdateNotificationAccountInfo)
|
userRouterGroup.POST("/update_notification_account", ParseToken, u.UpdateNotificationAccountInfo)
|
||||||
|
|||||||
@@ -221,11 +221,6 @@ func (u *UserApi) ProcessUserCommandGet(c *gin.Context) {
|
|||||||
a2r.Call(user.UserClient.ProcessUserCommandGet, u.Client, c)
|
a2r.Call(user.UserClient.ProcessUserCommandGet, u.Client, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProcessUserCommandGet user general function get all
|
|
||||||
func (u *UserApi) ProcessUserCommandGetAll(c *gin.Context) {
|
|
||||||
a2r.Call(user.UserClient.ProcessUserCommandGetAll, u.Client, c)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u *UserApi) AddNotificationAccount(c *gin.Context) {
|
func (u *UserApi) AddNotificationAccount(c *gin.Context) {
|
||||||
a2r.Call(user.UserClient.AddNotificationAccount, u.Client, c)
|
a2r.Call(user.UserClient.AddNotificationAccount, u.Client, c)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ func callbackOfflinePush(
|
|||||||
msg *sdkws.MsgData,
|
msg *sdkws.MsgData,
|
||||||
offlinePushUserIDs *[]string,
|
offlinePushUserIDs *[]string,
|
||||||
) error {
|
) error {
|
||||||
if !config.Config.Callback.CallbackOfflinePush.Enable || msg.ContentType == constant.Typing {
|
if !config.Config.Callback.CallbackOfflinePush.Enable {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
req := &callbackstruct.CallbackBeforePushReq{
|
req := &callbackstruct.CallbackBeforePushReq{
|
||||||
@@ -73,7 +73,7 @@ func callbackOfflinePush(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func callbackOnlinePush(ctx context.Context, userIDs []string, msg *sdkws.MsgData) error {
|
func callbackOnlinePush(ctx context.Context, userIDs []string, msg *sdkws.MsgData) error {
|
||||||
if !config.Config.Callback.CallbackOnlinePush.Enable || utils.Contain(msg.SendID, userIDs...) || msg.ContentType == constant.Typing {
|
if !config.Config.Callback.CallbackOnlinePush.Enable || utils.Contain(msg.SendID, userIDs...) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
req := callbackstruct.CallbackBeforePushReq{
|
req := callbackstruct.CallbackBeforePushReq{
|
||||||
@@ -107,7 +107,7 @@ func callbackBeforeSuperGroupOnlinePush(
|
|||||||
msg *sdkws.MsgData,
|
msg *sdkws.MsgData,
|
||||||
pushToUserIDs *[]string,
|
pushToUserIDs *[]string,
|
||||||
) error {
|
) error {
|
||||||
if !config.Config.Callback.CallbackBeforeSuperGroupOnlinePush.Enable || msg.ContentType == constant.Typing {
|
if !config.Config.Callback.CallbackBeforeSuperGroupOnlinePush.Enable {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
req := callbackstruct.CallbackBeforeSuperGroupOnlinePushReq{
|
req := callbackstruct.CallbackBeforeSuperGroupOnlinePushReq{
|
||||||
|
|||||||
@@ -101,9 +101,11 @@ func (p *Pusher) DeleteMemberAndSetConversationSeq(ctx context.Context, groupID
|
|||||||
|
|
||||||
func (p *Pusher) Push2User(ctx context.Context, userIDs []string, msg *sdkws.MsgData) error {
|
func (p *Pusher) Push2User(ctx context.Context, userIDs []string, msg *sdkws.MsgData) error {
|
||||||
log.ZDebug(ctx, "Get msg from msg_transfer And push msg", "userIDs", userIDs, "msg", msg.String())
|
log.ZDebug(ctx, "Get msg from msg_transfer And push msg", "userIDs", userIDs, "msg", msg.String())
|
||||||
|
// callback
|
||||||
if err := callbackOnlinePush(ctx, userIDs, msg); err != nil {
|
if err := callbackOnlinePush(ctx, userIDs, msg); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// push
|
// push
|
||||||
wsResults, err := p.GetConnsAndOnlinePush(ctx, msg, userIDs)
|
wsResults, err := p.GetConnsAndOnlinePush(ctx, msg, userIDs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -118,7 +120,7 @@ func (p *Pusher) Push2User(ctx context.Context, userIDs []string, msg *sdkws.Msg
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, v := range wsResults {
|
for _, v := range wsResults {
|
||||||
if !v.OnlinePush && msg.SendID == v.UserID {
|
if msg.SendID != v.UserID && (!v.OnlinePush) {
|
||||||
if err = callbackOfflinePush(ctx, userIDs, msg, &[]string{}); err != nil {
|
if err = callbackOfflinePush(ctx, userIDs, msg, &[]string{}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -128,7 +130,6 @@ func (p *Pusher) Push2User(ctx context.Context, userIDs []string, msg *sdkws.Msg
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -279,20 +279,20 @@ func CallbackApplyJoinGroupBefore(ctx context.Context, req *callbackstruct.Callb
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func CallbackAfterTransferGroupOwner(ctx context.Context, req *pbgroup.TransferGroupOwnerReq) (err error) {
|
func CallbackTransferGroupOwnerAfter(ctx context.Context, req *pbgroup.TransferGroupOwnerReq) (err error) {
|
||||||
if !config.Config.Callback.CallbackAfterTransferGroupOwner.Enable {
|
if !config.Config.Callback.CallbackTransferGroupOwnerAfter.Enable {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
cbReq := &callbackstruct.CallbackTransferGroupOwnerReq{
|
cbReq := &callbackstruct.CallbackTransferGroupOwnerReq{
|
||||||
CallbackCommand: callbackstruct.CallbackAfterTransferGroupOwner,
|
CallbackCommand: callbackstruct.CallbackTransferGroupOwnerAfter,
|
||||||
GroupID: req.GroupID,
|
GroupID: req.GroupID,
|
||||||
OldOwnerUserID: req.OldOwnerUserID,
|
OldOwnerUserID: req.OldOwnerUserID,
|
||||||
NewOwnerUserID: req.NewOwnerUserID,
|
NewOwnerUserID: req.NewOwnerUserID,
|
||||||
}
|
}
|
||||||
|
|
||||||
resp := &callbackstruct.CallbackTransferGroupOwnerResp{}
|
resp := &callbackstruct.CallbackTransferGroupOwnerResp{}
|
||||||
if err = http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, cbReq, resp, config.Config.Callback.CallbackAfterTransferGroupOwner); err != nil {
|
if err = http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, cbReq, resp, config.Config.Callback.CallbackBeforeJoinGroup); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -1058,7 +1058,7 @@ func (s *groupServer) TransferGroupOwner(ctx context.Context, req *pbgroup.Trans
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := CallbackAfterTransferGroupOwner(ctx, req); err != nil {
|
if err := CallbackTransferGroupOwnerAfter(ctx, req); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
s.Notification.GroupOwnerTransferredNotification(ctx, req)
|
s.Notification.GroupOwnerTransferredNotification(ctx, req)
|
||||||
|
|||||||
@@ -126,15 +126,14 @@ func (m *msgServer) MarkMsgsAsRead(
|
|||||||
}
|
}
|
||||||
|
|
||||||
req_callback := &cbapi.CallbackSingleMsgReadReq{
|
req_callback := &cbapi.CallbackSingleMsgReadReq{
|
||||||
ConversationID: conversation.ConversationID,
|
|
||||||
UserID: req.UserID,
|
UserID: req.UserID,
|
||||||
Seqs: req.Seqs,
|
ConversationID: req.ConversationID,
|
||||||
ContentType: conversation.ConversationType,
|
ContentType: conversation.ConversationType,
|
||||||
|
Seqs: req.Seqs,
|
||||||
}
|
}
|
||||||
if err = CallbackSingleMsgRead(ctx, req_callback); err != nil {
|
if err = CallbackSingleMsgRead(ctx, req_callback); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = m.sendMarkAsReadNotification(ctx, req.ConversationID, conversation.ConversationType, req.UserID,
|
if err = m.sendMarkAsReadNotification(ctx, req.ConversationID, conversation.ConversationType, req.UserID,
|
||||||
m.conversationAndGetRecvID(conversation, req.UserID), req.Seqs, hasReadSeq); err != nil {
|
m.conversationAndGetRecvID(conversation, req.UserID), req.Seqs, hasReadSeq); err != nil {
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ func (m *msgServer) sendMsgSuperGroupChat(
|
|||||||
if err = callbackBeforeSendGroupMsg(ctx, req); err != nil {
|
if err = callbackBeforeSendGroupMsg(ctx, req); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := callbackMsgModify(ctx, req); err != nil {
|
if err := callbackMsgModify(ctx, req); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -168,7 +167,6 @@ func (m *msgServer) sendMsgSingleChat(ctx context.Context, req *pbmsg.SendMsgReq
|
|||||||
if err = callbackBeforeSendSingleMsg(ctx, req); err != nil {
|
if err = callbackBeforeSendSingleMsg(ctx, req); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := callbackMsgModify(ctx, req); err != nil {
|
if err := callbackMsgModify(ctx, req); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-136
@@ -59,6 +59,11 @@ type userServer struct {
|
|||||||
RegisterCenter registry.SvcDiscoveryRegistry
|
RegisterCenter registry.SvcDiscoveryRegistry
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *userServer) ProcessUserCommandGetAll(ctx context.Context, req *pbuser.ProcessUserCommandGetAllReq) (*pbuser.ProcessUserCommandGetAllResp, error) {
|
||||||
|
//TODO implement me
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
func Start(client registry.SvcDiscoveryRegistry, server *grpc.Server) error {
|
func Start(client registry.SvcDiscoveryRegistry, server *grpc.Server) error {
|
||||||
rdb, err := cache.NewRedis()
|
rdb, err := cache.NewRedis()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -229,20 +234,11 @@ func (s *userServer) AccountCheck(ctx context.Context, req *pbuser.AccountCheckR
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *userServer) GetPaginationUsers(ctx context.Context, req *pbuser.GetPaginationUsersReq) (resp *pbuser.GetPaginationUsersResp, err error) {
|
func (s *userServer) GetPaginationUsers(ctx context.Context, req *pbuser.GetPaginationUsersReq) (resp *pbuser.GetPaginationUsersResp, err error) {
|
||||||
if req.UserID == "" && req.NickName == "" {
|
|
||||||
total, users, err := s.PageFindUser(ctx, constant.IMOrdinaryUser, constant.AppOrdinaryUsers, req.Pagination)
|
total, users, err := s.PageFindUser(ctx, constant.IMOrdinaryUser, constant.AppOrdinaryUsers, req.Pagination)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &pbuser.GetPaginationUsersResp{Total: int32(total), Users: convert.UsersDB2Pb(users)}, err
|
return &pbuser.GetPaginationUsersResp{Total: int32(total), Users: convert.UsersDB2Pb(users)}, err
|
||||||
} else {
|
|
||||||
total, users, err := s.PageFindUserWithKeyword(ctx, constant.IMOrdinaryUser, constant.AppOrdinaryUsers, req.UserID, req.NickName, req.Pagination)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return &pbuser.GetPaginationUsersResp{Total: int32(total), Users: convert.UsersDB2Pb(users)}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *userServer) UserRegister(ctx context.Context, req *pbuser.UserRegisterReq) (resp *pbuser.UserRegisterResp, err error) {
|
func (s *userServer) UserRegister(ctx context.Context, req *pbuser.UserRegisterReq) (resp *pbuser.UserRegisterResp, err error) {
|
||||||
@@ -389,51 +385,14 @@ func (s *userServer) GetSubscribeUsersStatus(ctx context.Context,
|
|||||||
|
|
||||||
// ProcessUserCommandAdd user general function add
|
// ProcessUserCommandAdd user general function add
|
||||||
func (s *userServer) ProcessUserCommandAdd(ctx context.Context, req *pbuser.ProcessUserCommandAddReq) (*pbuser.ProcessUserCommandAddResp, error) {
|
func (s *userServer) ProcessUserCommandAdd(ctx context.Context, req *pbuser.ProcessUserCommandAddReq) (*pbuser.ProcessUserCommandAddResp, error) {
|
||||||
err := authverify.CheckAccessV3(ctx, req.UserID)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var value string
|
|
||||||
if req.Value != nil {
|
|
||||||
value = req.Value.Value
|
|
||||||
}
|
|
||||||
var ex string
|
|
||||||
if req.Ex != nil {
|
|
||||||
value = req.Ex.Value
|
|
||||||
}
|
|
||||||
// Assuming you have a method in s.UserDatabase to add a user command
|
|
||||||
err = s.UserDatabase.AddUserCommand(ctx, req.UserID, req.Type, req.Uuid, value, ex)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
tips := &sdkws.UserCommandAddTips{
|
|
||||||
FromUserID: req.UserID,
|
|
||||||
ToUserID: req.UserID,
|
|
||||||
}
|
|
||||||
err = s.userNotificationSender.UserCommandAddNotification(ctx, tips)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return &pbuser.ProcessUserCommandAddResp{}, nil
|
return &pbuser.ProcessUserCommandAddResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProcessUserCommandDelete user general function delete
|
// ProcessUserCommandDelete user general function delete
|
||||||
func (s *userServer) ProcessUserCommandDelete(ctx context.Context, req *pbuser.ProcessUserCommandDeleteReq) (*pbuser.ProcessUserCommandDeleteResp, error) {
|
func (s *userServer) ProcessUserCommandDelete(ctx context.Context, req *pbuser.ProcessUserCommandDeleteReq) (*pbuser.ProcessUserCommandDeleteResp, error) {
|
||||||
err := authverify.CheckAccessV3(ctx, req.UserID)
|
// Assuming you have a method in s.UserDatabase to delete a user command
|
||||||
if err != nil {
|
err := s.UserDatabase.DeleteUserCommand(ctx, req.UserID, req.Type, req.Uuid)
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = s.UserDatabase.DeleteUserCommand(ctx, req.UserID, req.Type, req.Uuid)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
tips := &sdkws.UserCommandDeleteTips{
|
|
||||||
FromUserID: req.UserID,
|
|
||||||
ToUserID: req.UserID,
|
|
||||||
}
|
|
||||||
err = s.userNotificationSender.UserCommandDeleteNotification(ctx, tips)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -442,92 +401,14 @@ func (s *userServer) ProcessUserCommandDelete(ctx context.Context, req *pbuser.P
|
|||||||
|
|
||||||
// ProcessUserCommandUpdate user general function update
|
// ProcessUserCommandUpdate user general function update
|
||||||
func (s *userServer) ProcessUserCommandUpdate(ctx context.Context, req *pbuser.ProcessUserCommandUpdateReq) (*pbuser.ProcessUserCommandUpdateResp, error) {
|
func (s *userServer) ProcessUserCommandUpdate(ctx context.Context, req *pbuser.ProcessUserCommandUpdateReq) (*pbuser.ProcessUserCommandUpdateResp, error) {
|
||||||
err := authverify.CheckAccessV3(ctx, req.UserID)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
val := make(map[string]any)
|
|
||||||
|
|
||||||
// Map fields from eax to val
|
|
||||||
if req.Value != nil {
|
|
||||||
val["value"] = req.Value.Value
|
|
||||||
}
|
|
||||||
if req.Ex != nil {
|
|
||||||
val["ex"] = req.Ex.Value
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assuming you have a method in s.UserDatabase to update a user command
|
|
||||||
err = s.UserDatabase.UpdateUserCommand(ctx, req.UserID, req.Type, req.Uuid, val)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
tips := &sdkws.UserCommandUpdateTips{
|
|
||||||
FromUserID: req.UserID,
|
|
||||||
ToUserID: req.UserID,
|
|
||||||
}
|
|
||||||
err = s.userNotificationSender.UserCommandUpdateNotification(ctx, tips)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return &pbuser.ProcessUserCommandUpdateResp{}, nil
|
return &pbuser.ProcessUserCommandUpdateResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *userServer) ProcessUserCommandGet(ctx context.Context, req *pbuser.ProcessUserCommandGetReq) (*pbuser.ProcessUserCommandGetResp, error) {
|
func (s *userServer) ProcessUserCommandGet(ctx context.Context, req *pbuser.ProcessUserCommandGetReq) (*pbuser.ProcessUserCommandGetResp, error) {
|
||||||
err := authverify.CheckAccessV3(ctx, req.UserID)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
// Fetch user commands from the database
|
|
||||||
commands, err := s.UserDatabase.GetUserCommands(ctx, req.UserID, req.Type)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize commandInfoSlice as an empty slice
|
|
||||||
commandInfoSlice := make([]*pbuser.CommandInfoResp, 0, len(commands))
|
|
||||||
|
|
||||||
for _, command := range commands {
|
|
||||||
// No need to use index since command is already a pointer
|
|
||||||
commandInfoSlice = append(commandInfoSlice, &pbuser.CommandInfoResp{
|
|
||||||
Type: command.Type,
|
|
||||||
Uuid: command.Uuid,
|
|
||||||
Value: command.Value,
|
|
||||||
CreateTime: command.CreateTime,
|
|
||||||
Ex: command.Ex,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return the response with the slice
|
// Return the response with the slice
|
||||||
return &pbuser.ProcessUserCommandGetResp{CommandResp: commandInfoSlice}, nil
|
return &pbuser.ProcessUserCommandGetResp{}, nil
|
||||||
}
|
|
||||||
|
|
||||||
func (s *userServer) ProcessUserCommandGetAll(ctx context.Context, req *pbuser.ProcessUserCommandGetAllReq) (*pbuser.ProcessUserCommandGetAllResp, error) {
|
|
||||||
err := authverify.CheckAccessV3(ctx, req.UserID)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
// Fetch user commands from the database
|
|
||||||
commands, err := s.UserDatabase.GetAllUserCommands(ctx, req.UserID)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize commandInfoSlice as an empty slice
|
|
||||||
commandInfoSlice := make([]*pbuser.AllCommandInfoResp, 0, len(commands))
|
|
||||||
|
|
||||||
for _, command := range commands {
|
|
||||||
// No need to use index since command is already a pointer
|
|
||||||
commandInfoSlice = append(commandInfoSlice, &pbuser.AllCommandInfoResp{
|
|
||||||
Type: command.Type,
|
|
||||||
Uuid: command.Uuid,
|
|
||||||
Value: command.Value,
|
|
||||||
CreateTime: command.CreateTime,
|
|
||||||
Ex: command.Ex,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return the response with the slice
|
|
||||||
return &pbuser.ProcessUserCommandGetAllResp{CommandResp: commandInfoSlice}, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *userServer) AddNotificationAccount(ctx context.Context, req *pbuser.AddNotificationAccountReq) (*pbuser.AddNotificationAccountResp, error) {
|
func (s *userServer) AddNotificationAccount(ctx context.Context, req *pbuser.AddNotificationAccountReq) (*pbuser.AddNotificationAccountResp, error) {
|
||||||
@@ -600,38 +481,31 @@ func (s *userServer) UpdateNotificationAccountInfo(ctx context.Context, req *pbu
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *userServer) SearchNotificationAccount(ctx context.Context, req *pbuser.SearchNotificationAccountReq) (*pbuser.SearchNotificationAccountResp, error) {
|
func (s *userServer) SearchNotificationAccount(ctx context.Context, req *pbuser.SearchNotificationAccountReq) (*pbuser.SearchNotificationAccountResp, error) {
|
||||||
// Check if user is an admin
|
|
||||||
if err := authverify.CheckIMAdmin(ctx); err != nil {
|
if err := authverify.CheckIMAdmin(ctx); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var users []*relation.UserModel
|
var users []*relation.UserModel
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
// If a keyword is provided in the request
|
|
||||||
if req.Keyword != "" {
|
if req.Keyword != "" {
|
||||||
// Find users by keyword
|
|
||||||
users, err = s.UserDatabase.Find(ctx, []string{req.Keyword})
|
users, err = s.UserDatabase.Find(ctx, []string{req.Keyword})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert users to response format
|
|
||||||
resp := s.userModelToResp(users, req.Pagination)
|
resp := s.userModelToResp(users, req.Pagination)
|
||||||
if resp.Total != 0 {
|
if resp.Total != 0 {
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find users by nickname if no users found by keyword
|
|
||||||
users, err = s.UserDatabase.FindByNickname(ctx, req.Keyword)
|
users, err = s.UserDatabase.FindByNickname(ctx, req.Keyword)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
resp = s.userModelToResp(users, req.Pagination)
|
resp = s.userModelToResp(users, req.Pagination)
|
||||||
return resp, nil
|
return resp, nil
|
||||||
|
|
||||||
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no keyword, find users with notification settings
|
|
||||||
users, err = s.UserDatabase.FindNotification(ctx, constant.AppNotificationAdmin)
|
users, err = s.UserDatabase.FindNotification(ctx, constant.AppNotificationAdmin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ const (
|
|||||||
CallbackBeforeUpdateUserInfoExCommand = "callbackBeforeUpdateUserInfoExCommand"
|
CallbackBeforeUpdateUserInfoExCommand = "callbackBeforeUpdateUserInfoExCommand"
|
||||||
CallbackBeforeUserRegisterCommand = "callbackBeforeUserRegisterCommand"
|
CallbackBeforeUserRegisterCommand = "callbackBeforeUserRegisterCommand"
|
||||||
CallbackAfterUserRegisterCommand = "callbackAfterUserRegisterCommand"
|
CallbackAfterUserRegisterCommand = "callbackAfterUserRegisterCommand"
|
||||||
CallbackAfterTransferGroupOwner = "callbackAfterTransferGroupOwner"
|
CallbackTransferGroupOwnerAfter = "callbackTransferGroupOwnerAfter"
|
||||||
CallbackBeforeSetFriendRemark = "callbackBeforeSetFriendRemark"
|
CallbackBeforeSetFriendRemark = "callbackBeforeSetFriendRemark"
|
||||||
CallbackAfterSetFriendRemark = "callbackAfterSetFriendRemark"
|
CallbackAfterSetFriendRemark = "callbackAfterSetFriendRemark"
|
||||||
CallbackSingleMsgRead = "callbackSingleMsgRead"
|
CallbackSingleMsgRead = "callbackSingleMsgRead"
|
||||||
|
|||||||
@@ -94,10 +94,10 @@ type CallbackGroupMsgReadResp struct {
|
|||||||
|
|
||||||
type CallbackSingleMsgReadReq struct {
|
type CallbackSingleMsgReadReq struct {
|
||||||
CallbackCommand `json:"callbackCommand"`
|
CallbackCommand `json:"callbackCommand"`
|
||||||
ConversationID string `json:"conversationID"`
|
|
||||||
UserID string `json:"userID"`
|
UserID string `json:"userID"`
|
||||||
Seqs []int64 `json:"Seqs"`
|
ConversationID string `json:"conversationID"`
|
||||||
ContentType int32 `json:"contentType"`
|
ContentType int32 `json:"contentType"`
|
||||||
|
Seqs []int64 `json:"seqs"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CallbackSingleMsgReadResp struct {
|
type CallbackSingleMsgReadResp struct {
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ type configStruct struct {
|
|||||||
CallbackKillGroupMember CallBackConfig `yaml:"killGroupMember"`
|
CallbackKillGroupMember CallBackConfig `yaml:"killGroupMember"`
|
||||||
CallbackDismissGroup CallBackConfig `yaml:"dismissGroup"`
|
CallbackDismissGroup CallBackConfig `yaml:"dismissGroup"`
|
||||||
CallbackBeforeJoinGroup CallBackConfig `yaml:"joinGroup"`
|
CallbackBeforeJoinGroup CallBackConfig `yaml:"joinGroup"`
|
||||||
CallbackAfterTransferGroupOwner CallBackConfig `yaml:"transferGroupOwner"`
|
CallbackTransferGroupOwnerAfter CallBackConfig `yaml:"transferGroupOwner"`
|
||||||
CallbackBeforeInviteUserToGroup CallBackConfig `yaml:"beforeInviteUserToGroup"`
|
CallbackBeforeInviteUserToGroup CallBackConfig `yaml:"beforeInviteUserToGroup"`
|
||||||
CallbackAfterJoinGroup CallBackConfig `yaml:"joinGroupAfter"`
|
CallbackAfterJoinGroup CallBackConfig `yaml:"joinGroupAfter"`
|
||||||
CallbackAfterSetGroupInfo CallBackConfig `yaml:"setGroupInfoAfter"`
|
CallbackAfterSetGroupInfo CallBackConfig `yaml:"setGroupInfoAfter"`
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import (
|
|||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
|
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/msgprocessor"
|
"github.com/openimsdk/open-im-server/v3/pkg/msgprocessor"
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/util/genutil"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed version
|
//go:embed version
|
||||||
@@ -38,30 +37,19 @@ const (
|
|||||||
|
|
||||||
// return absolude path join ../config/, this is k8s container config path.
|
// return absolude path join ../config/, this is k8s container config path.
|
||||||
func GetDefaultConfigPath() string {
|
func GetDefaultConfigPath() string {
|
||||||
executablePath, err := os.Executable()
|
b, err := filepath.Abs(os.Args[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("GetDefaultConfigPath error:", err.Error())
|
fmt.Println("filepath.Abs error,err=", err)
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
return filepath.Join(filepath.Dir(b), "../config/")
|
||||||
configPath, err := genutil.OutDir(filepath.Join(filepath.Dir(executablePath), "../config/"))
|
|
||||||
if err != nil {
|
|
||||||
fmt.Fprintf(os.Stderr, "failed to get output directory: %v\n", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
return configPath
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// getProjectRoot returns the absolute path of the project root directory.
|
// getProjectRoot returns the absolute path of the project root directory.
|
||||||
func GetProjectRoot() string {
|
func GetProjectRoot() string {
|
||||||
executablePath, _ := os.Executable()
|
b, _ := filepath.Abs(os.Args[0])
|
||||||
|
|
||||||
projectRoot, err := genutil.OutDir(filepath.Join(filepath.Dir(executablePath), "../../../../.."))
|
return filepath.Join(filepath.Dir(b), "../../../../..")
|
||||||
if err != nil {
|
|
||||||
fmt.Fprintf(os.Stderr, "failed to get output directory: %v\n", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
return projectRoot
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetOptionsByNotification(cfg NotificationConf) msgprocessor.Options {
|
func GetOptionsByNotification(cfg NotificationConf) msgprocessor.Options {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
v3.5.0
|
v3.3.0
|
||||||
@@ -146,7 +146,7 @@ func Test_BatchInsertChat2DB(t *testing.T) {
|
|||||||
func GetDB() *commonMsgDatabase {
|
func GetDB() *commonMsgDatabase {
|
||||||
config.Config.Mongo.Address = []string{"203.56.175.233:37017"}
|
config.Config.Mongo.Address = []string{"203.56.175.233:37017"}
|
||||||
// config.Config.Mongo.Timeout = 60
|
// config.Config.Mongo.Timeout = 60
|
||||||
config.Config.Mongo.Database = "openim_v3"
|
config.Config.Mongo.Database = "openIM_v3"
|
||||||
// config.Config.Mongo.Source = "admin"
|
// config.Config.Mongo.Source = "admin"
|
||||||
config.Config.Mongo.Username = "root"
|
config.Config.Mongo.Username = "root"
|
||||||
config.Config.Mongo.Password = "openIM123"
|
config.Config.Mongo.Password = "openIM123"
|
||||||
|
|||||||
@@ -50,8 +50,6 @@ type UserDatabase interface {
|
|||||||
UpdateByMap(ctx context.Context, userID string, args map[string]any) (err error)
|
UpdateByMap(ctx context.Context, userID string, args map[string]any) (err error)
|
||||||
// FindUser
|
// FindUser
|
||||||
PageFindUser(ctx context.Context, level1 int64, level2 int64, pagination pagination.Pagination) (count int64, users []*relation.UserModel, err error)
|
PageFindUser(ctx context.Context, level1 int64, level2 int64, pagination pagination.Pagination) (count int64, users []*relation.UserModel, err error)
|
||||||
//FindUser with keyword
|
|
||||||
PageFindUserWithKeyword(ctx context.Context, level1 int64, level2 int64, userID string, nickName string, pagination pagination.Pagination) (count int64, users []*relation.UserModel, err error)
|
|
||||||
// Page If not found, no error is returned
|
// Page If not found, no error is returned
|
||||||
Page(ctx context.Context, pagination pagination.Pagination) (count int64, users []*relation.UserModel, err error)
|
Page(ctx context.Context, pagination pagination.Pagination) (count int64, users []*relation.UserModel, err error)
|
||||||
// IsExist true as long as one exists
|
// IsExist true as long as one exists
|
||||||
@@ -80,11 +78,10 @@ type UserDatabase interface {
|
|||||||
SetUserStatus(ctx context.Context, userID string, status, platformID int32) error
|
SetUserStatus(ctx context.Context, userID string, status, platformID int32) error
|
||||||
|
|
||||||
//CRUD user command
|
//CRUD user command
|
||||||
AddUserCommand(ctx context.Context, userID string, Type int32, UUID string, value string, ex string) error
|
AddUserCommand(ctx context.Context, userID string, Type int32, UUID string, value string) error
|
||||||
DeleteUserCommand(ctx context.Context, userID string, Type int32, UUID string) error
|
DeleteUserCommand(ctx context.Context, userID string, Type int32, UUID string) error
|
||||||
UpdateUserCommand(ctx context.Context, userID string, Type int32, UUID string, val map[string]any) error
|
UpdateUserCommand(ctx context.Context, userID string, Type int32, UUID string, value string) error
|
||||||
GetUserCommands(ctx context.Context, userID string, Type int32) ([]*user.CommandInfoResp, error)
|
GetUserCommands(ctx context.Context, userID string, Type int32) ([]*user.CommandInfoResp, error)
|
||||||
GetAllUserCommands(ctx context.Context, userID string) ([]*user.AllCommandInfoResp, error)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type userDatabase struct {
|
type userDatabase struct {
|
||||||
@@ -190,9 +187,6 @@ func (u *userDatabase) Page(ctx context.Context, pagination pagination.Paginatio
|
|||||||
func (u *userDatabase) PageFindUser(ctx context.Context, level1 int64, level2 int64, pagination pagination.Pagination) (count int64, users []*relation.UserModel, err error) {
|
func (u *userDatabase) PageFindUser(ctx context.Context, level1 int64, level2 int64, pagination pagination.Pagination) (count int64, users []*relation.UserModel, err error) {
|
||||||
return u.userDB.PageFindUser(ctx, level1, level2, pagination)
|
return u.userDB.PageFindUser(ctx, level1, level2, pagination)
|
||||||
}
|
}
|
||||||
func (u *userDatabase) PageFindUserWithKeyword(ctx context.Context, level1 int64, level2 int64, userID, nickName string, pagination pagination.Pagination) (count int64, users []*relation.UserModel, err error) {
|
|
||||||
return u.userDB.PageFindUserWithKeyword(ctx, level1, level2, userID, nickName, pagination)
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsExist Does userIDs exist? As long as there is one, it will be true.
|
// IsExist Does userIDs exist? As long as there is one, it will be true.
|
||||||
func (u *userDatabase) IsExist(ctx context.Context, userIDs []string) (exist bool, err error) {
|
func (u *userDatabase) IsExist(ctx context.Context, userIDs []string) (exist bool, err error) {
|
||||||
@@ -265,20 +259,16 @@ func (u *userDatabase) GetUserStatus(ctx context.Context, userIDs []string) ([]*
|
|||||||
func (u *userDatabase) SetUserStatus(ctx context.Context, userID string, status, platformID int32) error {
|
func (u *userDatabase) SetUserStatus(ctx context.Context, userID string, status, platformID int32) error {
|
||||||
return u.cache.SetUserStatus(ctx, userID, status, platformID)
|
return u.cache.SetUserStatus(ctx, userID, status, platformID)
|
||||||
}
|
}
|
||||||
func (u *userDatabase) AddUserCommand(ctx context.Context, userID string, Type int32, UUID string, value string, ex string) error {
|
func (u *userDatabase) AddUserCommand(ctx context.Context, userID string, Type int32, UUID string, value string) error {
|
||||||
return u.userDB.AddUserCommand(ctx, userID, Type, UUID, value, ex)
|
return u.userDB.AddUserCommand(ctx, userID, Type, UUID, value)
|
||||||
}
|
}
|
||||||
func (u *userDatabase) DeleteUserCommand(ctx context.Context, userID string, Type int32, UUID string) error {
|
func (u *userDatabase) DeleteUserCommand(ctx context.Context, userID string, Type int32, UUID string) error {
|
||||||
return u.userDB.DeleteUserCommand(ctx, userID, Type, UUID)
|
return u.userDB.DeleteUserCommand(ctx, userID, Type, UUID)
|
||||||
}
|
}
|
||||||
func (u *userDatabase) UpdateUserCommand(ctx context.Context, userID string, Type int32, UUID string, val map[string]any) error {
|
func (u *userDatabase) UpdateUserCommand(ctx context.Context, userID string, Type int32, UUID string, value string) error {
|
||||||
return u.userDB.UpdateUserCommand(ctx, userID, Type, UUID, val)
|
return u.userDB.UpdateUserCommand(ctx, userID, Type, UUID, value)
|
||||||
}
|
}
|
||||||
func (u *userDatabase) GetUserCommands(ctx context.Context, userID string, Type int32) ([]*user.CommandInfoResp, error) {
|
func (u *userDatabase) GetUserCommands(ctx context.Context, userID string, Type int32) ([]*user.CommandInfoResp, error) {
|
||||||
commands, err := u.userDB.GetUserCommand(ctx, userID, Type)
|
commands, err := u.userDB.GetUserCommand(ctx, userID, Type)
|
||||||
return commands, err
|
return commands, err
|
||||||
}
|
}
|
||||||
func (u *userDatabase) GetAllUserCommands(ctx context.Context, userID string) ([]*user.AllCommandInfoResp, error) {
|
|
||||||
commands, err := u.userDB.GetAllUserCommand(ctx, userID)
|
|
||||||
return commands, err
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -114,7 +114,8 @@ func (c *ConversationMgo) GetAllConversationIDs(ctx context.Context) ([]string,
|
|||||||
func (c *ConversationMgo) GetAllConversationIDsNumber(ctx context.Context) (int64, error) {
|
func (c *ConversationMgo) GetAllConversationIDsNumber(ctx context.Context) (int64, error) {
|
||||||
counts, err := mgoutil.Aggregate[int64](ctx, c.coll, []bson.M{
|
counts, err := mgoutil.Aggregate[int64](ctx, c.coll, []bson.M{
|
||||||
{"$group": bson.M{"_id": "$conversation_id"}},
|
{"$group": bson.M{"_id": "$conversation_id"}},
|
||||||
{"$project": bson.M{"_id": 0, "conversation_id": "$_id"}},
|
{"$group": bson.M{"_id": nil, "count": bson.M{"$sum": 1}}},
|
||||||
|
{"$project": bson.M{"_id": 0}},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
|
|||||||
+6
-100
@@ -17,8 +17,6 @@ package mgo
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/OpenIMSDK/protocol/user"
|
"github.com/OpenIMSDK/protocol/user"
|
||||||
"github.com/OpenIMSDK/tools/errs"
|
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/OpenIMSDK/tools/mgoutil"
|
"github.com/OpenIMSDK/tools/mgoutil"
|
||||||
@@ -89,33 +87,6 @@ func (u *UserMgo) PageFindUser(ctx context.Context, level1 int64, level2 int64,
|
|||||||
|
|
||||||
return mgoutil.FindPage[*relation.UserModel](ctx, u.coll, query, pagination)
|
return mgoutil.FindPage[*relation.UserModel](ctx, u.coll, query, pagination)
|
||||||
}
|
}
|
||||||
func (u *UserMgo) PageFindUserWithKeyword(ctx context.Context, level1 int64, level2 int64, userID string, nickName string, pagination pagination.Pagination) (count int64, users []*relation.UserModel, err error) {
|
|
||||||
// Initialize the base query with level conditions
|
|
||||||
query := bson.M{
|
|
||||||
"$and": []bson.M{
|
|
||||||
{"app_manger_level": bson.M{"$in": []int64{level1, level2}}},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add userID and userName conditions to the query if they are provided
|
|
||||||
if userID != "" || nickName != "" {
|
|
||||||
userConditions := []bson.M{}
|
|
||||||
if userID != "" {
|
|
||||||
// Use regex for userID
|
|
||||||
regexPattern := primitive.Regex{Pattern: userID, Options: "i"} // 'i' for case-insensitive matching
|
|
||||||
userConditions = append(userConditions, bson.M{"user_id": regexPattern})
|
|
||||||
}
|
|
||||||
if nickName != "" {
|
|
||||||
// Use regex for userName
|
|
||||||
regexPattern := primitive.Regex{Pattern: nickName, Options: "i"} // 'i' for case-insensitive matching
|
|
||||||
userConditions = append(userConditions, bson.M{"nickname": regexPattern})
|
|
||||||
}
|
|
||||||
query["$and"] = append(query["$and"].([]bson.M), bson.M{"$or": userConditions})
|
|
||||||
}
|
|
||||||
|
|
||||||
// Perform the paginated search
|
|
||||||
return mgoutil.FindPage[*relation.UserModel](ctx, u.coll, query, pagination)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u *UserMgo) GetAllUserID(ctx context.Context, pagination pagination.Pagination) (int64, []string, error) {
|
func (u *UserMgo) GetAllUserID(ctx context.Context, pagination pagination.Pagination) (int64, []string, error) {
|
||||||
return mgoutil.FindPage[string](ctx, u.coll, bson.M{}, pagination, options.Find().SetProjection(bson.M{"_id": 0, "user_id": 1}))
|
return mgoutil.FindPage[string](ctx, u.coll, bson.M{}, pagination, options.Find().SetProjection(bson.M{"_id": 0, "user_id": 1}))
|
||||||
@@ -136,7 +107,7 @@ func (u *UserMgo) CountTotal(ctx context.Context, before *time.Time) (count int6
|
|||||||
return mgoutil.Count(ctx, u.coll, bson.M{"create_time": bson.M{"$lt": before}})
|
return mgoutil.Count(ctx, u.coll, bson.M{"create_time": bson.M{"$lt": before}})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserMgo) AddUserCommand(ctx context.Context, userID string, Type int32, UUID string, value string, ex string) error {
|
func (u *UserMgo) AddUserCommand(ctx context.Context, userID string, Type int32, UUID string, value string) error {
|
||||||
collection := u.coll.Database().Collection("userCommands")
|
collection := u.coll.Database().Collection("userCommands")
|
||||||
|
|
||||||
// Create a new document instead of updating an existing one
|
// Create a new document instead of updating an existing one
|
||||||
@@ -146,48 +117,28 @@ func (u *UserMgo) AddUserCommand(ctx context.Context, userID string, Type int32,
|
|||||||
"uuid": UUID,
|
"uuid": UUID,
|
||||||
"createTime": time.Now().Unix(), // assuming you want the creation time in Unix timestamp
|
"createTime": time.Now().Unix(), // assuming you want the creation time in Unix timestamp
|
||||||
"value": value,
|
"value": value,
|
||||||
"ex": ex,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := collection.InsertOne(ctx, doc)
|
_, err := collection.InsertOne(ctx, doc)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserMgo) DeleteUserCommand(ctx context.Context, userID string, Type int32, UUID string) error {
|
func (u *UserMgo) DeleteUserCommand(ctx context.Context, userID string, Type int32, UUID string) error {
|
||||||
collection := u.coll.Database().Collection("userCommands")
|
collection := u.coll.Database().Collection("userCommands")
|
||||||
|
|
||||||
filter := bson.M{"userID": userID, "type": Type, "uuid": UUID}
|
filter := bson.M{"userID": userID, "type": Type, "uuid": UUID}
|
||||||
|
|
||||||
result, err := collection.DeleteOne(ctx, filter)
|
_, err := collection.DeleteOne(ctx, filter)
|
||||||
if result.DeletedCount == 0 {
|
|
||||||
// No records found to update
|
|
||||||
return errs.Wrap(errs.ErrRecordNotFound)
|
|
||||||
}
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
func (u *UserMgo) UpdateUserCommand(ctx context.Context, userID string, Type int32, UUID string, val map[string]any) error {
|
func (u *UserMgo) UpdateUserCommand(ctx context.Context, userID string, Type int32, UUID string, value string) error {
|
||||||
if len(val) == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
collection := u.coll.Database().Collection("userCommands")
|
collection := u.coll.Database().Collection("userCommands")
|
||||||
|
|
||||||
filter := bson.M{"userID": userID, "type": Type, "uuid": UUID}
|
filter := bson.M{"userID": userID, "type": Type, "uuid": UUID}
|
||||||
update := bson.M{"$set": val}
|
update := bson.M{"$set": bson.M{"value": value}}
|
||||||
|
|
||||||
result, err := collection.UpdateOne(ctx, filter, update)
|
_, err := collection.UpdateOne(ctx, filter, update)
|
||||||
if err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if result.MatchedCount == 0 {
|
|
||||||
// No records found to update
|
|
||||||
return errs.Wrap(errs.ErrRecordNotFound)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u *UserMgo) GetUserCommand(ctx context.Context, userID string, Type int32) ([]*user.CommandInfoResp, error) {
|
func (u *UserMgo) GetUserCommand(ctx context.Context, userID string, Type int32) ([]*user.CommandInfoResp, error) {
|
||||||
collection := u.coll.Database().Collection("userCommands")
|
collection := u.coll.Database().Collection("userCommands")
|
||||||
filter := bson.M{"userID": userID, "type": Type}
|
filter := bson.M{"userID": userID, "type": Type}
|
||||||
@@ -203,23 +154,19 @@ func (u *UserMgo) GetUserCommand(ctx context.Context, userID string, Type int32)
|
|||||||
|
|
||||||
for cursor.Next(ctx) {
|
for cursor.Next(ctx) {
|
||||||
var document struct {
|
var document struct {
|
||||||
Type int32 `bson:"type"`
|
|
||||||
UUID string `bson:"uuid"`
|
UUID string `bson:"uuid"`
|
||||||
Value string `bson:"value"`
|
Value string `bson:"value"`
|
||||||
CreateTime int64 `bson:"createTime"`
|
CreateTime int64 `bson:"createTime"`
|
||||||
Ex string `bson:"ex"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cursor.Decode(&document); err != nil {
|
if err := cursor.Decode(&document); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
commandInfo := &user.CommandInfoResp{
|
commandInfo := &user.CommandInfoResp{ // Change here: use a pointer to the struct
|
||||||
Type: document.Type,
|
|
||||||
Uuid: document.UUID,
|
Uuid: document.UUID,
|
||||||
Value: document.Value,
|
Value: document.Value,
|
||||||
CreateTime: document.CreateTime,
|
CreateTime: document.CreateTime,
|
||||||
Ex: document.Ex,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
commands = append(commands, commandInfo)
|
commands = append(commands, commandInfo)
|
||||||
@@ -231,48 +178,7 @@ func (u *UserMgo) GetUserCommand(ctx context.Context, userID string, Type int32)
|
|||||||
|
|
||||||
return commands, nil
|
return commands, nil
|
||||||
}
|
}
|
||||||
func (u *UserMgo) GetAllUserCommand(ctx context.Context, userID string) ([]*user.AllCommandInfoResp, error) {
|
|
||||||
collection := u.coll.Database().Collection("userCommands")
|
|
||||||
filter := bson.M{"userID": userID}
|
|
||||||
|
|
||||||
cursor, err := collection.Find(ctx, filter)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer cursor.Close(ctx)
|
|
||||||
|
|
||||||
// Initialize commands as a slice of pointers
|
|
||||||
commands := []*user.AllCommandInfoResp{}
|
|
||||||
|
|
||||||
for cursor.Next(ctx) {
|
|
||||||
var document struct {
|
|
||||||
Type int32 `bson:"type"`
|
|
||||||
UUID string `bson:"uuid"`
|
|
||||||
Value string `bson:"value"`
|
|
||||||
CreateTime int64 `bson:"createTime"`
|
|
||||||
Ex string `bson:"ex"`
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := cursor.Decode(&document); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
commandInfo := &user.AllCommandInfoResp{
|
|
||||||
Type: document.Type,
|
|
||||||
Uuid: document.UUID,
|
|
||||||
Value: document.Value,
|
|
||||||
CreateTime: document.CreateTime,
|
|
||||||
Ex: document.Ex,
|
|
||||||
}
|
|
||||||
|
|
||||||
commands = append(commands, commandInfo)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := cursor.Err(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return commands, nil
|
|
||||||
}
|
|
||||||
func (u *UserMgo) CountRangeEverydayTotal(ctx context.Context, start time.Time, end time.Time) (map[string]int64, error) {
|
func (u *UserMgo) CountRangeEverydayTotal(ctx context.Context, start time.Time, end time.Time) (map[string]int64, error) {
|
||||||
pipeline := bson.A{
|
pipeline := bson.A{
|
||||||
bson.M{
|
bson.M{
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ type UserModelInterface interface {
|
|||||||
TakeByNickname(ctx context.Context, nickname string) (user []*UserModel, err error)
|
TakeByNickname(ctx context.Context, nickname string) (user []*UserModel, err error)
|
||||||
Page(ctx context.Context, pagination pagination.Pagination) (count int64, users []*UserModel, err error)
|
Page(ctx context.Context, pagination pagination.Pagination) (count int64, users []*UserModel, err error)
|
||||||
PageFindUser(ctx context.Context, level1 int64, level2 int64, pagination pagination.Pagination) (count int64, users []*UserModel, err error)
|
PageFindUser(ctx context.Context, level1 int64, level2 int64, pagination pagination.Pagination) (count int64, users []*UserModel, err error)
|
||||||
PageFindUserWithKeyword(ctx context.Context, level1 int64, level2 int64, userID, nickName string, pagination pagination.Pagination) (count int64, users []*UserModel, err error)
|
|
||||||
Exist(ctx context.Context, userID string) (exist bool, err error)
|
Exist(ctx context.Context, userID string) (exist bool, err error)
|
||||||
GetAllUserID(ctx context.Context, pagination pagination.Pagination) (count int64, userIDs []string, err error)
|
GetAllUserID(ctx context.Context, pagination pagination.Pagination) (count int64, userIDs []string, err error)
|
||||||
GetUserGlobalRecvMsgOpt(ctx context.Context, userID string) (opt int, err error)
|
GetUserGlobalRecvMsgOpt(ctx context.Context, userID string) (opt int, err error)
|
||||||
@@ -66,9 +65,8 @@ type UserModelInterface interface {
|
|||||||
// 获取范围内用户增量
|
// 获取范围内用户增量
|
||||||
CountRangeEverydayTotal(ctx context.Context, start time.Time, end time.Time) (map[string]int64, error)
|
CountRangeEverydayTotal(ctx context.Context, start time.Time, end time.Time) (map[string]int64, error)
|
||||||
//CRUD user command
|
//CRUD user command
|
||||||
AddUserCommand(ctx context.Context, userID string, Type int32, UUID string, value string, ex string) error
|
AddUserCommand(ctx context.Context, userID string, Type int32, UUID string, value string) error
|
||||||
DeleteUserCommand(ctx context.Context, userID string, Type int32, UUID string) error
|
DeleteUserCommand(ctx context.Context, userID string, Type int32, UUID string) error
|
||||||
UpdateUserCommand(ctx context.Context, userID string, Type int32, UUID string, val map[string]any) error
|
UpdateUserCommand(ctx context.Context, userID string, Type int32, UUID string, value string) error
|
||||||
GetUserCommand(ctx context.Context, userID string, Type int32) ([]*user.CommandInfoResp, error)
|
GetUserCommand(ctx context.Context, userID string, Type int32) ([]*user.CommandInfoResp, error)
|
||||||
GetAllUserCommand(ctx context.Context, userID string) ([]*user.AllCommandInfoResp, error)
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,14 +14,14 @@
|
|||||||
|
|
||||||
package prommetrics
|
package prommetrics
|
||||||
|
|
||||||
import ginprom "github.com/openimsdk/open-im-server/v3/pkg/common/ginprometheus"
|
import ginProm "github.com/openimsdk/open-im-server/v3/pkg/common/ginprometheus"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
labels := prometheus.Labels{"label_one": "any", "label_two": "value"}
|
labels := prometheus.Labels{"label_one": "any", "label_two": "value"}
|
||||||
ApiCustomCnt.MetricCollector.(*prometheus.CounterVec).With(labels).Inc().
|
ApiCustomCnt.MetricCollector.(*prometheus.CounterVec).With(labels).Inc().
|
||||||
*/
|
*/
|
||||||
var (
|
var (
|
||||||
ApiCustomCnt = &ginprom.Metric{
|
ApiCustomCnt = &ginProm.Metric{
|
||||||
Name: "custom_total",
|
Name: "custom_total",
|
||||||
Description: "Custom counter events.",
|
Description: "Custom counter events.",
|
||||||
Type: "counter_vec",
|
Type: "counter_vec",
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
package prommetrics
|
package prommetrics
|
||||||
|
|
||||||
import (
|
import (
|
||||||
gp "github.com/grpc-ecosystem/go-grpc-prometheus"
|
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/prometheus/client_golang/prometheus/collectors"
|
"github.com/prometheus/client_golang/prometheus/collectors"
|
||||||
|
|
||||||
@@ -23,10 +23,10 @@ import (
|
|||||||
"github.com/openimsdk/open-im-server/v3/pkg/common/ginprometheus"
|
"github.com/openimsdk/open-im-server/v3/pkg/common/ginprometheus"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewGrpcPromObj(cusMetrics []prometheus.Collector) (*prometheus.Registry, *gp.ServerMetrics, error) {
|
func NewGrpcPromObj(cusMetrics []prometheus.Collector) (*prometheus.Registry, *grpc_prometheus.ServerMetrics, error) {
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
reg := prometheus.NewRegistry()
|
reg := prometheus.NewRegistry()
|
||||||
grpcMetrics := gp.NewServerMetrics()
|
grpcMetrics := grpc_prometheus.NewServerMetrics()
|
||||||
grpcMetrics.EnableHandlingTimeHistogram()
|
grpcMetrics.EnableHandlingTimeHistogram()
|
||||||
cusMetrics = append(cusMetrics, grpcMetrics, collectors.NewGoCollector())
|
cusMetrics = append(cusMetrics, grpcMetrics, collectors.NewGoCollector())
|
||||||
reg.MustRegister(cusMetrics...)
|
reg.MustRegister(cusMetrics...)
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ func GetChatConversationIDByMsg(msg *sdkws.MsgData) string {
|
|||||||
case constant.NotificationChatType:
|
case constant.NotificationChatType:
|
||||||
return "sn_" + msg.SendID + "_" + msg.RecvID
|
return "sn_" + msg.SendID + "_" + msg.RecvID
|
||||||
}
|
}
|
||||||
|
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ func NewOptions(opts ...OptionsOpt) Options {
|
|||||||
for _, opt := range opts {
|
for _, opt := range opts {
|
||||||
opt(options)
|
opt(options)
|
||||||
}
|
}
|
||||||
|
|
||||||
return options
|
return options
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,21 +103,3 @@ func (u *UserNotificationSender) UserStatusChangeNotification(
|
|||||||
) error {
|
) error {
|
||||||
return u.Notification(ctx, tips.FromUserID, tips.ToUserID, constant.UserStatusChangeNotification, tips)
|
return u.Notification(ctx, tips.FromUserID, tips.ToUserID, constant.UserStatusChangeNotification, tips)
|
||||||
}
|
}
|
||||||
func (u *UserNotificationSender) UserCommandUpdateNotification(
|
|
||||||
ctx context.Context,
|
|
||||||
tips *sdkws.UserCommandUpdateTips,
|
|
||||||
) error {
|
|
||||||
return u.Notification(ctx, tips.FromUserID, tips.ToUserID, constant.UserCommandUpdateNotification, tips)
|
|
||||||
}
|
|
||||||
func (u *UserNotificationSender) UserCommandAddNotification(
|
|
||||||
ctx context.Context,
|
|
||||||
tips *sdkws.UserCommandAddTips,
|
|
||||||
) error {
|
|
||||||
return u.Notification(ctx, tips.FromUserID, tips.ToUserID, constant.UserCommandAddNotification, tips)
|
|
||||||
}
|
|
||||||
func (u *UserNotificationSender) UserCommandDeleteNotification(
|
|
||||||
ctx context.Context,
|
|
||||||
tips *sdkws.UserCommandDeleteTips,
|
|
||||||
) error {
|
|
||||||
return u.Notification(ctx, tips.FromUserID, tips.ToUserID, constant.UserCommandDeleteNotification, tips)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
package flag
|
|
||||||
|
|
||||||
import (
|
|
||||||
goFlag "flag"
|
|
||||||
"log"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/spf13/pflag"
|
|
||||||
)
|
|
||||||
|
|
||||||
// WordSepNormalizeFunc changes all flags that contain "_" separators.
|
|
||||||
func WordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName {
|
|
||||||
if strings.Contains(name, "_") {
|
|
||||||
return pflag.NormalizedName(strings.ReplaceAll(name, "_", "-"))
|
|
||||||
}
|
|
||||||
return pflag.NormalizedName(name)
|
|
||||||
}
|
|
||||||
|
|
||||||
// WarnWordSepNormalizeFunc changes and warns for flags that contain "_" separators.
|
|
||||||
func WarnWordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName {
|
|
||||||
if strings.Contains(name, "_") {
|
|
||||||
normalizedName := strings.ReplaceAll(name, "_", "-")
|
|
||||||
log.Printf("WARNING: flag %s has been deprecated and will be removed in a future version. Use %s instead.", name, normalizedName)
|
|
||||||
return pflag.NormalizedName(normalizedName)
|
|
||||||
}
|
|
||||||
return pflag.NormalizedName(name)
|
|
||||||
}
|
|
||||||
|
|
||||||
// InitFlags normalizes, parses, then logs the command line flags.
|
|
||||||
func InitFlags() {
|
|
||||||
pflag.CommandLine.SetNormalizeFunc(WordSepNormalizeFunc)
|
|
||||||
pflag.CommandLine.AddGoFlagSet(goFlag.CommandLine)
|
|
||||||
}
|
|
||||||
|
|
||||||
// PrintFlags logs the flags in the flagset.
|
|
||||||
func PrintFlags(flags *pflag.FlagSet) {
|
|
||||||
flags.VisitAll(func(flag *pflag.Flag) {
|
|
||||||
log.Printf("FLAG: --%s=%q", flag.Name, flag.Value)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package genutil
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
)
|
|
||||||
|
|
||||||
// OutDir creates the absolute path name from path and checks path exists.
|
|
||||||
// Returns absolute path including trailing '/' or error if path does not exist.
|
|
||||||
func OutDir(path string) (string, error) {
|
|
||||||
outDir, err := filepath.Abs(path)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
stat, err := os.Stat(outDir)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
if !stat.IsDir() {
|
|
||||||
return "", fmt.Errorf("output directory %s is not a directory", outDir)
|
|
||||||
}
|
|
||||||
outDir += "/"
|
|
||||||
return outDir, nil
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package genutil
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestValidDir(t *testing.T) {
|
|
||||||
_, err := OutDir("./")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestInvalidDir(t *testing.T) {
|
|
||||||
_, err := OutDir("./nondir")
|
|
||||||
if err == nil {
|
|
||||||
t.Fatal("expected an error")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestNotDir(t *testing.T) {
|
|
||||||
_, err := OutDir("./genutils_test.go")
|
|
||||||
if err == nil {
|
|
||||||
t.Fatal("expected an error")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Executable
+173
@@ -0,0 +1,173 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
#**************************************************************************
|
||||||
|
# Copyright (C) 2011, Paul Lutus *
|
||||||
|
# *
|
||||||
|
# This program is free software; you can redistribute it and/or modify *
|
||||||
|
# it under the terms of the GNU General Public License as published by *
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
# (at your option) any later version. *
|
||||||
|
# *
|
||||||
|
# This program is distributed in the hope that it will be useful, *
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
# GNU General Public License for more details. *
|
||||||
|
# *
|
||||||
|
# You should have received a copy of the GNU General Public License *
|
||||||
|
# along with this program; if not, write to the *
|
||||||
|
# Free Software Foundation, Inc., *
|
||||||
|
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
#**************************************************************************
|
||||||
|
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
PVERSION = '1.0'
|
||||||
|
|
||||||
|
|
||||||
|
class BeautifyBash:
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.tab_str = ' '
|
||||||
|
self.tab_size = 2
|
||||||
|
|
||||||
|
def read_file(self, fp):
|
||||||
|
with open(fp) as f:
|
||||||
|
return f.read()
|
||||||
|
|
||||||
|
def write_file(self, fp, data):
|
||||||
|
with open(fp, 'w') as f:
|
||||||
|
f.write(data)
|
||||||
|
|
||||||
|
def beautify_string(self, data, path=''):
|
||||||
|
tab = 0
|
||||||
|
case_stack = []
|
||||||
|
in_here_doc = False
|
||||||
|
defer_ext_quote = False
|
||||||
|
in_ext_quote = False
|
||||||
|
ext_quote_string = ''
|
||||||
|
here_string = ''
|
||||||
|
output = []
|
||||||
|
line = 1
|
||||||
|
for record in re.split('\n', data):
|
||||||
|
record = record.rstrip()
|
||||||
|
stripped_record = record.strip()
|
||||||
|
|
||||||
|
# collapse multiple quotes between ' ... '
|
||||||
|
test_record = re.sub(r'\'.*?\'', '', stripped_record)
|
||||||
|
# collapse multiple quotes between " ... "
|
||||||
|
test_record = re.sub(r'".*?"', '', test_record)
|
||||||
|
# collapse multiple quotes between ` ... `
|
||||||
|
test_record = re.sub(r'`.*?`', '', test_record)
|
||||||
|
# collapse multiple quotes between \` ... ' (weird case)
|
||||||
|
test_record = re.sub(r'\\`.*?\'', '', test_record)
|
||||||
|
# strip out any escaped single characters
|
||||||
|
test_record = re.sub(r'\\.', '', test_record)
|
||||||
|
# remove '#' comments
|
||||||
|
test_record = re.sub(r'(\A|\s)(#.*)', '', test_record, 1)
|
||||||
|
if(not in_here_doc):
|
||||||
|
if(re.search('<<-?', test_record)):
|
||||||
|
here_string = re.sub(
|
||||||
|
'.*<<-?\s*[\'|"]?([_|\w]+)[\'|"]?.*', '\\1', stripped_record, 1)
|
||||||
|
in_here_doc = (len(here_string) > 0)
|
||||||
|
if(in_here_doc): # pass on with no changes
|
||||||
|
output.append(record)
|
||||||
|
# now test for here-doc termination string
|
||||||
|
if(re.search(here_string, test_record) and not re.search('<<', test_record)):
|
||||||
|
in_here_doc = False
|
||||||
|
else: # not in here doc
|
||||||
|
if(in_ext_quote):
|
||||||
|
if(re.search(ext_quote_string, test_record)):
|
||||||
|
# provide line after quotes
|
||||||
|
test_record = re.sub(
|
||||||
|
'.*%s(.*)' % ext_quote_string, '\\1', test_record, 1)
|
||||||
|
in_ext_quote = False
|
||||||
|
else: # not in ext quote
|
||||||
|
if(re.search(r'(\A|\s)(\'|")', test_record)):
|
||||||
|
# apply only after this line has been processed
|
||||||
|
defer_ext_quote = True
|
||||||
|
ext_quote_string = re.sub(
|
||||||
|
'.*([\'"]).*', '\\1', test_record, 1)
|
||||||
|
# provide line before quote
|
||||||
|
test_record = re.sub(
|
||||||
|
'(.*)%s.*' % ext_quote_string, '\\1', test_record, 1)
|
||||||
|
if(in_ext_quote):
|
||||||
|
# pass on unchanged
|
||||||
|
output.append(record)
|
||||||
|
else: # not in ext quote
|
||||||
|
inc = len(re.findall(
|
||||||
|
'(\s|\A|;)(case|then|do)(;|\Z|\s)', test_record))
|
||||||
|
inc += len(re.findall('(\{|\(|\[)', test_record))
|
||||||
|
outc = len(re.findall(
|
||||||
|
'(\s|\A|;)(esac|fi|done|elif)(;|\)|\||\Z|\s)', test_record))
|
||||||
|
outc += len(re.findall('(\}|\)|\])', test_record))
|
||||||
|
if(re.search(r'\besac\b', test_record)):
|
||||||
|
if(len(case_stack) == 0):
|
||||||
|
sys.stderr.write(
|
||||||
|
'File %s: error: "esac" before "case" in line %d.\n' % (
|
||||||
|
path, line)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
outc += case_stack.pop()
|
||||||
|
# sepcial handling for bad syntax within case ... esac
|
||||||
|
if(len(case_stack) > 0):
|
||||||
|
if(re.search('\A[^(]*\)', test_record)):
|
||||||
|
# avoid overcount
|
||||||
|
outc -= 2
|
||||||
|
case_stack[-1] += 1
|
||||||
|
if(re.search(';;', test_record)):
|
||||||
|
outc += 1
|
||||||
|
case_stack[-1] -= 1
|
||||||
|
# an ad-hoc solution for the "else" keyword
|
||||||
|
else_case = (
|
||||||
|
0, -1)[re.search('^(else)', test_record) != None]
|
||||||
|
net = inc - outc
|
||||||
|
tab += min(net, 0)
|
||||||
|
extab = tab + else_case
|
||||||
|
extab = max(0, extab)
|
||||||
|
output.append(
|
||||||
|
(self.tab_str * self.tab_size * extab) + stripped_record)
|
||||||
|
tab += max(net, 0)
|
||||||
|
if(defer_ext_quote):
|
||||||
|
in_ext_quote = True
|
||||||
|
defer_ext_quote = False
|
||||||
|
if(re.search(r'\bcase\b', test_record)):
|
||||||
|
case_stack.append(0)
|
||||||
|
line += 1
|
||||||
|
error = (tab != 0)
|
||||||
|
if(error):
|
||||||
|
sys.stderr.write(
|
||||||
|
'File %s: error: indent/outdent mismatch: %d.\n' % (path, tab))
|
||||||
|
return '\n'.join(output), error
|
||||||
|
|
||||||
|
def beautify_file(self, path):
|
||||||
|
error = False
|
||||||
|
if(path == '-'):
|
||||||
|
data = sys.stdin.read()
|
||||||
|
result, error = self.beautify_string(data, '(stdin)')
|
||||||
|
sys.stdout.write(result)
|
||||||
|
else: # named file
|
||||||
|
data = self.read_file(path)
|
||||||
|
result, error = self.beautify_string(data, path)
|
||||||
|
if(data != result):
|
||||||
|
# make a backup copy
|
||||||
|
self.write_file(path + '~', data)
|
||||||
|
self.write_file(path, result)
|
||||||
|
return error
|
||||||
|
|
||||||
|
def main(self):
|
||||||
|
error = False
|
||||||
|
sys.argv.pop(0)
|
||||||
|
if(len(sys.argv) < 1):
|
||||||
|
sys.stderr.write(
|
||||||
|
'usage: shell script filenames or \"-\" for stdin.\n')
|
||||||
|
else:
|
||||||
|
for path in sys.argv:
|
||||||
|
error |= self.beautify_file(path)
|
||||||
|
sys.exit((0, 1)[error])
|
||||||
|
|
||||||
|
# if not called as a module
|
||||||
|
if(__name__ == '__main__'):
|
||||||
|
BeautifyBash().main()
|
||||||
|
|
||||||
+1
-1
@@ -148,7 +148,7 @@ function openim::build::verify_prereqs() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
OPENIM_GIT_BRANCH=$(git symbolic-ref --short -q HEAD 2>/dev/null || true)
|
OPENIM_GIT_BRANCH=$(git symbolic-ref --short -q HEAD 2>/dev/null || true)
|
||||||
OPENIM_ROOT_HASH=$(openim::build::short_hash "${HOSTNAME:-}:"${OPENIM_ROOT}":${OPENIM_GIT_BRANCH}")
|
OPENIM_ROOT_HASH=$(openim::build::short_hash "${HOSTNAME:-}:${OPENIM_ROOT}:${OPENIM_GIT_BRANCH}")
|
||||||
OPENIM_BUILD_IMAGE_TAG_BASE="build-${OPENIM_ROOT_HASH}"
|
OPENIM_BUILD_IMAGE_TAG_BASE="build-${OPENIM_ROOT_HASH}"
|
||||||
#OPENIM_BUILD_IMAGE_TAG="${OPENIM_BUILD_IMAGE_TAG_BASE}-${OPENIM_BUILD_IMAGE_VERSION}"
|
#OPENIM_BUILD_IMAGE_TAG="${OPENIM_BUILD_IMAGE_TAG_BASE}-${OPENIM_BUILD_IMAGE_VERSION}"
|
||||||
#OPENIM_BUILD_IMAGE="${OPENIM_BUILD_IMAGE_REPO}:${OPENIM_BUILD_IMAGE_TAG}"
|
#OPENIM_BUILD_IMAGE="${OPENIM_BUILD_IMAGE_REPO}:${OPENIM_BUILD_IMAGE_TAG}"
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
|||||||
|
|
||||||
version="${VERSION}"
|
version="${VERSION}"
|
||||||
if [ "${version}" == "" ];then
|
if [ "${version}" == "" ];then
|
||||||
version=v`${OPENIM_ROOT}/_output/tools/gsemver bump`
|
version=v$(${OPENIM_ROOT}/_output/tools/gsemver bump)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "`git tag -l ${version}`" ];then
|
if [ -z "$(git tag -l ${version})" ];then
|
||||||
git tag -a -m "release version ${version}" ${version}
|
git tag -a -m "release version ${version}" ${version}
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ echo -e "=== any\nRepresents an untyped JSON map - see the description of the fi
|
|||||||
asciidoctor definitions.adoc
|
asciidoctor definitions.adoc
|
||||||
asciidoctor paths.adoc
|
asciidoctor paths.adoc
|
||||||
|
|
||||||
cp ${OPENIM_OUTPUT_TMP}/definitions.html ${OPENIM_OUTPUT_TMP}/_output/
|
cp "$OPENIM_OUTPUT_TMP/definitions.html" "$OPENIM_OUTPUT_TMP/_output/"
|
||||||
cp ${OPENIM_OUTPUT_TMP}/paths.html ${OPENIM_OUTPUT_TMP}/_output/operations.html
|
cp "$OPENIM_OUTPUT_TMP/paths.html" "$OPENIM_OUTPUT_TMP/_output/operations.html"
|
||||||
|
|
||||||
success "SUCCESS"
|
success "SUCCESS"
|
||||||
@@ -47,7 +47,7 @@ do
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [ "${missing}" ];then
|
if [ "${missing}" ];then
|
||||||
openim::log::error 'You may run `source scripts/environment.sh` to set these environment'
|
openim::log::error "You may run 'source scripts/environment.sh' to set these environment"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ printError() {
|
|||||||
|
|
||||||
printMessage "Running local OpenIM pre-push hook."
|
printMessage "Running local OpenIM pre-push hook."
|
||||||
|
|
||||||
if [[ `git status --porcelain` ]]; then
|
if [[ $(git status --porcelain) ]]; then
|
||||||
printError "This scripts needs to run against committed code only. Please commit or stash you changes."
|
printError "This scripts needs to run against committed code only. Please commit or stash you changes."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ readonly ENV_FILE=${ENV_FILE:-"${OPENIM_ROOT}/scripts/install/environment.sh"}
|
|||||||
# Templates for configuration files
|
# Templates for configuration files
|
||||||
declare -A TEMPLATES=(
|
declare -A TEMPLATES=(
|
||||||
["${OPENIM_ROOT}/deployments/templates/env-template.yaml"]="${OPENIM_ROOT}/.env"
|
["${OPENIM_ROOT}/deployments/templates/env-template.yaml"]="${OPENIM_ROOT}/.env"
|
||||||
["${OPENIM_ROOT}/deployments/templates/config.yaml"]="${OPENIM_ROOT}/config/openim.yaml"
|
["${OPENIM_ROOT}/deployments/templates/config.yaml"]="${OPENIM_ROOT}/config/config.yaml"
|
||||||
["${OPENIM_ROOT}/deployments/templates/prometheus.yml"]="${OPENIM_ROOT}/config/prometheus.yml"
|
["${OPENIM_ROOT}/deployments/templates/prometheus.yml"]="${OPENIM_ROOT}/config/prometheus.yml"
|
||||||
["${OPENIM_ROOT}/deployments/templates/alertmanager.yml"]="${OPENIM_ROOT}/config/alertmanager.yml"
|
["${OPENIM_ROOT}/deployments/templates/alertmanager.yml"]="${OPENIM_ROOT}/config/alertmanager.yml"
|
||||||
)
|
)
|
||||||
@@ -39,7 +39,7 @@ declare -A TEMPLATES=(
|
|||||||
# Templates for example files
|
# Templates for example files
|
||||||
declare -A EXAMPLES=(
|
declare -A EXAMPLES=(
|
||||||
["${OPENIM_ROOT}/deployments/templates/env-template.yaml"]="${OPENIM_ROOT}/config/templates/env.template"
|
["${OPENIM_ROOT}/deployments/templates/env-template.yaml"]="${OPENIM_ROOT}/config/templates/env.template"
|
||||||
["${OPENIM_ROOT}/deployments/templates/config.yaml"]="${OPENIM_ROOT}/config/templates/openim.yaml.template"
|
["${OPENIM_ROOT}/deployments/templates/config.yaml"]="${OPENIM_ROOT}/config/templates/config.yaml.template"
|
||||||
["${OPENIM_ROOT}/deployments/templates/prometheus.yml"]="${OPENIM_ROOT}/config/templates/prometheus.yml.template"
|
["${OPENIM_ROOT}/deployments/templates/prometheus.yml"]="${OPENIM_ROOT}/config/templates/prometheus.yml.template"
|
||||||
["${OPENIM_ROOT}/deployments/templates/alertmanager.yml"]="${OPENIM_ROOT}/config/templates/alertmanager.yml.template"
|
["${OPENIM_ROOT}/deployments/templates/alertmanager.yml"]="${OPENIM_ROOT}/config/templates/alertmanager.yml.template"
|
||||||
)
|
)
|
||||||
@@ -95,6 +95,10 @@ generate_config_files() {
|
|||||||
# Function to generate example files
|
# Function to generate example files
|
||||||
generate_example_files() {
|
generate_example_files() {
|
||||||
env_cmd="env -i"
|
env_cmd="env -i"
|
||||||
|
|
||||||
|
env_vars["OPENIM_IP"]="127.0.0.1"
|
||||||
|
env_vars["LOG_STORAGE_LOCATION"]="../../"
|
||||||
|
|
||||||
for var in "${!env_vars[@]}"; do
|
for var in "${!env_vars[@]}"; do
|
||||||
env_cmd+=" $var='${env_vars[$var]}'"
|
env_cmd+=" $var='${env_vars[$var]}'"
|
||||||
done
|
done
|
||||||
@@ -110,7 +114,6 @@ generate_example_files() {
|
|||||||
local example_file="${COPY_EXAMPLES[$template]}"
|
local example_file="${COPY_EXAMPLES[$template]}"
|
||||||
process_file "$template" "$example_file" false
|
process_file "$template" "$example_file" false
|
||||||
done
|
done
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to process a single file, either by generating or copying
|
# Function to process a single file, either by generating or copying
|
||||||
@@ -181,7 +184,6 @@ clean_config_files() {
|
|||||||
|
|
||||||
# Function to clean example files
|
# Function to clean example files
|
||||||
clean_example_files() {
|
clean_example_files() {
|
||||||
# 合并 EXAMPLES 和 COPY_EXAMPLES 数组
|
|
||||||
local all_examples=("${EXAMPLES[@]}" "${COPY_EXAMPLES[@]}")
|
local all_examples=("${EXAMPLES[@]}" "${COPY_EXAMPLES[@]}")
|
||||||
|
|
||||||
for example_file in "${all_examples[@]}"; do
|
for example_file in "${all_examples[@]}"; do
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ help_info() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
delete_hooks() {
|
delete_hooks() {
|
||||||
for file in ${OPENIM_ROOT}/scripts/githooks/*.sh; do
|
for file in "${OPENIM_ROOT}"/scripts/githooks/*.sh; do
|
||||||
hook_name=$(basename "$file" .sh) # This removes the .sh extension
|
hook_name=$(basename "$file" .sh) # This removes the .sh extension
|
||||||
rm -f "$HOOKS_DIR/$hook_name"
|
rm -f "$HOOKS_DIR/$hook_name"
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -69,7 +69,8 @@ ${DOCKER_COMPOSE_COMMAND} up -d
|
|||||||
check_containers() {
|
check_containers() {
|
||||||
if ! ${DOCKER_COMPOSE_COMMAND} ps | grep -q 'Up'; then
|
if ! ${DOCKER_COMPOSE_COMMAND} ps | grep -q 'Up'; then
|
||||||
echo "Error: One or more docker containers failed to start."
|
echo "Error: One or more docker containers failed to start."
|
||||||
${DOCKER_COMPOSE_COMMAND} logs
|
${DOCKER_COMPOSE_COMMAND} logs openim-server
|
||||||
|
${DOCKER_COMPOSE_COMMAND} logs openim-chat
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
@@ -77,9 +78,9 @@ check_containers() {
|
|||||||
|
|
||||||
# Wait for a short period to allow containers to initialize
|
# Wait for a short period to allow containers to initialize
|
||||||
sleep 30
|
sleep 30
|
||||||
check_containers
|
|
||||||
|
|
||||||
${DOCKER_COMPOSE_COMMAND} logs openim-server
|
|
||||||
${DOCKER_COMPOSE_COMMAND} ps
|
${DOCKER_COMPOSE_COMMAND} ps
|
||||||
|
|
||||||
|
check_containers
|
||||||
|
|
||||||
popd
|
popd
|
||||||
+115
-68
@@ -73,20 +73,22 @@ function openim::test::auth() {
|
|||||||
# Define a function to get a token for a specific user
|
# Define a function to get a token for a specific user
|
||||||
openim::test::get_token() {
|
openim::test::get_token() {
|
||||||
local user_id="${1:-openIM123456}" # Default user ID if not provided
|
local user_id="${1:-openIM123456}" # Default user ID if not provided
|
||||||
token_response=$(${CCURL} "${OperationID}" "${Header}" ${INSECURE_OPENIMAPI}/auth/user_token \
|
token_response=$(
|
||||||
-d'{"secret": "'"$SECRET"'","platformID": 1,"userID": "'$user_id'"}')
|
${CCURL} "${OperationID}" "${Header}" ${INSECURE_OPENIMAPI}/auth/user_token \
|
||||||
|
-d'{"secret": "'"$SECRET"'","platformID": 1,"userID": "'$user_id'"}'
|
||||||
|
)
|
||||||
token=$(echo $token_response | grep -Po 'token[" :]+\K[^"]+')
|
token=$(echo $token_response | grep -Po 'token[" :]+\K[^"]+')
|
||||||
echo "$token"
|
echo "$token"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Header="-HContent-Type: application/json"
|
Header="-HContent-Type: application/json"
|
||||||
OperationID="-HoperationID: 1646445464564"
|
OperationID="-HoperationID: 1646445464564"
|
||||||
Token="-Htoken: $(openim::test::get_token)"
|
Token="-Htoken: $(openim::test::get_token)"
|
||||||
|
|
||||||
# Forces a user to log out from the specified platform by user ID.
|
# Forces a user to log out from the specified platform by user ID.
|
||||||
openim::test::force_logout() {
|
openim::test::force_logout() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"platformID": 2,
|
"platformID": 2,
|
||||||
"userID": "4950983283"
|
"userID": "4950983283"
|
||||||
@@ -100,7 +102,6 @@ EOF
|
|||||||
openim::test::check_error "$response"
|
openim::test::check_error "$response"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#################################### User Module ####################################
|
#################################### User Module ####################################
|
||||||
|
|
||||||
# Registers a new user with provided user ID, nickname, and face URL using the API.
|
# Registers a new user with provided user ID, nickname, and face URL using the API.
|
||||||
@@ -111,7 +112,8 @@ openim::test::user_register() {
|
|||||||
local face_url="${3:-https://github.com/cubxxw}"
|
local face_url="${3:-https://github.com/cubxxw}"
|
||||||
|
|
||||||
# Create the request body using the provided or default values
|
# Create the request body using the provided or default values
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"secret": "${SECRET}",
|
"secret": "${SECRET}",
|
||||||
"users": [
|
"users": [
|
||||||
@@ -136,7 +138,8 @@ EOF
|
|||||||
|
|
||||||
# Checks if the provided list of user IDs exist in the system.
|
# Checks if the provided list of user IDs exist in the system.
|
||||||
openim::test::check_user_account() {
|
openim::test::check_user_account() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"checkUserIDs": [
|
"checkUserIDs": [
|
||||||
"${1}",
|
"${1}",
|
||||||
@@ -156,7 +159,8 @@ EOF
|
|||||||
|
|
||||||
# Retrieves a list of users with pagination, limited to a specific number per page.
|
# Retrieves a list of users with pagination, limited to a specific number per page.
|
||||||
openim::test::get_users() {
|
openim::test::get_users() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"pagination": {
|
"pagination": {
|
||||||
"pageNumber": 1,
|
"pageNumber": 1,
|
||||||
@@ -174,7 +178,8 @@ EOF
|
|||||||
|
|
||||||
# Obtains detailed information for a list of user IDs.
|
# Obtains detailed information for a list of user IDs.
|
||||||
openim::test::get_users_info() {
|
openim::test::get_users_info() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"userIDs": [
|
"userIDs": [
|
||||||
"${1}",
|
"${1}",
|
||||||
@@ -192,7 +197,8 @@ EOF
|
|||||||
|
|
||||||
# Retrieves the online status for a list of user IDs.
|
# Retrieves the online status for a list of user IDs.
|
||||||
openim::test::get_users_online_status() {
|
openim::test::get_users_online_status() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"userIDs": [
|
"userIDs": [
|
||||||
"${TEST_USER_ID}",
|
"${TEST_USER_ID}",
|
||||||
@@ -212,7 +218,8 @@ EOF
|
|||||||
|
|
||||||
# Updates the information for a user, such as nickname and face URL.
|
# Updates the information for a user, such as nickname and face URL.
|
||||||
openim::test::update_user_info() {
|
openim::test::update_user_info() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"userInfo": {
|
"userInfo": {
|
||||||
"userID": "${TEST_USER_ID}",
|
"userID": "${TEST_USER_ID}",
|
||||||
@@ -231,7 +238,8 @@ EOF
|
|||||||
|
|
||||||
# Gets the online status for users that a particular user has subscribed to.
|
# Gets the online status for users that a particular user has subscribed to.
|
||||||
openim::test::get_subscribe_users_status() {
|
openim::test::get_subscribe_users_status() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"userID": "${TEST_USER_ID}"
|
"userID": "${TEST_USER_ID}"
|
||||||
}
|
}
|
||||||
@@ -246,7 +254,8 @@ EOF
|
|||||||
|
|
||||||
# Subscribes to the online status of a list of users for a particular user ID.
|
# Subscribes to the online status of a list of users for a particular user ID.
|
||||||
openim::test::subscribe_users_status() {
|
openim::test::subscribe_users_status() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"userID": "9168684795",
|
"userID": "9168684795",
|
||||||
"userIDs": [
|
"userIDs": [
|
||||||
@@ -267,7 +276,8 @@ EOF
|
|||||||
|
|
||||||
# Sets the global message receiving option for a user, determining their messaging preferences.
|
# Sets the global message receiving option for a user, determining their messaging preferences.
|
||||||
openim::test::set_global_msg_recv_opt() {
|
openim::test::set_global_msg_recv_opt() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"userID": "${TEST_USER_ID}",
|
"userID": "${TEST_USER_ID}",
|
||||||
"globalRecvMsgOpt": 0
|
"globalRecvMsgOpt": 0
|
||||||
@@ -322,7 +332,8 @@ function openim::test::user() {
|
|||||||
|
|
||||||
# Checks if two users are friends.
|
# Checks if two users are friends.
|
||||||
openim::test::is_friend() {
|
openim::test::is_friend() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"userID1": "${1}",
|
"userID1": "${1}",
|
||||||
"userID2": "${2}"
|
"userID2": "${2}"
|
||||||
@@ -338,7 +349,8 @@ EOF
|
|||||||
|
|
||||||
# Deletes a friend for a user.
|
# Deletes a friend for a user.
|
||||||
openim::test::delete_friend() {
|
openim::test::delete_friend() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"ownerUserID":"${1}",
|
"ownerUserID":"${1}",
|
||||||
"friendUserID":"${2}"
|
"friendUserID":"${2}"
|
||||||
@@ -354,7 +366,8 @@ EOF
|
|||||||
|
|
||||||
# Gets the friend application list for a user.
|
# Gets the friend application list for a user.
|
||||||
openim::test::get_friend_apply_list() {
|
openim::test::get_friend_apply_list() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"userID": "${MANAGER_USERID_1}",
|
"userID": "${MANAGER_USERID_1}",
|
||||||
"pagination": {
|
"pagination": {
|
||||||
@@ -373,7 +386,8 @@ EOF
|
|||||||
|
|
||||||
# Gets the friend list for a user.
|
# Gets the friend list for a user.
|
||||||
openim::test::get_friend_list() {
|
openim::test::get_friend_list() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"userID": "${1}",
|
"userID": "${1}",
|
||||||
"pagination": {
|
"pagination": {
|
||||||
@@ -392,7 +406,8 @@ EOF
|
|||||||
|
|
||||||
# Sets a remark for a friend.
|
# Sets a remark for a friend.
|
||||||
openim::test::set_friend_remark() {
|
openim::test::set_friend_remark() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"ownerUserID": "${1}",
|
"ownerUserID": "${1}",
|
||||||
"friendUserID": "${2}",
|
"friendUserID": "${2}",
|
||||||
@@ -409,7 +424,8 @@ EOF
|
|||||||
|
|
||||||
# Adds a friend request.
|
# Adds a friend request.
|
||||||
openim::test::add_friend() {
|
openim::test::add_friend() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"fromUserID": "${1}",
|
"fromUserID": "${1}",
|
||||||
"toUserID": "${2}",
|
"toUserID": "${2}",
|
||||||
@@ -429,7 +445,8 @@ EOF
|
|||||||
openim::test::import_friend() {
|
openim::test::import_friend() {
|
||||||
local friend_ids=$(printf ', "%s"' "${@:2}")
|
local friend_ids=$(printf ', "%s"' "${@:2}")
|
||||||
friend_ids=${friend_ids:2}
|
friend_ids=${friend_ids:2}
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"ownerUserID": "${1}",
|
"ownerUserID": "${1}",
|
||||||
"friendUserIDs": [${friend_ids}]
|
"friendUserIDs": [${friend_ids}]
|
||||||
@@ -443,10 +460,10 @@ EOF
|
|||||||
openim::test::check_error "$response"
|
openim::test::check_error "$response"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Responds to a friend request.
|
# Responds to a friend request.
|
||||||
openim::test::add_friend_response() {
|
openim::test::add_friend_response() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"fromUserID": "${1}",
|
"fromUserID": "${1}",
|
||||||
"toUserID": "${2}",
|
"toUserID": "${2}",
|
||||||
@@ -464,7 +481,8 @@ EOF
|
|||||||
|
|
||||||
# Retrieves the friend application list that the user has applied for.
|
# Retrieves the friend application list that the user has applied for.
|
||||||
openim::test::get_self_friend_apply_list() {
|
openim::test::get_self_friend_apply_list() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"userID": "${1}",
|
"userID": "${1}",
|
||||||
"pagination": {
|
"pagination": {
|
||||||
@@ -483,7 +501,8 @@ EOF
|
|||||||
|
|
||||||
# Adds a user to the blacklist.
|
# Adds a user to the blacklist.
|
||||||
openim::test::add_black() {
|
openim::test::add_black() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"ownerUserID": "${1}",
|
"ownerUserID": "${1}",
|
||||||
"blackUserID": "${2}"
|
"blackUserID": "${2}"
|
||||||
@@ -499,7 +518,8 @@ EOF
|
|||||||
|
|
||||||
# Removes a user from the blacklist.
|
# Removes a user from the blacklist.
|
||||||
openim::test::remove_black() {
|
openim::test::remove_black() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"ownerUserID": "${1}",
|
"ownerUserID": "${1}",
|
||||||
"blackUserID": "${2}"
|
"blackUserID": "${2}"
|
||||||
@@ -515,7 +535,8 @@ EOF
|
|||||||
|
|
||||||
# Retrieves the blacklist for a user.
|
# Retrieves the blacklist for a user.
|
||||||
openim::test::get_black_list() {
|
openim::test::get_black_list() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"userID": "${1}",
|
"userID": "${1}",
|
||||||
"pagination": {
|
"pagination": {
|
||||||
@@ -544,9 +565,13 @@ openim::test::update_pin_status() {
|
|||||||
for friendUserID in "$@"; do
|
for friendUserID in "$@"; do
|
||||||
friendUserIDsArray+=("\"${friendUserID}\"")
|
friendUserIDsArray+=("\"${friendUserID}\"")
|
||||||
done
|
done
|
||||||
local friendUserIDs=$(IFS=,; echo "${friendUserIDsArray[*]}")
|
local friendUserIDs=$(
|
||||||
|
IFS=,
|
||||||
|
echo "${friendUserIDsArray[*]}"
|
||||||
|
)
|
||||||
|
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"ownerUserID": "${ownerUserID}",
|
"ownerUserID": "${ownerUserID}",
|
||||||
"friendUserIDs": [${friendUserIDs}],
|
"friendUserIDs": [${friendUserIDs}],
|
||||||
@@ -561,7 +586,6 @@ EOF
|
|||||||
openim::test::check_error "$response"
|
openim::test::check_error "$response"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# [openim::test::friend function description]
|
# [openim::test::friend function description]
|
||||||
# The `openim::test::friend` function serves as a test suite for friend-related operations.
|
# The `openim::test::friend` function serves as a test suite for friend-related operations.
|
||||||
# It sequentially invokes all friend-related test functions to ensure the API's friend operations are functioning correctly.
|
# It sequentially invokes all friend-related test functions to ensure the API's friend operations are functioning correctly.
|
||||||
@@ -631,12 +655,12 @@ function openim::test::friend() {
|
|||||||
openim::log::success "Friend test suite completed successfully."
|
openim::log::success "Friend test suite completed successfully."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#################################### Group Module ####################################
|
#################################### Group Module ####################################
|
||||||
|
|
||||||
# Creates a new group.
|
# Creates a new group.
|
||||||
openim::test::create_group() {
|
openim::test::create_group() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"memberUserIDs": [
|
"memberUserIDs": [
|
||||||
"${1}"
|
"${1}"
|
||||||
@@ -669,7 +693,8 @@ EOF
|
|||||||
|
|
||||||
# Invites a user to join a group.
|
# Invites a user to join a group.
|
||||||
openim::test::invite_user_to_group() {
|
openim::test::invite_user_to_group() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"groupID": "${1}",
|
"groupID": "${1}",
|
||||||
"invitedUserIDs": [
|
"invitedUserIDs": [
|
||||||
@@ -689,7 +714,8 @@ EOF
|
|||||||
|
|
||||||
# Transfers the ownership of a group to another user.
|
# Transfers the ownership of a group to another user.
|
||||||
openim::test::transfer_group() {
|
openim::test::transfer_group() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"groupID":"${1}",
|
"groupID":"${1}",
|
||||||
"oldOwnerUserID":"${2}",
|
"oldOwnerUserID":"${2}",
|
||||||
@@ -706,7 +732,8 @@ EOF
|
|||||||
|
|
||||||
# Retrieves information about multiple groups.
|
# Retrieves information about multiple groups.
|
||||||
openim::test::get_groups_info() {
|
openim::test::get_groups_info() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"groupIDs": ["${1}", "${2}"]
|
"groupIDs": ["${1}", "${2}"]
|
||||||
}
|
}
|
||||||
@@ -721,7 +748,8 @@ EOF
|
|||||||
|
|
||||||
# Removes a user from a group.
|
# Removes a user from a group.
|
||||||
openim::test::kick_group() {
|
openim::test::kick_group() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"groupID": "${1}",
|
"groupID": "${1}",
|
||||||
"kickedUserIDs": [
|
"kickedUserIDs": [
|
||||||
@@ -740,7 +768,8 @@ EOF
|
|||||||
|
|
||||||
# Retrieves information about group members.
|
# Retrieves information about group members.
|
||||||
openim::test::get_group_members_info() {
|
openim::test::get_group_members_info() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"groupID": "${1}",
|
"groupID": "${1}",
|
||||||
"userIDs": ["${2}"]
|
"userIDs": ["${2}"]
|
||||||
@@ -756,7 +785,8 @@ EOF
|
|||||||
|
|
||||||
# Retrieves a list of group members.
|
# Retrieves a list of group members.
|
||||||
openim::test::get_group_member_list() {
|
openim::test::get_group_member_list() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"groupID": "${1}",
|
"groupID": "${1}",
|
||||||
"pagination": {
|
"pagination": {
|
||||||
@@ -775,7 +805,8 @@ EOF
|
|||||||
|
|
||||||
# Retrieves a list of groups that a user has joined.
|
# Retrieves a list of groups that a user has joined.
|
||||||
openim::test::get_joined_group_list() {
|
openim::test::get_joined_group_list() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"fromUserID": "${1}",
|
"fromUserID": "${1}",
|
||||||
"pagination": {
|
"pagination": {
|
||||||
@@ -792,10 +823,10 @@ EOF
|
|||||||
openim::test::check_error "$response"
|
openim::test::check_error "$response"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Sets group member information.
|
# Sets group member information.
|
||||||
openim::test::set_group_member_info() {
|
openim::test::set_group_member_info() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
@@ -819,7 +850,8 @@ EOF
|
|||||||
|
|
||||||
# Mutes a group.
|
# Mutes a group.
|
||||||
openim::test::mute_group() {
|
openim::test::mute_group() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"groupID": "${1}"
|
"groupID": "${1}"
|
||||||
}
|
}
|
||||||
@@ -834,7 +866,8 @@ EOF
|
|||||||
|
|
||||||
# Cancels the muting of a group.
|
# Cancels the muting of a group.
|
||||||
openim::test::cancel_mute_group() {
|
openim::test::cancel_mute_group() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"groupID": "${1}"
|
"groupID": "${1}"
|
||||||
}
|
}
|
||||||
@@ -849,7 +882,8 @@ EOF
|
|||||||
|
|
||||||
# Dismisses a group.
|
# Dismisses a group.
|
||||||
openim::test::dismiss_group() {
|
openim::test::dismiss_group() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"groupID":"${1}"
|
"groupID":"${1}"
|
||||||
}
|
}
|
||||||
@@ -864,7 +898,8 @@ EOF
|
|||||||
|
|
||||||
# Cancels muting a group member.
|
# Cancels muting a group member.
|
||||||
openim::test::cancel_mute_group_member() {
|
openim::test::cancel_mute_group_member() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"groupID": "${1}",
|
"groupID": "${1}",
|
||||||
"userID": "${2}"
|
"userID": "${2}"
|
||||||
@@ -880,7 +915,8 @@ EOF
|
|||||||
|
|
||||||
# Allows a user to join a group.
|
# Allows a user to join a group.
|
||||||
openim::test::join_group() {
|
openim::test::join_group() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"groupID": "${1}",
|
"groupID": "${1}",
|
||||||
"reqMessage": "req msg join group",
|
"reqMessage": "req msg join group",
|
||||||
@@ -898,7 +934,8 @@ EOF
|
|||||||
|
|
||||||
# Sets group information.
|
# Sets group information.
|
||||||
openim::test::set_group_info() {
|
openim::test::set_group_info() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"groupInfoForSet": {
|
"groupInfoForSet": {
|
||||||
"groupID": "${1}",
|
"groupID": "${1}",
|
||||||
@@ -921,10 +958,10 @@ EOF
|
|||||||
openim::test::check_error "$response"
|
openim::test::check_error "$response"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Allows a user to quit a group.
|
# Allows a user to quit a group.
|
||||||
openim::test::quit_group() {
|
openim::test::quit_group() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"groupID": "${1}",
|
"groupID": "${1}",
|
||||||
"userID": "${2}"
|
"userID": "${2}"
|
||||||
@@ -940,7 +977,8 @@ EOF
|
|||||||
|
|
||||||
# Retrieves the list of group applications received by the user.
|
# Retrieves the list of group applications received by the user.
|
||||||
openim::test::get_recv_group_applicationList() {
|
openim::test::get_recv_group_applicationList() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"fromUserID": "${1}",
|
"fromUserID": "${1}",
|
||||||
"pagination": {
|
"pagination": {
|
||||||
@@ -959,7 +997,8 @@ EOF
|
|||||||
|
|
||||||
# Responds to a group application.
|
# Responds to a group application.
|
||||||
openim::test::group_application_response() {
|
openim::test::group_application_response() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"groupID": "${1}",
|
"groupID": "${1}",
|
||||||
"fromUserID": "${2}",
|
"fromUserID": "${2}",
|
||||||
@@ -977,7 +1016,8 @@ EOF
|
|||||||
|
|
||||||
# Retrieves the list of group applications made by the user.
|
# Retrieves the list of group applications made by the user.
|
||||||
openim::test::get_user_req_group_applicationList() {
|
openim::test::get_user_req_group_applicationList() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"userID": "${1}",
|
"userID": "${1}",
|
||||||
"pagination": {
|
"pagination": {
|
||||||
@@ -996,7 +1036,8 @@ EOF
|
|||||||
|
|
||||||
# Mutes a group member for a specified duration.
|
# Mutes a group member for a specified duration.
|
||||||
openim::test::mute_group_member() {
|
openim::test::mute_group_member() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"groupID": "${1}",
|
"groupID": "${1}",
|
||||||
"userID": "${2}",
|
"userID": "${2}",
|
||||||
@@ -1013,7 +1054,8 @@ EOF
|
|||||||
|
|
||||||
# Retrieves a list of group applications from specific users.
|
# Retrieves a list of group applications from specific users.
|
||||||
openim::test::get_group_users_req_application_list() {
|
openim::test::get_group_users_req_application_list() {
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"groupID": "${1}",
|
"groupID": "${1}",
|
||||||
"userIDs": [
|
"userIDs": [
|
||||||
@@ -1121,11 +1163,13 @@ function openim::test::group() {
|
|||||||
|
|
||||||
# Define a function to register a user
|
# Define a function to register a user
|
||||||
openim::register_user() {
|
openim::register_user() {
|
||||||
user_register_response=$(${CCURL} "${Header}" ${INSECURE_OPENIMAPI}/user/user_register \
|
user_register_response=$(
|
||||||
|
${CCURL} "${Header}" ${INSECURE_OPENIMAPI}/user/user_register \
|
||||||
-d'{
|
-d'{
|
||||||
"secret": "openIM123",
|
"secret": "openIM123",
|
||||||
"users": [{"userID": "11111112","nickname": "yourNickname","faceURL": "yourFaceURL"}]
|
"users": [{"userID": "11111112","nickname": "yourNickname","faceURL": "yourFaceURL"}]
|
||||||
}')
|
}'
|
||||||
|
)
|
||||||
|
|
||||||
echo "$user_register_response"
|
echo "$user_register_response"
|
||||||
}
|
}
|
||||||
@@ -1133,10 +1177,12 @@ openim::register_user() {
|
|||||||
# Define a function to check the account
|
# Define a function to check the account
|
||||||
openim::test::check_account() {
|
openim::test::check_account() {
|
||||||
local token=$1
|
local token=$1
|
||||||
account_check_response=$(${CCURL} "${Header}" -H"operationID: 1646445464564" -H"token: ${token}" ${INSECURE_OPENIMAPI}/user/account_check \
|
account_check_response=$(
|
||||||
|
${CCURL} "${Header}" -H"operationID: 1646445464564" -H"token: ${token}" ${INSECURE_OPENIMAPI}/user/account_check \
|
||||||
-d'{
|
-d'{
|
||||||
"checkUserIDs": ["11111111","11111112"]
|
"checkUserIDs": ["11111111","11111112"]
|
||||||
}')
|
}'
|
||||||
|
)
|
||||||
|
|
||||||
echo "$account_check_response"
|
echo "$account_check_response"
|
||||||
}
|
}
|
||||||
@@ -1179,7 +1225,8 @@ openim::test::send_msg() {
|
|||||||
local recvID="${2}"
|
local recvID="${2}"
|
||||||
local groupID="${3}"
|
local groupID="${3}"
|
||||||
|
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"sendID": "${sendID}",
|
"sendID": "${sendID}",
|
||||||
"recvID": "${recvID}",
|
"recvID": "${recvID}",
|
||||||
@@ -1223,7 +1270,8 @@ openim::test::search_msg() {
|
|||||||
local showNumber="${7}"
|
local showNumber="${7}"
|
||||||
|
|
||||||
# Construct the request body
|
# Construct the request body
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"sendID": "${sendID}",
|
"sendID": "${sendID}",
|
||||||
"recvID": "${recvID}",
|
"recvID": "${recvID}",
|
||||||
@@ -1256,7 +1304,8 @@ openim::test::pull_msg_by_seq() {
|
|||||||
local order="${6}" # Assuming 0 for ascending, 1 for descending
|
local order="${6}" # Assuming 0 for ascending, 1 for descending
|
||||||
|
|
||||||
# Construct the request body
|
# Construct the request body
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"userID": "${userID}",
|
"userID": "${userID}",
|
||||||
"seqRanges": [
|
"seqRanges": [
|
||||||
@@ -1286,7 +1335,8 @@ openim::test::revoke_msg() {
|
|||||||
local conversationID="${2}"
|
local conversationID="${2}"
|
||||||
local seq="${3}"
|
local seq="${3}"
|
||||||
|
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"userID": "${userID}",
|
"userID": "${userID}",
|
||||||
"conversationID": "${conversationID}",
|
"conversationID": "${conversationID}",
|
||||||
@@ -1301,12 +1351,12 @@ EOF
|
|||||||
openim::test::check_error "$response"
|
openim::test::check_error "$response"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Clears all messages for a user.
|
# Clears all messages for a user.
|
||||||
openim::test::user_clear_all_msg() {
|
openim::test::user_clear_all_msg() {
|
||||||
local userID="${1}"
|
local userID="${1}"
|
||||||
|
|
||||||
local request_body=$(cat <<EOF
|
local request_body=$(
|
||||||
|
cat <<EOF
|
||||||
{
|
{
|
||||||
"userID": "${userID}"
|
"userID": "${userID}"
|
||||||
}
|
}
|
||||||
@@ -1322,8 +1372,7 @@ EOF
|
|||||||
# [openim::test::msg function description]
|
# [openim::test::msg function description]
|
||||||
# The `openim::test::msg` function serves as a test suite for message-related operations.
|
# The `openim::test::msg` function serves as a test suite for message-related operations.
|
||||||
# It sequentially invokes all message-related test functions to ensure the API's message operations are functioning correctly.
|
# It sequentially invokes all message-related test functions to ensure the API's message operations are functioning correctly.
|
||||||
function openim::test::msg()
|
function openim::test::msg() {
|
||||||
{
|
|
||||||
local SEND_USER_ID="${MANAGER_USERID_1}" # This should be the sender's userID
|
local SEND_USER_ID="${MANAGER_USERID_1}" # This should be the sender's userID
|
||||||
local GROUP_ID="" # GroupID if it's a group message
|
local GROUP_ID="" # GroupID if it's a group message
|
||||||
local USER_ID="$RANDOM"
|
local USER_ID="$RANDOM"
|
||||||
@@ -1352,7 +1401,6 @@ function openim::test::msg()
|
|||||||
local ORDER=0 # Assuming 0 for ascending order
|
local ORDER=0 # Assuming 0 for ascending order
|
||||||
openim::test::pull_msg_by_seq "${RECV_USER_ID}" "${CONVERSATION_ID}" "${BEGIN_SEQ}" "${END_SEQ}" "${NUM}" "${ORDER}"
|
openim::test::pull_msg_by_seq "${RECV_USER_ID}" "${CONVERSATION_ID}" "${BEGIN_SEQ}" "${END_SEQ}" "${NUM}" "${ORDER}"
|
||||||
|
|
||||||
|
|
||||||
# Assuming message sending was successful and returned a sequence number.
|
# Assuming message sending was successful and returned a sequence number.
|
||||||
local SEQ_NUMBER=1 # This should be the actual sequence number of the message sent.
|
local SEQ_NUMBER=1 # This should be the actual sequence number of the message sent.
|
||||||
|
|
||||||
@@ -1375,7 +1423,6 @@ openim::test::man() {
|
|||||||
openim::log::info "TODO: openim test man"
|
openim::log::info "TODO: openim test man"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#################################### Build Module ####################################
|
#################################### Build Module ####################################
|
||||||
|
|
||||||
# Function: openim::test::smoke
|
# Function: openim::test::smoke
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
readonly BUCKET="openim-1306374445"
|
readonly BUCKET="openim-1306374445"
|
||||||
readonly REGION="ap-guangzhou"
|
readonly REGION="ap-guangzhou"
|
||||||
readonly COS_RELEASE_DIR="openim-release"
|
readonly COS_RELEASE_DIR="openim-release"
|
||||||
|
# readonly COS_RELEASE_DIR="openim-advanced-release" # !pro
|
||||||
|
|
||||||
# default cos command tool coscli or coscmd
|
# default cos command tool coscli or coscmd
|
||||||
readonly COSTOOL="coscli"
|
readonly COSTOOL="coscli"
|
||||||
@@ -37,9 +38,11 @@ readonly RELEASE_IMAGES="${LOCAL_OUTPUT_ROOT}/release-images"
|
|||||||
# OpenIM github account info
|
# OpenIM github account info
|
||||||
readonly OPENIM_GITHUB_ORG=openimsdk
|
readonly OPENIM_GITHUB_ORG=openimsdk
|
||||||
readonly OPENIM_GITHUB_REPO=open-im-server
|
readonly OPENIM_GITHUB_REPO=open-im-server
|
||||||
readonly CHAT_GITHUB_REPO=chat
|
# readonly OPENIM_GITHUB_REPO=open-im-server-enterprise # !pro
|
||||||
|
|
||||||
readonly ARTIFACT=openim.tar.gz
|
readonly ARTIFACT=openim.tar.gz
|
||||||
|
# readonly ARTIFACT=openim-enterprise.tar.gz # !pro
|
||||||
|
|
||||||
readonly CHECKSUM=${ARTIFACT}.sha1sum
|
readonly CHECKSUM=${ARTIFACT}.sha1sum
|
||||||
|
|
||||||
OPENIM_BUILD_CONFORMANCE=${OPENIM_BUILD_CONFORMANCE:-y}
|
OPENIM_BUILD_CONFORMANCE=${OPENIM_BUILD_CONFORMANCE:-y}
|
||||||
|
|||||||
+4
-4
@@ -1086,7 +1086,7 @@ function openim::util::ensure-install-nginx {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for port in 80
|
for port in "80"
|
||||||
do
|
do
|
||||||
if echo |telnet 127.0.0.1 $port 2>&1|grep refused &>/dev/null;then
|
if echo |telnet 127.0.0.1 $port 2>&1|grep refused &>/dev/null;then
|
||||||
exit 1
|
exit 1
|
||||||
@@ -2320,7 +2320,7 @@ function openim::util::ensure-install-nginx {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for port in 80
|
for port in "80"
|
||||||
do
|
do
|
||||||
if echo |telnet 127.0.0.1 $port 2>&1|grep refused &>/dev/null;then
|
if echo |telnet 127.0.0.1 $port 2>&1|grep refused &>/dev/null;then
|
||||||
exit 1
|
exit 1
|
||||||
@@ -2467,7 +2467,7 @@ function openim::util::desc() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function openim::util:run::prompt() {
|
function openim::util:run::prompt() {
|
||||||
echo -n "$yellow\$ $reset"
|
echo -n "${yellow}\$ ${reset}"
|
||||||
}
|
}
|
||||||
|
|
||||||
started=""
|
started=""
|
||||||
@@ -2488,7 +2488,7 @@ function openim::util::run() {
|
|||||||
if [ -n "$DEMO_RUN_FAST" ]; then
|
if [ -n "$DEMO_RUN_FAST" ]; then
|
||||||
rate=1000
|
rate=1000
|
||||||
fi
|
fi
|
||||||
echo "$green$1$reset" | pv -qL $rate
|
echo "${green}$1${reset}" | pv -qL "$rate"
|
||||||
if [ -n "$DEMO_RUN_FAST" ]; then
|
if [ -n "$DEMO_RUN_FAST" ]; then
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ APIROOT=$(ROOT_DIR)/pkg/proto
|
|||||||
|
|
||||||
# Linux command settings
|
# Linux command settings
|
||||||
# TODO: Whether you need to join utils?
|
# TODO: Whether you need to join utils?
|
||||||
FIND := find . ! -path './utils/*' ! -path './vendor/*' ! -path './third_party/*'
|
FIND := find . ! -path './utils/*' ! -path './vendor/*' ! -path './third_party/*' ! -path './components/*' ! -path './logs/*'
|
||||||
XARGS := xargs -r --no-run-if-empty
|
XARGS := xargs -r --no-run-if-empty
|
||||||
|
|
||||||
# Linux command settings-CODE DIRS Copyright
|
# Linux command settings-CODE DIRS Copyright
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ go.imports: tools.verify.goimports
|
|||||||
|
|
||||||
## go.verify: execute all verity scripts.
|
## go.verify: execute all verity scripts.
|
||||||
.PHONY: go.verify
|
.PHONY: go.verify
|
||||||
go.verify:
|
go.verify: tools.verify.misspell
|
||||||
@echo "Starting verification..."
|
@echo "Starting verification..."
|
||||||
@scripts_list=$$(find $(ROOT_DIR)/scripts -type f -name 'verify-*' | sort); \
|
@scripts_list=$$(find $(ROOT_DIR)/scripts -type f -name 'verify-*' | sort); \
|
||||||
for script in $$scripts_list; do \
|
for script in $$scripts_list; do \
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ endif
|
|||||||
IMAGES_DIR ?= $(wildcard ${ROOT_DIR}/build/images/*)
|
IMAGES_DIR ?= $(wildcard ${ROOT_DIR}/build/images/*)
|
||||||
# Determine images names by stripping out the dir names, and filter out the undesired directories
|
# Determine images names by stripping out the dir names, and filter out the undesired directories
|
||||||
# IMAGES ?= $(filter-out Dockerfile,$(foreach image,${IMAGES_DIR},$(notdir ${image})))
|
# IMAGES ?= $(filter-out Dockerfile,$(foreach image,${IMAGES_DIR},$(notdir ${image})))
|
||||||
IMAGES ?= $(filter-out Dockerfile openim-tools openim-cmdutils,$(foreach image,${IMAGES_DIR},$(notdir ${image})))
|
IMAGES ?= $(filter-out Dockerfile openim-tools openim-rpc-extend-msg openim-rpc-encryption openim-cmdutils,$(foreach image,${IMAGES_DIR},$(notdir ${image})))
|
||||||
|
# IMAGES ?= $(filter-out Dockerfile openim-tools openim-cmdutils,$(foreach image,${IMAGES_DIR},$(notdir ${image}))) # !pro
|
||||||
|
|
||||||
ifeq (${IMAGES},)
|
ifeq (${IMAGES},)
|
||||||
$(error Could not determine IMAGES, set ROOT_DIR or run in source dir)
|
$(error Could not determine IMAGES, set ROOT_DIR or run in source dir)
|
||||||
|
|||||||
@@ -217,6 +217,11 @@ install.depth:
|
|||||||
install.go-callvis:
|
install.go-callvis:
|
||||||
@$(GO) install github.com/ofabry/go-callvis@latest
|
@$(GO) install github.com/ofabry/go-callvis@latest
|
||||||
|
|
||||||
|
## install.misspell
|
||||||
|
.PHONY: install.misspell
|
||||||
|
install.misspell:
|
||||||
|
@$(GO) install github.com/client9/misspell/cmd/misspell@latest
|
||||||
|
|
||||||
## install.gothanks: Install gothanks, used to thank go dependencies
|
## install.gothanks: Install gothanks, used to thank go dependencies
|
||||||
.PHONY: install.gothanks
|
.PHONY: install.gothanks
|
||||||
install.gothanks:
|
install.gothanks:
|
||||||
|
|||||||
+1
-1
@@ -130,7 +130,7 @@ perform_action() {
|
|||||||
|
|
||||||
if [ "$flag" == true ]; then
|
if [ "$flag" == true ]; then
|
||||||
openim::log::info "## $message..."
|
openim::log::info "## $message..."
|
||||||
if ! $command; then
|
if ! eval "$command"; then
|
||||||
openim::log::errexit "Error in $message"
|
openim::log::errexit "Error in $message"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -43,6 +43,54 @@ disabled=(
|
|||||||
1091
|
1091
|
||||||
# this lint prefers command -v to which, they are not the same
|
# this lint prefers command -v to which, they are not the same
|
||||||
2230
|
2230
|
||||||
|
# Error SC2155 indicates that you should separate variable declaration and assignment to avoid masking the return value of the command.
|
||||||
|
# In Bash scripts, when you declare and assign a local variable at the same time a command is executed, you only get the output of the command, but not the exit status (return value) of the command. #
|
||||||
|
2155
|
||||||
|
# ShellCheck issues SC2086 warnings when you refer to a variable in a script but don't put it in double quotes.This can lead to unexpected behavior when scripts encounter Spaces,
|
||||||
|
# newlines, and wildcards in file names or other data.
|
||||||
|
2086
|
||||||
|
2206
|
||||||
|
|
||||||
|
# TODO: 需要修复,然后开启
|
||||||
|
2034
|
||||||
|
2048
|
||||||
|
2148
|
||||||
|
2059
|
||||||
|
2214
|
||||||
|
2145
|
||||||
|
2128
|
||||||
|
2550
|
||||||
|
2046
|
||||||
|
2181
|
||||||
|
1102
|
||||||
|
2045
|
||||||
|
2068
|
||||||
|
2145
|
||||||
|
2207
|
||||||
|
2231
|
||||||
|
2013
|
||||||
|
2154
|
||||||
|
2120
|
||||||
|
1083
|
||||||
|
2001
|
||||||
|
2012
|
||||||
|
2016
|
||||||
|
2164
|
||||||
|
2223
|
||||||
|
2166
|
||||||
|
2119
|
||||||
|
2162
|
||||||
|
2295
|
||||||
|
2002
|
||||||
|
2004
|
||||||
|
2202
|
||||||
|
2178
|
||||||
|
2064
|
||||||
|
2260
|
||||||
|
2043
|
||||||
|
2178
|
||||||
|
2044
|
||||||
|
2153
|
||||||
)
|
)
|
||||||
# comma separate for passing to shellcheck
|
# comma separate for passing to shellcheck
|
||||||
join_by() {
|
join_by() {
|
||||||
@@ -70,9 +118,13 @@ done < <(find . -name "*.sh" \
|
|||||||
-not \( \
|
-not \( \
|
||||||
-path ./_\* -o \
|
-path ./_\* -o \
|
||||||
-path ./.git\* -o \
|
-path ./.git\* -o \
|
||||||
|
-path ./Godeps\* -o \
|
||||||
|
-path ./_output\* -o \
|
||||||
|
-path ./components\* -o \
|
||||||
|
-path ./logs\* -o \
|
||||||
-path ./vendor\* -o \
|
-path ./vendor\* -o \
|
||||||
\( -path ./third_party\* -a -not -path ./third_party/forked\* \) \
|
\( -path ./third_party\* -a -not -path ./third_party/forked\* \) \
|
||||||
\))
|
\) -print 2>/dev/null)
|
||||||
|
|
||||||
# detect if the host machine has the required shellcheck version installed
|
# detect if the host machine has the required shellcheck version installed
|
||||||
# if so, we will use that instead.
|
# if so, we will use that instead.
|
||||||
@@ -113,7 +165,7 @@ if ${HAVE_SHELLCHECK}; then
|
|||||||
else
|
else
|
||||||
openim::log::info "Using shellcheck ${SHELLCHECK_VERSION} docker image."
|
openim::log::info "Using shellcheck ${SHELLCHECK_VERSION} docker image."
|
||||||
"${DOCKER}" run \
|
"${DOCKER}" run \
|
||||||
--rm -v "${OPENIM_ROOT}:"${OPENIM_ROOT}"" -w "${OPENIM_ROOT}" \
|
--rm -v "${OPENIM_ROOT}:${OPENIM_ROOT}" -w "${OPENIM_ROOT}" \
|
||||||
"${SHELLCHECK_IMAGE}" \
|
"${SHELLCHECK_IMAGE}" \
|
||||||
shellcheck "${SHELLCHECK_OPTIONS[@]}" "${all_shell_scripts[@]}" >&2 || res=$?
|
shellcheck "${SHELLCHECK_OPTIONS[@]}" "${all_shell_scripts[@]}" >&2 || res=$?
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -25,17 +25,8 @@ OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
|||||||
export OPENIM_ROOT
|
export OPENIM_ROOT
|
||||||
source "${OPENIM_ROOT}/scripts/lib/init.sh"
|
source "${OPENIM_ROOT}/scripts/lib/init.sh"
|
||||||
|
|
||||||
# Ensure that we find the binaries we build before anything else.
|
|
||||||
export GOBIN="${KUBE_OUTPUT_BINPATH}"
|
|
||||||
PATH="${GOBIN}:${PATH}"
|
|
||||||
|
|
||||||
# Install tools we need
|
|
||||||
pushd "${OPENIM_ROOT}/tools" >/dev/null
|
|
||||||
GO111MODULE=on go install github.com/client9/misspell/cmd/misspell
|
|
||||||
popd >/dev/null
|
|
||||||
|
|
||||||
# Spell checking
|
# Spell checking
|
||||||
# All the skipping files are defined in scripts/.spelling_failures
|
# All the skipping files are defined in scripts/.spelling_failures
|
||||||
skipping_file="${OPENIM_ROOT}/scripts/.spelling_failures"
|
skipping_file="${OPENIM_ROOT}/scripts/.spelling_failures"
|
||||||
failing_packages=$(sed "s| | -e |g" "${skipping_file}")
|
failing_packages=$(sed "s| | -e |g" "${skipping_file}")
|
||||||
git ls-files | grep -v -e "${failing_packages}" | xargs misspell -i "Creater,creater,ect" -error -o stderr
|
git ls-files | grep -v -e "${failing_packages}" | xargs "$OPENIM_ROOT/_output/tools/misspell" -i "Creater,creater,ect" -error -o stderr
|
||||||
|
|||||||
@@ -47,27 +47,23 @@ var (
|
|||||||
crossPlatforms = []string{
|
crossPlatforms = []string{
|
||||||
"linux/amd64", "windows/386",
|
"linux/amd64", "windows/386",
|
||||||
"darwin/amd64", "darwin/arm64",
|
"darwin/amd64", "darwin/arm64",
|
||||||
"linux/386",
|
"linux/arm", "linux/386",
|
||||||
"windows/amd64", "linux/arm64",
|
"windows/amd64", "linux/arm64",
|
||||||
"linux/ppc64le", "linux/s390x",
|
"linux/ppc64le", "linux/s390x",
|
||||||
"windows/arm64",
|
"windows/arm64",
|
||||||
}
|
}
|
||||||
|
|
||||||
// "linux/arm",
|
|
||||||
|
|
||||||
// directories we always ignore
|
// directories we always ignore
|
||||||
standardIgnoreDirs = []string{
|
standardIgnoreDirs = []string{
|
||||||
// Staging code is symlinked from vendor/k8s.io, and uses import
|
// Staging code is symlinked from vendor/k8s.io, and uses import
|
||||||
// paths as if it were inside of vendor/. It fails typechecking
|
// paths as if it were inside of vendor/. It fails typechecking
|
||||||
// inside of staging/, but works when typechecked as part of vendor/.
|
// inside of staging/, but works when typechecked as part of vendor/.
|
||||||
"staging",
|
"staging",
|
||||||
"components",
|
|
||||||
// OS-specific vendor code tends to be imported by OS-specific
|
// OS-specific vendor code tends to be imported by OS-specific
|
||||||
// packages. We recursively typecheck imported vendored packages for
|
// packages. We recursively typecheck imported vendored packages for
|
||||||
// each OS, but don't typecheck everything for every OS.
|
// each OS, but don't typecheck everything for every OS.
|
||||||
"vendor",
|
"vendor",
|
||||||
"_output",
|
"_output",
|
||||||
"OpenIMSKD/tools",
|
|
||||||
// This is a weird one. /testdata/ is *mostly* ignored by Go,
|
// This is a weird one. /testdata/ is *mostly* ignored by Go,
|
||||||
// and this translates to kubernetes/vendor not working.
|
// and this translates to kubernetes/vendor not working.
|
||||||
// edit/record.go doesn't compile without gopkg.in/yaml.v2
|
// edit/record.go doesn't compile without gopkg.in/yaml.v2
|
||||||
@@ -75,7 +71,7 @@ var (
|
|||||||
"pkg/kubectl/cmd/testdata/edit",
|
"pkg/kubectl/cmd/testdata/edit",
|
||||||
// Tools we use for maintaining the code base but not necessarily
|
// Tools we use for maintaining the code base but not necessarily
|
||||||
// ship as part of the release
|
// ship as part of the release
|
||||||
"sopenim::golang::setup_env:tools/yamlfmt/yamlfmt.go:tools",
|
"hack/tools",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -45,7 +45,7 @@ openim::wrk::setup() {
|
|||||||
cmd="wrk -t${threads} -d${duration} -T30s --latency"
|
cmd="wrk -t${threads} -d${duration} -T30s --latency"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Print usage
|
# Print usage infomation
|
||||||
openim::wrk::usage() {
|
openim::wrk::usage() {
|
||||||
cat << EOF
|
cat << EOF
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ var (
|
|||||||
{"template", "template"},
|
{"template", "template"},
|
||||||
{"etcd", "server"},
|
{"etcd", "server"},
|
||||||
{"pod", "node"},
|
{"pod", "node"},
|
||||||
{"scripts/", "hack"},
|
{"hack/", "hack"},
|
||||||
{"e2e", "test"},
|
{"e2e", "test"},
|
||||||
{"integration", "test"},
|
{"integration", "test"},
|
||||||
{"cluster", "cluster"},
|
{"cluster", "cluster"},
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ func main() {
|
|||||||
usernameV3 = "root" // v3版本mysql用户名
|
usernameV3 = "root" // v3版本mysql用户名
|
||||||
passwordV3 = "openIM123" // v3版本mysql密码
|
passwordV3 = "openIM123" // v3版本mysql密码
|
||||||
addrV3 = "127.0.0.1:13306" // v3版本mysql地址
|
addrV3 = "127.0.0.1:13306" // v3版本mysql地址
|
||||||
databaseV3 = "openim_v3" // v3版本mysql数据库名字
|
databaseV3 = "openIM_v3" // v3版本mysql数据库名字
|
||||||
)
|
)
|
||||||
|
|
||||||
var concurrency = 1 // 并发数量
|
var concurrency = 1 // 并发数量
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ const (
|
|||||||
UsernameV3 = "root"
|
UsernameV3 = "root"
|
||||||
PasswordV3 = "openIM123"
|
PasswordV3 = "openIM123"
|
||||||
IpV3 = "43.134.63.160:13306"
|
IpV3 = "43.134.63.160:13306"
|
||||||
DatabaseV3 = "openim_v3"
|
DatabaseV3 = "openIM_v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
// V3 chat.
|
// V3 chat.
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ func Cmd() {
|
|||||||
usernameV3 = "root"
|
usernameV3 = "root"
|
||||||
passwordV3 = "openIM123"
|
passwordV3 = "openIM123"
|
||||||
addrV3 = "203.56.175.233:13306"
|
addrV3 = "203.56.175.233:13306"
|
||||||
databaseV3 = "openim_v3"
|
databaseV3 = "openIM_v3"
|
||||||
)
|
)
|
||||||
log.SetFlags(log.LstdFlags | log.Llongfile)
|
log.SetFlags(log.LstdFlags | log.Llongfile)
|
||||||
dsnV2 := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8mb4&parseTime=True&loc=Local", usernameV2, passwordV2, addrV2, databaseV2)
|
dsnV2 := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8mb4&parseTime=True&loc=Local", usernameV2, passwordV2, addrV2, databaseV2)
|
||||||
|
|||||||
@@ -1,97 +0,0 @@
|
|||||||
package checker
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"regexp"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/openimsdk/open-im-server/tools/formitychecker/config"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
underscoreRegex = regexp.MustCompile(`^[a-zA-Z0-9_]+\.[a-zA-Z0-9]+$`)
|
|
||||||
hyphenRegex = regexp.MustCompile(`^[a-zA-Z0-9\-]+\.[a-zA-Z0-9]+$`)
|
|
||||||
)
|
|
||||||
|
|
||||||
// CheckDirectoCheckDirectoryries initiates the checking process for the specified directories using configuration from config.Config.
|
|
||||||
func CheckDirectory(cfg *config.Config) error {
|
|
||||||
ignoreMap := make(map[string]struct{})
|
|
||||||
for _, dir := range cfg.IgnoreDirs {
|
|
||||||
ignoreMap[dir] = struct{}{}
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, targetDir := range cfg.TargetDirs {
|
|
||||||
err := filepath.Walk(targetDir, func(path string, info os.FileInfo, err error) error {
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skip if the directory is in the ignore list
|
|
||||||
dirName := filepath.Base(filepath.Dir(path))
|
|
||||||
if _, ok := ignoreMap[dirName]; ok && info.IsDir() {
|
|
||||||
return filepath.SkipDir
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check the naming convention
|
|
||||||
if err := checkNamingConvention(path, info); err != nil {
|
|
||||||
fmt.Println(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("error checking directory '%s': %w", targetDir, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// checkNamingConvention checks if the file or directory name conforms to the standard naming conventions.
|
|
||||||
func checkNamingConvention(path string, info os.FileInfo) error {
|
|
||||||
fileName := info.Name()
|
|
||||||
|
|
||||||
// Handle special cases for directories like .git
|
|
||||||
if info.IsDir() && strings.HasPrefix(fileName, ".") {
|
|
||||||
return nil // Skip special directories
|
|
||||||
}
|
|
||||||
|
|
||||||
// Extract the main part of the name (without extension for files)
|
|
||||||
mainName := fileName
|
|
||||||
if !info.IsDir() {
|
|
||||||
mainName = strings.TrimSuffix(fileName, filepath.Ext(fileName))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine the type of file and apply corresponding naming rule
|
|
||||||
switch {
|
|
||||||
case info.IsDir():
|
|
||||||
if !isValidName(mainName, "_") { // Directory names must only contain underscores
|
|
||||||
return fmt.Errorf("!!! invalid directory name: %s", path)
|
|
||||||
}
|
|
||||||
case strings.HasSuffix(fileName, ".go"):
|
|
||||||
if !isValidName(mainName, "_") { // Go files must only contain underscores
|
|
||||||
return fmt.Errorf("!!! invalid Go file name: %s", path)
|
|
||||||
}
|
|
||||||
case strings.HasSuffix(fileName, ".yml"), strings.HasSuffix(fileName, ".yaml"), strings.HasSuffix(fileName, ".md"):
|
|
||||||
if !isValidName(mainName, "-") { // YML, YAML, and Markdown files must only contain hyphens
|
|
||||||
return fmt.Errorf("!!! invalid file name: %s", path)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// isValidName checks if the file name conforms to the specified rule (underscore or hyphen).
|
|
||||||
func isValidName(name, charType string) bool {
|
|
||||||
switch charType {
|
|
||||||
case "_":
|
|
||||||
return underscoreRegex.MatchString(name)
|
|
||||||
case "-":
|
|
||||||
return hyphenRegex.MatchString(name)
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package config
|
|
||||||
|
|
||||||
import (
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Config holds all the configuration parameters for the checker.
|
|
||||||
type Config struct {
|
|
||||||
TargetDirs []string // Directories to check
|
|
||||||
IgnoreDirs []string // Directories to ignore
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewConfig creates and returns a new Config instance.
|
|
||||||
func NewConfig(targetDirs, ignoreDirs string) *Config {
|
|
||||||
return &Config{
|
|
||||||
TargetDirs: parseDirs(targetDirs),
|
|
||||||
IgnoreDirs: parseDirs(ignoreDirs),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// parseDirs splits a comma-separated string into a slice of directory names.
|
|
||||||
func parseDirs(dirs string) []string {
|
|
||||||
if dirs == "" {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return strings.Split(dirs, ",")
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"flag"
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/openimsdk/open-im-server/tools/formitychecker/checker"
|
|
||||||
"github.com/openimsdk/open-im-server/tools/formitychecker/config"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
defaultTargetDirs := "."
|
|
||||||
defaultIgnoreDirs := "components,.git"
|
|
||||||
|
|
||||||
var targetDirs string
|
|
||||||
var ignoreDirs string
|
|
||||||
flag.StringVar(&targetDirs, "target", defaultTargetDirs, "Directories to check (default: current directory)")
|
|
||||||
flag.StringVar(&ignoreDirs, "ignore", defaultIgnoreDirs, "Directories to ignore (default: A/, B/)")
|
|
||||||
flag.Parse()
|
|
||||||
|
|
||||||
conf := config.NewConfig(targetDirs, ignoreDirs)
|
|
||||||
|
|
||||||
err := checker.CheckDirectory(conf)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("Error:", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
module github.com/openimsdk/open-im-server/tools/formitychecker
|
|
||||||
|
|
||||||
go 1.19
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import "fmt"
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
|
|
||||||
fmt.Println("imctl")
|
|
||||||
}
|
|
||||||
+35
-35
@@ -17,16 +17,16 @@ package pkg
|
|||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
mongomodel "github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation"
|
mongoModel "github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation"
|
||||||
mysqlmodel "github.com/openimsdk/open-im-server/v3/tools/data-conversion/openim/mysql/v3"
|
mysqlModel "github.com/openimsdk/open-im-server/v3/tools/data-conversion/openim/mysql/v3"
|
||||||
mongomodelrtc "github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mongo/table"
|
mongoModelRtc "github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mongo/table"
|
||||||
mysqlmodelrtc "github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mysql"
|
mysqlModelRtc "github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mysql"
|
||||||
)
|
)
|
||||||
|
|
||||||
type convert struct{}
|
type convert struct{}
|
||||||
|
|
||||||
func (convert) User(v mysqlmodel.UserModel) mongomodel.UserModel {
|
func (convert) User(v mysqlModel.UserModel) mongoModel.UserModel {
|
||||||
return mongomodel.UserModel{
|
return mongoModel.UserModel{
|
||||||
UserID: v.UserID,
|
UserID: v.UserID,
|
||||||
Nickname: v.Nickname,
|
Nickname: v.Nickname,
|
||||||
FaceURL: v.FaceURL,
|
FaceURL: v.FaceURL,
|
||||||
@@ -37,8 +37,8 @@ func (convert) User(v mysqlmodel.UserModel) mongomodel.UserModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (convert) Friend(v mysqlmodel.FriendModel) mongomodel.FriendModel {
|
func (convert) Friend(v mysqlModel.FriendModel) mongoModel.FriendModel {
|
||||||
return mongomodel.FriendModel{
|
return mongoModel.FriendModel{
|
||||||
OwnerUserID: v.OwnerUserID,
|
OwnerUserID: v.OwnerUserID,
|
||||||
FriendUserID: v.FriendUserID,
|
FriendUserID: v.FriendUserID,
|
||||||
Remark: v.Remark,
|
Remark: v.Remark,
|
||||||
@@ -49,8 +49,8 @@ func (convert) Friend(v mysqlmodel.FriendModel) mongomodel.FriendModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (convert) FriendRequest(v mysqlmodel.FriendRequestModel) mongomodel.FriendRequestModel {
|
func (convert) FriendRequest(v mysqlModel.FriendRequestModel) mongoModel.FriendRequestModel {
|
||||||
return mongomodel.FriendRequestModel{
|
return mongoModel.FriendRequestModel{
|
||||||
FromUserID: v.FromUserID,
|
FromUserID: v.FromUserID,
|
||||||
ToUserID: v.ToUserID,
|
ToUserID: v.ToUserID,
|
||||||
HandleResult: v.HandleResult,
|
HandleResult: v.HandleResult,
|
||||||
@@ -63,8 +63,8 @@ func (convert) FriendRequest(v mysqlmodel.FriendRequestModel) mongomodel.FriendR
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (convert) Black(v mysqlmodel.BlackModel) mongomodel.BlackModel {
|
func (convert) Black(v mysqlModel.BlackModel) mongoModel.BlackModel {
|
||||||
return mongomodel.BlackModel{
|
return mongoModel.BlackModel{
|
||||||
OwnerUserID: v.OwnerUserID,
|
OwnerUserID: v.OwnerUserID,
|
||||||
BlockUserID: v.BlockUserID,
|
BlockUserID: v.BlockUserID,
|
||||||
CreateTime: v.CreateTime,
|
CreateTime: v.CreateTime,
|
||||||
@@ -74,8 +74,8 @@ func (convert) Black(v mysqlmodel.BlackModel) mongomodel.BlackModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (convert) Group(v mysqlmodel.GroupModel) mongomodel.GroupModel {
|
func (convert) Group(v mysqlModel.GroupModel) mongoModel.GroupModel {
|
||||||
return mongomodel.GroupModel{
|
return mongoModel.GroupModel{
|
||||||
GroupID: v.GroupID,
|
GroupID: v.GroupID,
|
||||||
GroupName: v.GroupName,
|
GroupName: v.GroupName,
|
||||||
Notification: v.Notification,
|
Notification: v.Notification,
|
||||||
@@ -94,8 +94,8 @@ func (convert) Group(v mysqlmodel.GroupModel) mongomodel.GroupModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (convert) GroupMember(v mysqlmodel.GroupMemberModel) mongomodel.GroupMemberModel {
|
func (convert) GroupMember(v mysqlModel.GroupMemberModel) mongoModel.GroupMemberModel {
|
||||||
return mongomodel.GroupMemberModel{
|
return mongoModel.GroupMemberModel{
|
||||||
GroupID: v.GroupID,
|
GroupID: v.GroupID,
|
||||||
UserID: v.UserID,
|
UserID: v.UserID,
|
||||||
Nickname: v.Nickname,
|
Nickname: v.Nickname,
|
||||||
@@ -110,8 +110,8 @@ func (convert) GroupMember(v mysqlmodel.GroupMemberModel) mongomodel.GroupMember
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (convert) GroupRequest(v mysqlmodel.GroupRequestModel) mongomodel.GroupRequestModel {
|
func (convert) GroupRequest(v mysqlModel.GroupRequestModel) mongoModel.GroupRequestModel {
|
||||||
return mongomodel.GroupRequestModel{
|
return mongoModel.GroupRequestModel{
|
||||||
UserID: v.UserID,
|
UserID: v.UserID,
|
||||||
GroupID: v.GroupID,
|
GroupID: v.GroupID,
|
||||||
HandleResult: v.HandleResult,
|
HandleResult: v.HandleResult,
|
||||||
@@ -126,8 +126,8 @@ func (convert) GroupRequest(v mysqlmodel.GroupRequestModel) mongomodel.GroupRequ
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (convert) Conversation(v mysqlmodel.ConversationModel) mongomodel.ConversationModel {
|
func (convert) Conversation(v mysqlModel.ConversationModel) mongoModel.ConversationModel {
|
||||||
return mongomodel.ConversationModel{
|
return mongoModel.ConversationModel{
|
||||||
OwnerUserID: v.OwnerUserID,
|
OwnerUserID: v.OwnerUserID,
|
||||||
ConversationID: v.ConversationID,
|
ConversationID: v.ConversationID,
|
||||||
ConversationType: v.ConversationType,
|
ConversationType: v.ConversationType,
|
||||||
@@ -149,9 +149,9 @@ func (convert) Conversation(v mysqlmodel.ConversationModel) mongomodel.Conversat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (convert) Object(engine string) func(v mysqlmodel.ObjectModel) mongomodel.ObjectModel {
|
func (convert) Object(engine string) func(v mysqlModel.ObjectModel) mongoModel.ObjectModel {
|
||||||
return func(v mysqlmodel.ObjectModel) mongomodel.ObjectModel {
|
return func(v mysqlModel.ObjectModel) mongoModel.ObjectModel {
|
||||||
return mongomodel.ObjectModel{
|
return mongoModel.ObjectModel{
|
||||||
Name: v.Name,
|
Name: v.Name,
|
||||||
UserID: v.UserID,
|
UserID: v.UserID,
|
||||||
Hash: v.Hash,
|
Hash: v.Hash,
|
||||||
@@ -165,8 +165,8 @@ func (convert) Object(engine string) func(v mysqlmodel.ObjectModel) mongomodel.O
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (convert) Log(v mysqlmodel.Log) mongomodel.LogModel {
|
func (convert) Log(v mysqlModel.Log) mongoModel.LogModel {
|
||||||
return mongomodel.LogModel{
|
return mongoModel.LogModel{
|
||||||
LogID: v.LogID,
|
LogID: v.LogID,
|
||||||
Platform: v.Platform,
|
Platform: v.Platform,
|
||||||
UserID: v.UserID,
|
UserID: v.UserID,
|
||||||
@@ -179,8 +179,8 @@ func (convert) Log(v mysqlmodel.Log) mongomodel.LogModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (convert) SignalModel(v mysqlmodelrtc.SignalModel) mongomodelrtc.SignalModel {
|
func (convert) SignalModel(v mysqlModelRtc.SignalModel) mongoModelRtc.SignalModel {
|
||||||
return mongomodelrtc.SignalModel{
|
return mongoModelRtc.SignalModel{
|
||||||
SID: v.SID,
|
SID: v.SID,
|
||||||
InviterUserID: v.InviterUserID,
|
InviterUserID: v.InviterUserID,
|
||||||
CustomData: v.CustomData,
|
CustomData: v.CustomData,
|
||||||
@@ -202,8 +202,8 @@ func (convert) SignalModel(v mysqlmodelrtc.SignalModel) mongomodelrtc.SignalMode
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (convert) SignalInvitationModel(v mysqlmodelrtc.SignalInvitationModel) mongomodelrtc.SignalInvitationModel {
|
func (convert) SignalInvitationModel(v mysqlModelRtc.SignalInvitationModel) mongoModelRtc.SignalInvitationModel {
|
||||||
return mongomodelrtc.SignalInvitationModel{
|
return mongoModelRtc.SignalInvitationModel{
|
||||||
SID: v.SID,
|
SID: v.SID,
|
||||||
UserID: v.UserID,
|
UserID: v.UserID,
|
||||||
Status: v.Status,
|
Status: v.Status,
|
||||||
@@ -212,8 +212,8 @@ func (convert) SignalInvitationModel(v mysqlmodelrtc.SignalInvitationModel) mong
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (convert) Meeting(v mysqlmodelrtc.MeetingInfo) mongomodelrtc.MeetingInfo {
|
func (convert) Meeting(v mysqlModelRtc.MeetingInfo) mongoModelRtc.MeetingInfo {
|
||||||
return mongomodelrtc.MeetingInfo{
|
return mongoModelRtc.MeetingInfo{
|
||||||
RoomID: v.RoomID,
|
RoomID: v.RoomID,
|
||||||
MeetingName: v.MeetingName,
|
MeetingName: v.MeetingName,
|
||||||
HostUserID: v.HostUserID,
|
HostUserID: v.HostUserID,
|
||||||
@@ -225,16 +225,16 @@ func (convert) Meeting(v mysqlmodelrtc.MeetingInfo) mongomodelrtc.MeetingInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (convert) MeetingInvitationInfo(v mysqlmodelrtc.MeetingInvitationInfo) mongomodelrtc.MeetingInvitationInfo {
|
func (convert) MeetingInvitationInfo(v mysqlModelRtc.MeetingInvitationInfo) mongoModelRtc.MeetingInvitationInfo {
|
||||||
return mongomodelrtc.MeetingInvitationInfo{
|
return mongoModelRtc.MeetingInvitationInfo{
|
||||||
RoomID: v.RoomID,
|
RoomID: v.RoomID,
|
||||||
UserID: v.UserID,
|
UserID: v.UserID,
|
||||||
CreateTime: v.CreateTime,
|
CreateTime: v.CreateTime,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (convert) MeetingVideoRecord(v mysqlmodelrtc.MeetingVideoRecord) mongomodelrtc.MeetingVideoRecord {
|
func (convert) MeetingVideoRecord(v mysqlModelRtc.MeetingVideoRecord) mongoModelRtc.MeetingVideoRecord {
|
||||||
return mongomodelrtc.MeetingVideoRecord{
|
return mongoModelRtc.MeetingVideoRecord{
|
||||||
RoomID: v.RoomID,
|
RoomID: v.RoomID,
|
||||||
FileURL: v.FileURL,
|
FileURL: v.FileURL,
|
||||||
CreateTime: v.CreateTime,
|
CreateTime: v.CreateTime,
|
||||||
|
|||||||
@@ -29,14 +29,14 @@ import (
|
|||||||
"go.mongodb.org/mongo-driver/bson"
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
"go.mongodb.org/mongo-driver/mongo/options"
|
"go.mongodb.org/mongo-driver/mongo/options"
|
||||||
gormmysql "gorm.io/driver/mysql"
|
gormMysql "gorm.io/driver/mysql"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"gorm.io/gorm/logger"
|
"gorm.io/gorm/logger"
|
||||||
|
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/common/db/mgo"
|
"github.com/openimsdk/open-im-server/v3/pkg/common/db/mgo"
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/common/db/unrelation"
|
"github.com/openimsdk/open-im-server/v3/pkg/common/db/unrelation"
|
||||||
rtcmgo "github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mongo/mgo"
|
rtcMgo "github.com/openimsdk/open-im-server/v3/tools/up35/pkg/internal/rtc/mongo/mgo"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -56,7 +56,7 @@ func InitConfig(path string) error {
|
|||||||
func GetMysql() (*gorm.DB, error) {
|
func GetMysql() (*gorm.DB, error) {
|
||||||
conf := config.Config.Mysql
|
conf := config.Config.Mysql
|
||||||
mysqlDSN := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8mb4&parseTime=True&loc=Local", conf.Username, conf.Password, conf.Address[0], conf.Database)
|
mysqlDSN := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8mb4&parseTime=True&loc=Local", conf.Username, conf.Password, conf.Address[0], conf.Database)
|
||||||
return gorm.Open(gormmysql.Open(mysqlDSN), &gorm.Config{Logger: logger.Discard})
|
return gorm.Open(gormMysql.Open(mysqlDSN), &gorm.Config{Logger: logger.Discard})
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetMongo() (*mongo.Database, error) {
|
func GetMongo() (*mongo.Database, error) {
|
||||||
@@ -116,11 +116,11 @@ func Main(path string) error {
|
|||||||
func() error { return NewTask(mysqlDB, mongoDB, mgo.NewS3Mongo, c.Object(config.Config.Object.Enable)) },
|
func() error { return NewTask(mysqlDB, mongoDB, mgo.NewS3Mongo, c.Object(config.Config.Object.Enable)) },
|
||||||
func() error { return NewTask(mysqlDB, mongoDB, mgo.NewLogMongo, c.Log) },
|
func() error { return NewTask(mysqlDB, mongoDB, mgo.NewLogMongo, c.Log) },
|
||||||
|
|
||||||
func() error { return NewTask(mysqlDB, mongoDB, rtcmgo.NewSignal, c.SignalModel) },
|
func() error { return NewTask(mysqlDB, mongoDB, rtcMgo.NewSignal, c.SignalModel) },
|
||||||
func() error { return NewTask(mysqlDB, mongoDB, rtcmgo.NewSignalInvitation, c.SignalInvitationModel) },
|
func() error { return NewTask(mysqlDB, mongoDB, rtcMgo.NewSignalInvitation, c.SignalInvitationModel) },
|
||||||
func() error { return NewTask(mysqlDB, mongoDB, rtcmgo.NewMeeting, c.Meeting) },
|
func() error { return NewTask(mysqlDB, mongoDB, rtcMgo.NewMeeting, c.Meeting) },
|
||||||
func() error { return NewTask(mysqlDB, mongoDB, rtcmgo.NewMeetingInvitation, c.MeetingInvitationInfo) },
|
func() error { return NewTask(mysqlDB, mongoDB, rtcMgo.NewMeetingInvitation, c.MeetingInvitationInfo) },
|
||||||
func() error { return NewTask(mysqlDB, mongoDB, rtcmgo.NewMeetingRecord, c.MeetingVideoRecord) },
|
func() error { return NewTask(mysqlDB, mongoDB, rtcMgo.NewMeetingRecord, c.MeetingVideoRecord) },
|
||||||
)
|
)
|
||||||
|
|
||||||
for _, task := range tasks {
|
for _, task := range tasks {
|
||||||
|
|||||||
Reference in New Issue
Block a user