Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
f4bc0d3d
Commit
f4bc0d3d
authored
Apr 15, 2021
by
YKai
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/okhttp配置防抓包' into 4.1.69(强绑手机号)
# Conflicts: # config.gradle
parents
720bcebb
7a6e2320
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
80 additions
and
15 deletions
+80
-15
config.gradle
config.gradle
+13
-13
OkHttpConfig.java
ydl-net/src/main/java/com/ydl/ydlnet/builder/config/OkHttpConfig.java
+27
-0
HttpConfig.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/HttpConfig.kt
+1
-1
ProxyCheckUtils.kt
ydl-webview/src/main/java/com/ydl/utils/ProxyCheckUtils.kt
+33
-0
NewH5Activity.java
ydl-webview/src/main/java/com/ydl/webview/NewH5Activity.java
+6
-1
No files found.
config.gradle
View file @
f4bc0d3d
...
...
@@ -88,22 +88,22 @@ ext {
// -------------- 业务模块 --------------
//第三步 若干
"m-confide"
:
"0.0.49.0
7
"
,
"m-consultant"
:
"0.0.59.
70
"
,
"m-fm"
:
"0.0.30.0
3
"
,
"m-user"
:
"0.0.61.
30
"
,
"m-home"
:
"0.0.22.
60
"
,
"m-im"
:
"0.0.18.4
9
"
,
"m-dynamic"
:
"0.0.7.
21
"
,
"m-article"
:
"0.0.0.
8
"
,
"m-confide"
:
"0.0.49.0
2
"
,
"m-consultant"
:
"0.0.59.
65
"
,
"m-fm"
:
"0.0.30.0
1
"
,
"m-user"
:
"0.0.61.
18
"
,
"m-home"
:
"0.0.22.
54
"
,
"m-im"
:
"0.0.18.4
0
"
,
"m-dynamic"
:
"0.0.7.
19
"
,
"m-article"
:
"0.0.0.
6
"
,
"m-muse"
:
"0.0.2
8.22
"
,
"m-tests"
:
"0.0.24.
12
"
,
"m-course"
:
"0.0.42.2
3
"
,
"m-muse"
:
"0.0.2
0.7
"
,
"m-tests"
:
"0.0.24.
9
"
,
"m-course"
:
"0.0.42.2
0
"
,
//-------------- 业务模块 API 层 --------------
"m-audioim-api"
:
"0.0.6"
,
"m-confide-api"
:
"0.0.2.1
1
"
,
"m-consultant-api"
:
"0.0.5.6
1
"
,
"m-confide-api"
:
"0.0.2.1"
,
"m-consultant-api"
:
"0.0.5.6"
,
"m-course-api"
:
"0.0.3.6"
,
"m-fm-api"
:
"0.0.3"
,
"m-muse-api"
:
"0.0.1"
,
...
...
ydl-net/src/main/java/com/ydl/ydlnet/builder/config/OkHttpConfig.java
View file @
f4bc0d3d
...
...
@@ -2,6 +2,7 @@ package com.ydl.ydlnet.builder.config;
import
android.content.Context
;
import
android.text.TextUtils
;
import
android.widget.Toast
;
import
com.ydl.ydlnet.builder.cookie.CookieJarImpl
;
import
com.ydl.ydlnet.builder.cookie.store.CookieStore
;
...
...
@@ -16,8 +17,14 @@ import com.ydl.ydlnet.builder.manage.HttpUrlManager;
import
com.ydl.ydlnet.client.interfaces.BuildHeadersListener
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.net.Proxy
;
import
java.net.ProxySelector
;
import
java.net.SocketAddress
;
import
java.net.URI
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
...
...
@@ -197,6 +204,7 @@ public class OkHttpConfig {
setTimeout
();
setMultipleUrl
();
setDebugConfig
();
setProxy
();
okHttpClient
=
okHttpClientBuilder
.
build
();
return
okHttpClient
;
...
...
@@ -225,6 +233,25 @@ public class OkHttpConfig {
okHttpClientBuilder
.
addInterceptor
(
new
RequestLogInterceptor
(
isDebug
,
requestHandler
));
}
/**
* 配置线上环境防止抓包
*/
private
void
setProxy
(){
if
(!
isDebug
)
{
okHttpClientBuilder
.
proxySelector
(
new
ProxySelector
()
{
@Override
public
List
<
Proxy
>
select
(
URI
uri
)
{
return
Collections
.
singletonList
(
Proxy
.
NO_PROXY
);
}
@Override
public
void
connectFailed
(
URI
uri
,
SocketAddress
socketAddress
,
IOException
e
)
{
Toast
.
makeText
(
context
,
e
.
getMessage
(),
Toast
.
LENGTH_SHORT
).
show
();
}
});
}
}
/**
* 配置headers
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/HttpConfig.kt
View file @
f4bc0d3d
...
...
@@ -137,7 +137,7 @@ class HttpConfig {
//获取证书
val
cerInputStream
=
context
.
resources
.
openRawResource
(
com
.
ydl
.
ydlcommon
.
R
.
raw
.
ydl_trust
);
val
builder
=
OkHttpConfig
.
Builder
(
context
)
;
val
builder
=
OkHttpConfig
.
Builder
(
context
)
if
(
appDebug
)
{
builder
.
setNetInterceptor
(
StethoInterceptor
())
}
else
{
...
...
ydl-webview/src/main/java/com/ydl/utils/ProxyCheckUtils.kt
0 → 100644
View file @
f4bc0d3d
package
com.ydl.utils
import
android.content.Context
import
android.net.Proxy
import
android.os.Build
import
android.text.TextUtils
/**
* Created by Ykai on 2021/4/1.
*/
object
ProxyCheckUtils
{
/**
* 判断设备 是否使用代理上网
* @param context 上下文对象
* return 当前网络是否开启了代理
*/
fun
isWifiProxy
(
context
:
Context
):
Boolean
{
val
IS_ICS_OR_LATER
:
Boolean
=
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
ICE_CREAM_SANDWICH
val
proxyAddress
:
String
val
proxyPort
:
Int
if
(
IS_ICS_OR_LATER
)
{
proxyAddress
=
System
.
getProperty
(
"http.proxyHost"
)
val
portStr
=
System
.
getProperty
(
"http.proxyPort"
)
proxyPort
=
(
portStr
?:
"-1"
).
toInt
()
}
else
{
proxyAddress
=
Proxy
.
getHost
(
context
)
proxyPort
=
Proxy
.
getPort
(
context
)
}
return
!
TextUtils
.
isEmpty
(
proxyAddress
)
&&
proxyPort
!=
-
1
}
}
\ No newline at end of file
ydl-webview/src/main/java/com/ydl/webview/NewH5Activity.java
View file @
f4bc0d3d
...
...
@@ -35,6 +35,7 @@ import com.tencent.smtt.sdk.WebViewClient;
import
com.umeng.socialize.UMShareAPI
;
import
com.umeng.socialize.bean.SHARE_MEDIA
;
import
com.ydl.utils.PopUtils
;
import
com.ydl.utils.ProxyCheckUtils
;
import
com.ydl.utils.WebUrlParamsUtils
;
import
com.ydl.ydl_router.manager.YDLRouterManager
;
import
com.ydl.ydlcommon.base.BaseActivity
;
...
...
@@ -371,7 +372,10 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
tellData
=
new
TellData
();
}
initView
();
if
(!
BaseApp
.
instance
.
getGlobalConfig
().
getAppDebug
()&&
ProxyCheckUtils
.
INSTANCE
.
isWifiProxy
(
this
)){
ToastUtil
.
toastShort
(
"网络设置错误"
);
return
;
}
startType
=
getIntent
().
getIntExtra
(
"startType"
,
0
);
rightText
=
getIntent
().
getStringExtra
(
"rightText"
);
if
(
h5Params
==
null
)
{
...
...
@@ -380,6 +384,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
finish
();
return
;
}
setUrlHeightParams
();
EventBus
.
getDefault
().
register
(
this
);
jtoJHandle
=
WebModularServiceUtils
.
Companion
.
getWebService
().
getJavascripHandler
(
this
,
tellData
=
tellData
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment