hunter-open-sdk 2.0.0-beta.12 → 2.0.0-beta.14
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/index.js +1 -1
- package/lib/abilities/erase/index.js +1 -1
- package/lib/abilities/getGeneralReport/index.js +1 -1
- package/lib/abilities/getGeneralReport/worker.js +19 -1
- package/lib/abilities/getSaaSReport/index.js +1 -1
- package/lib/abilities/skip/index.js +1 -1
- package/lib/events/driver/service.js +2 -2
- package/lib/events/driver/winDriver.js +1 -1
- package/lib/index.js +2 -2
- package/lib/registerEvent/index.js +18 -11
- package/lib/resources/dll/{libinspectionkit_x64_0.2.0.dll → libinspectionkit_x64_0.2.1.dll} +0 -0
- package/lib/resources/mac/{libinspectionkit_amd64_0.2.0.dylib → libinspectionkit_amd64_0.2.1.dylib} +0 -0
- package/lib/resources/mac/{libinspectionkit_arm64_0.2.0.dylib → libinspectionkit_arm64_0.2.1.dylib} +0 -0
- package/lib/resources/version.online +1 -1
- package/lib/utils/utils.global.js +1 -1
- package/lib/utils/utils.initDll.js +1 -1
- package/package.json +1 -1
|
@@ -43,7 +43,7 @@ class GetGeneralReport {
|
|
|
43
43
|
if (!this.worker) {
|
|
44
44
|
const workerPath = new _url.default.URL('file://' + (0, _utils.getCurrentEnvPath)(__dirname, './worker.js'));
|
|
45
45
|
this.worker = new _webWorker.default(workerPath, {
|
|
46
|
-
type:
|
|
46
|
+
type: 'module'
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _utils = require("../../utils/utils.global");
|
|
4
|
+
const MAX_RETRY_COUNT = 3;
|
|
5
|
+
const RETRY_INTERVAL = 300;
|
|
6
|
+
|
|
4
7
|
// 处理主进程消息
|
|
5
|
-
function onMainMessage(event) {
|
|
8
|
+
function onMainMessage(event, retryCount = 0) {
|
|
6
9
|
const {
|
|
7
10
|
type,
|
|
8
11
|
params
|
|
@@ -17,6 +20,21 @@ function onMainMessage(event) {
|
|
|
17
20
|
};
|
|
18
21
|
}
|
|
19
22
|
const reportRes = (0, _utils.getGeneralReportCallKit)(params);
|
|
23
|
+
console.log(`第${retryCount + 1}次获取报告:`, reportRes);
|
|
24
|
+
const {
|
|
25
|
+
data: {
|
|
26
|
+
code
|
|
27
|
+
} = {}
|
|
28
|
+
} = reportRes;
|
|
29
|
+
|
|
30
|
+
// 如果获取报告失败,则重试一次
|
|
31
|
+
if (code !== 0 && retryCount < MAX_RETRY_COUNT) {
|
|
32
|
+
retryCount++;
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
onMainMessage(event, retryCount);
|
|
35
|
+
}, retryCount * RETRY_INTERVAL);
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
20
38
|
postMessage(reportRes);
|
|
21
39
|
break;
|
|
22
40
|
}
|
|
@@ -43,7 +43,7 @@ class GetSaaSReport {
|
|
|
43
43
|
if (!this.worker) {
|
|
44
44
|
const workerPath = new _url.default.URL('file://' + (0, _utils.getCurrentEnvPath)(__dirname, './worker.js'));
|
|
45
45
|
this.worker = new _webWorker.default(workerPath, {
|
|
46
|
-
type:
|
|
46
|
+
type: 'module'
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -24,9 +24,9 @@ class Service {
|
|
|
24
24
|
(0, _winDriver.checkHasDriver)().then(res => {
|
|
25
25
|
console.log('------------checkHasDriver', res);
|
|
26
26
|
if (res) {
|
|
27
|
-
mainWindow.webContents.send(
|
|
27
|
+
mainWindow.webContents.send('checkDriver', true);
|
|
28
28
|
} else {
|
|
29
|
-
mainWindow.webContents.send(
|
|
29
|
+
mainWindow.webContents.send('checkDriver', false);
|
|
30
30
|
(0, _winDriver.downloadDriver)(mainWindow);
|
|
31
31
|
}
|
|
32
32
|
});
|
|
@@ -12,7 +12,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
12
12
|
// import { app } from 'electron'
|
|
13
13
|
// import { command } from '../../utils/utils.command'
|
|
14
14
|
|
|
15
|
-
const Sentry = require(
|
|
15
|
+
const Sentry = require('@sentry/browser');
|
|
16
16
|
const sudo = require('sudo-prompt');
|
|
17
17
|
const path = require('path');
|
|
18
18
|
const fs = require('fs');
|
package/lib/index.js
CHANGED
|
@@ -11,9 +11,9 @@ var _getGeneralReport = require("./abilities/getGeneralReport");
|
|
|
11
11
|
var _erase = require("./abilities/erase");
|
|
12
12
|
var _activate = require("./abilities/activate");
|
|
13
13
|
var _skip = require("./abilities/skip");
|
|
14
|
-
const Sentry = require(
|
|
14
|
+
const Sentry = require('@sentry/browser');
|
|
15
15
|
Sentry.init({
|
|
16
|
-
dsn:
|
|
16
|
+
dsn: 'https://8a5296c59083430fbac0756f56ddbf5d@sentry.zhuanzhuan.com/2300',
|
|
17
17
|
tracesSampleRate: 1.0
|
|
18
18
|
});
|
|
19
19
|
console.log('Sentry initialized');
|
|
@@ -12,9 +12,9 @@ var _deviceHelper = require("../helper/deviceHelper");
|
|
|
12
12
|
var _utils4 = require("../utils/utils.initDll");
|
|
13
13
|
const usbmux = require('usbmux');
|
|
14
14
|
const path = require('path');
|
|
15
|
-
const request = require(
|
|
15
|
+
const request = require('request');
|
|
16
16
|
const fs = require('fs');
|
|
17
|
-
const Sentry = require(
|
|
17
|
+
const Sentry = require('@sentry/browser');
|
|
18
18
|
|
|
19
19
|
// saas回调
|
|
20
20
|
let saasCallBack;
|
|
@@ -55,7 +55,7 @@ const publishPair = (udid = '', params) => {
|
|
|
55
55
|
/**
|
|
56
56
|
* 获取信任状态
|
|
57
57
|
* @param {String} udid 设备id
|
|
58
|
-
* @returns
|
|
58
|
+
* @returns
|
|
59
59
|
*/
|
|
60
60
|
const getTrustStatus = async (udid = '', params, once = false) => {
|
|
61
61
|
if (!_deviceHelper.deviceHelper.hasUdid(udid)) {
|
|
@@ -63,14 +63,21 @@ const getTrustStatus = async (udid = '', params, once = false) => {
|
|
|
63
63
|
return false;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
// 通过调用 trust_status 来判断信任状态
|
|
67
|
-
const kitParamsObj = JSON.parse(params);
|
|
68
|
-
|
|
69
66
|
// 合并参数
|
|
70
|
-
Object.assign(
|
|
71
|
-
cmd: 'trust_status',
|
|
67
|
+
const paramsObj = Object.assign(JSON.parse(params), {
|
|
72
68
|
udid
|
|
73
69
|
});
|
|
70
|
+
let label = 'Windows';
|
|
71
|
+
if ((0, _utils.isMac)()) {
|
|
72
|
+
label = 'Mac';
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// 通过调用 trust_status 来判断信任状态
|
|
76
|
+
const kitParamsObj = {
|
|
77
|
+
cmd: 'trust_status',
|
|
78
|
+
label,
|
|
79
|
+
params: JSON.stringify(paramsObj)
|
|
80
|
+
};
|
|
74
81
|
|
|
75
82
|
// 获取信任状态
|
|
76
83
|
const trustStatusRes = (0, _utils3.callHunterInspectionKit)('TheForceKit', JSON.stringify(kitParamsObj));
|
|
@@ -96,7 +103,7 @@ const getTrustStatusOnce = async (udid, params) => {
|
|
|
96
103
|
/**
|
|
97
104
|
* 配对并获取信任状态
|
|
98
105
|
* @param {String} udid 设备id
|
|
99
|
-
* @returns
|
|
106
|
+
* @returns
|
|
100
107
|
*/
|
|
101
108
|
const DevicePair = async (udid = '', params) => {
|
|
102
109
|
const callBack = () => {
|
|
@@ -168,7 +175,7 @@ const updateDll = (packageUrl, targetVersion) => {
|
|
|
168
175
|
dllOutPath = path.resolve(resourcePath, `dll/libinspectionkit_x64_${targetVersion}.dll`);
|
|
169
176
|
}
|
|
170
177
|
const dllStream = fs.createWriteStream(dllOutPath);
|
|
171
|
-
request(packageUrl).pipe(dllStream).on(
|
|
178
|
+
request(packageUrl).pipe(dllStream).on('close', function (err) {
|
|
172
179
|
if (err) {
|
|
173
180
|
saasCallBack({
|
|
174
181
|
data: {
|
|
@@ -186,7 +193,7 @@ const updateDll = (packageUrl, targetVersion) => {
|
|
|
186
193
|
/**
|
|
187
194
|
* 更新下载dll文件 并重写本地版本号
|
|
188
195
|
* @param {String} udid 设备id
|
|
189
|
-
* @returns
|
|
196
|
+
* @returns
|
|
190
197
|
*/
|
|
191
198
|
const updateDllFileCheck = () => {
|
|
192
199
|
// mac的amd不支持更新
|
|
Binary file
|
package/lib/resources/mac/{libinspectionkit_amd64_0.2.0.dylib → libinspectionkit_amd64_0.2.1.dylib}
RENAMED
|
Binary file
|
package/lib/resources/mac/{libinspectionkit_arm64_0.2.0.dylib → libinspectionkit_arm64_0.2.1.dylib}
RENAMED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.1
|