wechaty / wechaty

Conversational RPA SDK for Chatbot Makers. Join our Discord: https://discord.gg/7q8NBZbQzt
https://wechaty.js.org
Apache License 2.0
19.87k stars 2.57k forks source link

feature for configurable autoLogin and switchAccount #1172

Closed alamusi closed 6 years ago

alamusi commented 6 years ago

Provide Your Network Information

  1. Where is the location of your server? (i.e. City, or In/Out China) North America

  2. Which cloud platform(AliYun/Qcloud/DigitalOcean/etc) are you using? AWS

Run npm run doctor or wechaty run doctor(for docker user), paste output here

wechaty@0.14.0 doctor /wechaty npm run check-node-version && ts-node bin/doctor

wechaty@0.14.0 check-node-version /wechaty check-node-version --node ">= 8.5"

Wechaty Doctor

  1. Wechaty version: #git[32b624e]
  2. Linux x64 version 4.4.0-1054-aws memory 963/7478 MB
  3. Docker: true
  4. Node version: v9.11.1
  5. Tcp IPC TEST: PASS

Expected behavior

Add configurable element to Wechaty.instance({}) to control the default init behaviour:

  1. autoAogin (fires the login event and ask user to confirm login on his/her phone)
  2. switchAccount (fires scan event and ask user to scan the QR code)

Actual behavior

puppet always calls clickSwitchAccount() per implementation on issue #636

Steps to reproduce the behavior (and fixes, if any)

huan commented 6 years ago

Yes, according to #636, we will always try to click the switch account button.

If the button appears, then it will be clicked. Otherwise, we will do nothing.

I agree that you proposed a good feature that we should also click the auto login button if it appears too, did I understand right?

alamusi commented 6 years ago

@zixia correct!

Similar to some other web-wechat based projects, make the init behaviour configuration with a default value. if we set "autoLogin", then the puppet init will try to find the "log in" button to click; otherwise, the puppet init will try to find the "switch account" button to click (current behaviour)

The reason is that our client would like to have the ability to re-login to his/her previous wechaty instance without having to scan the QR, under the circumstances that the instance was kicked out by other web/mac/pc login.

thanks!

alamusi commented 6 years ago

@zixia which version are you expecting this feature to be put in? it seems that the current master and the latest stable 0.14 are quite apart... master moves onto puppeteer and 0.14 is on puppet-web? even though the logic is in bridge...

alamusi commented 6 years ago

use 0.14 as an example, there are two approaches to pass the autoLogin option over.

once the autoLogin is passed over to puppet-web, the rest is the same

@zixia let me know which approach you would like to take. thanks

huan commented 6 years ago

Moved to https://github.com/Chatie/wechaty-puppet-puppeteer/issues/34

huan commented 6 years ago

Hello @alamusi ,

I'm very sorry for reply you so late, but we are really busy on de-coupling the wechaty-puppet systems, which we changed a lot, including we separate the puppeteer module to its separate npm module: wechaty-puppet-puppeteer.

I had moved your issue to the new repository, let's continue discussing this topic over there.

Thanks again for your feature request, it's very valuable.