From 1754f4faeb57a8ee6ea68fae673fd92121577d4c Mon Sep 17 00:00:00 2001 From: benqi <teamgram.io@gmail.com> Date: Wed, 2 Mar 2022 11:41:23 +0800 Subject: [PATCH] Initial commit --- app/bff/bff/internal/server/server.go | 16 --- app/bff/gdpr/client/gdpr_client.go | 66 ----------- app/bff/gdpr/cmd/gdpr/main.go | 21 ---- app/bff/gdpr/etc/gdpr.yaml | 2 - app/bff/gdpr/helper.go | 25 ---- app/bff/gdpr/internal/config/config.go | 27 ----- .../account.finishTakeoutSession_handler.go | 32 ------ .../account.initTakeoutSession_handler.go | 32 ------ .../core/channels.getLeftChannels_handler.go | 32 ------ app/bff/gdpr/internal/core/core.go | 44 ------- .../core/messages.getSplitRanges_handler.go | 32 ------ app/bff/gdpr/internal/dao/dao.go | 26 ----- app/bff/gdpr/internal/server/grpc/grpc.go | 30 ----- .../server/grpc/service/gdpr_service_impl.go | 78 ------------- .../internal/server/grpc/service/service.go | 25 ---- app/bff/gdpr/internal/server/server.go | 62 ---------- app/bff/gdpr/internal/svc/service_context.go | 33 ------ .../statistics/client/statistics_client.go | 82 ------------- app/bff/statistics/cmd/statistics/main.go | 21 ---- app/bff/statistics/etc/statistics.yaml | 2 - app/bff/statistics/helper.go | 25 ---- app/bff/statistics/internal/config/config.go | 27 ----- app/bff/statistics/internal/core/core.go | 44 ------- .../core/messages.getStatsURL_handler.go | 32 ------ .../core/stats.getBroadcastStats_handler.go | 32 ------ .../core/stats.getMegagroupStats_handler.go | 32 ------ .../stats.getMessagePublicForwards_handler.go | 32 ------ .../core/stats.getMessageStats_handler.go | 32 ------ .../core/stats.loadAsyncGraph_handler.go | 32 ------ app/bff/statistics/internal/dao/dao.go | 26 ----- .../statistics/internal/server/grpc/grpc.go | 30 ----- .../internal/server/grpc/service/service.go | 25 ---- .../grpc/service/statistics_service_impl.go | 108 ------------------ app/bff/statistics/internal/server/server.go | 62 ---------- .../internal/svc/service_context.go | 33 ------ 35 files changed, 1260 deletions(-) delete mode 100644 app/bff/gdpr/client/gdpr_client.go delete mode 100644 app/bff/gdpr/cmd/gdpr/main.go delete mode 100644 app/bff/gdpr/etc/gdpr.yaml delete mode 100644 app/bff/gdpr/helper.go delete mode 100644 app/bff/gdpr/internal/config/config.go delete mode 100644 app/bff/gdpr/internal/core/account.finishTakeoutSession_handler.go delete mode 100644 app/bff/gdpr/internal/core/account.initTakeoutSession_handler.go delete mode 100644 app/bff/gdpr/internal/core/channels.getLeftChannels_handler.go delete mode 100644 app/bff/gdpr/internal/core/core.go delete mode 100644 app/bff/gdpr/internal/core/messages.getSplitRanges_handler.go delete mode 100644 app/bff/gdpr/internal/dao/dao.go delete mode 100644 app/bff/gdpr/internal/server/grpc/grpc.go delete mode 100644 app/bff/gdpr/internal/server/grpc/service/gdpr_service_impl.go delete mode 100644 app/bff/gdpr/internal/server/grpc/service/service.go delete mode 100644 app/bff/gdpr/internal/server/server.go delete mode 100644 app/bff/gdpr/internal/svc/service_context.go delete mode 100644 app/bff/statistics/client/statistics_client.go delete mode 100644 app/bff/statistics/cmd/statistics/main.go delete mode 100644 app/bff/statistics/etc/statistics.yaml delete mode 100644 app/bff/statistics/helper.go delete mode 100644 app/bff/statistics/internal/config/config.go delete mode 100644 app/bff/statistics/internal/core/core.go delete mode 100644 app/bff/statistics/internal/core/messages.getStatsURL_handler.go delete mode 100644 app/bff/statistics/internal/core/stats.getBroadcastStats_handler.go delete mode 100644 app/bff/statistics/internal/core/stats.getMegagroupStats_handler.go delete mode 100644 app/bff/statistics/internal/core/stats.getMessagePublicForwards_handler.go delete mode 100644 app/bff/statistics/internal/core/stats.getMessageStats_handler.go delete mode 100644 app/bff/statistics/internal/core/stats.loadAsyncGraph_handler.go delete mode 100644 app/bff/statistics/internal/dao/dao.go delete mode 100644 app/bff/statistics/internal/server/grpc/grpc.go delete mode 100644 app/bff/statistics/internal/server/grpc/service/service.go delete mode 100644 app/bff/statistics/internal/server/grpc/service/statistics_service_impl.go delete mode 100644 app/bff/statistics/internal/server/server.go delete mode 100644 app/bff/statistics/internal/svc/service_context.go diff --git a/app/bff/bff/internal/server/server.go b/app/bff/bff/internal/server/server.go index 65ccbbdab..4cbbf8481 100644 --- a/app/bff/bff/internal/server/server.go +++ b/app/bff/bff/internal/server/server.go @@ -33,7 +33,6 @@ import ( emoji_helper "github.com/teamgram/teamgram-server/app/bff/emoji" files_helper "github.com/teamgram/teamgram-server/app/bff/files" folders_helper "github.com/teamgram/teamgram-server/app/bff/folders" - gdpr_helper "github.com/teamgram/teamgram-server/app/bff/gdpr" gifs_helper "github.com/teamgram/teamgram-server/app/bff/gifs" langpack_helper "github.com/teamgram/teamgram-server/app/bff/langpack" messages_helper "github.com/teamgram/teamgram-server/app/bff/messages" @@ -47,7 +46,6 @@ import ( reports_helper "github.com/teamgram/teamgram-server/app/bff/reports" secretchats_helper "github.com/teamgram/teamgram-server/app/bff/secretchats" sponsoredmessages_helper "github.com/teamgram/teamgram-server/app/bff/sponsoredmessages" - statistics_helper "github.com/teamgram/teamgram-server/app/bff/statistics" stickers_helper "github.com/teamgram/teamgram-server/app/bff/stickers" themes_helper "github.com/teamgram/teamgram-server/app/bff/themes" tos_helper "github.com/teamgram/teamgram-server/app/bff/tos" @@ -138,13 +136,6 @@ func (s *Server) Initialize() error { MsgClient: c.MsgClient, })) - // gdpr_helper - mtproto.RegisterRPCGdprServer( - grpcServer, - gdpr_helper.New(gdpr_helper.Config{ - RpcServerConf: c.RpcServerConf, - })) - // gifs_helper mtproto.RegisterRPCGifsServer( grpcServer, @@ -350,13 +341,6 @@ func (s *Server) Initialize() error { RpcServerConf: c.RpcServerConf, })) - // statistics_helper - mtproto.RegisterRPCStatisticsServer( - grpcServer, - statistics_helper.New(statistics_helper.Config{ - RpcServerConf: c.RpcServerConf, - })) - // stickers_helper mtproto.RegisterRPCStickersServer( grpcServer, diff --git a/app/bff/gdpr/client/gdpr_client.go b/app/bff/gdpr/client/gdpr_client.go deleted file mode 100644 index 03fa8ea54..000000000 --- a/app/bff/gdpr/client/gdpr_client.go +++ /dev/null @@ -1,66 +0,0 @@ -/* - * WARNING! All changes made in this file will be lost! - * Created from 'scheme.tl' by 'mtprotoc' - * - * Copyright 2022 Teamgram Authors. - * All rights reserved. - * - * Author: teamgramio (teamgram.io@gmail.com) - */ - -package gdpr_client - -import ( - "context" - - "github.com/teamgram/proto/mtproto" - - "github.com/zeromicro/go-zero/zrpc" -) - -var _ *mtproto.Bool - -type GdprClient interface { - AccountInitTakeoutSession(ctx context.Context, in *mtproto.TLAccountInitTakeoutSession) (*mtproto.Account_Takeout, error) - AccountFinishTakeoutSession(ctx context.Context, in *mtproto.TLAccountFinishTakeoutSession) (*mtproto.Bool, error) - MessagesGetSplitRanges(ctx context.Context, in *mtproto.TLMessagesGetSplitRanges) (*mtproto.Vector_MessageRange, error) - ChannelsGetLeftChannels(ctx context.Context, in *mtproto.TLChannelsGetLeftChannels) (*mtproto.Messages_Chats, error) -} - -type defaultGdprClient struct { - cli zrpc.Client -} - -func NewGdprClient(cli zrpc.Client) GdprClient { - return &defaultGdprClient{ - cli: cli, - } -} - -// AccountInitTakeoutSession -// account.initTakeoutSession#f05b4804 flags:# contacts:flags.0?true message_users:flags.1?true message_chats:flags.2?true message_megagroups:flags.3?true message_channels:flags.4?true files:flags.5?true file_max_size:flags.5?int = account.Takeout; -func (m *defaultGdprClient) AccountInitTakeoutSession(ctx context.Context, in *mtproto.TLAccountInitTakeoutSession) (*mtproto.Account_Takeout, error) { - client := mtproto.NewRPCGdprClient(m.cli.Conn()) - return client.AccountInitTakeoutSession(ctx, in) -} - -// AccountFinishTakeoutSession -// account.finishTakeoutSession#1d2652ee flags:# success:flags.0?true = Bool; -func (m *defaultGdprClient) AccountFinishTakeoutSession(ctx context.Context, in *mtproto.TLAccountFinishTakeoutSession) (*mtproto.Bool, error) { - client := mtproto.NewRPCGdprClient(m.cli.Conn()) - return client.AccountFinishTakeoutSession(ctx, in) -} - -// MessagesGetSplitRanges -// messages.getSplitRanges#1cff7e08 = Vector<MessageRange>; -func (m *defaultGdprClient) MessagesGetSplitRanges(ctx context.Context, in *mtproto.TLMessagesGetSplitRanges) (*mtproto.Vector_MessageRange, error) { - client := mtproto.NewRPCGdprClient(m.cli.Conn()) - return client.MessagesGetSplitRanges(ctx, in) -} - -// ChannelsGetLeftChannels -// channels.getLeftChannels#8341ecc0 offset:int = messages.Chats; -func (m *defaultGdprClient) ChannelsGetLeftChannels(ctx context.Context, in *mtproto.TLChannelsGetLeftChannels) (*mtproto.Messages_Chats, error) { - client := mtproto.NewRPCGdprClient(m.cli.Conn()) - return client.ChannelsGetLeftChannels(ctx, in) -} diff --git a/app/bff/gdpr/cmd/gdpr/main.go b/app/bff/gdpr/cmd/gdpr/main.go deleted file mode 100644 index 16490122e..000000000 --- a/app/bff/gdpr/cmd/gdpr/main.go +++ /dev/null @@ -1,21 +0,0 @@ -/* - * WARNING! All changes made in this file will be lost! - * Created from 'scheme.tl' by 'mtprotoc' - * - * Copyright 2022 Teamgram Authors. - * All rights reserved. - * - * Author: teamgramio (teamgram.io@gmail.com) - */ - -package main - -import ( - "github.com/teamgram/marmota/pkg/commands" - - "github.com/teamgram/teamgram-server/app/bff/gdpr/internal/server" -) - -func main() { - commands.Run(server.New()) -} diff --git a/app/bff/gdpr/etc/gdpr.yaml b/app/bff/gdpr/etc/gdpr.yaml deleted file mode 100644 index 6af4d7448..000000000 --- a/app/bff/gdpr/etc/gdpr.yaml +++ /dev/null @@ -1,2 +0,0 @@ -Name: bff.gdpr -ListenOn: 0.0.0.0:21260 diff --git a/app/bff/gdpr/helper.go b/app/bff/gdpr/helper.go deleted file mode 100644 index 2e1ad7192..000000000 --- a/app/bff/gdpr/helper.go +++ /dev/null @@ -1,25 +0,0 @@ -/* - * WARNING! All changes made in this file will be lost! - * Created from 'scheme.tl' by 'mtprotoc' - * - * Copyright 2022 Teamgram Authors. - * All rights reserved. - * - * Author: teamgramio (teamgram.io@gmail.com) - */ - -package gdpr_helper - -import ( - "github.com/teamgram/teamgram-server/app/bff/gdpr/internal/config" - "github.com/teamgram/teamgram-server/app/bff/gdpr/internal/server/grpc/service" - "github.com/teamgram/teamgram-server/app/bff/gdpr/internal/svc" -) - -type ( - Config = config.Config -) - -func New(c Config) *service.Service { - return service.New(svc.NewServiceContext(c)) -} diff --git a/app/bff/gdpr/internal/config/config.go b/app/bff/gdpr/internal/config/config.go deleted file mode 100644 index e2aec3578..000000000 --- a/app/bff/gdpr/internal/config/config.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 Teamgram Authors -// 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. -// -// Author: teamgramio (teamgram.io@gmail.com) -// - -package config - -import ( - "github.com/zeromicro/go-zero/zrpc" -) - -type Config struct { - zrpc.RpcServerConf -} diff --git a/app/bff/gdpr/internal/core/account.finishTakeoutSession_handler.go b/app/bff/gdpr/internal/core/account.finishTakeoutSession_handler.go deleted file mode 100644 index 7c792db29..000000000 --- a/app/bff/gdpr/internal/core/account.finishTakeoutSession_handler.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 Teamgram Authors -// 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. -// -// Author: teamgramio (teamgram.io@gmail.com) -// - -package core - -import ( - "github.com/teamgram/proto/mtproto" -) - -// AccountFinishTakeoutSession -// account.finishTakeoutSession#1d2652ee flags:# success:flags.0?true = Bool; -func (c *GdprCore) AccountFinishTakeoutSession(in *mtproto.TLAccountFinishTakeoutSession) (*mtproto.Bool, error) { - // TODO: not impl - c.Logger.Errorf("account.finishTakeoutSession blocked, License key from https://teamgram.net required to unlock enterprise features.") - - return nil, mtproto.ErrEnterpriseIsBlocked -} diff --git a/app/bff/gdpr/internal/core/account.initTakeoutSession_handler.go b/app/bff/gdpr/internal/core/account.initTakeoutSession_handler.go deleted file mode 100644 index 79d413d4e..000000000 --- a/app/bff/gdpr/internal/core/account.initTakeoutSession_handler.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 Teamgram Authors -// 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. -// -// Author: teamgramio (teamgram.io@gmail.com) -// - -package core - -import ( - "github.com/teamgram/proto/mtproto" -) - -// AccountInitTakeoutSession -// account.initTakeoutSession#f05b4804 flags:# contacts:flags.0?true message_users:flags.1?true message_chats:flags.2?true message_megagroups:flags.3?true message_channels:flags.4?true files:flags.5?true file_max_size:flags.5?int = account.Takeout; -func (c *GdprCore) AccountInitTakeoutSession(in *mtproto.TLAccountInitTakeoutSession) (*mtproto.Account_Takeout, error) { - // TODO: not impl - c.Logger.Errorf("account.initTakeoutSession blocked, License key from https://teamgram.net required to unlock enterprise features.") - - return nil, mtproto.ErrEnterpriseIsBlocked -} diff --git a/app/bff/gdpr/internal/core/channels.getLeftChannels_handler.go b/app/bff/gdpr/internal/core/channels.getLeftChannels_handler.go deleted file mode 100644 index 6fe296574..000000000 --- a/app/bff/gdpr/internal/core/channels.getLeftChannels_handler.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 Teamgram Authors -// 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. -// -// Author: teamgramio (teamgram.io@gmail.com) -// - -package core - -import ( - "github.com/teamgram/proto/mtproto" -) - -// ChannelsGetLeftChannels -// channels.getLeftChannels#8341ecc0 offset:int = messages.Chats; -func (c *GdprCore) ChannelsGetLeftChannels(in *mtproto.TLChannelsGetLeftChannels) (*mtproto.Messages_Chats, error) { - // TODO: not impl - c.Logger.Errorf("channels.getLeftChannels blocked, License key from https://teamgram.net required to unlock enterprise features.") - - return nil, mtproto.ErrEnterpriseIsBlocked -} diff --git a/app/bff/gdpr/internal/core/core.go b/app/bff/gdpr/internal/core/core.go deleted file mode 100644 index 5a87cc3a5..000000000 --- a/app/bff/gdpr/internal/core/core.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2022 Teamgram Authors -// 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. -// -// Author: teamgramio (teamgram.io@gmail.com) -// - -package core - -import ( - "context" - - "github.com/zeromicro/go-zero/core/logx" - - "github.com/teamgram/proto/mtproto/rpc/metadata" - "github.com/teamgram/teamgram-server/app/bff/gdpr/internal/svc" -) - -type GdprCore struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger - MD *metadata.RpcMetadata -} - -func New(ctx context.Context, svcCtx *svc.ServiceContext) *GdprCore { - return &GdprCore{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - MD: metadata.RpcMetadataFromIncoming(ctx), - } -} diff --git a/app/bff/gdpr/internal/core/messages.getSplitRanges_handler.go b/app/bff/gdpr/internal/core/messages.getSplitRanges_handler.go deleted file mode 100644 index c300a1b11..000000000 --- a/app/bff/gdpr/internal/core/messages.getSplitRanges_handler.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 Teamgram Authors -// 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. -// -// Author: teamgramio (teamgram.io@gmail.com) -// - -package core - -import ( - "github.com/teamgram/proto/mtproto" -) - -// MessagesGetSplitRanges -// messages.getSplitRanges#1cff7e08 = Vector<MessageRange>; -func (c *GdprCore) MessagesGetSplitRanges(in *mtproto.TLMessagesGetSplitRanges) (*mtproto.Vector_MessageRange, error) { - // TODO: not impl - c.Logger.Errorf("messages.getSplitRanges blocked, License key from https://teamgram.net required to unlock enterprise features.") - - return nil, mtproto.ErrEnterpriseIsBlocked -} diff --git a/app/bff/gdpr/internal/dao/dao.go b/app/bff/gdpr/internal/dao/dao.go deleted file mode 100644 index 0460e330a..000000000 --- a/app/bff/gdpr/internal/dao/dao.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2022 Teamgram Authors -// 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. -// -// Author: teamgramio (teamgram.io@gmail.com) -// - -package dao - -type Dao struct { -} - -func New() *Dao { - return new(Dao) -} diff --git a/app/bff/gdpr/internal/server/grpc/grpc.go b/app/bff/gdpr/internal/server/grpc/grpc.go deleted file mode 100644 index 7bb129a21..000000000 --- a/app/bff/gdpr/internal/server/grpc/grpc.go +++ /dev/null @@ -1,30 +0,0 @@ -/* - * WARNING! All changes made in this file will be lost! - * Created from 'scheme.tl' by 'mtprotoc' - * - * Copyright 2022 Teamgram Authors. - * All rights reserved. - * - * Author: teamgramio (teamgram.io@gmail.com) - */ - -package grpc - -import ( - "github.com/teamgram/proto/mtproto" - "github.com/teamgram/teamgram-server/app/bff/gdpr/internal/server/grpc/service" - "github.com/teamgram/teamgram-server/app/bff/gdpr/internal/svc" - - "github.com/zeromicro/go-zero/core/logx" - "github.com/zeromicro/go-zero/zrpc" - "google.golang.org/grpc" -) - -// New new a grpc server. -func New(ctx *svc.ServiceContext, c zrpc.RpcServerConf) *zrpc.RpcServer { - s, err := zrpc.NewServer(c, func(grpcServer *grpc.Server) { - mtproto.RegisterRPCGdprServer(grpcServer, service.New(ctx)) - }) - logx.Must(err) - return s -} diff --git a/app/bff/gdpr/internal/server/grpc/service/gdpr_service_impl.go b/app/bff/gdpr/internal/server/grpc/service/gdpr_service_impl.go deleted file mode 100644 index 7b447fb79..000000000 --- a/app/bff/gdpr/internal/server/grpc/service/gdpr_service_impl.go +++ /dev/null @@ -1,78 +0,0 @@ -/* - * WARNING! All changes made in this file will be lost! - * Created from 'scheme.tl' by 'mtprotoc' - * - * Copyright 2022 Teamgram Authors. - * All rights reserved. - * - * Author: teamgramio (teamgram.io@gmail.com) - */ - -package service - -import ( - "context" - - "github.com/teamgram/proto/mtproto" - "github.com/teamgram/teamgram-server/app/bff/gdpr/internal/core" -) - -// AccountInitTakeoutSession -// account.initTakeoutSession#f05b4804 flags:# contacts:flags.0?true message_users:flags.1?true message_chats:flags.2?true message_megagroups:flags.3?true message_channels:flags.4?true files:flags.5?true file_max_size:flags.5?int = account.Takeout; -func (s *Service) AccountInitTakeoutSession(ctx context.Context, request *mtproto.TLAccountInitTakeoutSession) (*mtproto.Account_Takeout, error) { - c := core.New(ctx, s.svcCtx) - c.Infof("account.initTakeoutSession - metadata: %s, request: %s", c.MD.DebugString(), request.DebugString()) - - r, err := c.AccountInitTakeoutSession(request) - if err != nil { - return nil, err - } - - c.Infof("account.initTakeoutSession - reply: %s", r.DebugString()) - return r, err -} - -// AccountFinishTakeoutSession -// account.finishTakeoutSession#1d2652ee flags:# success:flags.0?true = Bool; -func (s *Service) AccountFinishTakeoutSession(ctx context.Context, request *mtproto.TLAccountFinishTakeoutSession) (*mtproto.Bool, error) { - c := core.New(ctx, s.svcCtx) - c.Infof("account.finishTakeoutSession - metadata: %s, request: %s", c.MD.DebugString(), request.DebugString()) - - r, err := c.AccountFinishTakeoutSession(request) - if err != nil { - return nil, err - } - - c.Infof("account.finishTakeoutSession - reply: %s", r.DebugString()) - return r, err -} - -// MessagesGetSplitRanges -// messages.getSplitRanges#1cff7e08 = Vector<MessageRange>; -func (s *Service) MessagesGetSplitRanges(ctx context.Context, request *mtproto.TLMessagesGetSplitRanges) (*mtproto.Vector_MessageRange, error) { - c := core.New(ctx, s.svcCtx) - c.Infof("messages.getSplitRanges - metadata: %s, request: %s", c.MD.DebugString(), request.DebugString()) - - r, err := c.MessagesGetSplitRanges(request) - if err != nil { - return nil, err - } - - c.Infof("messages.getSplitRanges - reply: %s", r.DebugString()) - return r, err -} - -// ChannelsGetLeftChannels -// channels.getLeftChannels#8341ecc0 offset:int = messages.Chats; -func (s *Service) ChannelsGetLeftChannels(ctx context.Context, request *mtproto.TLChannelsGetLeftChannels) (*mtproto.Messages_Chats, error) { - c := core.New(ctx, s.svcCtx) - c.Infof("channels.getLeftChannels - metadata: %s, request: %s", c.MD.DebugString(), request.DebugString()) - - r, err := c.ChannelsGetLeftChannels(request) - if err != nil { - return nil, err - } - - c.Infof("channels.getLeftChannels - reply: %s", r.DebugString()) - return r, err -} diff --git a/app/bff/gdpr/internal/server/grpc/service/service.go b/app/bff/gdpr/internal/server/grpc/service/service.go deleted file mode 100644 index ed7626822..000000000 --- a/app/bff/gdpr/internal/server/grpc/service/service.go +++ /dev/null @@ -1,25 +0,0 @@ -/* - * WARNING! All changes made in this file will be lost! - * Created from 'scheme.tl' by 'mtprotoc' - * - * Copyright 2022 Teamgram Authors. - * All rights reserved. - * - * Author: teamgramio (teamgram.io@gmail.com) - */ - -package service - -import ( - "github.com/teamgram/teamgram-server/app/bff/gdpr/internal/svc" -) - -type Service struct { - svcCtx *svc.ServiceContext -} - -func New(ctx *svc.ServiceContext) *Service { - return &Service{ - svcCtx: ctx, - } -} diff --git a/app/bff/gdpr/internal/server/server.go b/app/bff/gdpr/internal/server/server.go deleted file mode 100644 index 3c034ef8e..000000000 --- a/app/bff/gdpr/internal/server/server.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2022 Teamgram Authors -// 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. -// -// Author: teamgramio (teamgram.io@gmail.com) -// - -package server - -import ( - "flag" - - "github.com/teamgram/teamgram-server/app/bff/gdpr/internal/config" - "github.com/teamgram/teamgram-server/app/bff/gdpr/internal/server/grpc" - "github.com/teamgram/teamgram-server/app/bff/gdpr/internal/svc" - - "github.com/zeromicro/go-zero/core/conf" - "github.com/zeromicro/go-zero/core/logx" - "github.com/zeromicro/go-zero/zrpc" -) - -var configFile = flag.String("f", "etc/gdpr.yaml", "the config file") - -type Server struct { - grpcSrv *zrpc.RpcServer -} - -func New() *Server { - return new(Server) -} - -func (s *Server) Initialize() error { - var c config.Config - conf.MustLoad(*configFile, &c) - - logx.Infov(c) - ctx := svc.NewServiceContext(c) - s.grpcSrv = grpc.New(ctx, c.RpcServerConf) - - go func() { - go s.grpcSrv.Start() - }() - return nil -} - -func (s *Server) RunLoop() { -} - -func (s *Server) Destroy() { - s.grpcSrv.Stop() -} diff --git a/app/bff/gdpr/internal/svc/service_context.go b/app/bff/gdpr/internal/svc/service_context.go deleted file mode 100644 index 386da3ea2..000000000 --- a/app/bff/gdpr/internal/svc/service_context.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 Teamgram Authors -// 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. -// -// Author: teamgramio (teamgram.io@gmail.com) -// - -package svc - -import ( - "github.com/teamgram/teamgram-server/app/bff/gdpr/internal/config" -) - -type ServiceContext struct { - Config config.Config -} - -func NewServiceContext(c config.Config) *ServiceContext { - return &ServiceContext{ - Config: c, - } -} diff --git a/app/bff/statistics/client/statistics_client.go b/app/bff/statistics/client/statistics_client.go deleted file mode 100644 index 8818914f9..000000000 --- a/app/bff/statistics/client/statistics_client.go +++ /dev/null @@ -1,82 +0,0 @@ -/* - * WARNING! All changes made in this file will be lost! - * Created from 'scheme.tl' by 'mtprotoc' - * - * Copyright 2022 Teamgram Authors. - * All rights reserved. - * - * Author: teamgramio (teamgram.io@gmail.com) - */ - -package statistics_client - -import ( - "context" - - "github.com/teamgram/proto/mtproto" - - "github.com/zeromicro/go-zero/zrpc" -) - -var _ *mtproto.Bool - -type StatisticsClient interface { - StatsGetBroadcastStats(ctx context.Context, in *mtproto.TLStatsGetBroadcastStats) (*mtproto.Stats_BroadcastStats, error) - StatsLoadAsyncGraph(ctx context.Context, in *mtproto.TLStatsLoadAsyncGraph) (*mtproto.StatsGraph, error) - StatsGetMegagroupStats(ctx context.Context, in *mtproto.TLStatsGetMegagroupStats) (*mtproto.Stats_MegagroupStats, error) - StatsGetMessagePublicForwards(ctx context.Context, in *mtproto.TLStatsGetMessagePublicForwards) (*mtproto.Messages_Messages, error) - StatsGetMessageStats(ctx context.Context, in *mtproto.TLStatsGetMessageStats) (*mtproto.Stats_MessageStats, error) - MessagesGetStatsURL(ctx context.Context, in *mtproto.TLMessagesGetStatsURL) (*mtproto.StatsURL, error) -} - -type defaultStatisticsClient struct { - cli zrpc.Client -} - -func NewStatisticsClient(cli zrpc.Client) StatisticsClient { - return &defaultStatisticsClient{ - cli: cli, - } -} - -// StatsGetBroadcastStats -// stats.getBroadcastStats#ab42441a flags:# dark:flags.0?true channel:InputChannel = stats.BroadcastStats; -func (m *defaultStatisticsClient) StatsGetBroadcastStats(ctx context.Context, in *mtproto.TLStatsGetBroadcastStats) (*mtproto.Stats_BroadcastStats, error) { - client := mtproto.NewRPCStatisticsClient(m.cli.Conn()) - return client.StatsGetBroadcastStats(ctx, in) -} - -// StatsLoadAsyncGraph -// stats.loadAsyncGraph#621d5fa0 flags:# token:string x:flags.0?long = StatsGraph; -func (m *defaultStatisticsClient) StatsLoadAsyncGraph(ctx context.Context, in *mtproto.TLStatsLoadAsyncGraph) (*mtproto.StatsGraph, error) { - client := mtproto.NewRPCStatisticsClient(m.cli.Conn()) - return client.StatsLoadAsyncGraph(ctx, in) -} - -// StatsGetMegagroupStats -// stats.getMegagroupStats#dcdf8607 flags:# dark:flags.0?true channel:InputChannel = stats.MegagroupStats; -func (m *defaultStatisticsClient) StatsGetMegagroupStats(ctx context.Context, in *mtproto.TLStatsGetMegagroupStats) (*mtproto.Stats_MegagroupStats, error) { - client := mtproto.NewRPCStatisticsClient(m.cli.Conn()) - return client.StatsGetMegagroupStats(ctx, in) -} - -// StatsGetMessagePublicForwards -// stats.getMessagePublicForwards#5630281b channel:InputChannel msg_id:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; -func (m *defaultStatisticsClient) StatsGetMessagePublicForwards(ctx context.Context, in *mtproto.TLStatsGetMessagePublicForwards) (*mtproto.Messages_Messages, error) { - client := mtproto.NewRPCStatisticsClient(m.cli.Conn()) - return client.StatsGetMessagePublicForwards(ctx, in) -} - -// StatsGetMessageStats -// stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats; -func (m *defaultStatisticsClient) StatsGetMessageStats(ctx context.Context, in *mtproto.TLStatsGetMessageStats) (*mtproto.Stats_MessageStats, error) { - client := mtproto.NewRPCStatisticsClient(m.cli.Conn()) - return client.StatsGetMessageStats(ctx, in) -} - -// MessagesGetStatsURL -// messages.getStatsURL#812c2ae6 flags:# dark:flags.0?true peer:InputPeer params:string = StatsURL; -func (m *defaultStatisticsClient) MessagesGetStatsURL(ctx context.Context, in *mtproto.TLMessagesGetStatsURL) (*mtproto.StatsURL, error) { - client := mtproto.NewRPCStatisticsClient(m.cli.Conn()) - return client.MessagesGetStatsURL(ctx, in) -} diff --git a/app/bff/statistics/cmd/statistics/main.go b/app/bff/statistics/cmd/statistics/main.go deleted file mode 100644 index c20da5932..000000000 --- a/app/bff/statistics/cmd/statistics/main.go +++ /dev/null @@ -1,21 +0,0 @@ -/* - * WARNING! All changes made in this file will be lost! - * Created from 'scheme.tl' by 'mtprotoc' - * - * Copyright 2022 Teamgram Authors. - * All rights reserved. - * - * Author: teamgramio (teamgram.io@gmail.com) - */ - -package main - -import ( - "github.com/teamgram/marmota/pkg/commands" - - "github.com/teamgram/teamgram-server/app/bff/statistics/internal/server" -) - -func main() { - commands.Run(server.New()) -} diff --git a/app/bff/statistics/etc/statistics.yaml b/app/bff/statistics/etc/statistics.yaml deleted file mode 100644 index 3fd6e06e7..000000000 --- a/app/bff/statistics/etc/statistics.yaml +++ /dev/null @@ -1,2 +0,0 @@ -Name: bff.statistics -ListenOn: 0.0.0.0:21660 diff --git a/app/bff/statistics/helper.go b/app/bff/statistics/helper.go deleted file mode 100644 index a513c401a..000000000 --- a/app/bff/statistics/helper.go +++ /dev/null @@ -1,25 +0,0 @@ -/* - * WARNING! All changes made in this file will be lost! - * Created from 'scheme.tl' by 'mtprotoc' - * - * Copyright 2022 Teamgram Authors. - * All rights reserved. - * - * Author: teamgramio (teamgram.io@gmail.com) - */ - -package statistics_helper - -import ( - "github.com/teamgram/teamgram-server/app/bff/statistics/internal/config" - "github.com/teamgram/teamgram-server/app/bff/statistics/internal/server/grpc/service" - "github.com/teamgram/teamgram-server/app/bff/statistics/internal/svc" -) - -type ( - Config = config.Config -) - -func New(c Config) *service.Service { - return service.New(svc.NewServiceContext(c)) -} diff --git a/app/bff/statistics/internal/config/config.go b/app/bff/statistics/internal/config/config.go deleted file mode 100644 index e2aec3578..000000000 --- a/app/bff/statistics/internal/config/config.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 Teamgram Authors -// 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. -// -// Author: teamgramio (teamgram.io@gmail.com) -// - -package config - -import ( - "github.com/zeromicro/go-zero/zrpc" -) - -type Config struct { - zrpc.RpcServerConf -} diff --git a/app/bff/statistics/internal/core/core.go b/app/bff/statistics/internal/core/core.go deleted file mode 100644 index 3f5c857b6..000000000 --- a/app/bff/statistics/internal/core/core.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2022 Teamgram Authors -// 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. -// -// Author: teamgramio (teamgram.io@gmail.com) -// - -package core - -import ( - "context" - - "github.com/zeromicro/go-zero/core/logx" - - "github.com/teamgram/proto/mtproto/rpc/metadata" - "github.com/teamgram/teamgram-server/app/bff/statistics/internal/svc" -) - -type StatisticsCore struct { - ctx context.Context - svcCtx *svc.ServiceContext - logx.Logger - MD *metadata.RpcMetadata -} - -func New(ctx context.Context, svcCtx *svc.ServiceContext) *StatisticsCore { - return &StatisticsCore{ - ctx: ctx, - svcCtx: svcCtx, - Logger: logx.WithContext(ctx), - MD: metadata.RpcMetadataFromIncoming(ctx), - } -} diff --git a/app/bff/statistics/internal/core/messages.getStatsURL_handler.go b/app/bff/statistics/internal/core/messages.getStatsURL_handler.go deleted file mode 100644 index 2ceffc9a2..000000000 --- a/app/bff/statistics/internal/core/messages.getStatsURL_handler.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 Teamgram Authors -// 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. -// -// Author: teamgramio (teamgram.io@gmail.com) -// - -package core - -import ( - "github.com/teamgram/proto/mtproto" -) - -// MessagesGetStatsURL -// messages.getStatsURL#812c2ae6 flags:# dark:flags.0?true peer:InputPeer params:string = StatsURL; -func (c *StatisticsCore) MessagesGetStatsURL(in *mtproto.TLMessagesGetStatsURL) (*mtproto.StatsURL, error) { - // TODO: not impl - c.Logger.Errorf("messages.getStatsURL blocked, License key from https://teamgram.net required to unlock enterprise features.") - - return nil, mtproto.ErrEnterpriseIsBlocked -} diff --git a/app/bff/statistics/internal/core/stats.getBroadcastStats_handler.go b/app/bff/statistics/internal/core/stats.getBroadcastStats_handler.go deleted file mode 100644 index c8b87c4ed..000000000 --- a/app/bff/statistics/internal/core/stats.getBroadcastStats_handler.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 Teamgram Authors -// 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. -// -// Author: teamgramio (teamgram.io@gmail.com) -// - -package core - -import ( - "github.com/teamgram/proto/mtproto" -) - -// StatsGetBroadcastStats -// stats.getBroadcastStats#ab42441a flags:# dark:flags.0?true channel:InputChannel = stats.BroadcastStats; -func (c *StatisticsCore) StatsGetBroadcastStats(in *mtproto.TLStatsGetBroadcastStats) (*mtproto.Stats_BroadcastStats, error) { - // TODO: not impl - c.Logger.Errorf("stats.getBroadcastStats blocked, License key from https://teamgram.net required to unlock enterprise features.") - - return nil, mtproto.ErrEnterpriseIsBlocked -} diff --git a/app/bff/statistics/internal/core/stats.getMegagroupStats_handler.go b/app/bff/statistics/internal/core/stats.getMegagroupStats_handler.go deleted file mode 100644 index 9eba41545..000000000 --- a/app/bff/statistics/internal/core/stats.getMegagroupStats_handler.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 Teamgram Authors -// 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. -// -// Author: teamgramio (teamgram.io@gmail.com) -// - -package core - -import ( - "github.com/teamgram/proto/mtproto" -) - -// StatsGetMegagroupStats -// stats.getMegagroupStats#dcdf8607 flags:# dark:flags.0?true channel:InputChannel = stats.MegagroupStats; -func (c *StatisticsCore) StatsGetMegagroupStats(in *mtproto.TLStatsGetMegagroupStats) (*mtproto.Stats_MegagroupStats, error) { - // TODO: not impl - c.Logger.Errorf("stats.getMegagroupStats blocked, License key from https://teamgram.net required to unlock enterprise features.") - - return nil, mtproto.ErrEnterpriseIsBlocked -} diff --git a/app/bff/statistics/internal/core/stats.getMessagePublicForwards_handler.go b/app/bff/statistics/internal/core/stats.getMessagePublicForwards_handler.go deleted file mode 100644 index 320d7f71b..000000000 --- a/app/bff/statistics/internal/core/stats.getMessagePublicForwards_handler.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 Teamgram Authors -// 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. -// -// Author: teamgramio (teamgram.io@gmail.com) -// - -package core - -import ( - "github.com/teamgram/proto/mtproto" -) - -// StatsGetMessagePublicForwards -// stats.getMessagePublicForwards#5630281b channel:InputChannel msg_id:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; -func (c *StatisticsCore) StatsGetMessagePublicForwards(in *mtproto.TLStatsGetMessagePublicForwards) (*mtproto.Messages_Messages, error) { - // TODO: not impl - c.Logger.Errorf("stats.getMessagePublicForwards blocked, License key from https://teamgram.net required to unlock enterprise features.") - - return nil, mtproto.ErrEnterpriseIsBlocked -} diff --git a/app/bff/statistics/internal/core/stats.getMessageStats_handler.go b/app/bff/statistics/internal/core/stats.getMessageStats_handler.go deleted file mode 100644 index b530e693a..000000000 --- a/app/bff/statistics/internal/core/stats.getMessageStats_handler.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 Teamgram Authors -// 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. -// -// Author: teamgramio (teamgram.io@gmail.com) -// - -package core - -import ( - "github.com/teamgram/proto/mtproto" -) - -// StatsGetMessageStats -// stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats; -func (c *StatisticsCore) StatsGetMessageStats(in *mtproto.TLStatsGetMessageStats) (*mtproto.Stats_MessageStats, error) { - // TODO: not impl - c.Logger.Errorf("stats.getMessageStats blocked, License key from https://teamgram.net required to unlock enterprise features.") - - return nil, mtproto.ErrEnterpriseIsBlocked -} diff --git a/app/bff/statistics/internal/core/stats.loadAsyncGraph_handler.go b/app/bff/statistics/internal/core/stats.loadAsyncGraph_handler.go deleted file mode 100644 index 17ebffbe1..000000000 --- a/app/bff/statistics/internal/core/stats.loadAsyncGraph_handler.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 Teamgram Authors -// 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. -// -// Author: teamgramio (teamgram.io@gmail.com) -// - -package core - -import ( - "github.com/teamgram/proto/mtproto" -) - -// StatsLoadAsyncGraph -// stats.loadAsyncGraph#621d5fa0 flags:# token:string x:flags.0?long = StatsGraph; -func (c *StatisticsCore) StatsLoadAsyncGraph(in *mtproto.TLStatsLoadAsyncGraph) (*mtproto.StatsGraph, error) { - // TODO: not impl - c.Logger.Errorf("stats.loadAsyncGraph blocked, License key from https://teamgram.net required to unlock enterprise features.") - - return nil, mtproto.ErrEnterpriseIsBlocked -} diff --git a/app/bff/statistics/internal/dao/dao.go b/app/bff/statistics/internal/dao/dao.go deleted file mode 100644 index 0460e330a..000000000 --- a/app/bff/statistics/internal/dao/dao.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2022 Teamgram Authors -// 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. -// -// Author: teamgramio (teamgram.io@gmail.com) -// - -package dao - -type Dao struct { -} - -func New() *Dao { - return new(Dao) -} diff --git a/app/bff/statistics/internal/server/grpc/grpc.go b/app/bff/statistics/internal/server/grpc/grpc.go deleted file mode 100644 index b0cbfd07c..000000000 --- a/app/bff/statistics/internal/server/grpc/grpc.go +++ /dev/null @@ -1,30 +0,0 @@ -/* - * WARNING! All changes made in this file will be lost! - * Created from 'scheme.tl' by 'mtprotoc' - * - * Copyright 2022 Teamgram Authors. - * All rights reserved. - * - * Author: teamgramio (teamgram.io@gmail.com) - */ - -package grpc - -import ( - "github.com/teamgram/proto/mtproto" - "github.com/teamgram/teamgram-server/app/bff/statistics/internal/server/grpc/service" - "github.com/teamgram/teamgram-server/app/bff/statistics/internal/svc" - - "github.com/zeromicro/go-zero/core/logx" - "github.com/zeromicro/go-zero/zrpc" - "google.golang.org/grpc" -) - -// New new a grpc server. -func New(ctx *svc.ServiceContext, c zrpc.RpcServerConf) *zrpc.RpcServer { - s, err := zrpc.NewServer(c, func(grpcServer *grpc.Server) { - mtproto.RegisterRPCStatisticsServer(grpcServer, service.New(ctx)) - }) - logx.Must(err) - return s -} diff --git a/app/bff/statistics/internal/server/grpc/service/service.go b/app/bff/statistics/internal/server/grpc/service/service.go deleted file mode 100644 index 821fbaf1f..000000000 --- a/app/bff/statistics/internal/server/grpc/service/service.go +++ /dev/null @@ -1,25 +0,0 @@ -/* - * WARNING! All changes made in this file will be lost! - * Created from 'scheme.tl' by 'mtprotoc' - * - * Copyright 2022 Teamgram Authors. - * All rights reserved. - * - * Author: teamgramio (teamgram.io@gmail.com) - */ - -package service - -import ( - "github.com/teamgram/teamgram-server/app/bff/statistics/internal/svc" -) - -type Service struct { - svcCtx *svc.ServiceContext -} - -func New(ctx *svc.ServiceContext) *Service { - return &Service{ - svcCtx: ctx, - } -} diff --git a/app/bff/statistics/internal/server/grpc/service/statistics_service_impl.go b/app/bff/statistics/internal/server/grpc/service/statistics_service_impl.go deleted file mode 100644 index 01e6cd6bb..000000000 --- a/app/bff/statistics/internal/server/grpc/service/statistics_service_impl.go +++ /dev/null @@ -1,108 +0,0 @@ -/* - * WARNING! All changes made in this file will be lost! - * Created from 'scheme.tl' by 'mtprotoc' - * - * Copyright 2022 Teamgram Authors. - * All rights reserved. - * - * Author: teamgramio (teamgram.io@gmail.com) - */ - -package service - -import ( - "context" - - "github.com/teamgram/proto/mtproto" - "github.com/teamgram/teamgram-server/app/bff/statistics/internal/core" -) - -// StatsGetBroadcastStats -// stats.getBroadcastStats#ab42441a flags:# dark:flags.0?true channel:InputChannel = stats.BroadcastStats; -func (s *Service) StatsGetBroadcastStats(ctx context.Context, request *mtproto.TLStatsGetBroadcastStats) (*mtproto.Stats_BroadcastStats, error) { - c := core.New(ctx, s.svcCtx) - c.Infof("stats.getBroadcastStats - metadata: %s, request: %s", c.MD.DebugString(), request.DebugString()) - - r, err := c.StatsGetBroadcastStats(request) - if err != nil { - return nil, err - } - - c.Infof("stats.getBroadcastStats - reply: %s", r.DebugString()) - return r, err -} - -// StatsLoadAsyncGraph -// stats.loadAsyncGraph#621d5fa0 flags:# token:string x:flags.0?long = StatsGraph; -func (s *Service) StatsLoadAsyncGraph(ctx context.Context, request *mtproto.TLStatsLoadAsyncGraph) (*mtproto.StatsGraph, error) { - c := core.New(ctx, s.svcCtx) - c.Infof("stats.loadAsyncGraph - metadata: %s, request: %s", c.MD.DebugString(), request.DebugString()) - - r, err := c.StatsLoadAsyncGraph(request) - if err != nil { - return nil, err - } - - c.Infof("stats.loadAsyncGraph - reply: %s", r.DebugString()) - return r, err -} - -// StatsGetMegagroupStats -// stats.getMegagroupStats#dcdf8607 flags:# dark:flags.0?true channel:InputChannel = stats.MegagroupStats; -func (s *Service) StatsGetMegagroupStats(ctx context.Context, request *mtproto.TLStatsGetMegagroupStats) (*mtproto.Stats_MegagroupStats, error) { - c := core.New(ctx, s.svcCtx) - c.Infof("stats.getMegagroupStats - metadata: %s, request: %s", c.MD.DebugString(), request.DebugString()) - - r, err := c.StatsGetMegagroupStats(request) - if err != nil { - return nil, err - } - - c.Infof("stats.getMegagroupStats - reply: %s", r.DebugString()) - return r, err -} - -// StatsGetMessagePublicForwards -// stats.getMessagePublicForwards#5630281b channel:InputChannel msg_id:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; -func (s *Service) StatsGetMessagePublicForwards(ctx context.Context, request *mtproto.TLStatsGetMessagePublicForwards) (*mtproto.Messages_Messages, error) { - c := core.New(ctx, s.svcCtx) - c.Infof("stats.getMessagePublicForwards - metadata: %s, request: %s", c.MD.DebugString(), request.DebugString()) - - r, err := c.StatsGetMessagePublicForwards(request) - if err != nil { - return nil, err - } - - c.Infof("stats.getMessagePublicForwards - reply: %s", r.DebugString()) - return r, err -} - -// StatsGetMessageStats -// stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats; -func (s *Service) StatsGetMessageStats(ctx context.Context, request *mtproto.TLStatsGetMessageStats) (*mtproto.Stats_MessageStats, error) { - c := core.New(ctx, s.svcCtx) - c.Infof("stats.getMessageStats - metadata: %s, request: %s", c.MD.DebugString(), request.DebugString()) - - r, err := c.StatsGetMessageStats(request) - if err != nil { - return nil, err - } - - c.Infof("stats.getMessageStats - reply: %s", r.DebugString()) - return r, err -} - -// MessagesGetStatsURL -// messages.getStatsURL#812c2ae6 flags:# dark:flags.0?true peer:InputPeer params:string = StatsURL; -func (s *Service) MessagesGetStatsURL(ctx context.Context, request *mtproto.TLMessagesGetStatsURL) (*mtproto.StatsURL, error) { - c := core.New(ctx, s.svcCtx) - c.Infof("messages.getStatsURL - metadata: %s, request: %s", c.MD.DebugString(), request.DebugString()) - - r, err := c.MessagesGetStatsURL(request) - if err != nil { - return nil, err - } - - c.Infof("messages.getStatsURL - reply: %s", r.DebugString()) - return r, err -} diff --git a/app/bff/statistics/internal/server/server.go b/app/bff/statistics/internal/server/server.go deleted file mode 100644 index b22442de6..000000000 --- a/app/bff/statistics/internal/server/server.go +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2022 Teamgram Authors -// 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. -// -// Author: teamgramio (teamgram.io@gmail.com) -// - -package server - -import ( - "flag" - - "github.com/teamgram/teamgram-server/app/bff/statistics/internal/config" - "github.com/teamgram/teamgram-server/app/bff/statistics/internal/server/grpc" - "github.com/teamgram/teamgram-server/app/bff/statistics/internal/svc" - - "github.com/zeromicro/go-zero/core/conf" - "github.com/zeromicro/go-zero/core/logx" - "github.com/zeromicro/go-zero/zrpc" -) - -var configFile = flag.String("f", "etc/statistics.yaml", "the config file") - -type Server struct { - grpcSrv *zrpc.RpcServer -} - -func New() *Server { - return new(Server) -} - -func (s *Server) Initialize() error { - var c config.Config - conf.MustLoad(*configFile, &c) - - logx.Infov(c) - ctx := svc.NewServiceContext(c) - s.grpcSrv = grpc.New(ctx, c.RpcServerConf) - - go func() { - go s.grpcSrv.Start() - }() - return nil -} - -func (s *Server) RunLoop() { -} - -func (s *Server) Destroy() { - s.grpcSrv.Stop() -} diff --git a/app/bff/statistics/internal/svc/service_context.go b/app/bff/statistics/internal/svc/service_context.go deleted file mode 100644 index c369a81b5..000000000 --- a/app/bff/statistics/internal/svc/service_context.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 Teamgram Authors -// 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. -// -// Author: teamgramio (teamgram.io@gmail.com) -// - -package svc - -import ( - "github.com/teamgram/teamgram-server/app/bff/statistics/internal/config" -) - -type ServiceContext struct { - Config config.Config -} - -func NewServiceContext(c config.Config) *ServiceContext { - return &ServiceContext{ - Config: c, - } -}