[master] fix bug of http header add auth key check

This commit is contained in:
zhongchao
2023-07-17 16:46:55 +08:00
parent fcf6eb58bd
commit 74d95bed7f
2 changed files with 15 additions and 14 deletions

View File

@@ -11,8 +11,7 @@ import okhttp3.Response
class HttpHeaderInterceptor : Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
val original = chain.request()
val request = original.newBuilder()
.header("authKey",MoGoAiCloudClient.getInstance().aiCloudClientConfig.authPubKey)
var request = original.newBuilder()
.header("token", MoGoAiCloudClient.getInstance().aiCloudClientConfig.token)
.header("cityCode", MoGoAiCloudClient.getInstance().aiCloudClientConfig.iHttpCurrentLocation.currentLocation?.cityCode.toString())
.header("lat",MoGoAiCloudClient.getInstance().aiCloudClientConfig.iHttpCurrentLocation.currentLocation?.lat.toString())
@@ -21,7 +20,9 @@ class HttpHeaderInterceptor : Interceptor {
.header("sn",MoGoAiCloudClient.getInstance().aiCloudClientConfig.sn)
.method(original.method(), original.body())
.build()
if(MoGoAiCloudClient.getInstance().aiCloudClientConfig.authPubKey.isNotBlank()){
request = request.newBuilder().header("authKey",MoGoAiCloudClient.getInstance().aiCloudClientConfig.authPubKey).build()
}
return chain.proceed(request)
}
}

View File

@@ -36,24 +36,24 @@ PASSWORD=xintai2018
RELEASE=true
# AI CLOUD 云平台
# 工具类
MOGO_UTILS_VERSION=1.4.7.10
MOGO_UTILS_VERSION=1.4.7.11
# 网络请求
MOGO_NETWORK_VERSION=1.4.7.10
MOGO_NETWORK_VERSION=1.4.7.11
# 鉴权
MOGO_PASSPORT_VERSION=1.4.7.10
MOGO_PASSPORT_VERSION=1.4.7.11
# 常链接
MOGO_SOCKET_VERSION=1.4.7.10
MOGO_SOCKET_VERSION=1.4.7.11
# 数据采集
MOGO_REALTIME_VERSION=1.4.7.10
MOGO_REALTIME_VERSION=1.4.7.11
# 探路,道路事件发布,获取
MOGO_TANLU_VERSION=1.4.7.10
MOGO_TANLU_VERSION=1.4.7.11
# 直播推流
MOGO_LIVE_VERSION=1.4.7.10
MOGO_LIVE_VERSION=1.4.7.11
# 直播拉流
MOGO_TRAFFICLIVE_VERSION=1.4.7.10
MOGO_TRAFFICLIVE_VERSION=1.4.7.11
# 定位服务
MOGO_LOCATION_VERSION=1.4.7.10
MOGO_LOCATION_VERSION=1.4.7.11
# 远程通讯模块
MOGO_TELEMATIC_VERSION=1.4.7.10
MOGO_TELEMATIC_VERSION=1.4.7.11
# v2x
MOGO_V2X_VERSION=1.4.7.10
MOGO_V2X_VERSION=1.4.7.11