abler-api 0.1.9 → 0.1.10
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/dist/cjs/pp-util.js +6 -8
- package/dist/es/pp-util.js +6 -8
- package/package.json +1 -1
package/dist/cjs/pp-util.js
CHANGED
|
@@ -424,7 +424,7 @@ class apiUtil$1 {
|
|
|
424
424
|
// Object.defineProperty(options, "identifyLimit", {
|
|
425
425
|
// get: function () {
|
|
426
426
|
// if (!this._identifyLimit) {
|
|
427
|
-
// // this._identifyLimit =
|
|
427
|
+
// // this._identifyLimit = ppUtil.waitPromise(_getIdentifyLimit(this.companyId));
|
|
428
428
|
// throw "options._identifyLimit 没有赋值";
|
|
429
429
|
// }
|
|
430
430
|
//
|
|
@@ -451,7 +451,7 @@ class apiUtil$1 {
|
|
|
451
451
|
*/
|
|
452
452
|
|
|
453
453
|
|
|
454
|
-
static
|
|
454
|
+
static extractToken(req, res, noErr) {
|
|
455
455
|
configNeeded();
|
|
456
456
|
|
|
457
457
|
if (!req.accessToken) {
|
|
@@ -732,7 +732,7 @@ class apiUtil$1 {
|
|
|
732
732
|
};
|
|
733
733
|
|
|
734
734
|
if (rec.secret !== "") {
|
|
735
|
-
rec.secret =
|
|
735
|
+
rec.secret = ppUtil$1.getEncAse192(rec.secret);
|
|
736
736
|
}
|
|
737
737
|
|
|
738
738
|
req.apiCallRec = rec;
|
|
@@ -1197,18 +1197,16 @@ class apiUtil$1 {
|
|
|
1197
1197
|
if (req.isMobile) {
|
|
1198
1198
|
// GET 请求的应该都是H5页面,由手机前端发起,需要把headers中的请求方ip换成服务端的
|
|
1199
1199
|
// todo: 如何在API访问记录中记住请求者(手机端)的真实IP
|
|
1200
|
-
req.headers['x-phone-ip'] =
|
|
1200
|
+
req.headers['x-phone-ip'] = apiUtil$1.getClientIp(req);
|
|
1201
1201
|
req.headers['x-real-ip'] = p.clientIp;
|
|
1202
1202
|
} else {
|
|
1203
|
-
p.clientIp =
|
|
1203
|
+
p.clientIp = apiUtil$1.getClientIp(req);
|
|
1204
1204
|
}
|
|
1205
1205
|
|
|
1206
1206
|
req.isApiCall = true;
|
|
1207
1207
|
req.tokenData = p;
|
|
1208
1208
|
apiUtil$1.$checkApiKeyOld(req, res, next);
|
|
1209
1209
|
}).catch(e => {
|
|
1210
|
-
// res.send(hb.showError("授权令牌不存在或已过期"));
|
|
1211
|
-
// res.send(spoApiFail(err.TOKEN_INVALID, req));
|
|
1212
1210
|
apiUtil$1.sendOrRedirect(req, res, apiUtil$1.spoApiFail(err.TOKEN_INVALID, req));
|
|
1213
1211
|
});
|
|
1214
1212
|
}
|
|
@@ -1228,7 +1226,7 @@ class apiUtil$1 {
|
|
|
1228
1226
|
let tokenExist = await apiUtil$1.tokenDataExist(apiUtil$1.userTokenStoreKey(accessToken));
|
|
1229
1227
|
|
|
1230
1228
|
if (tokenExist) {
|
|
1231
|
-
return apiUtil$1.$checkToken(req, res, next);
|
|
1229
|
+
return await apiUtil$1.$checkToken(req, res, next);
|
|
1232
1230
|
}
|
|
1233
1231
|
|
|
1234
1232
|
tokenExist = await apiUtil$1.tokenDataExist(apiUtil$1.apiTokenStoreKey(accessToken));
|
package/dist/es/pp-util.js
CHANGED
|
@@ -416,7 +416,7 @@ class apiUtil$1 {
|
|
|
416
416
|
// Object.defineProperty(options, "identifyLimit", {
|
|
417
417
|
// get: function () {
|
|
418
418
|
// if (!this._identifyLimit) {
|
|
419
|
-
// // this._identifyLimit =
|
|
419
|
+
// // this._identifyLimit = ppUtil.waitPromise(_getIdentifyLimit(this.companyId));
|
|
420
420
|
// throw "options._identifyLimit 没有赋值";
|
|
421
421
|
// }
|
|
422
422
|
//
|
|
@@ -443,7 +443,7 @@ class apiUtil$1 {
|
|
|
443
443
|
*/
|
|
444
444
|
|
|
445
445
|
|
|
446
|
-
static
|
|
446
|
+
static extractToken(req, res, noErr) {
|
|
447
447
|
configNeeded();
|
|
448
448
|
|
|
449
449
|
if (!req.accessToken) {
|
|
@@ -724,7 +724,7 @@ class apiUtil$1 {
|
|
|
724
724
|
};
|
|
725
725
|
|
|
726
726
|
if (rec.secret !== "") {
|
|
727
|
-
rec.secret =
|
|
727
|
+
rec.secret = ppUtil$1.getEncAse192(rec.secret);
|
|
728
728
|
}
|
|
729
729
|
|
|
730
730
|
req.apiCallRec = rec;
|
|
@@ -1189,18 +1189,16 @@ class apiUtil$1 {
|
|
|
1189
1189
|
if (req.isMobile) {
|
|
1190
1190
|
// GET 请求的应该都是H5页面,由手机前端发起,需要把headers中的请求方ip换成服务端的
|
|
1191
1191
|
// todo: 如何在API访问记录中记住请求者(手机端)的真实IP
|
|
1192
|
-
req.headers['x-phone-ip'] =
|
|
1192
|
+
req.headers['x-phone-ip'] = apiUtil$1.getClientIp(req);
|
|
1193
1193
|
req.headers['x-real-ip'] = p.clientIp;
|
|
1194
1194
|
} else {
|
|
1195
|
-
p.clientIp =
|
|
1195
|
+
p.clientIp = apiUtil$1.getClientIp(req);
|
|
1196
1196
|
}
|
|
1197
1197
|
|
|
1198
1198
|
req.isApiCall = true;
|
|
1199
1199
|
req.tokenData = p;
|
|
1200
1200
|
apiUtil$1.$checkApiKeyOld(req, res, next);
|
|
1201
1201
|
}).catch(e => {
|
|
1202
|
-
// res.send(hb.showError("授权令牌不存在或已过期"));
|
|
1203
|
-
// res.send(spoApiFail(err.TOKEN_INVALID, req));
|
|
1204
1202
|
apiUtil$1.sendOrRedirect(req, res, apiUtil$1.spoApiFail(err.TOKEN_INVALID, req));
|
|
1205
1203
|
});
|
|
1206
1204
|
}
|
|
@@ -1220,7 +1218,7 @@ class apiUtil$1 {
|
|
|
1220
1218
|
let tokenExist = await apiUtil$1.tokenDataExist(apiUtil$1.userTokenStoreKey(accessToken));
|
|
1221
1219
|
|
|
1222
1220
|
if (tokenExist) {
|
|
1223
|
-
return apiUtil$1.$checkToken(req, res, next);
|
|
1221
|
+
return await apiUtil$1.$checkToken(req, res, next);
|
|
1224
1222
|
}
|
|
1225
1223
|
|
|
1226
1224
|
tokenExist = await apiUtil$1.tokenDataExist(apiUtil$1.apiTokenStoreKey(accessToken));
|