Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
.Veneno.
wechaty
提交
574341c0
W
wechaty
项目概览
.Veneno.
/
wechaty
与 Fork 源项目一致
Fork自
wechaty / wechaty
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
W
wechaty
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
574341c0
编写于
6月 14, 2016
作者:
Huan (李卓桓)
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of github.com:zixia/wechaty
上级
cd3e7d28
86179384
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
14 addition
and
7 deletion
+14
-7
src/puppet-web-bridge.js
src/puppet-web-bridge.js
+11
-5
src/puppet-web-browser.js
src/puppet-web-browser.js
+2
-1
src/puppet-web.js
src/puppet-web.js
+1
-1
未找到文件。
src/puppet-web-bridge.js
浏览文件 @
574341c0
...
@@ -120,7 +120,7 @@ class Bridge {
...
@@ -120,7 +120,7 @@ class Bridge {
,
'
utf8
'
,
'
utf8
'
)
)
}
}
inject
()
{
inject
(
attempt
)
{
log
.
verbose
(
'
PuppetWebBridge
'
,
'
inject()
'
)
log
.
verbose
(
'
PuppetWebBridge
'
,
'
inject()
'
)
return
co
.
call
(
this
,
function
*
()
{
return
co
.
call
(
this
,
function
*
()
{
const
injectio
=
this
.
getInjectio
()
const
injectio
=
this
.
getInjectio
()
...
@@ -131,7 +131,13 @@ class Bridge {
...
@@ -131,7 +131,13 @@ class Bridge {
return
r
return
r
})
})
.
catch
(
e
=>
{
.
catch
(
e
=>
{
log
.
error
(
'
PuppetWebBridge
'
,
'
inject() exception: %s
'
,
e
.
message
)
log
.
warn
(
'
PuppetWebBridge
'
,
'
inject() exception: %s
'
,
e
.
message
)
attempt
=
attempt
||
0
if
(
attempt
++
<
3
)
{
log
.
warn
(
'
PuppetWebBridge
'
,
'
inject(%d) retry after 1 second: %s
'
,
attempt
,
e
.
message
)
setTimeout
(()
=>
this
.
inject
(
attempt
),
1000
)
return
}
throw
e
throw
e
})
})
}
}
...
@@ -148,11 +154,11 @@ class Bridge {
...
@@ -148,11 +154,11 @@ class Bridge {
// see: http://blog.sqrtthree.com/2015/08/29/utf8-to-b64/
// see: http://blog.sqrtthree.com/2015/08/29/utf8-to-b64/
const
argsDecoded
=
`JSON.parse(decodeURIComponent(window.atob('
${
argsEncoded
}
')))`
const
argsDecoded
=
`JSON.parse(decodeURIComponent(window.atob('
${
argsEncoded
}
')))`
const
wechatyScript
=
`return
(typeof Wechaty !== 'undefined' && Wechaty.
${
wechatyFunc
}
.apply(undefined,
${
argsDecoded
}
)
)`
const
wechatyScript
=
`return
Wechaty.
${
wechatyFunc
}
.apply(undefined,
${
argsDecoded
}
)`
log
.
silly
(
'
PuppetWebBridge
'
,
'
proxyWechaty(%s, ...args) %s
'
,
wechatyFunc
,
wechatyScript
)
log
.
silly
(
'
PuppetWebBridge
'
,
'
proxyWechaty(%s, ...args) %s
'
,
wechatyFunc
,
wechatyScript
)
return
this
.
execute
(
wechatyScript
)
return
this
.
execute
(
wechatyScript
)
.
catch
(
e
=>
{
.
catch
(
e
=>
{
log
.
warn
(
'
PuppetWebBridge
'
,
'
proxyWechaty() exception: %s
'
,
e
.
message
||
e
)
log
.
warn
(
'
PuppetWebBridge
'
,
'
proxyWechaty() exception: %s
'
,
e
.
message
)
throw
e
throw
e
})
})
}
}
...
@@ -160,7 +166,7 @@ class Bridge {
...
@@ -160,7 +166,7 @@ class Bridge {
execute
(
script
,
...
args
)
{
execute
(
script
,
...
args
)
{
return
this
.
options
.
puppet
.
browser
.
execute
(
script
,
...
args
)
return
this
.
options
.
puppet
.
browser
.
execute
(
script
,
...
args
)
.
catch
(
e
=>
{
.
catch
(
e
=>
{
log
.
warn
(
'
PuppetWebBridge
'
,
'
execute() exception: %s
'
,
e
.
message
||
e
)
log
.
warn
(
'
PuppetWebBridge
'
,
'
execute() exception: %s
'
,
e
.
message
)
throw
e
throw
e
})
})
}
}
...
...
src/puppet-web-browser.js
浏览文件 @
574341c0
...
@@ -248,7 +248,8 @@ class Browser extends EventEmitter {
...
@@ -248,7 +248,8 @@ class Browser extends EventEmitter {
return
this
.
driver
.
executeScript
.
apply
(
this
.
driver
,
arguments
)
return
this
.
driver
.
executeScript
.
apply
(
this
.
driver
,
arguments
)
.
catch
(
e
=>
{
.
catch
(
e
=>
{
this
.
dead
(
e
)
// this.dead(e)
log
.
warn
(
'
PuppetWebBrowser
'
,
'
execute() exception: %s
'
,
e
.
message
)
throw
e
throw
e
})
})
}
}
...
...
src/puppet-web.js
浏览文件 @
574341c0
...
@@ -312,7 +312,7 @@ class PuppetWeb extends Puppet {
...
@@ -312,7 +312,7 @@ class PuppetWeb extends Puppet {
this
.
bridge
.
init
()
this
.
bridge
.
init
()
.
then
(
r
=>
log
.
verbose
(
'
PuppetWeb
'
,
'
onServerDisconnect() bridge re-inited: %s
'
,
r
))
.
then
(
r
=>
log
.
verbose
(
'
PuppetWeb
'
,
'
onServerDisconnect() bridge re-inited: %s
'
,
r
))
.
catch
(
e
=>
log
.
error
(
'
PuppetWeb
'
,
'
onServerDisconnect() exception: [%s]
'
,
e
))
.
catch
(
e
=>
log
.
error
(
'
PuppetWeb
'
,
'
onServerDisconnect() exception: [%s]
'
,
e
))
},
1000
0
)
// 10 seconds should be enough to wait
},
1000
)
// 1 second instead of 10 seconds? try. (should be enough to wait)
return
return
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录