Skip to content

Commit

Permalink
fix(tgc): ignore login status. close iyear#4
Browse files Browse the repository at this point in the history
  • Loading branch information
iyear committed Sep 9, 2022
1 parent aab794f commit 8ed91a6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/dl/dlurl/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func Run(ctx context.Context, ns, proxy string, partSize, threads, limit int, ur
return err
}

c := tgc.New(proxy, kvd, floodwait.NewSimpleWaiter())
c := tgc.New(proxy, kvd, false, floodwait.NewSimpleWaiter())

return c.Run(ctx, func(ctx context.Context) error {
status, err := c.Auth().Status(ctx)
Expand Down
4 changes: 2 additions & 2 deletions app/internal/tgc/tgc.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import (
"time"
)

func New(proxy string, kvd *kv.KV, middlewares ...telegram.Middleware) *telegram.Client {
func New(proxy string, kvd *kv.KV, login bool, middlewares ...telegram.Middleware) *telegram.Client {
return telegram.NewClient(consts.AppID, consts.AppHash, telegram.Options{
Resolver: dcs.Plain(dcs.PlainOptions{
Dial: utils.Proxy.GetDial(proxy).DialContext,
}),
Device: consts.Device,
SessionStorage: storage.NewSession(kvd, true),
SessionStorage: storage.NewSession(kvd, login),
RetryInterval: time.Second,
MaxRetries: 10,
DialTimeout: 10 * time.Second,
Expand Down
2 changes: 1 addition & 1 deletion app/login/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func Run(ctx context.Context, ns, proxy string) error {
return err
}

c := tgc.New(proxy, kvd)
c := tgc.New(proxy, kvd, true)

return c.Run(ctx, func(ctx context.Context) error {
if err := c.Ping(ctx); err != nil {
Expand Down

0 comments on commit 8ed91a6

Please sign in to comment.