mirror of
https://github.com/iyear/tdl
synced 2025-01-08 11:57:55 +08:00
feat(login): use desktop app in new session
This commit is contained in:
parent
8127fb7a7b
commit
6470e57ff5
@ -26,6 +26,11 @@ func Code(ctx context.Context) error {
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "open kv")
|
||||
}
|
||||
|
||||
if err = kvd.Set(key.App(), []byte(tclient.AppDesktop)); err != nil {
|
||||
return errors.Wrap(err, "set app")
|
||||
}
|
||||
|
||||
c, err := tclient.New(ctx, tclient.Options{
|
||||
KV: kvd,
|
||||
Proxy: viper.GetString(consts.FlagProxy),
|
||||
@ -57,9 +62,6 @@ func Code(ctx context.Context) error {
|
||||
}, backoff.NewConstantBackOff(time.Second))
|
||||
}
|
||||
|
||||
color.Yellow("WARN: Using the built-in APP_ID & APP_HASH may increase the probability of blocking")
|
||||
color.Blue("Login...")
|
||||
|
||||
flow := auth.NewFlow(termAuth{}, auth.SendCodeOptions{})
|
||||
if err = c.Auth().IfNecessary(ctx, flow); err != nil {
|
||||
return err
|
||||
@ -70,10 +72,6 @@ func Code(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = kvd.Set(key.App(), []byte(tclient.AppBuiltin)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
color.Green("Login successfully! ID: %d, Username: %s", user.ID, user.Username)
|
||||
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user