diff --git a/.github/.codecov.yml b/.github/.codecov.yml index 9e262e0e3..25b77e528 100644 --- a/.github/.codecov.yml +++ b/.github/.codecov.yml @@ -11,7 +11,6 @@ # 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. - coverage: status: project: diff --git a/.github/code-language-detector.yml b/.github/code-language-detector.yml deleted file mode 100644 index 6e5386249..000000000 --- a/.github/code-language-detector.yml +++ /dev/null @@ -1,7 +0,0 @@ -directory: ./ -file_types: - - .go - - .yaml - - .yml -languages: - - Chinese diff --git a/.github/labels.yml b/.github/labels.yml deleted file mode 100644 index b85a824b4..000000000 --- a/.github/labels.yml +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright © 2023 OpenIM. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Refer to Kubernetes for size/* Settings -# https://github.com/Kubernetes/Kubernetes -XS: - name: size/XS - lines: 0 - color: 3CBF00 -S: - name: size/S - lines: 10 - color: 5D9801 -M: - name: size/M - lines: 30 - color: 7F7203 -L: - name: size/L - lines: 100 - color: A14C05 -XL: - name: size/XL - lines: 500 - color: C32607 -XXL: - name: size/XXL - lines: 1000 - color: E50009 - comment: | - # Whoa! Easy there, Partner! - This PR is too big. Please break it up into smaller PRs. \ No newline at end of file diff --git a/.github/sync-release.yml b/.github/sync-release.yml index b8c27976d..1472ba58b 100644 --- a/.github/sync-release.yml +++ b/.github/sync-release.yml @@ -1,19 +1,3 @@ -# 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. - -# https://github.com/BetaHuhn/repo-file-sync-action -# Synchronization for the.github repository openim-sigs/openim-docker: - source: ./config dest: ./openim-chat/release/config diff --git a/.github/weekly-digest.yml b/.github/weekly-digest.yml deleted file mode 100644 index fb3614ad8..000000000 --- a/.github/weekly-digest.yml +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright © 2023 OpenIM. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# https://github.com/apps/weekly-digest/installations/new -publishDay: sun -canPublishIssues: true -canPublishPullRequests: true -canPublishContributors: true -canPublishStargazers: true -canPublishCommits: true \ No newline at end of file diff --git a/.github/workflows/auto-assign-issue.yml b/.github/workflows/auto-assign-issue.yml index d87a571dc..320174d8c 100644 --- a/.github/workflows/auto-assign-issue.yml +++ b/.github/workflows/auto-assign-issue.yml @@ -1,17 +1,3 @@ -# Copyright © 2023 OpenIM open source community. 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. - name: Assign issue to comment author on: issue_comment: @@ -20,24 +6,24 @@ jobs: assign-issue: if: | contains(github.event.comment.body, '/assign') || contains(github.event.comment.body, '/accept') && - !contains(github.event.comment.user.login, 'openimbot') && - !contains(github.event.comment.user.login, 'kubbot') + !contains(github.event.comment.user.login, 'openim-robot') runs-on: ubuntu-latest permissions: issues: write steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Assign the issue run: | export LETASE_MILESTONES=$(curl 'https://api.github.com/repos/$OWNER/$PEPO/milestones' | jq -r 'last(.[]).title') gh issue edit ${{ github.event.issue.number }} --add-assignee "${{ github.event.comment.user.login }}" - gh issue edit ${{ github.event.issue.number }} --add-label "triage/accepted" - gh issue edit ${{ github.event.issue.number }} --milestone "$LETASE_MILESTONES" + gh issue edit ${{ github.event.issue.number }} --add-label "accepted" gh issue comment $ISSUE --body "@${{ github.event.comment.user.login }} Glad to see you accepted this issue🤲, this issue has been assigned to you. I set the milestones for this issue to [$LETASE_MILESTONES](https://github.com/$OWNER/$PEPO/milestones), We are looking forward to your PR!" + + # gh issue edit ${{ github.event.issue.number }} --milestone "$LETASE_MILESTONES" env: - GH_TOKEN: ${{ secrets.REDBOT_GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.BOT_TOKEN }} ISSUE: ${{ github.event.issue.html_url }} OWNER: ${{ github.repository_owner }} - REPO: ${{ github.event.repository.name }} \ No newline at end of file + REPO: ${{ github.event.repository.name }} diff --git a/.github/workflows/auto-gh-pr.yml b/.github/workflows/auto-gh-pr.yml deleted file mode 100644 index 0913655ca..000000000 --- a/.github/workflows/auto-gh-pr.yml +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright © 2023 OpenIM open source community. 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. - -name: Auto PR to release - -on: - pull_request: - # types: - # - closed - issue_comment: - types: [created] - pull_request_review_comment: - types: [created] - -jobs: - create-pr: - runs-on: ubuntu-latest - if: github.event.pull_request.base.ref == 'main' && github.event.pull_request.merged == true - steps: - - name: Check out code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Create PR to release branch - run: | - ISSUEID=$(gh pr view ${{ github.event.pull_request.number }} --repo $OWNER/$REPO | grep -oP 'Fixes #\K\d+') - echo "===========> $ISSUEID" - ISSUE=$(gh issue view $ISSUEID --repo $OWNER/$REPO --json labels,assignees,milestone,title) - echo "===========> $ISSUE" - - LABELS=$(echo $ISSUE | jq -r '.labels[] | select(.name) | .name' | jq -R -r -s -c 'split("\n")[:-1] | join(",")') - ASSIGNEES=$(echo $ISSUE | jq -r '.assignees[] | select(.login) | .login' | jq -R -s -c 'split("\n")[:-1] | join(",")') - MILESTONE=$(echo $ISSUE | jq -r '.milestone | select(.title) | .title') - TITLE=$(echo $ISSUE | jq -r '.title') - - gh pr edit ${{ github.event.pull_request.number }} --repo $OWNER/$REPO --add-label "$LABELS" --add-assignee "$ASSIGNEES" --milestone "$MILESTONE" - - # git checkout -b bot/merge-to-release-$ISSUEID - # git push origin bot/merge-to-release-$ISSUEID - # gh pr create --base release --head bot/merge-to-release-$ISSUEID --title "Merge main to release" --body "" - # gh pr create --base main --head feat/auto-release-pr-624 --title "The bug is fixed" --body "$x" --repo OpenIMSDK/Open-IM-Server --reviewer "cubxxw" - continue-on-error: true - env: - GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} - GH_TOKEN: ${{ github.token }} - ISSUE: ${{ github.event.issue.html_url }} - OWNER: ${{ github.repository_owner }} - REPO: ${{ github.event.repository.name }} diff --git a/.github/workflows/auto-invite-comment.yml b/.github/workflows/auto-invite-comment.yml new file mode 100644 index 000000000..76fbcdfd3 --- /dev/null +++ b/.github/workflows/auto-invite-comment.yml @@ -0,0 +1,39 @@ +name: Invite users to join OpenIM Community. +on: + issue_comment: + types: + - created +jobs: + issue_comment: + name: Invite users to join OpenIM Community + if: ${{ github.event.comment.body == '/invite' || github.event.comment.body == '/close' || github.event.comment.body == '/comment' }} + runs-on: ubuntu-latest + permissions: + issues: write + steps: + + - name: Invite user to join OpenIM Community + uses: peter-evans/create-or-update-comment@v4 + with: + token: ${{ secrets.BOT_GITHUB_TOKEN }} + issue-number: ${{ github.event.issue.number }} + body: | + We value close connections with our users, developers, and contributors here at Open-IM-Server. With a large community and maintainer team, we're always here to help and support you. Whether you're looking to join our community or have any questions or suggestions, we welcome you to get in touch with us. + + Our most recommended way to get in touch is through [Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q). Even if you're in China, Slack is usually not blocked by firewalls, making it an easy way to connect with us. Our Slack community is the ideal place to discuss and share ideas and suggestions with other users and developers of Open-IM-Server. You can ask technical questions, seek help, or share your experiences with other users of Open-IM-Server. + + In addition to Slack, we also offer the following ways to get in touch: + + + We also have Slack channels for you to communicate and discuss. To join, visit https://slack.com/ and join our [👀 Open-IM-Server slack](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) team channel. + + Get in touch with us on [Gmail](https://mail.google.com/mail/u/0/?fs=1&tf=cm&to=winxu81@gmail.com). If you have any questions or issues that need resolving, or any suggestions and feedback for our open source projects, please feel free to contact us via email. + + Read our [blog](https://doc.rentsoft.cn/). Our blog is a great place to stay up-to-date with Open-IM-Server projects and trends. On the blog, we share our latest developments, tech trends, and other interesting information. + + Add [Wechat](https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg) and indicate that you are a user or developer of Open-IM-Server. We will process your request as soon as possible. + + # - name: Close Issue + # uses: peter-evans/close-issue@v3 + # with: + # token: ${{ secrets.BOT_GITHUB_TOKEN }} + # issue-number: ${{ github.event.issue.number }} + # comment: 🤖 Auto-closing issue, if you still need help please reopen the issue or ask for help in the community above + # labels: | + # accepted \ No newline at end of file diff --git a/.github/workflows/auto-tag.yml b/.github/workflows/auto-tag.yml deleted file mode 100644 index e50ab4ed6..000000000 --- a/.github/workflows/auto-tag.yml +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright © 2023 OpenIM open source community. 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. - -name: Create Tag - -on: - issue_comment: - types: [created] - pull_request_review_comment: - types: [created] - -jobs: - create_tag: - runs-on: ubuntu-latest - if: startsWith(github.event.comment.body, '/create tag') - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Validate version number and get comment - id: validate - run: | - COMMENT="${{ github.event.comment.body }}" - VERSION=$(echo $COMMENT | cut -d ' ' -f 3) - TAG_COMMENT=$(echo $COMMENT | cut -d '"' -f 2) - if [[ $VERSION =~ ^v([0-9]+\.){2}[0-9]+$ ]]; then - echo "version=$VERSION" >> $GITHUB_STATE - echo "tag_comment=$TAG_COMMENT" >> $GITHUB_STATE - else - echo "Invalid version number." - exit 1 - fi - - - name: Create a new tag - env: - GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} - run: | - source $GITHUB_STATE - git tag -a $VERSION -m "$tag_comment" - git push origin $VERSION - echo "tag_created=$VERSION" >> $GITHUB_OUTPUT diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index db154c467..64d5d0c5c 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -1,17 +1,3 @@ -# Copyright © 2023 OpenIM open source community. 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. - name: Publish Docker image on: diff --git a/.github/workflows/chatci.yml b/.github/workflows/chatci.yml index 6f97293e4..e6c1b7a83 100644 --- a/.github/workflows/chatci.yml +++ b/.github/workflows/chatci.yml @@ -1,16 +1,3 @@ -# Copyright © 2023 OpenIM open source community. 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. name: OpenIM CI Auto Build on: @@ -45,11 +32,11 @@ jobs: permissions: contents: write pull-requests: write - environment: - name: openim + # environment: + # name: openim strategy: matrix: - arch: [arm64, armv7, amd64] + arch: [amd64] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/check-coverage.yml b/.github/workflows/check-coverage.yml index 7080ef7be..8c8d44185 100644 --- a/.github/workflows/check-coverage.yml +++ b/.github/workflows/check-coverage.yml @@ -1,17 +1,3 @@ -# Copyright © 2023 OpenIM open source community. 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. - name: Check-Coverage on: diff --git a/.github/workflows/cla-assistant.yml b/.github/workflows/cla-assistant.yml new file mode 100644 index 000000000..4aaa4e25a --- /dev/null +++ b/.github/workflows/cla-assistant.yml @@ -0,0 +1,40 @@ +name: CLA Assistant +on: + issue_comment: + types: [created] + pull_request_target: + types: [opened,closed,synchronize] + +# explicitly configure permissions, in case your GITHUB_TOKEN workflow permissions are set to read-only in repository settings +permissions: + actions: write + contents: write # this can be 'read' if the signatures are in remote repository + pull-requests: write + statuses: write + +jobs: + CLA-Assistant: + runs-on: ubuntu-latest + steps: + - name: "CLA Assistant" + if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target' + uses: contributor-assistant/github-action@v2.4.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PERSONAL_ACCESS_TOKEN: ${{ secrets.BOT_TOKEN }} + with: + path-to-signatures: 'signatures/cla.json' + path-to-document: 'https://github.com/OpenIM-Robot/cla/blob/main/README.md' # e.g. a CLA or a DCO document + branch: 'main' + allowlist: 'bot*,*bot,OpenIM-Robot' + + # the followings are the optional inputs - If the optional inputs are not given, then default values will be taken + remote-organization-name: OpenIM-Robot + remote-repository-name: cla + create-file-commit-message: 'Creating file for storing CLA Signatures' + # signed-commit-message: '$contributorName has signed the CLA in $owner/$repo#$pullRequestNo' + custom-notsigned-prcomment: '💕 Thank you for your contribution and please kindly read and sign our CLA. [CLA Docs](https://github.com/OpenIM-Robot/cla/blob/main/README.md)' + custom-pr-sign-comment: 'I have read the CLA Document and I hereby sign the CLA' + custom-allsigned-prcomment: '🤖 All Contributors have signed the [CLA](https://github.com/OpenIM-Robot/cla/blob/main/README.md).
The signed information is recorded [**here**](https://github.com/OpenIM-Robot/cla/blob/main/signatures/cla.json)' + #lock-pullrequest-aftermerge: false - if you don't want this bot to automatically lock the pull request after merging (default - true) + #use-dco-flag: true - If you are using DCO instead of CLA \ No newline at end of file diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml deleted file mode 100644 index 3f658284a..000000000 --- a/.github/workflows/cla.yml +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright © 2023 OpenIM open source community. 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. - -name: "OpenIM CLA Assistant" -on: - issue_comment: - types: [created] - pull_request_target: - types: [opened,closed,synchronize] - -# explicitly configure permissions, in case your GITHUB_TOKEN workflow permissions are set to read-only in repository settings -permissions: - actions: write - contents: write - pull-requests: write - statuses: write - -env: - # Define Open-IM-Server variables here - OPEN_IM_SERVER_REMOTE_ORGANIZATION: openim-sigs - REMOTE_REPOSITORY: cla - OPEN_IM_SERVER_CLA_DOCUMENT: https://github.com/openim-sigs/cla/blob/main/README.md - OPEN_IM_SERVER_SIGNATURES_PATH: signatures/${{ github.event.repository.name }}/cla.json - - OPEN_IM_SERVER_ALLOWLIST: kubbot,bot* - -jobs: - CLAAssistant: - runs-on: ubuntu-latest - steps: - - name: "CLA Assistant" - if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target' - uses: contributor-assistant/github-action@v2.3.0 - env: - GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} - PERSONAL_ACCESS_TOKEN: ${{ secrets.REDBOT_GITHUB_TOKEN }} - with: - path-to-signatures: ${{ env.OPEN_IM_SERVER_SIGNATURES_PATH }} - path-to-document: ${{ env.OPEN_IM_SERVER_CLA_DOCUMENT }} - branch: 'main' - allowlist: ${{ env.OPEN_IM_SERVER_ALLOWLIST }} - - remote-organization-name: ${{ env.OPEN_IM_SERVER_REMOTE_ORGANIZATION }} - remote-repository-name: ${{ env.REMOTE_REPOSITORY }} - - create-file-commit-message: '📚 Docs: Creating file for storing ${{ github.event.repository.name }} CLA Signatures' - custom-notsigned-prcomment: '💕 Thank you for your contribution and please kindly read and sign our [🎯https://github.com/openim-sigs/cla/blob/main/README.md](https://github.com/openim-sigs/cla/blob/main/README.md).
If you wish to sign the CRA, **Please copy and comment on the following sentence:**' - custom-pr-sign-comment: 'I have read the CLA Document and I hereby sign the CLA' - custom-allsigned-prcomment: '🤖 All Contributors have signed the [${{ github.event.repository.name }} CLA](https://github.com/openim-sigs/cla/blob/main/README.md).
The signed information is recorded [🤖here](https://github.com/openim-sigs/cla/tree/main/signatures/${{ github.event.repository.name }}/cla.json)' - # lock-pullrequest-aftermerge: false - if you don't want this bot to automatically lock the pull request after merging (default - true) - # use-dco-flag: true - If you are using DCO instead of CLA diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6233ffcad..fd871e2b5 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,76 +1,67 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. # -# 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 +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. # -# 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. - +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. -name: "Code Scanning - Action" +name: "CodeQL" on: push: - branches: [main] + branches: [ main ] pull_request: - branches: [main] + # The branches below must be a subset of the branches above + branches: [ main ] schedule: - # ┌───────────── minute (0 - 59) - # │ ┌───────────── hour (0 - 23) - # │ │ ┌───────────── day of the month (1 - 31) - # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) - # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) - # │ │ │ │ │ - # │ │ │ │ │ - # │ │ │ │ │ - # * * * * * - - cron: '30 1 * * 0' + - cron: '18 19 * * 6' jobs: - CodeQL-Build: - # CodeQL runs on ubuntu-latest, windows-latest, and macos-latest + analyze: + name: Analyze runs-on: ubuntu-latest - permissions: - # required for all workflows - security-events: write - - # only required for workflows in private repositories - actions: read - contents: read + strategy: + fail-fast: false + matrix: + language: [ 'go' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] + # Learn more: + # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed steps: - - name: Checkout repository - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v4 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - # Override language selection by uncommenting this and choosing your languages - # with: - # languages: go, javascript, csharp, python, cpp, java, ruby + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). - # If this step fails, then you should remove it and run the build manually (see below). - - name: Autobuild - uses: github/codeql-action/autobuild@v2 + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v3 - # ℹ️ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + # ℹ️ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl - # ✏️ If the Autobuild fails above, remove it and uncomment the following - # three lines and modify them (or add more) to build your code if your - # project uses a compiled language + # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language - #- run: | - # make bootstrap - # make release + #- run: | + # make bootstrap + # make release - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 \ No newline at end of file + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 \ No newline at end of file diff --git a/.github/workflows/comment-check.yml b/.github/workflows/comment-check.yml new file mode 100644 index 000000000..1609355ed --- /dev/null +++ b/.github/workflows/comment-check.yml @@ -0,0 +1,51 @@ +name: Non-English Comments Check + +on: + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + non-english-comments-check: + runs-on: ubuntu-latest + + env: + # need ignore Dirs + EXCLUDE_DIRS: ".git docs tests scripts assets node_modules build" + # need ignore Files + EXCLUDE_FILES: "*.md *.txt *.html *.css *.min.js *.mdx" + + steps: + - uses: actions/checkout@v4 + + - name: Search for Non-English comments + run: | + set -e + # Define the regex pattern to match Chinese characters + pattern='[\p{Han}]' + + # Process the directories to be excluded + exclude_dirs="" + for dir in $EXCLUDE_DIRS; do + exclude_dirs="$exclude_dirs --exclude-dir=$dir" + done + + # Process the file types to be excluded + exclude_files="" + for file in $EXCLUDE_FILES; do + exclude_files="$exclude_files --exclude=$file" + done + + # Use grep to find all comments containing Non-English characters and save to file + grep -Pnr "$pattern" . $exclude_dirs $exclude_files > non_english_comments.txt || true + + - name: Output non-English comments are found + run: | + if [ -s non_english_comments.txt ]; then + echo "Non-English comments found in the following locations:" + cat non_english_comments.txt + exit 1 # terminate the workflow + else + echo "No Non_English comments found." + fi \ No newline at end of file diff --git a/.github/workflows/depsreview.yaml b/.github/workflows/depsreview.yaml deleted file mode 100644 index c95afb845..000000000 --- a/.github/workflows/depsreview.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright © 2023 KubeCub open source community. All rights reserved. -# Licensed under the MIT License (the "License"); -# you may not use this file except in compliance with the License. - -name: Dependency Review -on: [pull_request] - -permissions: - contents: read - -jobs: - dependency-review: - runs-on: ubuntu-latest - steps: - - name: 'Checkout Repository' - uses: actions/checkout@v3 - - name: 'Dependency Review' - uses: actions/dependency-review-action@v3 \ No newline at end of file diff --git a/.github/workflows/gosec.yml b/.github/workflows/gosec.yml index 708eca4f8..43fba5c0c 100644 --- a/.github/workflows/gosec.yml +++ b/.github/workflows/gosec.yml @@ -1,17 +1,3 @@ -# 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. - name: OpenIM Run Gosec # gosec is a source code security audit tool for the Go language. It performs a static diff --git a/.github/workflows/help-comment-issue.yml b/.github/workflows/help-comment-issue.yml index 755fb035d..bb6367e42 100644 --- a/.github/workflows/help-comment-issue.yml +++ b/.github/workflows/help-comment-issue.yml @@ -1,22 +1,9 @@ -# 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. - name: Good frist issue add comment on: issues: types: - labeled + jobs: add-comment: if: github.event.label.name == 'help wanted' || github.event.label.name == 'good first issue' @@ -25,11 +12,11 @@ jobs: issues: write steps: - name: Add comment - uses: peter-evans/create-or-update-comment@v3 + uses: peter-evans/create-or-update-comment@v4 with: issue-number: ${{ github.event.issue.number }} - token: ${{ secrets.BOT_GITHUB_TOKEN }} + token: ${{ secrets.BOT_TOKEN }} body: | This issue is available for anyone to work on. **Make sure to reference this issue in your pull request.** :sparkles: Thank you for your contribution! :sparkles: - [Join slack 🤖](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) to connect and communicate with our developers. + [Join slack 🤖](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) to connect and communicate with our developers. If you wish to accept this assignment, please leave a comment in the comments section: `/accept`.🎯 \ No newline at end of file diff --git a/.github/workflows/issue-translator.yml b/.github/workflows/issue-translator.yml new file mode 100644 index 000000000..6a8528ae6 --- /dev/null +++ b/.github/workflows/issue-translator.yml @@ -0,0 +1,19 @@ +name: 'issue-translator' +on: + issue_comment: + types: [created] + issues: + types: [opened] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: usthe/issues-translate-action@v2.7 + with: + BOT_GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} + IS_MODIFY_TITLE: true + # not require, default false, . Decide whether to modify the issue title + # if true, the robot account @Issues-translate-bot must have modification permissions, invite @Issues-translate-bot to your project or use your custom bot. + CUSTOM_BOT_NOTE: Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿 + # not require. Customize the translation robot prefix message. \ No newline at end of file diff --git a/.github/workflows/language-check.yml b/.github/workflows/language-check.yml deleted file mode 100644 index 904323cd9..000000000 --- a/.github/workflows/language-check.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Language Check Workflow Test - -on: [pull_request] - -jobs: - comment-language-detector: - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Code Language Detector - uses: kubecub/comment-lang-detector@v1.0.0 diff --git a/.github/workflows/project-progress.yml b/.github/workflows/project-progress.yml deleted file mode 100644 index e6a7156e1..000000000 --- a/.github/workflows/project-progress.yml +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright © 2023 OpenIM open source community. 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. - -# GitHub recommends pinning actions to a commit SHA. -# To get a newer version, you will need to update the SHA. -# You can also reference a tag or branch, but the action may change without warning. - -name: Move assigned card -on: - issues: - types: - - assigned - pull_request: - types: - - assigned - -jobs: - move-assigned-card: - runs-on: ubuntu-latest - steps: - - uses: alex-page/github-project-automation-plus@v0.8.3 - with: - project: OpenIM-V3.1 - column: In Progress - repo-token: ${{ secrets.BOT_GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml deleted file mode 100644 index cb5c39fc9..000000000 --- a/.github/workflows/pull-request.yml +++ /dev/null @@ -1,115 +0,0 @@ -name: Github Pull Request -on: - workflow_dispatch: - schedule: - - cron: '0 2 * * *' - -permissions: - contents: write - pull-requests: write - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - uses: actions/setup-node@v4 - - name: Setup Go - uses: actions/setup-go@v5 - - name: Run go modules tidy - run: | - sudo apt-get install jq - sudo make tidy - sudo make tools.verify.go-gitlint - echo "Run go modules tidy successfully" - continue-on-error: true - - - name: Run go format and lint - run: | - sudo make format - echo "Run go format successfully" - continue-on-error: true - - - name: Run go lint - run: | - sudo make lint - echo "Run go lint successfully" - continue-on-error: true - - - name: Generate all necessary files, such as error code files - run: | - make generate - echo "Generate all necessary files successfully" - continue-on-error: true - - - name: make init - run: | - export OPENIM_IP=127.0.0.1 - export LOG_STORAGE_LOCATION="../logs/" - ./scripts/init-config.sh --examples --force - echo "Generate all necessary files successfully" - continue-on-error: true - - - name: Generate Vertions - run: | - latest_tag=$(git describe --tags `git rev-list --tags --max-count=1` | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') - echo $latest_tag > pkg/common/config/version - continue-on-error: true - - - name: Gen CHANGELOG file - run: | - current_tag=$(git describe --tags --abbrev=0) - version=$(echo "$current_tag" | sed -E 's/^v?([0-9]+)\.([0-9]+)\..*$/\1.\2/') - echo "OpenIM Version: $version" - make tools.install.git-chglog - cd CHANGELOG - git-chglog --tag-filter-pattern "v${version}.*" -o CHANGELOG-${version}.md - cd .. - continue-on-error: true - - - name: Run unit test and get test coverage - run: | - make cover - echo "Run unit test and get test coverage successfully" - continue-on-error: true - - - name: OpenIM verify copyright - run: | - sudo make add-copyright - echo "OpenIM verify successfully" - continue-on-error: true - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v6 - with: - token: ${{ secrets.BOT_GITHUB_TOKEN }} - commit-message: "cicd: bump League Patch" - author: kubbot <3293172751ysy@gmail.com> - committer: kubbot <3293172751ysy@gmail.com> - # signoff: false - # draft: false - branch: "asf-auto-updates" - assignees: cubxxw - reviewers: cubxxw - title: "[Auto PR 🤖] Bump League Patch auto PR" - body: | - I am a PR generated by robot automation. - - Review criteria: - - - [ ] Disenchanter can connect and issue actions - - Github Actions Status: - - [![Github Pull Request](https://github.com/openimsdk/chat/actions/workflows/pull-request.yml/badge.svg)](https://github.com/openimsdk/open-im-server/actions/workflows/pull-request.yml) - - This is an automated PR. - [workflow](https://github.com/openimsdk/chat/blob/main/.github/workflows/pull-request.yml). - labels: | - kind/documentation - enhancement - report diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d133b9d07..a46b1c8bd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,17 +1,3 @@ -# Copyright © 2023 OpenIM open source community. 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. - name: OpenIM chat release on: diff --git a/.github/workflows/reopen-issue.yml b/.github/workflows/reopen-issue.yml new file mode 100644 index 000000000..d12e2c30e --- /dev/null +++ b/.github/workflows/reopen-issue.yml @@ -0,0 +1,78 @@ +name: Reopen and Update Stale Issues + +on: + workflow_dispatch: + +jobs: + reopen_stale_issues: + runs-on: ubuntu-latest + permissions: + issues: write + contents: read + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Fetch Closed Issues with lifecycle/stale Label + id: fetch_issues + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const issues = await github.paginate(github.rest.issues.listForRepo, { + owner: context.repo.owner, + repo: context.repo.repo, + state: 'closed', + labels: 'lifecycle/stale', + per_page: 100 + }); + const issueNumbers = issues + .filter(issue => !issue.pull_request) + .map(issue => issue.number); + console.log(`Fetched issues: ${issueNumbers}`); + return issueNumbers; + + - name: Set issue numbers + id: set_issue_numbers + run: | + echo "ISSUE_NUMBERS=${{ steps.fetch_issues.outputs.result }}" >> $GITHUB_ENV + echo "Issue numbers: ${{ steps.fetch_issues.outputs.result }}" + + - name: Reopen Issues + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const issueNumbers = JSON.parse(process.env.ISSUE_NUMBERS); + console.log(`Reopening issues: ${issueNumbers}`); + + for (const issue_number of issueNumbers) { + // Reopen the issue + await github.rest.issues.update({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue_number, + state: 'open' + }); + console.log(`Reopened issue #${issue_number}`); + } + + - name: Remove lifecycle/stale Label + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const issueNumbers = JSON.parse(process.env.ISSUE_NUMBERS); + console.log(`Removing 'lifecycle/stale' label from issues: ${issueNumbers}`); + + for (const issue_number of issueNumbers) { + // Remove the lifecycle/stale label + await github.rest.issues.removeLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue_number, + name: 'lifecycle/stale' + }); + console.log(`Removed label 'lifecycle/stale' from issue #${issue_number}`); + } diff --git a/.github/workflows/update-version-file-on-release.yml b/.github/workflows/update-version-file-on-release.yml new file mode 100644 index 000000000..f582edf48 --- /dev/null +++ b/.github/workflows/update-version-file-on-release.yml @@ -0,0 +1,84 @@ +name: Update Version File on Release + +on: + release: + types: [created] + +jobs: + update-version: + runs-on: ubuntu-latest + env: + TAG_VERSION: ${{ github.event.release.tag_name }} + steps: + # Step 1: Checkout the original repository's code + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # Step 2: Set up Git with official account + - name: Set up Git + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + # Step 3: Check and delete existing tag + - name: Check and delete existing tag + run: | + if git rev-parse ${{ env.TAG_VERSION }} >/dev/null 2>&1; then + git tag -d ${{ env.TAG_VERSION }} + git push --delete origin ${{ env.TAG_VERSION }} + fi + + # Step 4: Update version file + - name: Update version file + run: | + echo "${{ env.TAG_VERSION }}" > version/version + + # Step 5: Commit and push changes + - name: Commit and push changes + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git add version/version + git commit -m "Update version to ${{ env.TAG_VERSION }}" + git push origin HEAD:${{ github.ref }} + + # Step 6: Create and push tag + - name: Create and push tag + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git tag ${{ env.TAG_VERSION }} + git push origin ${{ env.TAG_VERSION }} + + # Step 8: Find and Publish Draft Release + - name: Find and Publish Draft Release + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + // Get the list of releases + const releases = await github.rest.repos.listReleases({ + owner: context.repo.owner, + repo: context.repo.repo + }); + + // Find the draft release where the title and tag_name are the same + const draftRelease = releases.data.find(release => + release.draft && release.name === release.tag_name + ); + + if (draftRelease) { + // Publish the draft release using the release_id + await github.rest.repos.updateRelease({ + owner: context.repo.owner, + repo: context.repo.repo, + release_id: draftRelease.id, // Use release_id + draft: false + }); + + core.info(`Draft Release ${draftRelease.tag_name} published successfully.`); + } else { + core.info("No matching draft release found."); + } \ No newline at end of file diff --git a/HOW_TO_SETUP_LIVEKIT_SERVER.md b/HOW_TO_SETUP_LIVEKIT_SERVER.md index c8c6dd23e..a5762a13b 100644 --- a/HOW_TO_SETUP_LIVEKIT_SERVER.md +++ b/HOW_TO_SETUP_LIVEKIT_SERVER.md @@ -9,6 +9,7 @@ OpenIM Chat uses the LiveKit server as the media server to support video calls a ## Quick Start To self-host LiveKit, start the server with the following Docker command: +> replace `your-server-ip` with your server IP address ```bash docker run -d \ @@ -18,7 +19,8 @@ docker run -d \ -v $PWD/livekit/livekit.yaml:/livekit.yaml \ livekit/livekit-server \ --config /livekit.yaml \ - --bind 0.0.0.0 + --bind 0.0.0.0 \ + --node-ip=your-server-ip ``` ## Viewing Logs diff --git a/config/log.yml b/config/log.yml index 44ff3ee71..8620af611 100644 --- a/config/log.yml +++ b/config/log.yml @@ -10,3 +10,5 @@ remainLogLevel: 6 isStdout: false # Whether to log in JSON format, default is acceptable isJson: false +# output simplify log when KeyAndValues's value len is bigger than 50 in rpc method log +isSimplify: true \ No newline at end of file diff --git a/go.mod b/go.mod index 723dd02e8..2b84c4af7 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,6 @@ require ( github.com/golang/protobuf v1.5.4 // indirect github.com/google/uuid v1.6.0 github.com/jinzhu/copier v0.4.0 // indirect - github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible // indirect github.com/pkg/errors v0.9.1 // indirect google.golang.org/grpc v1.62.1 google.golang.org/protobuf v1.33.0 @@ -26,8 +25,8 @@ require ( github.com/livekit/protocol v1.10.1 github.com/mitchellh/mapstructure v1.5.0 github.com/openimsdk/gomake v0.0.14-alpha.5 - github.com/openimsdk/protocol v0.0.63 - github.com/openimsdk/tools v0.0.49-alpha.24 + github.com/openimsdk/protocol v0.0.72 + github.com/openimsdk/tools v0.0.50-alpha.15 github.com/redis/go-redis/v9 v9.5.1 github.com/spf13/cobra v1.8.0 github.com/spf13/viper v1.18.2 diff --git a/go.sum b/go.sum index 6587e0cdc..a4f7c8ac8 100644 --- a/go.sum +++ b/go.sum @@ -187,10 +187,10 @@ github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OS github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/openimsdk/gomake v0.0.14-alpha.5 h1:VY9c5x515lTfmdhhPjMvR3BBRrRquAUCFsz7t7vbv7Y= github.com/openimsdk/gomake v0.0.14-alpha.5/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI= -github.com/openimsdk/protocol v0.0.63 h1:9DnweZe9nEYDFa4fGTbC9Cqi0gLUdtBhRo1NRP2X3WQ= -github.com/openimsdk/protocol v0.0.63/go.mod h1:OZQA9FR55lseYoN2Ql1XAHYKHJGu7OMNkUbuekrKCM8= -github.com/openimsdk/tools v0.0.49-alpha.24 h1:lJsqnjTPujnr91LRQ6QmcTliMIa4fMOBSTri6rFz2ek= -github.com/openimsdk/tools v0.0.49-alpha.24/go.mod h1:g7mkHXYUPi0/8aAX8VPMHpnb3hqdV69Jph+bXOGvvNM= +github.com/openimsdk/protocol v0.0.72 h1:K+vslwaR7lDXyBzb07UuEQITaqsgighz7NyXVIWsu6A= +github.com/openimsdk/protocol v0.0.72/go.mod h1:OZQA9FR55lseYoN2Ql1XAHYKHJGu7OMNkUbuekrKCM8= +github.com/openimsdk/tools v0.0.50-alpha.15 h1:HV9aKZ4vvCZCGG4wFDsgUONkkdJeCcrFNn3BT52nUVQ= +github.com/openimsdk/tools v0.0.50-alpha.15/go.mod h1:h1cYmfyaVtgFbKmb1Cfsl8XwUOMTt8ubVUQrdGtsUh4= github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/pion/datachannel v1.5.5 h1:10ef4kwdjije+M9d7Xm9im2Y3O6A6ccQb0zcqZcJew8= diff --git a/internal/api/admin/admin.go b/internal/api/admin/admin.go index e0586939c..7e0a44893 100644 --- a/internal/api/admin/admin.go +++ b/internal/api/admin/admin.go @@ -18,6 +18,11 @@ import ( "context" "crypto/md5" "encoding/hex" + "net/http" + "strconv" + "strings" + "time" + "github.com/gin-gonic/gin" "github.com/openimsdk/chat/internal/api/util" "github.com/openimsdk/chat/pkg/common/apistruct" @@ -37,10 +42,6 @@ import ( "github.com/openimsdk/tools/log" "github.com/openimsdk/tools/utils/datautil" "github.com/openimsdk/tools/utils/encrypt" - "net/http" - "strconv" - "strings" - "time" ) func New(chatClient chat.ChatClient, adminClient admin.AdminClient, imApiCaller imapi.CallerInterface, api *util.Api) *Api { @@ -71,7 +72,7 @@ func (o *Api) AdminLogin(c *gin.Context) { return } imAdminUserID := o.GetDefaultIMAdminUserID() - imToken, err := o.imApiCaller.UserToken(c, imAdminUserID, constant.AdminPlatformID) + imToken, err := o.imApiCaller.GetAdminToken(c, imAdminUserID) if err != nil { apiresp.GinError(c, err) return @@ -87,7 +88,30 @@ func (o *Api) AdminLogin(c *gin.Context) { } func (o *Api) ResetUserPassword(c *gin.Context) { - a2r.Call(chat.ChatClient.ChangePassword, o.chatClient, c) + req, err := a2r.ParseRequest[chat.ChangePasswordReq](c) + if err != nil { + apiresp.GinError(c, err) + return + } + resp, err := o.chatClient.ChangePassword(c, req) + if err != nil { + apiresp.GinError(c, err) + return + } + + imToken, err := o.imApiCaller.ImAdminTokenWithDefaultAdmin(c) + if err != nil { + apiresp.GinError(c, err) + return + } + + err = o.imApiCaller.ForceOffLine(mctx.WithApiToken(c, imToken), req.UserID) + if err != nil { + apiresp.GinError(c, err) + return + } + + apiresp.GinSuccess(c, resp) } func (o *Api) AdminUpdateInfo(c *gin.Context) { @@ -103,7 +127,7 @@ func (o *Api) AdminUpdateInfo(c *gin.Context) { } imAdminUserID := o.GetDefaultIMAdminUserID() - imToken, err := o.imApiCaller.UserToken(c, imAdminUserID, constant.AdminPlatformID) + imToken, err := o.imApiCaller.GetAdminToken(c, imAdminUserID) if err != nil { log.ZError(c, "AdminUpdateInfo ImAdminTokenWithDefaultAdmin", err, "imAdminUserID", imAdminUserID) return @@ -183,7 +207,7 @@ func (o *Api) AddDefaultGroup(c *gin.Context) { apiresp.GinError(c, err) return } - imToken, err := o.imApiCaller.UserToken(c, o.GetDefaultIMAdminUserID(), constant.AdminPlatformID) + imToken, err := o.imApiCaller.GetAdminToken(c, o.GetDefaultIMAdminUserID()) if err != nil { apiresp.GinError(c, err) return @@ -231,7 +255,7 @@ func (o *Api) SearchDefaultGroup(c *gin.Context) { Groups: make([]*sdkws.GroupInfo, 0, len(searchResp.GroupIDs)), } if len(searchResp.GroupIDs) > 0 { - imToken, err := o.imApiCaller.UserToken(c, o.GetDefaultIMAdminUserID(), constant.AdminPlatformID) + imToken, err := o.imApiCaller.GetAdminToken(c, o.GetDefaultIMAdminUserID()) if err != nil { apiresp.GinError(c, err) return @@ -313,7 +337,7 @@ func (o *Api) BlockUser(c *gin.Context) { apiresp.GinError(c, err) return } - imToken, err := o.imApiCaller.UserToken(c, o.GetDefaultIMAdminUserID(), constant.AdminPlatformID) + imToken, err := o.imApiCaller.GetAdminToken(c, o.GetDefaultIMAdminUserID()) if err != nil { apiresp.GinError(c, err) return @@ -372,7 +396,7 @@ func (o *Api) NewUserCount(c *gin.Context) { apiresp.GinError(c, err) return } - imToken, err := o.imApiCaller.UserToken(c, o.GetDefaultIMAdminUserID(), constant.AdminPlatformID) + imToken, err := o.imApiCaller.GetAdminToken(c, o.GetDefaultIMAdminUserID()) if err != nil { apiresp.GinError(c, err) return diff --git a/internal/api/chat/chat.go b/internal/api/chat/chat.go index 6ab2e4bbc..eca5e3bbe 100644 --- a/internal/api/chat/chat.go +++ b/internal/api/chat/chat.go @@ -132,7 +132,7 @@ func (o *Api) RegisterUser(c *gin.Context) { FaceURL: req.User.FaceURL, CreateTime: time.Now().UnixMilli(), } - err = o.imApiCaller.RegisterUser(c, []*sdkws.UserInfo{userInfo}) + err = o.imApiCaller.RegisterUser(apiCtx, []*sdkws.UserInfo{userInfo}) if err != nil { apiresp.GinError(c, err) return @@ -146,7 +146,7 @@ func (o *Api) RegisterUser(c *gin.Context) { } var resp apistruct.UserRegisterResp if req.AutoLogin { - resp.ImToken, err = o.imApiCaller.UserToken(c, respRegisterUser.UserID, req.Platform) + resp.ImToken, err = o.imApiCaller.GetUserToken(apiCtx, respRegisterUser.UserID, req.Platform) if err != nil { apiresp.GinError(c, err) return @@ -174,7 +174,14 @@ func (o *Api) Login(c *gin.Context) { apiresp.GinError(c, err) return } - imToken, err := o.imApiCaller.UserToken(c, resp.UserID, req.Platform) + adminToken, err := o.imApiCaller.ImAdminTokenWithDefaultAdmin(c) + if err != nil { + apiresp.GinError(c, err) + return + } + apiCtx := mctx.WithApiToken(c, adminToken) + + imToken, err := o.imApiCaller.GetUserToken(apiCtx, resp.UserID, req.Platform) if err != nil { apiresp.GinError(c, err) return @@ -237,7 +244,7 @@ func (o *Api) UpdateUserInfo(c *gin.Context) { if opUserType == constant.NormalUser { imToken, err = o.imApiCaller.ImAdminTokenWithDefaultAdmin(c) } else if opUserType == constant.AdminUser { - imToken, err = o.imApiCaller.UserToken(c, o.GetDefaultIMAdminUserID(), constantpb.AdminPlatformID) + imToken, err = o.imApiCaller.GetAdminToken(c, o.GetDefaultIMAdminUserID()) } else { apiresp.GinError(c, errs.ErrArgs.WrapMsg("opUserType unknown")) return diff --git a/internal/rpc/chat/login.go b/internal/rpc/chat/login.go index f1f2474b8..59990302d 100644 --- a/internal/rpc/chat/login.go +++ b/internal/rpc/chat/login.go @@ -240,8 +240,6 @@ func (o *chatSvr) genVerifyCode() string { } func (o *chatSvr) RegisterUser(ctx context.Context, req *chat.RegisterUserReq) (*chat.RegisterUserResp, error) { - resp := &chat.RegisterUserResp{} - isAdmin, err := o.Admin.CheckNilOrAdmin(ctx) ctx = o.WithAdminUser(ctx) if err != nil { @@ -389,6 +387,7 @@ func (o *chatSvr) RegisterUser(ctx context.Context, req *chat.RegisterUserReq) ( log.ZError(ctx, "UseInvitationCode", err, "userID", req.User.UserID, "invitationCode", req.InvitationCode) } } + var resp chat.RegisterUserResp if req.AutoLogin { chatToken, err := o.Admin.CreateToken(ctx, req.User.UserID, constant.NormalUser) if err == nil { @@ -398,7 +397,7 @@ func (o *chatSvr) RegisterUser(ctx context.Context, req *chat.RegisterUserReq) ( } } resp.UserID = req.User.UserID - return resp, nil + return &resp, nil } func (o *chatSvr) Login(ctx context.Context, req *chat.LoginReq) (*chat.LoginResp, error) { diff --git a/internal/rpc/chat/update.go b/internal/rpc/chat/update.go index 169694fff..4579f1c3e 100644 --- a/internal/rpc/chat/update.go +++ b/internal/rpc/chat/update.go @@ -63,8 +63,8 @@ func ToDBAttributeUpdate(req *chat.UpdateUserInfoReq) (map[string]any, error) { if req.GlobalRecvMsgOpt != nil { update["global_recv_msg_opt"] = req.GlobalRecvMsgOpt.Value } - if len(update) == 0 { - return nil, errs.ErrArgs.WrapMsg("no update info") - } + //if len(update) == 0 { + // return nil, errs.ErrArgs.WrapMsg("no update info") + //} return update, nil } diff --git a/internal/rpc/chat/user.go b/internal/rpc/chat/user.go index ff53c9177..ce789613a 100644 --- a/internal/rpc/chat/user.go +++ b/internal/rpc/chat/user.go @@ -32,8 +32,95 @@ import ( "github.com/openimsdk/tools/errs" ) +func (o *chatSvr) checkUpdateInfo(ctx context.Context, req *chat.UpdateUserInfoReq) error { + attribute, err := o.Database.TakeAttributeByUserID(ctx, req.UserID) + if err != nil { + return err + } + checkEmail := func() error { + if req.Email == nil { + return nil + } + if req.Email.Value == attribute.Email { + req.Email = nil + return nil + } + if req.Email.Value == "" { + if !(attribute.Account != "" || (attribute.AreaCode != "" && attribute.PhoneNumber != "")) { + return errs.ErrArgs.WrapMsg("a login method must exist") + } + return nil + } else { + if _, err := o.Database.GetAttributeByEmail(ctx, req.Email.Value); err == nil { + return errs.ErrDuplicateKey.WrapMsg("email already exists") + } else if !dbutil.IsDBNotFound(err) { + return err + } + } + return nil + } + checkPhone := func() error { + if req.AreaCode == nil { + return nil + } + if req.AreaCode.Value == attribute.AreaCode && req.PhoneNumber.Value == attribute.PhoneNumber { + req.AreaCode = nil + req.PhoneNumber = nil + return nil + } + if req.AreaCode.Value == "" || req.PhoneNumber.Value == "" { + if attribute.Email == "" || attribute.Account == "" { + return errs.ErrArgs.WrapMsg("a login method must exist") + } + } else { + if _, err := o.Database.GetAttributeByPhone(ctx, req.AreaCode.Value, req.PhoneNumber.Value); err == nil { + return errs.ErrDuplicateKey.WrapMsg("phone number already exists") + } else if !dbutil.IsDBNotFound(err) { + return err + } + } + return nil + } + checkAccount := func() error { + if req.Account == nil { + return nil + } + if req.Account.Value == attribute.Account { + req.Account = nil + return nil + } + if req.Account.Value == "" { + if !(attribute.Email == "" && (attribute.AreaCode == "" || attribute.PhoneNumber == "")) { + return errs.ErrArgs.WrapMsg("a login method must exist") + } + } else { + if _, err := o.Database.GetAttributeByAccount(ctx, req.Account.Value); err == nil { + return errs.ErrDuplicateKey.WrapMsg("account already exists") + } else if !dbutil.IsDBNotFound(err) { + return err + } + } + return nil + } + for _, fn := range []func() error{checkEmail, checkPhone, checkAccount} { + if err := fn(); err != nil { + return err + } + } + return nil +} + func (o *chatSvr) UpdateUserInfo(ctx context.Context, req *chat.UpdateUserInfoReq) (*chat.UpdateUserInfoResp, error) { - resp := &chat.UpdateUserInfoResp{} + if req.AreaCode != nil || req.PhoneNumber != nil { + if !(req.AreaCode != nil && req.PhoneNumber != nil) { + return nil, errs.ErrArgs.WrapMsg("areaCode and phoneNumber must be set together") + } + if req.AreaCode.Value == "" || req.PhoneNumber.Value == "" { + if req.AreaCode.Value != req.PhoneNumber.Value { + return nil, errs.ErrArgs.WrapMsg("areaCode and phoneNumber must be set together") + } + } + } opUserID, userType, err := mctx.Check(ctx) if err != nil { return nil, err @@ -65,44 +152,19 @@ func (o *chatSvr) UpdateUserInfo(ctx context.Context, req *chat.UpdateUserInfoRe default: return nil, errs.ErrNoPermission.WrapMsg("user type error") } - update, err := ToDBAttributeUpdate(req) - if err != nil { + if err := o.checkUpdateInfo(ctx, req); err != nil { return nil, err } - attribute, err := o.Database.TakeAttributeByUserID(ctx, req.UserID) + update, err := ToDBAttributeUpdate(req) if err != nil { return nil, err } - if req.Account != nil && req.Account.Value != attribute.Account { - _, err := o.Database.TakeAttributeByAccount(ctx, req.Account.Value) - if err == nil { - return nil, eerrs.ErrAccountAlreadyRegister.Wrap() - } else if !dbutil.IsDBNotFound(err) { + if len(update) > 0 { + if err := o.Database.UpdateUseInfo(ctx, req.UserID, update); err != nil { return nil, err } } - if req.AreaCode != nil || req.PhoneNumber != nil { - areaCode := attribute.AreaCode - phoneNumber := attribute.PhoneNumber - if req.AreaCode != nil { - areaCode = req.AreaCode.Value - } - if req.PhoneNumber != nil { - phoneNumber = req.PhoneNumber.Value - } - if attribute.AreaCode != areaCode || attribute.PhoneNumber != phoneNumber { - _, err := o.Database.TakeAttributeByPhone(ctx, areaCode, phoneNumber) - if err == nil { - return nil, eerrs.ErrAccountAlreadyRegister.Wrap() - } else if !dbutil.IsDBNotFound(err) { - return nil, err - } - } - } - if err := o.Database.UpdateUseInfo(ctx, req.UserID, update); err != nil { - return nil, err - } - return resp, nil + return &chat.UpdateUserInfoResp{}, nil } func (o *chatSvr) FindUserPublicInfo(ctx context.Context, req *chat.FindUserPublicInfoReq) (*chat.FindUserPublicInfoResp, error) { diff --git a/livekit/livekit.yaml b/livekit/livekit.yaml index e199bbf00..b6243f2cf 100644 --- a/livekit/livekit.yaml +++ b/livekit/livekit.yaml @@ -3,7 +3,7 @@ rtc: tcp_port: 7881 port_range_start: 50000 port_range_end: 60000 - use_external_ip: true + use_external_ip: false enable_loopback_candidate: false keys: APIGPW3gnFTzqHH: 23ztfSqsfQ8hKkHzHTl3Z4bvaxro0snjk5jwbp5p6Q3 \ No newline at end of file diff --git a/pkg/common/cmd/root.go b/pkg/common/cmd/root.go index 7c4a3075a..762cbacd8 100644 --- a/pkg/common/cmd/root.go +++ b/pkg/common/cmd/root.go @@ -16,9 +16,11 @@ package cmd import ( "fmt" - "github.com/openimsdk/chat/pkg/common/config" "path/filepath" + "github.com/openimsdk/chat/pkg/common/config" + "github.com/openimsdk/chat/version/version" + "github.com/openimsdk/tools/errs" "github.com/openimsdk/tools/log" "github.com/spf13/cobra" @@ -117,16 +119,18 @@ func (r *RootCmd) applyOptions(opts ...func(*CmdOpts)) *CmdOpts { } func (r *RootCmd) initializeLogger(cmdOpts *CmdOpts) error { - err := log.InitFromConfig( + err := log.InitLoggerFromConfig( cmdOpts.loggerPrefixName, r.processName, + "", "", r.log.RemainLogLevel, r.log.IsStdout, r.log.IsJson, r.log.StorageLocation, r.log.RemainRotationCount, r.log.RotationTime, - config.Version, + version.Version, + r.log.IsSimplify, ) if err != nil { return errs.Wrap(err) diff --git a/pkg/common/config/config.go b/pkg/common/config/config.go index 6f926660a..76acd6c65 100644 --- a/pkg/common/config/config.go +++ b/pkg/common/config/config.go @@ -2,6 +2,7 @@ package config import ( _ "embed" + "github.com/openimsdk/tools/db/mongoutil" "github.com/openimsdk/tools/db/redisutil" ) @@ -165,5 +166,6 @@ type Log struct { RemainLogLevel int `mapstructure:"remainLogLevel"` IsStdout bool `mapstructure:"isStdout"` IsJson bool `mapstructure:"isJson"` + IsSimplify bool `mapstructure:"isSimplify"` WithStack bool `mapstructure:"withStack"` } diff --git a/pkg/common/imapi/api.go b/pkg/common/imapi/api.go index 6d5aff2fd..60891be0f 100644 --- a/pkg/common/imapi/api.go +++ b/pkg/common/imapi/api.go @@ -16,21 +16,22 @@ package imapi import ( "github.com/openimsdk/protocol/auth" - "github.com/openimsdk/protocol/friend" "github.com/openimsdk/protocol/group" + "github.com/openimsdk/protocol/relation" "github.com/openimsdk/protocol/user" ) // im caller. var ( - importFriend = NewApiCaller[friend.ImportFriendReq, friend.ImportFriendResp]("/friend/import_friend") - userToken = NewApiCaller[auth.UserTokenReq, auth.UserTokenResp]("/auth/user_token") + importFriend = NewApiCaller[relation.ImportFriendReq, relation.ImportFriendResp]("/friend/import_friend") + getAdminToken = NewApiCaller[auth.GetAdminTokenReq, auth.GetAdminTokenResp]("/auth/get_admin_token") + getuserToken = NewApiCaller[auth.GetUserTokenReq, auth.GetUserTokenResp]("/auth/get_user_token") inviteToGroup = NewApiCaller[group.InviteUserToGroupReq, group.InviteUserToGroupResp]("/group/invite_user_to_group") updateUserInfo = NewApiCaller[user.UpdateUserInfoReq, user.UpdateUserInfoResp]("/user/update_user_info") registerUser = NewApiCaller[user.UserRegisterReq, user.UserRegisterResp]("/user/user_register") forceOffLine = NewApiCaller[auth.ForceLogoutReq, auth.ForceLogoutResp]("/auth/force_logout") getGroupsInfo = NewApiCaller[group.GetGroupsInfoReq, group.GetGroupsInfoResp]("/group/get_groups_info") registerUserCount = NewApiCaller[user.UserRegisterCountReq, user.UserRegisterCountResp]("/statistics/user/register") - friendUserIDs = NewApiCaller[friend.GetFriendIDsReq, friend.GetFriendIDsResp]("/friend/get_friend_id") + friendUserIDs = NewApiCaller[relation.GetFriendIDsReq, relation.GetFriendIDsResp]("/friend/get_friend_id") accountCheck = NewApiCaller[user.AccountCheckReq, user.AccountCheckResp]("/user/account_check") ) diff --git a/pkg/common/imapi/caller.go b/pkg/common/imapi/caller.go index c6ca3f1e6..0a3923cb2 100644 --- a/pkg/common/imapi/caller.go +++ b/pkg/common/imapi/caller.go @@ -23,9 +23,10 @@ import ( "github.com/openimsdk/tools/log" "github.com/openimsdk/protocol/auth" + "github.com/openimsdk/protocol/constant" constantpb "github.com/openimsdk/protocol/constant" - "github.com/openimsdk/protocol/friend" "github.com/openimsdk/protocol/group" + "github.com/openimsdk/protocol/relation" "github.com/openimsdk/protocol/sdkws" "github.com/openimsdk/protocol/user" ) @@ -33,7 +34,8 @@ import ( type CallerInterface interface { ImAdminTokenWithDefaultAdmin(ctx context.Context) (string, error) ImportFriend(ctx context.Context, ownerUserID string, friendUserID []string) error - UserToken(ctx context.Context, userID string, platform int32) (string, error) + GetUserToken(ctx context.Context, userID string, platform int32) (string, error) + GetAdminToken(ctx context.Context, userID string) (string, error) InviteToGroup(ctx context.Context, userID string, groupIDs []string) error UpdateUserInfo(ctx context.Context, userID string, nickName string, faceURL string) error ForceOffLine(ctx context.Context, userID string) error @@ -65,7 +67,7 @@ func (c *Caller) ImportFriend(ctx context.Context, ownerUserID string, friendUse if len(friendUserIDs) == 0 { return nil } - _, err := importFriend.Call(ctx, c.imApi, &friend.ImportFriendReq{ + _, err := importFriend.Call(ctx, c.imApi, &relation.ImportFriendReq{ OwnerUserID: ownerUserID, FriendUserIDs: friendUserIDs, }) @@ -77,7 +79,7 @@ func (c *Caller) ImAdminTokenWithDefaultAdmin(ctx context.Context) (string, erro defer c.lock.Unlock() if c.token == "" || c.timeout.Before(time.Now()) { userID := c.defaultIMUserID - token, err := c.UserToken(ctx, userID, constantpb.AdminPlatformID) + token, err := c.GetAdminToken(ctx, userID) if err != nil { log.ZError(ctx, "get im admin token", err, "userID", userID) return "", err @@ -89,9 +91,19 @@ func (c *Caller) ImAdminTokenWithDefaultAdmin(ctx context.Context) (string, erro return c.token, nil } -func (c *Caller) UserToken(ctx context.Context, userID string, platformID int32) (string, error) { - resp, err := userToken.Call(ctx, c.imApi, &auth.UserTokenReq{ - Secret: c.imSecret, +func (c *Caller) GetAdminToken(ctx context.Context, userID string) (string, error) { + resp, err := getAdminToken.Call(ctx, c.imApi, &auth.GetAdminTokenReq{ + Secret: c.imSecret, + UserID: userID, + }) + if err != nil { + return "", err + } + return resp.Token, nil +} + +func (c *Caller) GetUserToken(ctx context.Context, userID string, platformID int32) (string, error) { + resp, err := getuserToken.Call(ctx, c.imApi, &auth.GetUserTokenReq{ PlatformID: platformID, UserID: userID, }) @@ -123,8 +135,7 @@ func (c *Caller) UpdateUserInfo(ctx context.Context, userID string, nickName str func (c *Caller) RegisterUser(ctx context.Context, users []*sdkws.UserInfo) error { _, err := registerUser.Call(ctx, c.imApi, &user.UserRegisterReq{ - Secret: c.imSecret, - Users: users, + Users: users, }) return err } @@ -161,7 +172,7 @@ func (c *Caller) UserRegisterCount(ctx context.Context, start int64, end int64) } func (c *Caller) FriendUserIDs(ctx context.Context, userID string) ([]string, error) { - resp, err := friendUserIDs.Call(ctx, c.imApi, &friend.GetFriendIDsReq{UserID: userID}) + resp, err := friendUserIDs.Call(ctx, c.imApi, &relation.GetFriendIDsReq{UserID: userID}) if err != nil { return nil, err } @@ -174,7 +185,7 @@ func (c *Caller) AccountCheckSingle(ctx context.Context, userID string) (bool, e if err != nil { return false, err } - if resp.Results[0].AccountStatus == "registered" { + if resp.Results[0].AccountStatus == constant.Registered { return false, eerrs.ErrAccountAlreadyRegister.Wrap() } return true, nil diff --git a/pkg/protocol/sdkws/sdkws.proto b/pkg/protocol/sdkws/sdkws.proto index 8032ed836..57301c5be 100644 --- a/pkg/protocol/sdkws/sdkws.proto +++ b/pkg/protocol/sdkws/sdkws.proto @@ -14,12 +14,14 @@ syntax = "proto3"; package openim.sdkws; + import "wrapperspb/wrapperspb.proto"; + option go_package = "github.com/openimsdk/protocol/sdkws"; ////////////////////////////////base/////////////////////////////// -message GroupInfo{ +message GroupInfo { string groupID = 1; string groupName = 2; string notification = 3; @@ -39,7 +41,7 @@ message GroupInfo{ string notificationUserID = 17; } -message GroupInfoForSet{ +message GroupInfoForSet { string groupID = 1; string groupName = 2; string notification = 3; @@ -51,10 +53,9 @@ message GroupInfoForSet{ openim.protobuf.Int32Value applyMemberFriend = 9; } - message GroupMemberFullInfo { - string groupID = 1 ; - string userID = 2 ; + string groupID = 1; + string userID = 2; int32 roleLevel = 3; int64 joinTime = 4; string nickname = 5; @@ -67,14 +68,14 @@ message GroupMemberFullInfo { string inviterUserID = 12; } -message PublicUserInfo{ +message PublicUserInfo { string userID = 1; string nickname = 2; string faceURL = 3; string ex = 4; } -message UserInfo{ +message UserInfo { string userID = 1; string nickname = 2; string faceURL = 3; @@ -84,7 +85,7 @@ message UserInfo{ int32 globalRecvMsgOpt = 7; } -message UserInfoWithEx{ +message UserInfoWithEx { string userID = 1; openim.protobuf.StringValue nickname = 2; openim.protobuf.StringValue faceURL = 3; @@ -92,7 +93,7 @@ message UserInfoWithEx{ openim.protobuf.Int32Value globalRecvMsgOpt = 7; } -message FriendInfo{ +message FriendInfo { string ownerUserID = 1; string remark = 2; int64 createTime = 3; @@ -103,7 +104,7 @@ message FriendInfo{ bool isPinned = 8; } -message BlackInfo{ +message BlackInfo { string ownerUserID = 1; int64 createTime = 2; PublicUserInfo blackUserInfo = 3; @@ -112,12 +113,12 @@ message BlackInfo{ string ex = 6; } -message GroupRequest{ +message GroupRequest { PublicUserInfo userInfo = 1; GroupInfo groupInfo = 2; int32 handleResult = 3; string reqMsg = 4; - string handleMsg = 5; + string handleMsg = 5; int64 reqTime = 6; string handleUserID = 7; int64 handleTime = 8; @@ -126,7 +127,7 @@ message GroupRequest{ string inviterUserID = 11; } -message FriendRequest{ +message FriendRequest { string fromUserID = 1; string fromNickname = 2; string fromFaceURL = 3; @@ -142,14 +143,12 @@ message FriendRequest{ string ex = 13; } - ///////////////////////////////////base end///////////////////////////////////// -enum PullOrder{ +enum PullOrder { PullOrderAsc = 0; PullOrderDesc = 1; - } -message PullMessageBySeqsReq{ +message PullMessageBySeqsReq { string userID = 1; repeated SeqRange seqRanges = 2; PullOrder order = 3; @@ -184,19 +183,19 @@ message GetMaxSeqResp { message UserSendMsgResp { string serverMsgID = 1; string clientMsgID = 2; - int64 sendTime = 3; + int64 sendTime = 3; } message MsgData { - string sendID = 1; - string recvID = 2; + string sendID = 1; + string recvID = 2; string groupID = 3; string clientMsgID = 4; string serverMsgID = 5; int32 senderPlatformID = 6; - string senderNickname = 7; - string senderFaceURL = 8; - int32 sessionType = 9; + string senderNickname = 7; + string senderFaceURL = 8; + int32 sessionType = 9; int32 msgFrom = 10; int32 contentType = 11; bytes content = 12; @@ -211,11 +210,11 @@ message MsgData { string attachedInfo = 22; string ex = 23; } -message PushMessages{ +message PushMessages { map msgs = 1; map notificationMsgs = 2; } -message OfflinePushInfo{ +message OfflinePushInfo { string title = 1; string desc = 2; string ex = 3; @@ -224,7 +223,7 @@ message OfflinePushInfo{ string signalInfo = 6; } -message TipsComm{ +message TipsComm { bytes detail = 1; string defaultTips = 2; string jsonDetail = 3; @@ -232,9 +231,8 @@ message TipsComm{ //////////////////////group///////////////////// - // OnGroupCreated() -message GroupCreatedTips{ +message GroupCreatedTips { GroupInfo group = 1; GroupMemberFullInfo opUser = 2; repeated GroupMemberFullInfo memberList = 3; @@ -243,56 +241,55 @@ message GroupCreatedTips{ } // OnGroupInfoSet() -message GroupInfoSetTips{ +message GroupInfoSetTips { GroupMemberFullInfo opUser = 1; //who do this int64 muteTime = 2; GroupInfo group = 3; } -message GroupInfoSetNameTips{ +message GroupInfoSetNameTips { GroupMemberFullInfo opUser = 1; //who do this GroupInfo group = 2; } -message GroupInfoSetAnnouncementTips{ +message GroupInfoSetAnnouncementTips { GroupMemberFullInfo opUser = 1; //who do this GroupInfo group = 2; } // OnJoinGroupApplication() -message JoinGroupApplicationTips{ +message JoinGroupApplicationTips { GroupInfo group = 1; PublicUserInfo applicant = 2; - string reqMsg = 3; + string reqMsg = 3; } // OnQuitGroup() //Actively leave the group -message MemberQuitTips{ +message MemberQuitTips { GroupInfo group = 1; GroupMemberFullInfo quitUser = 2; int64 operationTime = 3; } - // OnApplicationGroupAccepted() -message GroupApplicationAcceptedTips{ +message GroupApplicationAcceptedTips { GroupInfo group = 1; GroupMemberFullInfo opUser = 2; - string handleMsg = 4; + string handleMsg = 4; int32 receiverAs = 5; // admin(==1) or applicant(==0) } // OnApplicationGroupRejected() -message GroupApplicationRejectedTips{ +message GroupApplicationRejectedTips { GroupInfo group = 1; GroupMemberFullInfo opUser = 2; - string handleMsg = 4; + string handleMsg = 4; int32 receiverAs = 5; // admin(==1) or applicant(==0) } // OnTransferGroupOwner() -message GroupOwnerTransferredTips{ +message GroupOwnerTransferredTips { GroupInfo group = 1; GroupMemberFullInfo opUser = 2; GroupMemberFullInfo newGroupOwner = 3; @@ -300,9 +297,8 @@ message GroupOwnerTransferredTips{ int64 operationTime = 5; } - // OnMemberKicked() -message MemberKickedTips{ +message MemberKickedTips { GroupInfo group = 1; GroupMemberFullInfo opUser = 2; repeated GroupMemberFullInfo kickedUserList = 3; @@ -310,7 +306,7 @@ message MemberKickedTips{ } // OnMemberInvited() -message MemberInvitedTips{ +message MemberInvitedTips { GroupInfo group = 1; GroupMemberFullInfo opUser = 2; repeated GroupMemberFullInfo invitedUserList = 3; @@ -318,19 +314,19 @@ message MemberInvitedTips{ } //Actively join the group -message MemberEnterTips{ +message MemberEnterTips { GroupInfo group = 1; GroupMemberFullInfo entrantUser = 2; int64 operationTime = 3; } -message GroupDismissedTips{ +message GroupDismissedTips { GroupInfo group = 1; GroupMemberFullInfo opUser = 2; int64 operationTime = 3; } -message GroupMemberMutedTips{ +message GroupMemberMutedTips { GroupInfo group = 1; GroupMemberFullInfo opUser = 2; int64 operationTime = 3; @@ -338,26 +334,26 @@ message GroupMemberMutedTips{ uint32 mutedSeconds = 5; } -message GroupMemberCancelMutedTips{ +message GroupMemberCancelMutedTips { GroupInfo group = 1; GroupMemberFullInfo opUser = 2; int64 operationTime = 3; GroupMemberFullInfo mutedUser = 4; } -message GroupMutedTips{ +message GroupMutedTips { GroupInfo group = 1; GroupMemberFullInfo opUser = 2; int64 operationTime = 3; } -message GroupCancelMutedTips{ +message GroupCancelMutedTips { GroupInfo group = 1; GroupMemberFullInfo opUser = 2; int64 operationTime = 3; } -message GroupMemberInfoSetTips{ +message GroupMemberInfoSetTips { GroupInfo group = 1; GroupMemberFullInfo opUser = 2; int64 operationTime = 3; @@ -366,64 +362,61 @@ message GroupMemberInfoSetTips{ //////////////////////friend///////////////////// -message FriendApplication{ +message FriendApplication { int64 addTime = 1; string addSource = 2; string addWording = 3; } -message FromToUserID{ +message FromToUserID { string fromUserID = 1; string toUserID = 2; } //FromUserID apply to add ToUserID -message FriendApplicationTips{ - FromToUserID fromToUserID = 1; //from:发起者; to:接收者 +message FriendApplicationTips { + FromToUserID fromToUserID = 1; //from:sender; to:receiver } //FromUserID accept or reject ToUserID -message FriendApplicationApprovedTips{ - FromToUserID fromToUserID = 1; //from:同意者;to:请求发起者 +message FriendApplicationApprovedTips { + FromToUserID fromToUserID = 1; //from: approver; to: requester string handleMsg = 2; } //FromUserID accept or reject ToUserID -message FriendApplicationRejectedTips{ - FromToUserID fromToUserID = 1; //from:拒绝者;to:请求发起者 +message FriendApplicationRejectedTips { + FromToUserID fromToUserID = 1; //from: rejecter; to: requester string handleMsg = 2; } - +} // FromUserID Added a friend ToUserID -message FriendAddedTips{ +message FriendAddedTips { FriendInfo friend = 1; int64 operationTime = 2; - PublicUserInfo opUser = 3; //who do this - + PublicUserInfo opUser = 3; //who do this } // FromUserID deleted a friend ToUserID -message FriendDeletedTips{ +message FriendDeletedTips { FromToUserID fromToUserID = 1; //from:owner; to:friend } - - -message BlackAddedTips{ +message BlackAddedTips { FromToUserID fromToUserID = 1; //from:owner; to:black } -message BlackDeletedTips{ +message BlackDeletedTips { FromToUserID fromToUserID = 1; //from:owner; to:black } -message FriendInfoChangedTips{ +message FriendInfoChangedTips { FromToUserID fromToUserID = 1; //from:changed; to:friend } //////////////////////user///////////////////// -message UserInfoUpdatedTips{ +message UserInfoUpdatedTips { string userID = 1; } @@ -447,12 +440,12 @@ message UserCommandDeleteTips { } //////////////////////conversation///////////////////// -message ConversationUpdateTips{ +message ConversationUpdateTips { string userID = 1; repeated string conversationIDList = 2; } -message ConversationSetPrivateTips{ +message ConversationSetPrivateTips { string recvID = 1; string sendID = 2; bool isPrivate = 3; @@ -475,14 +468,13 @@ message seqs { repeated int64 seqs = 1; } -message DeleteMessageTips{ +message DeleteMessageTips { string opUserID = 1; string userID = 2; repeated int64 seqs = 3; } - -message RevokeMsgTips{ +message RevokeMsgTips { string revokerUserID = 1; string clientMsgID = 2; int64 revokeTime = 3; @@ -492,19 +484,18 @@ message RevokeMsgTips{ bool isAdminRevoke = 8; } - message MessageRevokedContent { - string revokerID = 1; - int32 revokerRole = 2; - string clientMsgID = 3; - string revokerNickname = 4; - int64 revokeTime = 5; - int64 sourceMessageSendTime = 6; - string sourceMessageSendID = 7; - string sourceMessageSenderNickname = 8; - int32 sessionType = 10; - int64 seq = 11; - string ex = 12; + string revokerID = 1; + int32 revokerRole = 2; + string clientMsgID = 3; + string revokerNickname = 4; + int64 revokeTime = 5; + int64 sourceMessageSendTime = 6; + string sourceMessageSendID = 7; + string sourceMessageSenderNickname = 8; + int32 sessionType = 10; + int64 seq = 11; + string ex = 12; } message ClearConversationTips { @@ -513,7 +504,7 @@ message ClearConversationTips { } message DeleteMsgsTips { - string userID = 1; + string userID = 1; string conversationID = 2; repeated int64 seqs = 3; } @@ -525,15 +516,13 @@ message MarkAsReadTips { int64 hasReadSeq = 4; } - message SetAppBackgroundStatusReq { string userID = 1; bool isBackground = 2; } -message SetAppBackgroundStatusResp { -} -message ProcessUserCommand{ +message SetAppBackgroundStatusResp {} +message ProcessUserCommand { string userID = 1; int32 type = 2; int64 createTime = 3; @@ -545,7 +534,7 @@ message RequestPagination { int32 pageNumber = 1; int32 showNumber = 2; } -message FriendsInfoUpdateTips{ +message FriendsInfoUpdateTips { FromToUserID fromToUserID = 1; repeated string friendIDs = 2; } diff --git a/tools/check-component/main.go b/tools/check-component/main.go index cc3937baa..ab7676a16 100644 --- a/tools/check-component/main.go +++ b/tools/check-component/main.go @@ -24,7 +24,6 @@ import ( "github.com/openimsdk/chat/pkg/common/cmd" "github.com/openimsdk/chat/pkg/common/config" "github.com/openimsdk/chat/pkg/common/imapi" - constantpb "github.com/openimsdk/protocol/constant" "github.com/openimsdk/tools/db/mongoutil" "github.com/openimsdk/tools/db/redisutil" "github.com/openimsdk/tools/discovery/etcd" @@ -58,7 +57,7 @@ func CheckRedis(ctx context.Context, config *config.Redis) error { func CheckOpenIM(ctx context.Context, apiURL, secret, adminUserID string) error { imAPI := imapi.New(apiURL, secret, adminUserID) - _, err := imAPI.UserToken(mcontext.SetOperationID(ctx, "CheckOpenIM"+idutil.OperationIDGenerator()), adminUserID, constantpb.AdminPlatformID) + _, err := imAPI.GetAdminToken(mcontext.SetOperationID(ctx, "CheckOpenIM"+idutil.OperationIDGenerator()), adminUserID) return err } diff --git a/version/version/version b/version/version/version new file mode 100644 index 000000000..b9268dae2 --- /dev/null +++ b/version/version/version @@ -0,0 +1 @@ +1.8.1 \ No newline at end of file diff --git a/version/version/version.go b/version/version/version.go new file mode 100644 index 000000000..23b3a82f5 --- /dev/null +++ b/version/version/version.go @@ -0,0 +1,6 @@ +package version + +import _ "embed" + +//go:embed version +var Version string