hunter-open-sdk 0.0.22 → 0.0.23
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/getAndroidSn/index.js +23 -3
- package/lib/utils/utils.sn.js +5 -19
- package/package.json +1 -1
|
@@ -16,7 +16,8 @@ var exec = childProcess.exec;
|
|
|
16
16
|
// mac获取sn
|
|
17
17
|
var getMacSn = /*#__PURE__*/function () {
|
|
18
18
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(device, callBack) {
|
|
19
|
-
var
|
|
19
|
+
var _deviceInfo$productNa, _deviceInfo$manufactu;
|
|
20
|
+
var attachDeviceId, customWebUSB, deviceList, currentDevice, deviceInfo, productName, manufacturerName, supportedBrands, isSupportedBrand;
|
|
20
21
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
21
22
|
while (1) switch (_context.prev = _context.next) {
|
|
22
23
|
case 0:
|
|
@@ -50,6 +51,25 @@ var getMacSn = /*#__PURE__*/function () {
|
|
|
50
51
|
});
|
|
51
52
|
return _context.abrupt("return");
|
|
52
53
|
case 11:
|
|
54
|
+
// 检查设备是否为支持的三星、华为、荣耀手机品牌
|
|
55
|
+
deviceInfo = currentDevice[0];
|
|
56
|
+
productName = ((_deviceInfo$productNa = deviceInfo.productName) === null || _deviceInfo$productNa === void 0 ? void 0 : _deviceInfo$productNa.toLowerCase()) || '';
|
|
57
|
+
manufacturerName = ((_deviceInfo$manufactu = deviceInfo.manufacturerName) === null || _deviceInfo$manufactu === void 0 ? void 0 : _deviceInfo$manufactu.toLowerCase()) || ''; // 支持的三星、华为、荣耀品牌关键词
|
|
58
|
+
supportedBrands = ['samsung', 'galaxy', 'huawei', 'honor', 'honor magic'];
|
|
59
|
+
isSupportedBrand = supportedBrands.some(function (brand) {
|
|
60
|
+
return productName.includes(brand) || manufacturerName.includes(brand);
|
|
61
|
+
});
|
|
62
|
+
if (isSupportedBrand) {
|
|
63
|
+
_context.next = 19;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
callBack({
|
|
67
|
+
code: -1,
|
|
68
|
+
data: {},
|
|
69
|
+
message: '暂不支持该品牌手机查询SN'
|
|
70
|
+
});
|
|
71
|
+
return _context.abrupt("return");
|
|
72
|
+
case 19:
|
|
53
73
|
callBack({
|
|
54
74
|
code: 0,
|
|
55
75
|
data: {
|
|
@@ -57,7 +77,7 @@ var getMacSn = /*#__PURE__*/function () {
|
|
|
57
77
|
},
|
|
58
78
|
message: '获取SN成功'
|
|
59
79
|
});
|
|
60
|
-
case
|
|
80
|
+
case 20:
|
|
61
81
|
case "end":
|
|
62
82
|
return _context.stop();
|
|
63
83
|
}
|
|
@@ -103,7 +123,7 @@ var getWinSn = /*#__PURE__*/function () {
|
|
|
103
123
|
callBack({
|
|
104
124
|
code: -1,
|
|
105
125
|
data: {},
|
|
106
|
-
message: "\
|
|
126
|
+
message: "\u6682\u4E0D\u652F\u6301\u8BE5\u54C1\u724C\u624B\u673A\u67E5\u8BE2SN"
|
|
107
127
|
});
|
|
108
128
|
} else {
|
|
109
129
|
console.log('检测到的手机设备:');
|
package/lib/utils/utils.sn.js
CHANGED
|
@@ -16,29 +16,15 @@ function isPhoneDevice(device) {
|
|
|
16
16
|
var name = device.name.toLowerCase();
|
|
17
17
|
var pnpId = device.pnpDeviceId.toLowerCase();
|
|
18
18
|
|
|
19
|
-
//
|
|
20
|
-
var phoneKeywords = ['
|
|
19
|
+
// 只支持三星、荣耀、华为的手机设备关键词
|
|
20
|
+
var phoneKeywords = ['samsung', 'galaxy', 'huawei', 'honor', 'honor magic'];
|
|
21
21
|
|
|
22
|
-
//
|
|
23
|
-
var phoneVendors = ['
|
|
24
|
-
// Google
|
|
25
|
-
'VID_22B8',
|
|
26
|
-
// Motorola
|
|
27
|
-
'VID_04E8',
|
|
22
|
+
// 只支持三星、荣耀、华为的手机厂商VID
|
|
23
|
+
var phoneVendors = ['VID_04E8',
|
|
28
24
|
// Samsung
|
|
29
|
-
'VID_0FCE',
|
|
30
|
-
// Sony Ericsson
|
|
31
|
-
'VID_1004',
|
|
32
|
-
// LG
|
|
33
25
|
'VID_12D1',
|
|
34
26
|
// Huawei
|
|
35
|
-
'
|
|
36
|
-
// Xiaomi
|
|
37
|
-
'VID_2A45',
|
|
38
|
-
// OnePlus
|
|
39
|
-
'VID_05C6',
|
|
40
|
-
// Qualcomm
|
|
41
|
-
'VID_0BB4' // HTC
|
|
27
|
+
'VID_2A45' // Honor (OnePlus VID,但荣耀也使用此VID)
|
|
42
28
|
];
|
|
43
29
|
|
|
44
30
|
// 检查名称中是否包含手机关键词
|