wechaty / puppet-whatsapp

Wechaty Puppet for Whatsapp
https://npmjs.com/package/wechaty-puppet-whatsapp
Apache License 2.0
24 stars 17 forks source link

After deleted the MemoryCard data, the PuppetWhatsApp still can logged in with previous session #350

Open huan opened 2 years ago

huan commented 2 years ago

I logged in with Puppet WhatsApp once, and then want to start from refresh again.

Then I deleted the ding-dong-bot.memory-card.json, and started Wechaty again.

However, the Bot still has old sessions and is logged in automatically.

I believe this is a BUG.

After deleting the MemoryCard data, the Puppet should get a fresh restart, which means, a Puppet should store it's session data in the Memory Card and only store them in the Memory Card, so that we can have a single source of truth to manage them.

See also:

huan commented 2 years ago

@su-chang Could you please share a workaround with me to fix this issue manually?

Like how to remove the existing session and make the QR Code can be show when I ran into this issue?

huan commented 2 years ago

Workaround

Instead of deleting the .memory-card.json file, change it.

$ cat ding-dong-bot.memory-card.json 
{"\rpuppet\nPUPPET_WHATSAPP_CLIENT_ID":"default-client"}

Change the above PUPPET_WHATSAPP_CLIENT_ID to a new string, like default-client-2, then restart the program.

huan commented 2 years ago

The PuppetWhatsApp should take care of the .wwebjs_auth/* so that all the data is stored in the MemoryCard only.

In the future version, we should prevent the .wwebjs_auth/ to be created, by managing all those data by the puppet internally.

$ pwd
/home/huan/git/wechaty/getting-started
ls -l .wwebjs_auth/
total 12
drwxrwxr-x 3 huan huan 4096 Apr  6 14:47 session-default-client
drwxrwxr-x 3 huan huan 4096 Apr  6 16:45 session-default-client2
drwxrwxr-x 3 huan huan 4096 Apr  6 16:52 session-default-client3
$ tree .wwebjs_auth/session-default-client
.wwebjs_auth/session-default-client
├── Default
│   ├── blob_storage
│   │   └── 01374f4b-f2c5-464b-aa17-defed5feb2af
│   ├── Cache
│   │   └── Cache_Data
│   │       ├── 0014ad3a47fbaab6_0
│   │       ├── 003f7e9e5da2df4f_0
│   │       ├── 73e38c8f00825eb8_0
│   │       ├── index
│   │       └── index-dir
│   │           └── the-real-index
│   ├── Code Cache
│   │   ├── js
│   │   │   ├── 144461c9cb54197d_0
│   │   │   ├── ee28db862e53c224_0
│   │   │   ├── f1a8b82fd9084dd2_0
│   │   │   ├── index
│   │   │   └── index-dir
│   │   │       └── the-real-index
│   │   └── wasm
│   │       ├── index
│   │       └── index-dir
│   │           └── the-real-index
│   ├── Cookies
│   ├── Cookies-journal
│   ├── databases
│   │   ├── Databases.db
│   │   └── Databases.db-journal
│   ├── File System
│   │   ├── 000
│   │   │   └── t
│   │   │       └── Paths
│   │   │           ├── 000003.log
│   │   │           ├── CURRENT
│   │   │           ├── LOCK
│   │   │           ├── LOG
│   │   │           └── MANIFEST-000001
│   │   └── Origins
│   │       ├── 000003.log
│   │       ├── CURRENT
│   │       ├── LOCK
│   │       ├── LOG
│   │       ├── LOG.old
│   │       └── MANIFEST-000001
│   ├── GPUCache
│   │   ├── data_0
│   │   ├── data_1
│   │   ├── data_2
│   │   ├── data_3
│   │   └── index
│   ├── IndexedDB
│   │   └── https_web.whatsapp.com_0.indexeddb.leveldb
│   │       ├── 000033.log
│   │       ├── 000035.ldb
│   │       ├── CURRENT
│   │       ├── LOCK
│   │       ├── LOG
│   │       ├── LOG.old
│   │       └── MANIFEST-000001
│   ├── Local Storage
│   │   └── leveldb
│   │       ├── 000003.log
│   │       ├── CURRENT
│   │       ├── LOCK
│   │       ├── LOG
│   │       ├── LOG.old
│   │       └── MANIFEST-000001
│   ├── Platform Notifications
│   │   ├── 000003.log
│   │   ├── CURRENT
│   │   ├── LOCK
│   │   ├── LOG
│   │   ├── LOG.old
│   │   └── MANIFEST-000001
│   ├── Preferences
│   ├── QuotaManager
│   ├── QuotaManager-journal
│   ├── Service Worker
│   │   ├── CacheStorage
│   │   │   └── 0bf6ab7f94a21cdc9c1649f884333ec20f40a544
│   │   │       ├── 2b4aeb50-0d33-424f-9391-2e18056edc65
│   │   │       │   ├── index
│   │   │       │   └── index-dir
│   │   │       │       └── the-real-index
│   │   │       ├── 46ddede8-44cb-443e-871c-49c8d8649a36
│   │   │       │   ├── bffe4b5fa60b2dc1_0
│   │   │       │   ├── e7794419dd2d4037_0
│   │   │       │   ├── index
│   │   │       │   └── index-dir
│   │   │       │       └── the-real-index
│   │   │       ├── 8920de79-0483-43fa-9474-e0de4e8dfda4
│   │   │       │   ├── 7f5ec8d09b92c79b_0
│   │   │       │   ├── a1d9de4f4d0f159f_0
│   │   │       │   ├── index
│   │   │       │   └── index-dir
│   │   │       │       └── the-real-index
│   │   │       ├── d101b7d5-cfb9-4d45-8800-0e240b73b4d1
│   │   │       │   ├── index
│   │   │       │   └── index-dir
│   │   │       │       └── the-real-index
│   │   │       └── index.txt
│   │   ├── Database
│   │   │   ├── 000003.log
│   │   │   ├── CURRENT
│   │   │   ├── LOCK
│   │   │   ├── LOG
│   │   │   ├── LOG.old
│   │   │   └── MANIFEST-000001
│   │   └── ScriptCache
│   │       ├── ba23d8ecda68de77_0
│   │       ├── ba23d8ecda68de77_1
│   │       ├── index
│   │       └── index-dir
│   │           └── the-real-index
│   └── Session Storage
│       ├── 000003.log
│       ├── CURRENT
│       ├── LOCK
│       ├── LOG
│       ├── LOG.old
│       └── MANIFEST-000001
└── DevToolsActivePort

38 directories, 320 files