@tmsfe/tms-core 0.0.177 → 0.0.178
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -317,7 +317,7 @@ const cryptRuleUtil = {
|
|
|
317
317
|
// 远程加密服务是否开启
|
|
318
318
|
isServerOpen: (): boolean => !!wx.$_publicKey,
|
|
319
319
|
// 检查path是否符合下发的路由前缀
|
|
320
|
-
|
|
320
|
+
pathInUnablePrefix: (path: string): boolean => {
|
|
321
321
|
if (!wx.$_publicKey) {
|
|
322
322
|
return false;
|
|
323
323
|
}
|
|
@@ -392,8 +392,8 @@ const isCryptoRuleMath = (path: string, reqData: any): BaseResp<boolean> => {
|
|
|
392
392
|
if (!cryptRuleUtil.isServerOpen()) {
|
|
393
393
|
return new baseUtil.BaseRespFac(false, false, '服务端加密未开启');
|
|
394
394
|
}
|
|
395
|
-
//
|
|
396
|
-
if (
|
|
395
|
+
// 请求路由满足服务端下发的不加密规则,不走加密
|
|
396
|
+
if (cryptRuleUtil.pathInUnablePrefix(path)) {
|
|
397
397
|
return new baseUtil.BaseRespFac(false, false, '未命中服务端加密规则');
|
|
398
398
|
}
|
|
399
399
|
// 请求接口是加密性能埋点上报接口,不加密
|
package/src/encrypt/index.ts
CHANGED
|
@@ -145,7 +145,7 @@ function proxyWxRequest(): void {
|
|
|
145
145
|
});
|
|
146
146
|
success?.call(this, res);
|
|
147
147
|
// 接口重试耗时
|
|
148
|
-
|
|
148
|
+
const now = Date.now();
|
|
149
149
|
wx.reportEvent?.('cost_encrypt_statistic', {
|
|
150
150
|
period: 'retry_request',
|
|
151
151
|
cost: Date.now() - startTime,
|
|
@@ -165,7 +165,7 @@ function proxyWxRequest(): void {
|
|
|
165
165
|
});
|
|
166
166
|
success?.call(this, res);
|
|
167
167
|
// 响应回调耗时
|
|
168
|
-
|
|
168
|
+
const now = Date.now();
|
|
169
169
|
wx.reportEvent?.('cost_encrypt_statistic', {
|
|
170
170
|
period: 'response_callback',
|
|
171
171
|
cost: now - startTime,
|
|
@@ -192,7 +192,7 @@ function proxyWxRequest(): void {
|
|
|
192
192
|
},
|
|
193
193
|
});
|
|
194
194
|
// 加密请求准备耗时
|
|
195
|
-
|
|
195
|
+
const now = Date.now();
|
|
196
196
|
wx.reportEvent?.('cost_encrypt_statistic', {
|
|
197
197
|
period: 'before_request',
|
|
198
198
|
cost: now - startTime,
|