Skip to content

Commit fe5cd51

Browse files
leochen-ghuan
andauthored
修复主动退出登陆后,再次扫描无法登录的情况 (#147)
* 修复主动退出登录后,重新登录提示网页端登录报错 * 修复主动退出登陆后,再次扫描无法登录的问题 本地已经测试,此次加的判断应该会杜绝此类问题的发生了。由于主动退出后,网页重定向的地址没有携带`target=t`所以导致此问题 * 0.48.4 Co-authored-by: Huan (李卓桓) <[email protected]>
1 parent 53445f2 commit fe5cd51

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wechaty-puppet-wechat",
3-
"version": "0.28.3",
3+
"version": "0.28.4",
44
"description": "Puppet WeChat for Wechaty",
55
"main": "dist/src/mod.js",
66
"typings": "dist/src/mod.d.ts",

src/bridge.ts

+10
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,16 @@ export class Bridge extends EventEmitter {
278278
await page.setRequestInterception(true)
279279
page.on('request', async req => {
280280
const url = new URL(req.url())
281+
if (url.pathname === '/' && url.search.indexOf('target=t') === -1) {
282+
if (url.search === '' || url.search === '?') {
283+
url.search = '?'
284+
} else {
285+
url.search += '&'
286+
}
287+
url.search += 'target=t'
288+
await req.continue({ url })
289+
return
290+
}
281291
if (url.pathname === '/cgi-bin/mmwebwx-bin/webwxnewloginpage') {
282292
const override = {
283293
headers: {

0 commit comments

Comments
 (0)