Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: modify scripts/*.sh #15

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/chat.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# 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 CI

on:
Expand Down
14 changes: 14 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# 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.


# options for analysis running
run:
Expand Down
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# 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.

FROM ubuntu

# 设置固定的项目路径
Expand Down
5 changes: 3 additions & 2 deletions cmd/api/admin_api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ import (
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/mw"
openKeeper "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry/zookeeper"
"github.com/OpenIMSDK/chat/internal/api"
"github.com/OpenIMSDK/chat/pkg/common/config"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

"github.com/OpenIMSDK/chat/internal/api"
"github.com/OpenIMSDK/chat/pkg/common/config"

"github.com/gin-gonic/gin"
)

Expand Down
5 changes: 3 additions & 2 deletions cmd/api/chat_api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ import (
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/mw"
openKeeper "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry/zookeeper"
"github.com/OpenIMSDK/chat/internal/api"
"github.com/OpenIMSDK/chat/pkg/common/config"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

"github.com/OpenIMSDK/chat/internal/api"
"github.com/OpenIMSDK/chat/pkg/common/config"

"github.com/gin-gonic/gin"
)

Expand Down
1 change: 1 addition & 0 deletions cmd/rpc/admin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package main

import (
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"

"github.com/OpenIMSDK/chat/pkg/common/chatrpcstart"

"github.com/OpenIMSDK/chat/internal/rpc/admin"
Expand Down
1 change: 1 addition & 0 deletions cmd/rpc/chat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package main

import (
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"

"github.com/OpenIMSDK/chat/pkg/common/chatrpcstart"

"github.com/OpenIMSDK/chat/internal/rpc/chat"
Expand Down
14 changes: 14 additions & 0 deletions deploy.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# 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.

# Use an existing docker image as base
FROM ubuntu

Expand Down
1 change: 0 additions & 1 deletion internal/api/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
)

func NewChat(chatConn, adminConn grpc.ClientConnInterface) *ChatApi {

return &ChatApi{chatClient: chat.NewChatClient(chatConn), adminClient: admin.NewAdminClient(adminConn)}
}

Expand Down
3 changes: 2 additions & 1 deletion internal/api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ import (
"context"

"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
"github.com/OpenIMSDK/chat/pkg/common/config"
"github.com/gin-gonic/gin"

"github.com/OpenIMSDK/chat/pkg/common/config"
)

func NewChatRoute(router gin.IRouter, discov discoveryregistry.SvcDiscoveryRegistry) {
Expand Down
5 changes: 4 additions & 1 deletion internal/rpc/admin/applet.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ package admin

import (
"context"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
"strings"
"time"

"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"

"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"

"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
"github.com/google/uuid"
Expand Down
1 change: 1 addition & 0 deletions internal/rpc/admin/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package admin
import (
"context"
"fmt"

"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"

"github.com/OpenIMSDK/chat/pkg/common/db/dbutil"
Expand Down
1 change: 1 addition & 0 deletions internal/rpc/admin/client_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package admin

import (
"context"

"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"

"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
Expand Down
5 changes: 4 additions & 1 deletion internal/rpc/admin/invitation.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ package admin

import (
"context"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
"math/rand"
"strings"
"time"

"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"

"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"

"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"

Expand Down
4 changes: 3 additions & 1 deletion internal/rpc/admin/ip_forbidden.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ package admin

import (
"context"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
"time"


"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"

admin2 "github.com/OpenIMSDK/chat/pkg/common/db/table/admin"
"github.com/OpenIMSDK/chat/pkg/common/mctx"
"github.com/OpenIMSDK/chat/pkg/proto/admin"
Expand Down
5 changes: 4 additions & 1 deletion internal/rpc/admin/register_add_friend.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ package admin

import (
"context"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
"strings"
"time"

"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"

"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"

"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"

Expand Down
5 changes: 4 additions & 1 deletion internal/rpc/admin/register_add_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ package admin

import (
"context"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
"strings"
"time"

"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"

"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"

"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws"
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
Expand Down
1 change: 1 addition & 0 deletions internal/rpc/admin/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package admin

import (
"context"

"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"

"github.com/OpenIMSDK/chat/pkg/common/config"
Expand Down
7 changes: 5 additions & 2 deletions internal/rpc/admin/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ package admin

import (
"context"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
"github.com/OpenIMSDK/chat/pkg/common/constant"
"strings"
"time"


"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"

"github.com/OpenIMSDK/chat/pkg/common/constant"

"github.com/OpenIMSDK/Open-IM-Server/pkg/common/mcontext"
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb"
Expand Down
4 changes: 3 additions & 1 deletion internal/rpc/admin/user_ip_limit_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ package admin

import (
"context"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
"time"


"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"

"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"

Expand Down
5 changes: 4 additions & 1 deletion internal/rpc/chat/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ package chat

import (
"context"
"github.com/OpenIMSDK/chat/pkg/common/mctx"
"math/rand"
"strconv"
"strings"
"time"

"github.com/OpenIMSDK/chat/pkg/common/mctx"

"github.com/OpenIMSDK/chat/pkg/common/mctx"

constant2 "github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/mcontext"
Expand Down
1 change: 1 addition & 0 deletions internal/rpc/chat/password.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package chat

import (
"context"

"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"

"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
Expand Down
1 change: 1 addition & 0 deletions internal/rpc/chat/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package chat

import (
"context"

"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"

"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
Expand Down
23 changes: 18 additions & 5 deletions pkg/common/chatrpcstart/start.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
// 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.

package chatrpcstart

import (
"fmt"
"net"
"strconv"
"time"

"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/mw"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/network"
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
openKeeper "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry/zookeeper"
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
"github.com/OpenIMSDK/chat/pkg/common/config"
chatMw "github.com/OpenIMSDK/chat/pkg/common/mw"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"net"
"strconv"
"time"
)

func Start(rpcPort int, rpcRegisterName string, prometheusPort int, rpcFn func(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error, options ...grpc.ServerOption) error {
Expand Down
7 changes: 2 additions & 5 deletions pkg/common/config/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,16 @@ import (
"bytes"
"errors"
"fmt"
openIMConfig "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
openKeeper "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry/zookeeper"
"gopkg.in/yaml.v3"
"os"
"path/filepath"
"runtime"
"time"

)

var (
_, b, _, _ = runtime.Caller(0)
// Root folder of this project
// Root folder of this project.
Root = filepath.Join(filepath.Dir(b), "../../..")
)

Expand Down
8 changes: 5 additions & 3 deletions pkg/common/db/database/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ package database

import (
"context"
"time"

"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/tx"
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
"gorm.io/gorm"

admin2 "github.com/OpenIMSDK/chat/pkg/common/db/model/admin"
"github.com/OpenIMSDK/chat/pkg/common/db/model/chat"
"github.com/OpenIMSDK/chat/pkg/common/db/table/admin"
table "github.com/OpenIMSDK/chat/pkg/common/db/table/chat"
"gorm.io/gorm"
"time"
)

type ChatDatabaseInterface interface {
Expand Down Expand Up @@ -116,7 +118,7 @@ func (o *ChatDatabase) TakeAttributeByUserID(ctx context.Context, userID string)
}

func (o *ChatDatabase) Search(ctx context.Context, normalUser int32, keyword string, genders []int32, pageNumber int32, showNumber int32) (uint32, []*table.Attribute, error) {
var forbiddenIDs = []string{}
forbiddenIDs := []string{}
if normalUser == 1 {
_, forbiddenUsers, err := o.forbiddenAccount.Search(ctx, keyword, pageNumber, showNumber)
if err != nil {
Expand Down
Loading
Loading