Skip to content

Commit a01bba7

Browse files
committed
update document: 设计实现思路,如何调试
1 parent 5324855 commit a01bba7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,13 @@ Tested with `node v7.7.3` and `PhantomJS V 2.1.1`: [phantomjs-2.1.1-macosx.zip ]
1515
2. 收到`pingping`,回复`pongpong`
1616
3. 收到`pingpingping`,回复`pongpongpong`
1717
4. 其他,不做特殊处理.
18+
19+
## 设计思路
20+
1. 使用 phantomjs 访问微信 web 登录页面;
21+
2. 劫持脚本: https://res.wx.qq.com/a/wx_fed/webwx/res/static/js/index_c7d281c.js(这个脚本的版本号可能会变更)通过 phantomjs `networkRequest.changeUrl()` 把脚本请求转发为本机脚本 wechat_injection.js;
22+
3. [wechat_injection.js](src/wechat_injection.js) 中重载`angular.bootstrap`并且挂载自定义的 hook,从而监听微信聊天信息;
23+
4. 根据自定义规则做自动应答。
24+
25+
## 如何调试?
26+
使用任意 proxy 代理软件,如 Charles Proxy,或者chrome浏览器插件[trumpet](https://chrome.google.com/webstore/detail/trumpet/cflekmkldaldnelemkkldoaedapbkmog) 转发资源请求。
27+
- 需要注意 [wechat_injection.js](src/wechat_injection.js)`loadOriginalScript()` 在 Chrome 中会遇到跨域请求限制问题,可以直接修改代码,把原始 script 下载后添加到该文件中即可。

0 commit comments

Comments
 (0)