hunter-open-sdk 2.0.0-beta.2 → 2.0.0-beta.20
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 +48 -0
- package/lib/abilities/activate/worker.js +19 -0
- package/lib/abilities/erase/index.js +48 -0
- package/lib/abilities/erase/worker.js +19 -0
- package/lib/abilities/eventManager/index.js +338 -0
- package/lib/abilities/getAndroidSn/index.js +165 -0
- package/lib/abilities/getGeneralReport/index.js +64 -0
- package/lib/abilities/getGeneralReport/worker.js +38 -0
- package/lib/abilities/getSaaSReport/index.js +48 -0
- package/lib/abilities/getSaaSReport/worker.js +21 -0
- package/lib/abilities/installApp/index.js +48 -0
- package/lib/abilities/installApp/worker.js +19 -0
- package/lib/abilities/reboot/index.js +48 -0
- package/lib/abilities/reboot/worker.js +19 -0
- package/lib/abilities/shutdown/index.js +48 -0
- package/lib/abilities/shutdown/worker.js +19 -0
- package/lib/abilities/skip/index.js +48 -0
- package/lib/abilities/skip/worker.js +19 -0
- package/lib/events/driver/command.js +8 -9
- package/lib/events/driver/service.js +24 -35
- package/lib/events/driver/winDriver.js +121 -188
- package/lib/helper/deviceHelper.js +19 -37
- package/lib/index.js +24 -12
- package/lib/resources/dll/{libinspectionkit_x64_0.1.0.dll → libinspectionkit_x64_0.4.1.dll} +0 -0
- package/lib/resources/mac/{libinspectionkit_arm64_0.1.0.dylib → libinspectionkit_amd64_0.4.1.dylib} +0 -0
- package/lib/resources/mac/libinspectionkit_arm64_0.4.1.dylib +0 -0
- package/lib/resources/version.online +1 -1
- package/lib/utils/utils.ability.js +9 -0
- package/lib/utils/utils.command.js +8 -9
- package/lib/utils/utils.common.js +26 -0
- package/lib/utils/{utils.js → utils.env.js} +19 -18
- package/lib/utils/utils.global.js +70 -89
- package/lib/utils/utils.initDll.js +16 -14
- package/lib/utils/utils.path.js +21 -6
- package/lib/utils/utils.process.js +35 -0
- package/lib/utils/utils.sn.js +31 -47
- package/lib/utils/utils.worker.js +32 -0
- package/package.json +7 -8
- package/lib/getAndroidSn/index.js +0 -228
- package/lib/getGeneralReport/index.js +0 -76
- package/lib/getGeneralReport/worker.js +0 -20
- package/lib/getSaaSReport/index.js +0 -76
- package/lib/getSaaSReport/worker.js +0 -20
- package/lib/registerEvent/index.js +0 -427
- package/lib/resources/mac/libinspectionkit_amd64_0.1.0.dylib +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
initWorkerNodePath
|
|
5
|
+
} = require("../../utils/utils.worker");
|
|
6
|
+
|
|
7
|
+
// 先注册NodePath后才能正常使用node包,请勿挪动位置
|
|
8
|
+
initWorkerNodePath();
|
|
9
|
+
const {
|
|
10
|
+
abilityCallKit
|
|
11
|
+
} = require("../../utils/utils.global");
|
|
12
|
+
const MAX_RETRY_COUNT = 3;
|
|
13
|
+
const RETRY_INTERVAL = 300;
|
|
14
|
+
|
|
15
|
+
// 处理主进程消息
|
|
16
|
+
function onMainMessage(event, retryCount = 0) {
|
|
17
|
+
const {
|
|
18
|
+
payload
|
|
19
|
+
} = event.data;
|
|
20
|
+
const reportRes = abilityCallKit('general_report', payload);
|
|
21
|
+
const {
|
|
22
|
+
payload: {
|
|
23
|
+
code
|
|
24
|
+
} = {}
|
|
25
|
+
} = reportRes;
|
|
26
|
+
|
|
27
|
+
// 如果获取报告失败,则重试一次
|
|
28
|
+
if (code !== 0 && retryCount < MAX_RETRY_COUNT) {
|
|
29
|
+
retryCount++;
|
|
30
|
+
console.log(`获取报告失败,重试次数:${retryCount}/${MAX_RETRY_COUNT}`);
|
|
31
|
+
setTimeout(() => {
|
|
32
|
+
onMainMessage(event, retryCount);
|
|
33
|
+
}, retryCount * RETRY_INTERVAL);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
postMessage(reportRes);
|
|
37
|
+
}
|
|
38
|
+
addEventListener('message', onMainMessage);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getSaaSReport = getSaaSReport;
|
|
7
|
+
var _webWorker = _interopRequireDefault(require("web-worker"));
|
|
8
|
+
var _url = _interopRequireDefault(require("url"));
|
|
9
|
+
var _utils = require("../../utils/utils.common");
|
|
10
|
+
var _utils2 = require("../../utils/utils.path");
|
|
11
|
+
var _utils3 = require("../../utils/utils.ability");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
class GetSaaSReport {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.initWorker();
|
|
16
|
+
this.initWorkerListener();
|
|
17
|
+
}
|
|
18
|
+
worker = null;
|
|
19
|
+
callback = null;
|
|
20
|
+
exec(payload, callback) {
|
|
21
|
+
this.callback = typeof callback === 'function' ? callback : _utils3.defaultCallback;
|
|
22
|
+
this.worker && this.worker.postMessage({
|
|
23
|
+
payload
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
initWorkerListener() {
|
|
27
|
+
this.worker && this.worker.addEventListener('message', event => {
|
|
28
|
+
const {
|
|
29
|
+
payload
|
|
30
|
+
} = event.data;
|
|
31
|
+
this.callback(payload);
|
|
32
|
+
this.callback = null;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
initWorker() {
|
|
36
|
+
if (!this.worker) {
|
|
37
|
+
const workerPath = new _url.default.URL('file://' + (0, _utils2.getCurrentEnvPath)(__dirname, './worker.js'));
|
|
38
|
+
this.worker = new _webWorker.default(workerPath, {
|
|
39
|
+
type: 'module'
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const entity = new GetSaaSReport();
|
|
45
|
+
function getSaaSReport(params, callback) {
|
|
46
|
+
const payload = (0, _utils.parsePayload)(params);
|
|
47
|
+
entity.exec(payload, callback);
|
|
48
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
initWorkerNodePath
|
|
5
|
+
} = require("../../utils/utils.worker");
|
|
6
|
+
|
|
7
|
+
// 先注册NodePath后才能正常使用node包,请勿挪动位置
|
|
8
|
+
initWorkerNodePath();
|
|
9
|
+
const {
|
|
10
|
+
abilityCallKit
|
|
11
|
+
} = require("../../utils/utils.global");
|
|
12
|
+
|
|
13
|
+
// 处理主进程消息
|
|
14
|
+
function onMainMessage(event) {
|
|
15
|
+
const {
|
|
16
|
+
payload
|
|
17
|
+
} = event.data;
|
|
18
|
+
const res = abilityCallKit('saas_report', payload);
|
|
19
|
+
postMessage(res);
|
|
20
|
+
}
|
|
21
|
+
addEventListener('message', onMainMessage);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.installApp = installApp;
|
|
7
|
+
var _webWorker = _interopRequireDefault(require("web-worker"));
|
|
8
|
+
var _url = _interopRequireDefault(require("url"));
|
|
9
|
+
var _utils = require("../../utils/utils.common");
|
|
10
|
+
var _utils2 = require("../../utils/utils.path");
|
|
11
|
+
var _utils3 = require("../../utils/utils.ability");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
class InstallApp {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.initWorker();
|
|
16
|
+
this.initWorkerListener();
|
|
17
|
+
}
|
|
18
|
+
worker = null;
|
|
19
|
+
callback = null;
|
|
20
|
+
exec(payload, callback) {
|
|
21
|
+
this.callback = typeof callback === 'function' ? callback : _utils3.defaultCallback;
|
|
22
|
+
this.worker && this.worker.postMessage({
|
|
23
|
+
payload
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
initWorkerListener() {
|
|
27
|
+
this.worker && this.worker.addEventListener('message', event => {
|
|
28
|
+
const {
|
|
29
|
+
payload
|
|
30
|
+
} = event.data;
|
|
31
|
+
this.callback(payload);
|
|
32
|
+
this.callback = null;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
initWorker() {
|
|
36
|
+
if (!this.worker) {
|
|
37
|
+
const workerPath = new _url.default.URL('file://' + (0, _utils2.getCurrentEnvPath)(__dirname, './worker.js'));
|
|
38
|
+
this.worker = new _webWorker.default(workerPath, {
|
|
39
|
+
type: 'module'
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const entity = new InstallApp();
|
|
45
|
+
function installApp(params, callback) {
|
|
46
|
+
const payload = (0, _utils.parsePayload)(params);
|
|
47
|
+
entity.exec(payload, callback);
|
|
48
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
initWorkerNodePath
|
|
5
|
+
} = require("../../utils/utils.worker");
|
|
6
|
+
|
|
7
|
+
// 先注册NodePath后才能正常使用node包,请勿挪动位置
|
|
8
|
+
initWorkerNodePath();
|
|
9
|
+
const {
|
|
10
|
+
abilityCallKit
|
|
11
|
+
} = require("../../utils/utils.global");
|
|
12
|
+
function onMainMessage(event) {
|
|
13
|
+
const {
|
|
14
|
+
payload
|
|
15
|
+
} = event.data;
|
|
16
|
+
const res = abilityCallKit('install_app', payload);
|
|
17
|
+
postMessage(res);
|
|
18
|
+
}
|
|
19
|
+
addEventListener('message', onMainMessage);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.reboot = reboot;
|
|
7
|
+
var _webWorker = _interopRequireDefault(require("web-worker"));
|
|
8
|
+
var _url = _interopRequireDefault(require("url"));
|
|
9
|
+
var _utils = require("../../utils/utils.common");
|
|
10
|
+
var _utils2 = require("../../utils/utils.path");
|
|
11
|
+
var _utils3 = require("../../utils/utils.ability");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
class Reboot {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.initWorker();
|
|
16
|
+
this.initWorkerListener();
|
|
17
|
+
}
|
|
18
|
+
worker = null;
|
|
19
|
+
callback = null;
|
|
20
|
+
exec(payload, callback) {
|
|
21
|
+
this.callback = typeof callback === 'function' ? callback : _utils3.defaultCallback;
|
|
22
|
+
this.worker && this.worker.postMessage({
|
|
23
|
+
payload
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
initWorkerListener() {
|
|
27
|
+
this.worker && this.worker.addEventListener('message', event => {
|
|
28
|
+
const {
|
|
29
|
+
payload
|
|
30
|
+
} = event.data;
|
|
31
|
+
this.callback(payload);
|
|
32
|
+
this.callback = null;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
initWorker() {
|
|
36
|
+
if (!this.worker) {
|
|
37
|
+
const workerPath = new _url.default.URL('file://' + (0, _utils2.getCurrentEnvPath)(__dirname, './worker.js'));
|
|
38
|
+
this.worker = new _webWorker.default(workerPath, {
|
|
39
|
+
type: "module"
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const entity = new Reboot();
|
|
45
|
+
function reboot(params, callback) {
|
|
46
|
+
const payload = (0, _utils.parsePayload)(params);
|
|
47
|
+
entity.exec(payload, callback);
|
|
48
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
initWorkerNodePath
|
|
5
|
+
} = require("../../utils/utils.worker");
|
|
6
|
+
|
|
7
|
+
// 先注册NodePath后才能正常使用node包,请勿挪动位置
|
|
8
|
+
initWorkerNodePath();
|
|
9
|
+
const {
|
|
10
|
+
abilityCallKit
|
|
11
|
+
} = require("../../utils/utils.global");
|
|
12
|
+
function onMainMessage(event) {
|
|
13
|
+
const {
|
|
14
|
+
payload
|
|
15
|
+
} = event.data;
|
|
16
|
+
const res = abilityCallKit('reboot', payload);
|
|
17
|
+
postMessage(res);
|
|
18
|
+
}
|
|
19
|
+
addEventListener('message', onMainMessage);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.shutdown = shutdown;
|
|
7
|
+
var _webWorker = _interopRequireDefault(require("web-worker"));
|
|
8
|
+
var _url = _interopRequireDefault(require("url"));
|
|
9
|
+
var _utils = require("../../utils/utils.common");
|
|
10
|
+
var _utils2 = require("../../utils/utils.path");
|
|
11
|
+
var _utils3 = require("../../utils/utils.ability");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
class Shutdown {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.initWorker();
|
|
16
|
+
this.initWorkerListener();
|
|
17
|
+
}
|
|
18
|
+
worker = null;
|
|
19
|
+
callback = null;
|
|
20
|
+
exec(payload, callback) {
|
|
21
|
+
this.callback = typeof callback === 'function' ? callback : _utils3.defaultCallback;
|
|
22
|
+
this.worker && this.worker.postMessage({
|
|
23
|
+
payload
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
initWorkerListener() {
|
|
27
|
+
this.worker && this.worker.addEventListener('message', event => {
|
|
28
|
+
const {
|
|
29
|
+
payload
|
|
30
|
+
} = event.data;
|
|
31
|
+
this.callback(payload);
|
|
32
|
+
this.callback = null;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
initWorker() {
|
|
36
|
+
if (!this.worker) {
|
|
37
|
+
const workerPath = new _url.default.URL('file://' + (0, _utils2.getCurrentEnvPath)(__dirname, './worker.js'));
|
|
38
|
+
this.worker = new _webWorker.default(workerPath, {
|
|
39
|
+
type: "module"
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const entity = new Shutdown();
|
|
45
|
+
function shutdown(params, callback) {
|
|
46
|
+
const payload = (0, _utils.parsePayload)(params);
|
|
47
|
+
entity.exec(payload, callback);
|
|
48
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
initWorkerNodePath
|
|
5
|
+
} = require("../../utils/utils.worker");
|
|
6
|
+
|
|
7
|
+
// 先注册NodePath后才能正常使用node包,请勿挪动位置
|
|
8
|
+
initWorkerNodePath();
|
|
9
|
+
const {
|
|
10
|
+
abilityCallKit
|
|
11
|
+
} = require("../../utils/utils.global");
|
|
12
|
+
function onMainMessage(event) {
|
|
13
|
+
const {
|
|
14
|
+
payload
|
|
15
|
+
} = event.data;
|
|
16
|
+
const res = abilityCallKit('shutdown', payload);
|
|
17
|
+
postMessage(res);
|
|
18
|
+
}
|
|
19
|
+
addEventListener('message', onMainMessage);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.skip = skip;
|
|
7
|
+
var _webWorker = _interopRequireDefault(require("web-worker"));
|
|
8
|
+
var _url = _interopRequireDefault(require("url"));
|
|
9
|
+
var _utils = require("../../utils/utils.common");
|
|
10
|
+
var _utils2 = require("../../utils/utils.path");
|
|
11
|
+
var _utils3 = require("../../utils/utils.ability");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
class Skip {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.initWorker();
|
|
16
|
+
this.initWorkerListener();
|
|
17
|
+
}
|
|
18
|
+
worker = null;
|
|
19
|
+
callback = null;
|
|
20
|
+
exec(payload, callback) {
|
|
21
|
+
this.callback = typeof callback === 'function' ? callback : _utils3.defaultCallback;
|
|
22
|
+
this.worker && this.worker.postMessage({
|
|
23
|
+
payload
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
initWorkerListener() {
|
|
27
|
+
this.worker && this.worker.addEventListener('message', event => {
|
|
28
|
+
const {
|
|
29
|
+
payload
|
|
30
|
+
} = event.data;
|
|
31
|
+
this.callback(payload);
|
|
32
|
+
this.callback = null;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
initWorker() {
|
|
36
|
+
if (!this.worker) {
|
|
37
|
+
const workerPath = new _url.default.URL('file://' + (0, _utils2.getCurrentEnvPath)(__dirname, './worker.js'));
|
|
38
|
+
this.worker = new _webWorker.default(workerPath, {
|
|
39
|
+
type: 'module'
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const entity = new Skip();
|
|
45
|
+
function skip(params, callback) {
|
|
46
|
+
const payload = (0, _utils.parsePayload)(params);
|
|
47
|
+
entity.exec(payload, callback);
|
|
48
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
initWorkerNodePath
|
|
5
|
+
} = require("../../utils/utils.worker");
|
|
6
|
+
|
|
7
|
+
// 先注册NodePath后才能正常使用node包,请勿挪动位置
|
|
8
|
+
initWorkerNodePath();
|
|
9
|
+
const {
|
|
10
|
+
abilityCallKit
|
|
11
|
+
} = require("../../utils/utils.global");
|
|
12
|
+
function onMainMessage(event) {
|
|
13
|
+
const {
|
|
14
|
+
payload
|
|
15
|
+
} = event.data;
|
|
16
|
+
const res = abilityCallKit('skip', payload);
|
|
17
|
+
postMessage(res);
|
|
18
|
+
}
|
|
19
|
+
addEventListener('message', onMainMessage);
|
|
@@ -4,29 +4,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.command = command;
|
|
7
|
-
|
|
8
|
-
function command(cmd) {
|
|
9
|
-
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : './';
|
|
7
|
+
const exec = require('child_process').exec;
|
|
8
|
+
function command(cmd, path = './') {
|
|
10
9
|
// 任何你期望执行的cmd命令,ls都可以
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
let cmdStr1 = cmd;
|
|
11
|
+
let cmdPath = path;
|
|
13
12
|
// 子进程名称
|
|
14
|
-
|
|
13
|
+
let workerProcess;
|
|
15
14
|
runExec(cmdStr1);
|
|
16
15
|
function runExec(cmdStr) {
|
|
17
16
|
workerProcess = exec(cmdStr, {
|
|
18
17
|
cwd: cmdPath
|
|
19
18
|
});
|
|
20
19
|
// 打印正常的后台可执行程序输出
|
|
21
|
-
workerProcess.stdout.on('data',
|
|
20
|
+
workerProcess.stdout.on('data', data => {
|
|
22
21
|
console.log('stdout: ' + data);
|
|
23
22
|
});
|
|
24
23
|
// 打印错误的后台可执行程序输出
|
|
25
|
-
workerProcess.stderr.on('data',
|
|
24
|
+
workerProcess.stderr.on('data', data => {
|
|
26
25
|
console.log('stderr: ' + data);
|
|
27
26
|
});
|
|
28
27
|
// 退出之后的输出
|
|
29
|
-
workerProcess.on('close',
|
|
28
|
+
workerProcess.on('close', code => {
|
|
30
29
|
console.log('out code:' + code);
|
|
31
30
|
});
|
|
32
31
|
}
|
|
@@ -1,47 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = void 0;
|
|
8
|
-
var
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _utils = require("../../utils/utils");
|
|
7
|
+
var _utils = require("../../utils/utils.env");
|
|
11
8
|
var _command = require("./command");
|
|
12
9
|
var _winDriver = require("./winDriver");
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// constructor () {}
|
|
22
|
-
function setup(mainWindow) {
|
|
23
|
-
console.log('Service setup');
|
|
24
|
-
if ((0, _utils.isMac)()) {
|
|
25
|
-
if ((0, _utils.isDev)()) {
|
|
26
|
-
(0, _command.command)(path.join(process.cwd(), './extraResources/ightools'));
|
|
27
|
-
}
|
|
28
|
-
if ((0, _utils.isProd)()) {
|
|
29
|
-
(0, _command.command)('nohup ' + path.join(process.resourcesPath, './extraResources/ightools') + ' > /dev/null 2>&1 & > ' + path.join(process.resourcesPath, './log/ightools.log'));
|
|
30
|
-
}
|
|
10
|
+
const path = require('path');
|
|
11
|
+
class Service {
|
|
12
|
+
// constructor () {}
|
|
13
|
+
setup(mainWindow) {
|
|
14
|
+
console.log('Service setup');
|
|
15
|
+
if ((0, _utils.isMac)()) {
|
|
16
|
+
if ((0, _utils.isDev)()) {
|
|
17
|
+
(0, _command.command)(path.join(process.cwd(), './extraResources/ightools'));
|
|
31
18
|
}
|
|
32
|
-
if ((0, _utils.
|
|
33
|
-
(0,
|
|
34
|
-
console.log('------------checkHasDriver', res);
|
|
35
|
-
if (res) {
|
|
36
|
-
mainWindow.webContents.send("checkDriver", true);
|
|
37
|
-
} else {
|
|
38
|
-
mainWindow.webContents.send("checkDriver", false);
|
|
39
|
-
(0, _winDriver.downloadDriver)(mainWindow);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
19
|
+
if ((0, _utils.isProd)()) {
|
|
20
|
+
(0, _command.command)('nohup ' + path.join(process.resourcesPath, './extraResources/ightools') + ' > /dev/null 2>&1 & > ' + path.join(process.resourcesPath, './log/ightools.log'));
|
|
42
21
|
}
|
|
43
22
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
23
|
+
if ((0, _utils.isWin)()) {
|
|
24
|
+
(0, _winDriver.checkHasDriver)().then(res => {
|
|
25
|
+
console.log('------------checkHasDriver', res);
|
|
26
|
+
if (res) {
|
|
27
|
+
mainWindow.webContents.send('checkDriver', true);
|
|
28
|
+
} else {
|
|
29
|
+
mainWindow.webContents.send('checkDriver', false);
|
|
30
|
+
(0, _winDriver.downloadDriver)(mainWindow);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
47
36
|
var _default = exports.default = Service;
|