abler-api 0.1.35 → 0.1.36

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.
@@ -1077,9 +1077,14 @@ class apiUtil$2 {
1077
1077
 
1078
1078
  static async hostIsMySelf(host, req) {
1079
1079
  let clientIp = apiUtil$2.getClientIp(req);
1080
- return ppUtil$4.getMyIp({
1081
- hosts: [host, clientIp]
1082
- });
1080
+
1081
+ try {
1082
+ return !!ppUtil$4.getMyIp({
1083
+ hosts: [host, clientIp]
1084
+ });
1085
+ } catch (e) {
1086
+ return false;
1087
+ }
1083
1088
  }
1084
1089
  /**
1085
1090
  * 检查是否应该把请求转发到其它服务器,若是则转发
@@ -1462,7 +1467,7 @@ var ppUtilApi = apiUtil$2;
1462
1467
  const fs = require$$4__default["default"];
1463
1468
  const path = require$$1__default$1["default"];
1464
1469
  const ppUtil$3 = require$$1__default["default"].ppUtil;
1465
- const redisUtil = require$$2__default["default"].redisUtil;
1470
+ const ppRedis = require$$2__default["default"].ppRedis;
1466
1471
  let conf$2, err$1; // const dbCheck = require('../dbupdate/dd-version');
1467
1472
 
1468
1473
  /**
@@ -1614,7 +1619,7 @@ async function checkExEnvSetting(loadjs) {
1614
1619
 
1615
1620
  async function checkRedis() {
1616
1621
  if (!conf$2.redis.enabled) return "";
1617
- const redis = redisUtil.newClient("io"); // console.log(`checkRedis begin:`);
1622
+ const redis = ppRedis.newClient("kv"); // console.log(`checkRedis begin:`);
1618
1623
 
1619
1624
  await ppUtil$3.wait(15 * 1000, param => {
1620
1625
  if (redis.ready && redis.connected || redis.error) {
@@ -1064,9 +1064,14 @@ class apiUtil$2 {
1064
1064
 
1065
1065
  static async hostIsMySelf(host, req) {
1066
1066
  let clientIp = apiUtil$2.getClientIp(req);
1067
- return ppUtil$4.getMyIp({
1068
- hosts: [host, clientIp]
1069
- });
1067
+
1068
+ try {
1069
+ return !!ppUtil$4.getMyIp({
1070
+ hosts: [host, clientIp]
1071
+ });
1072
+ } catch (e) {
1073
+ return false;
1074
+ }
1070
1075
  }
1071
1076
  /**
1072
1077
  * 检查是否应该把请求转发到其它服务器,若是则转发
@@ -1449,7 +1454,7 @@ var ppUtilApi = apiUtil$2;
1449
1454
  const fs = require$$4;
1450
1455
  const path = require$$1$1;
1451
1456
  const ppUtil$3 = require$$1.ppUtil;
1452
- const redisUtil = require$$2.redisUtil;
1457
+ const ppRedis = require$$2.ppRedis;
1453
1458
  let conf$2, err$1; // const dbCheck = require('../dbupdate/dd-version');
1454
1459
 
1455
1460
  /**
@@ -1601,7 +1606,7 @@ async function checkExEnvSetting(loadjs) {
1601
1606
 
1602
1607
  async function checkRedis() {
1603
1608
  if (!conf$2.redis.enabled) return "";
1604
- const redis = redisUtil.newClient("io"); // console.log(`checkRedis begin:`);
1609
+ const redis = ppRedis.newClient("kv"); // console.log(`checkRedis begin:`);
1605
1610
 
1606
1611
  await ppUtil$3.wait(15 * 1000, param => {
1607
1612
  if (redis.ready && redis.connected || redis.error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abler-api",
3
- "version": "0.1.35",
3
+ "version": "0.1.36",
4
4
  "description": "API服务相关工具",
5
5
  "main": "./dist/cjs/pp-util.js",
6
6
  "module": "./dist/es/pp-util.js",