From 335efdb565999c33d98af23e72f2cff28b989fe4 Mon Sep 17 00:00:00 2001 From: Monet Lee Date: Mon, 23 Sep 2024 14:07:08 +0800 Subject: [PATCH 1/2] fix: reset UserPassword in admin. (#572) * update dockerfile contents. * update field. * fix: reset UserPassword in admin. --- internal/api/admin/admin.go | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/internal/api/admin/admin.go b/internal/api/admin/admin.go index e0586939c..96f159742 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 { @@ -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) { From 4adbbc59b131230f33ba7ca83fbc6f83e699b3cd Mon Sep 17 00:00:00 2001 From: Monet Lee Date: Mon, 23 Sep 2024 14:51:14 +0800 Subject: [PATCH 2/2] refactor: improve github workflows. (#573) * update dockerfile contents. * update field. * refactor: improve github workflows. * remove en --- .github/.codecov.yml | 1 - .github/code-language-detector.yml | 7 - .github/labels.yml | 43 ------ .github/sync-release.yml | 16 -- .github/weekly-digest.yml | 21 --- .github/workflows/auto-assign-issue.yml | 28 +--- .github/workflows/auto-gh-pr.yml | 60 -------- .github/workflows/auto-invite-comment.yml | 39 +++++ .github/workflows/auto-tag.yml | 52 ------- .github/workflows/build-docker-image.yml | 14 -- .github/workflows/chatci.yml | 17 +-- .github/workflows/check-coverage.yml | 14 -- .github/workflows/cla-assistant.yml | 40 +++++ .github/workflows/cla.yml | 62 -------- .github/workflows/codeql-analysis.yml | 103 ++++++------- .github/workflows/comment-check.yml | 51 +++++++ .github/workflows/depsreview.yaml | 18 --- .github/workflows/gosec.yml | 14 -- .github/workflows/help-comment-issue.yml | 21 +-- .github/workflows/issue-translator.yml | 19 +++ .github/workflows/language-check.yml | 13 -- .github/workflows/project-progress.yml | 36 ----- .github/workflows/pull-request.yml | 115 -------------- .github/workflows/release.yml | 14 -- .github/workflows/reopen-issue.yml | 78 ++++++++++ pkg/protocol/sdkws/sdkws.proto | 173 ++++++++++------------ 26 files changed, 368 insertions(+), 701 deletions(-) delete mode 100644 .github/code-language-detector.yml delete mode 100644 .github/labels.yml delete mode 100644 .github/weekly-digest.yml delete mode 100644 .github/workflows/auto-gh-pr.yml create mode 100644 .github/workflows/auto-invite-comment.yml delete mode 100644 .github/workflows/auto-tag.yml create mode 100644 .github/workflows/cla-assistant.yml delete mode 100644 .github/workflows/cla.yml create mode 100644 .github/workflows/comment-check.yml delete mode 100644 .github/workflows/depsreview.yaml create mode 100644 .github/workflows/issue-translator.yml delete mode 100644 .github/workflows/language-check.yml delete mode 100644 .github/workflows/project-progress.yml delete mode 100644 .github/workflows/pull-request.yml create mode 100644 .github/workflows/reopen-issue.yml 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..b4ef74eb2 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,8 +32,8 @@ jobs: permissions: contents: write pull-requests: write - environment: - name: openim + # environment: + # name: openim strategy: matrix: arch: [arm64, armv7, amd64] 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/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; }