File tree 1 file changed +2
-10
lines changed
1 file changed +2
-10
lines changed Original file line number Diff line number Diff line change @@ -35,16 +35,8 @@ function chooseUserAgent(ua = false) {
35
35
// Linux 就算了
36
36
]
37
37
}
38
- let realUserAgentList = [ ]
39
- if ( ! ua )
40
- realUserAgentList = ( userAgentList . mobile ) . concat ( userAgentList . pc ) // concat 把两个 array 合并
41
- else if ( ua == 'mobile' )
42
- realUserAgentList = userAgentList . mobile
43
- else if ( ua == 'pc' )
44
- realUserAgentList = userAgentList . pc
45
- else
46
- return ua // 最后返回自定义的 ua
47
- return realUserAgentList [ Math . floor ( Math . random ( ) * realUserAgentList . length ) ]
38
+ let realUserAgentList = userAgentList [ ua ] || ( userAgentList . mobile ) . concat ( userAgentList . pc )
39
+ return ( [ 'mobile' , 'pc' , false ] . indexOf ( ua ) > - 1 ) ? realUserAgentList [ Math . floor ( Math . random ( ) * realUserAgentList . length ) ] : ua
48
40
}
49
41
const createRequest = ( method , url , data , options ) => {
50
42
return new Promise ( ( resolve , reject ) => {
You can’t perform that action at this time.
0 commit comments