hunter-open-sdk 2.0.0-beta.15 → 2.0.0-beta.17
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/abilities/activate/worker.js +8 -2
- package/lib/abilities/erase/worker.js +8 -2
- package/lib/abilities/getGeneralReport/worker.js +8 -2
- package/lib/abilities/getSaaSReport/worker.js +9 -2
- package/lib/abilities/reboot/worker.js +8 -2
- package/lib/abilities/shutdown/worker.js +8 -2
- package/lib/abilities/skip/worker.js +8 -2
- package/lib/resources/dll/{libinspectionkit_x64_0.3.0.dll → libinspectionkit_x64_0.3.1.dll} +0 -0
- package/lib/resources/mac/{libinspectionkit_amd64_0.3.0.dylib → libinspectionkit_amd64_0.3.1.dylib} +0 -0
- package/lib/resources/mac/{libinspectionkit_arm64_0.3.0.dylib → libinspectionkit_arm64_0.3.1.dylib} +0 -0
- package/lib/resources/version.online +1 -1
- package/lib/utils/utils.global.js +4 -1
- package/lib/utils/utils.path.js +8 -11
- package/lib/utils/utils.process.js +12 -0
- package/lib/utils/utils.worker.js +32 -0
- package/package.json +1 -1
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const {
|
|
4
|
+
initWorkerNodePath
|
|
5
|
+
} = require("../../utils/utils.worker");
|
|
6
|
+
initWorkerNodePath();
|
|
7
|
+
const {
|
|
8
|
+
activateCallKit
|
|
9
|
+
} = require("../../utils/utils.global");
|
|
4
10
|
function onMainMessage(event) {
|
|
5
11
|
const {
|
|
6
12
|
type,
|
|
@@ -15,7 +21,7 @@ function onMainMessage(event) {
|
|
|
15
21
|
message: '【activate】方法缺少必要参数'
|
|
16
22
|
};
|
|
17
23
|
}
|
|
18
|
-
const res =
|
|
24
|
+
const res = activateCallKit(params);
|
|
19
25
|
postMessage(res);
|
|
20
26
|
break;
|
|
21
27
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const {
|
|
4
|
+
initWorkerNodePath
|
|
5
|
+
} = require("../../utils/utils.worker");
|
|
6
|
+
initWorkerNodePath();
|
|
7
|
+
const {
|
|
8
|
+
eraseCallKit
|
|
9
|
+
} = require("../../utils/utils.global");
|
|
4
10
|
function onMainMessage(event) {
|
|
5
11
|
const {
|
|
6
12
|
type,
|
|
@@ -15,7 +21,7 @@ function onMainMessage(event) {
|
|
|
15
21
|
message: '【erase】方法缺少必要参数'
|
|
16
22
|
};
|
|
17
23
|
}
|
|
18
|
-
const res =
|
|
24
|
+
const res = eraseCallKit(params);
|
|
19
25
|
postMessage(res);
|
|
20
26
|
break;
|
|
21
27
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const {
|
|
4
|
+
initWorkerNodePath
|
|
5
|
+
} = require("../../utils/utils.worker");
|
|
6
|
+
initWorkerNodePath();
|
|
7
|
+
const {
|
|
8
|
+
getGeneralReportCallKit
|
|
9
|
+
} = require("../../utils/utils.global");
|
|
4
10
|
const MAX_RETRY_COUNT = 3;
|
|
5
11
|
const RETRY_INTERVAL = 300;
|
|
6
12
|
|
|
@@ -19,7 +25,7 @@ function onMainMessage(event, retryCount = 0) {
|
|
|
19
25
|
message: '【getGeneralReport】方法缺少必要参数'
|
|
20
26
|
};
|
|
21
27
|
}
|
|
22
|
-
const reportRes =
|
|
28
|
+
const reportRes = getGeneralReportCallKit(params);
|
|
23
29
|
console.log(`第${retryCount + 1}次获取报告:`, reportRes);
|
|
24
30
|
const {
|
|
25
31
|
data: {
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const {
|
|
4
|
+
initWorkerNodePath
|
|
5
|
+
} = require("../../utils/utils.worker");
|
|
6
|
+
initWorkerNodePath();
|
|
7
|
+
const {
|
|
8
|
+
getSaaSReportCallKit
|
|
9
|
+
} = require("../../utils/utils.global");
|
|
10
|
+
|
|
4
11
|
// 处理主进程消息
|
|
5
12
|
function onMainMessage(event) {
|
|
6
13
|
const {
|
|
@@ -9,7 +16,7 @@ function onMainMessage(event) {
|
|
|
9
16
|
} = event.data;
|
|
10
17
|
switch (type) {
|
|
11
18
|
case 'getSaaSReport':
|
|
12
|
-
const reportRes =
|
|
19
|
+
const reportRes = getSaaSReportCallKit(params);
|
|
13
20
|
postMessage(reportRes);
|
|
14
21
|
break;
|
|
15
22
|
default:
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const {
|
|
4
|
+
initWorkerNodePath
|
|
5
|
+
} = require("../../utils/utils.worker");
|
|
6
|
+
initWorkerNodePath();
|
|
7
|
+
const {
|
|
8
|
+
rebootCallKit
|
|
9
|
+
} = require("../../utils/utils.global");
|
|
4
10
|
function onMainMessage(event) {
|
|
5
11
|
const {
|
|
6
12
|
type,
|
|
@@ -15,7 +21,7 @@ function onMainMessage(event) {
|
|
|
15
21
|
message: '【reboot】方法缺少必要参数'
|
|
16
22
|
};
|
|
17
23
|
}
|
|
18
|
-
const res =
|
|
24
|
+
const res = rebootCallKit(params);
|
|
19
25
|
postMessage(res);
|
|
20
26
|
break;
|
|
21
27
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const {
|
|
4
|
+
initWorkerNodePath
|
|
5
|
+
} = require("../../utils/utils.worker");
|
|
6
|
+
initWorkerNodePath();
|
|
7
|
+
const {
|
|
8
|
+
shutdownCallKit
|
|
9
|
+
} = require("../../utils/utils.global");
|
|
4
10
|
function onMainMessage(event) {
|
|
5
11
|
const {
|
|
6
12
|
type,
|
|
@@ -15,7 +21,7 @@ function onMainMessage(event) {
|
|
|
15
21
|
message: '【shutdown】方法缺少必要参数'
|
|
16
22
|
};
|
|
17
23
|
}
|
|
18
|
-
const res =
|
|
24
|
+
const res = shutdownCallKit(params);
|
|
19
25
|
postMessage(res);
|
|
20
26
|
break;
|
|
21
27
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const {
|
|
4
|
+
initWorkerNodePath
|
|
5
|
+
} = require("../../utils/utils.worker");
|
|
6
|
+
initWorkerNodePath();
|
|
7
|
+
const {
|
|
8
|
+
skipCallKit
|
|
9
|
+
} = require("../../utils/utils.global");
|
|
4
10
|
function onMainMessage(event) {
|
|
5
11
|
const {
|
|
6
12
|
type,
|
|
@@ -15,7 +21,7 @@ function onMainMessage(event) {
|
|
|
15
21
|
message: '【skip】方法缺少必要参数'
|
|
16
22
|
};
|
|
17
23
|
}
|
|
18
|
-
const res =
|
|
24
|
+
const res = skipCallKit(params);
|
|
19
25
|
postMessage(res);
|
|
20
26
|
break;
|
|
21
27
|
}
|
|
Binary file
|
package/lib/resources/mac/{libinspectionkit_amd64_0.3.0.dylib → libinspectionkit_amd64_0.3.1.dylib}
RENAMED
|
Binary file
|
package/lib/resources/mac/{libinspectionkit_arm64_0.3.0.dylib → libinspectionkit_arm64_0.3.1.dylib}
RENAMED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0.3.
|
|
1
|
+
0.3.1
|
|
@@ -5,11 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.skipCallKit = exports.shutdownCallKit = exports.setGlobalProperty = exports.rebootCallKit = exports.hasGlobalProperty = exports.getSaaSReportCallKit = exports.getHunterInspectionKit = exports.getGlobalProperty = exports.getGlobalObject = exports.getGeneralReportCallKit = exports.eraseCallKit = exports.deleteGlobalProperty = exports.callHunterInspectionKit = exports.activateCallKit = void 0;
|
|
7
7
|
var _utils = require("../utils/utils.initDll");
|
|
8
|
+
var Sentry = _interopRequireWildcard(require("@sentry/browser"));
|
|
9
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
8
11
|
/**
|
|
9
12
|
* 全局对象兼容性处理工具
|
|
10
13
|
* 兼容Electron主进程(global)和渲染进程(window)环境
|
|
11
14
|
*/
|
|
12
|
-
|
|
15
|
+
|
|
13
16
|
/**
|
|
14
17
|
* 获取全局对象
|
|
15
18
|
* @returns {Object} 全局对象
|
package/lib/utils/utils.path.js
CHANGED
|
@@ -4,7 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getCurrentEnvPath = getCurrentEnvPath;
|
|
7
|
-
exports.
|
|
7
|
+
exports.getCurrentNodePath = getCurrentNodePath;
|
|
8
|
+
exports.getPathWithCWD = getPathWithCWD;
|
|
8
9
|
var _path = _interopRequireDefault(require("path"));
|
|
9
10
|
var _process = _interopRequireDefault(require("process"));
|
|
10
11
|
var _utils = require("./utils.env");
|
|
@@ -21,14 +22,10 @@ function getCurrentEnvPath(dirPath, filePath = '') {
|
|
|
21
22
|
}
|
|
22
23
|
return _path.default.resolve(fixPath, filePath);
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} else {
|
|
31
|
-
return '这是在 Electron 的渲染进程中';
|
|
32
|
-
}
|
|
33
|
-
}
|
|
25
|
+
function getPathWithCWD(dirPath) {
|
|
26
|
+
const cwd = _process.default.cwd();
|
|
27
|
+
return _path.default.join(cwd, dirPath);
|
|
28
|
+
}
|
|
29
|
+
function getCurrentNodePath() {
|
|
30
|
+
return _process.default.env.NODE_PATH || '';
|
|
34
31
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.getCurrentProcess = getCurrentProcess;
|
|
6
7
|
exports.getProccessType = getProccessType;
|
|
7
8
|
exports.isInMainProcess = isInMainProcess;
|
|
8
9
|
exports.isInRenderProcess = isInRenderProcess;
|
|
@@ -20,4 +21,15 @@ function isInMainProcess() {
|
|
|
20
21
|
// eslint-disable-next-line no-unused-vars
|
|
21
22
|
function isInRenderProcess() {
|
|
22
23
|
return getProccessType() === 'renderer';
|
|
24
|
+
}
|
|
25
|
+
function getCurrentProcess() {
|
|
26
|
+
if (typeof process === 'undefined' || process.type === undefined) {
|
|
27
|
+
return '这是在浏览器环境中';
|
|
28
|
+
} else {
|
|
29
|
+
if (process.type === 'browser') {
|
|
30
|
+
return '这是在 Node.js 环境中';
|
|
31
|
+
} else {
|
|
32
|
+
return '这是在 Electron 的渲染进程中';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
23
35
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getAsarNodePath = getAsarNodePath;
|
|
7
|
+
exports.initWorkerNodePath = initWorkerNodePath;
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const _module = require('module');
|
|
10
|
+
const {
|
|
11
|
+
getPathWithCWD,
|
|
12
|
+
getCurrentNodePath
|
|
13
|
+
} = require("./utils.path");
|
|
14
|
+
function getAsarNodePath() {
|
|
15
|
+
const asarRoot = getPathWithCWD('app.asar');
|
|
16
|
+
const unpackedRoot = asarRoot.replace('app.asar', 'app.asar.unpacked');
|
|
17
|
+
const nodeModulesPaths = [path.join(asarRoot, 'node_modules'), path.join(unpackedRoot, 'node_modules')];
|
|
18
|
+
return nodeModulesPaths.join(path.delimiter);
|
|
19
|
+
}
|
|
20
|
+
function initWorkerNodePath() {
|
|
21
|
+
const currentNodePath = getCurrentNodePath();
|
|
22
|
+
if (currentNodePath.includes('app.asar') && currentNodePath.includes('app.asar.unpacked')) {
|
|
23
|
+
console.log('Has process.env.NODE_PATH =>', process.env.NODE_PATH);
|
|
24
|
+
_module.Module._initPaths();
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const asarNodePath = getAsarNodePath();
|
|
28
|
+
const nodePathArr = [currentNodePath, asarNodePath];
|
|
29
|
+
process.env.NODE_PATH = nodePathArr.filter(Boolean).join(path.delimiter);
|
|
30
|
+
console.log('Set process.env.NODE_PATH =>', process.env.NODE_PATH);
|
|
31
|
+
_module.Module._initPaths();
|
|
32
|
+
}
|