crabatool 1.0.127 → 1.0.129

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/lib/utils.js CHANGED
@@ -547,6 +547,30 @@ class Utils {
547
547
  });
548
548
  obj[lastKey] = value;
549
549
  }
550
+
551
+ getHostName() {
552
+ const os = require('os');
553
+ return os.hostname();
554
+ }
555
+
556
+ getLocalIP() {
557
+ const os = require('os');
558
+ const osType = os.type(); //系统类型
559
+ const netInfo = os.networkInterfaces(); //网络信息
560
+ let ip = 'null';
561
+
562
+ for (let dev in netInfo) {
563
+ for (let j = 0; j < netInfo[dev].length; j++) {
564
+ var adr = netInfo[dev][j];
565
+ if (adr.family === 'IPv4' && adr.address != '127.0.0.1' && !adr.internal) {
566
+ ip = adr.address;
567
+ break;
568
+ }
569
+ }
570
+ }
571
+
572
+ return ip;
573
+ }
550
574
  }
551
575
  var utils = new Utils();
552
576
  module = module.exports = utils;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crabatool",
3
- "version": "1.0.127",
3
+ "version": "1.0.129",
4
4
  "description": "crabatool",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/tool/checkjs.js CHANGED
@@ -171,6 +171,7 @@ module.exports.start = async function() {
171
171
  }
172
172
  info.push(`| 生成报告时间 | ${new Date().toString()} |`);
173
173
  info.push(`| 分支名 | ${branchName} |`);
174
+ info.push(`| 检测主机 | ${utils.getHostName()}(${utils.getLocalIP()}) |`);
174
175
  info.push(`| 网站路径 | ${config.webPath} |`);
175
176
  info.push(`| 共检查 | ${jsFiles.length}个js文件 |`);
176
177
  info.push(`| 共检查 | ${gspxData.count}个gspx文件 |`);
@@ -194,6 +195,7 @@ module.exports.start = async function() {
194
195
  webhookList.push(`1. 平台日期:${localVersion.date}`);
195
196
  }
196
197
  webhookList.push(`1. 分支名:${branchName}`);
198
+ webhookList.push(`1. 检测主机:${utils.getHostName()}(${utils.getLocalIP()}) |`);
197
199
  webhookList.push(`1. 共检测 ${jsFiles.length}个 js文件 `);
198
200
  webhookList.push(`1. 共检测 ${gspxData.count}个 gspx文件 `);
199
201