yaver-cli 1.99.446 → 1.99.448
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/package.json +4 -1
- package/sdk-manifest.json +37 -53
- package/src/agent-runtime.js +35 -32
- package/src/discovery.js +33 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yaver-cli",
|
|
3
|
-
"version": "1.99.
|
|
3
|
+
"version": "1.99.448",
|
|
4
4
|
"mcpName": "io.github.yaver-io/yaver",
|
|
5
5
|
"description": "Unified npm bootstrap for the Yaver agent, SDK injection, and local-first developer runtime",
|
|
6
6
|
"bin": {
|
|
@@ -49,5 +49,8 @@
|
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"semver": "^7.6.0",
|
|
51
51
|
"yaver-mobile-headless": "^0.1.2"
|
|
52
|
+
},
|
|
53
|
+
"overrides": {
|
|
54
|
+
"@modelcontextprotocol/sdk": "^1.30.0"
|
|
52
55
|
}
|
|
53
56
|
}
|
package/sdk-manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"sdkVersion": "1.0.0",
|
|
3
|
-
"expo": "54.0.
|
|
3
|
+
"expo": "54.0.37",
|
|
4
4
|
"reactNative": "0.81.5",
|
|
5
5
|
"react": "19.1.0",
|
|
6
6
|
"hermes": {
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"runtimeFamilies": [
|
|
17
17
|
{
|
|
18
18
|
"id": "family-a",
|
|
19
|
-
"label": "Family A · Expo 54.0.
|
|
19
|
+
"label": "Family A · Expo 54.0.37 / RN 0.81.5 / React 19.1.0 / BC96",
|
|
20
20
|
"sdkVersion": "1.0.0",
|
|
21
|
-
"expoVersion": "54.0.
|
|
21
|
+
"expoVersion": "54.0.37",
|
|
22
22
|
"reactNativeVersion": "0.81.5",
|
|
23
23
|
"reactVersion": "19.1.0",
|
|
24
24
|
"hermesVersion": "0.81.5",
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
}
|
|
32
32
|
],
|
|
33
33
|
"nativeModules": {
|
|
34
|
-
"@amplitude/analytics-react-native": "1.5.52",
|
|
35
34
|
"@intercom/intercom-react-native": "10.0.0",
|
|
36
35
|
"@notifee/react-native": "9.1.8",
|
|
37
36
|
"@react-native-async-storage/async-storage": "2.2.0",
|
|
@@ -44,10 +43,9 @@
|
|
|
44
43
|
"@react-native-ml-kit/text-recognition": "2.0.0",
|
|
45
44
|
"@react-native-picker/picker": "2.11.1",
|
|
46
45
|
"@react-native-segmented-control/segmented-control": "2.5.7",
|
|
47
|
-
"@sentry/react-native": "8.8.0",
|
|
48
46
|
"@shopify/react-native-skia": "2.2.12",
|
|
49
47
|
"expo-apple-authentication": "8.0.8",
|
|
50
|
-
"expo-asset": "12.0.
|
|
48
|
+
"expo-asset": "12.0.13",
|
|
51
49
|
"expo-av": "16.0.8",
|
|
52
50
|
"expo-background-fetch": "14.0.9",
|
|
53
51
|
"expo-battery": "10.0.8",
|
|
@@ -56,28 +54,28 @@
|
|
|
56
54
|
"expo-calendar": "15.0.8",
|
|
57
55
|
"expo-camera": "17.0.10",
|
|
58
56
|
"expo-clipboard": "8.0.8",
|
|
59
|
-
"expo-constants": "18.0.
|
|
57
|
+
"expo-constants": "18.0.14",
|
|
60
58
|
"expo-contacts": "15.0.11",
|
|
61
|
-
"expo-crypto": "15.0.
|
|
59
|
+
"expo-crypto": "15.0.9",
|
|
62
60
|
"expo-device": "8.0.10",
|
|
63
61
|
"expo-document-picker": "14.0.8",
|
|
64
|
-
"expo-file-system": "19.0.
|
|
65
|
-
"expo-font": "14.0.
|
|
66
|
-
"expo-glass-effect": "
|
|
62
|
+
"expo-file-system": "19.0.24",
|
|
63
|
+
"expo-font": "14.0.12",
|
|
64
|
+
"expo-glass-effect": "0.1.10",
|
|
67
65
|
"expo-haptics": "15.0.8",
|
|
68
66
|
"expo-image": "3.0.11",
|
|
69
67
|
"expo-image-manipulator": "14.0.8",
|
|
70
|
-
"expo-image-picker": "17.0.
|
|
68
|
+
"expo-image-picker": "17.0.11",
|
|
71
69
|
"expo-keep-awake": "15.0.8",
|
|
72
70
|
"expo-linear-gradient": "15.0.8",
|
|
73
|
-
"expo-linking": "8.0.
|
|
74
|
-
"expo-local-authentication": "17.0.
|
|
75
|
-
"expo-localization": "17.0.
|
|
71
|
+
"expo-linking": "8.0.12",
|
|
72
|
+
"expo-local-authentication": "17.0.9",
|
|
73
|
+
"expo-localization": "17.0.9",
|
|
76
74
|
"expo-location": "19.0.8",
|
|
77
|
-
"expo-mail-composer": "
|
|
78
|
-
"expo-notifications": "0.32.
|
|
75
|
+
"expo-mail-composer": "15.0.8",
|
|
76
|
+
"expo-notifications": "0.32.17",
|
|
79
77
|
"expo-print": "15.0.8",
|
|
80
|
-
"expo-screen-orientation": "9.0.
|
|
78
|
+
"expo-screen-orientation": "9.0.9",
|
|
81
79
|
"expo-secure-store": "15.0.8",
|
|
82
80
|
"expo-sensors": "15.0.8",
|
|
83
81
|
"expo-share-intent": "5.1.1",
|
|
@@ -87,17 +85,17 @@
|
|
|
87
85
|
"expo-sqlite": "16.0.10",
|
|
88
86
|
"expo-system-ui": "6.0.9",
|
|
89
87
|
"expo-task-manager": "14.0.9",
|
|
90
|
-
"expo-updates": "29.0.
|
|
88
|
+
"expo-updates": "29.0.20",
|
|
91
89
|
"expo-video": "3.0.16",
|
|
92
90
|
"expo-video-thumbnails": "10.0.8",
|
|
93
|
-
"expo-web-browser": "15.0.
|
|
91
|
+
"expo-web-browser": "15.0.11",
|
|
94
92
|
"lottie-react-native": "7.3.6",
|
|
95
93
|
"react-native-audio-api": "0.11.7",
|
|
96
94
|
"react-native-ble-plx": "3.5.1",
|
|
97
95
|
"react-native-device-info": "15.0.2",
|
|
98
96
|
"react-native-gesture-handler": "2.28.0",
|
|
99
97
|
"react-native-get-random-values": "1.11.0",
|
|
100
|
-
"react-native-keyboard-controller": "1.
|
|
98
|
+
"react-native-keyboard-controller": "1.18.5",
|
|
101
99
|
"react-native-maps": "1.20.1",
|
|
102
100
|
"react-native-mmkv": "4.3.0",
|
|
103
101
|
"react-native-nitro-image": "0.13.1",
|
|
@@ -116,17 +114,10 @@
|
|
|
116
114
|
"react-native-view-shot": "4.0.3",
|
|
117
115
|
"react-native-vision-camera": "4.7.3",
|
|
118
116
|
"react-native-webview": "13.15.0",
|
|
119
|
-
"react-native-worklets": "0.
|
|
117
|
+
"react-native-worklets": "0.5.1",
|
|
120
118
|
"whisper.rn": "0.5.5"
|
|
121
119
|
},
|
|
122
120
|
"moduleSupport": {
|
|
123
|
-
"@amplitude/analytics-react-native": {
|
|
124
|
-
"version": "1.5.52",
|
|
125
|
-
"hostApp": true,
|
|
126
|
-
"cliPush": true,
|
|
127
|
-
"agentOpenInYaver": true,
|
|
128
|
-
"pluginEnabled": false
|
|
129
|
-
},
|
|
130
121
|
"@intercom/intercom-react-native": {
|
|
131
122
|
"version": "10.0.0",
|
|
132
123
|
"hostApp": true,
|
|
@@ -211,13 +202,6 @@
|
|
|
211
202
|
"agentOpenInYaver": true,
|
|
212
203
|
"pluginEnabled": false
|
|
213
204
|
},
|
|
214
|
-
"@sentry/react-native": {
|
|
215
|
-
"version": "8.8.0",
|
|
216
|
-
"hostApp": true,
|
|
217
|
-
"cliPush": true,
|
|
218
|
-
"agentOpenInYaver": true,
|
|
219
|
-
"pluginEnabled": false
|
|
220
|
-
},
|
|
221
205
|
"@shopify/react-native-skia": {
|
|
222
206
|
"version": "2.2.12",
|
|
223
207
|
"hostApp": true,
|
|
@@ -233,7 +217,7 @@
|
|
|
233
217
|
"pluginEnabled": true
|
|
234
218
|
},
|
|
235
219
|
"expo-asset": {
|
|
236
|
-
"version": "12.0.
|
|
220
|
+
"version": "12.0.13",
|
|
237
221
|
"hostApp": true,
|
|
238
222
|
"cliPush": true,
|
|
239
223
|
"agentOpenInYaver": true,
|
|
@@ -296,7 +280,7 @@
|
|
|
296
280
|
"pluginEnabled": false
|
|
297
281
|
},
|
|
298
282
|
"expo-constants": {
|
|
299
|
-
"version": "18.0.
|
|
283
|
+
"version": "18.0.14",
|
|
300
284
|
"hostApp": true,
|
|
301
285
|
"cliPush": true,
|
|
302
286
|
"agentOpenInYaver": true,
|
|
@@ -310,7 +294,7 @@
|
|
|
310
294
|
"pluginEnabled": false
|
|
311
295
|
},
|
|
312
296
|
"expo-crypto": {
|
|
313
|
-
"version": "15.0.
|
|
297
|
+
"version": "15.0.9",
|
|
314
298
|
"hostApp": true,
|
|
315
299
|
"cliPush": true,
|
|
316
300
|
"agentOpenInYaver": true,
|
|
@@ -331,21 +315,21 @@
|
|
|
331
315
|
"pluginEnabled": false
|
|
332
316
|
},
|
|
333
317
|
"expo-file-system": {
|
|
334
|
-
"version": "19.0.
|
|
318
|
+
"version": "19.0.24",
|
|
335
319
|
"hostApp": true,
|
|
336
320
|
"cliPush": true,
|
|
337
321
|
"agentOpenInYaver": true,
|
|
338
322
|
"pluginEnabled": false
|
|
339
323
|
},
|
|
340
324
|
"expo-font": {
|
|
341
|
-
"version": "14.0.
|
|
325
|
+
"version": "14.0.12",
|
|
342
326
|
"hostApp": true,
|
|
343
327
|
"cliPush": true,
|
|
344
328
|
"agentOpenInYaver": true,
|
|
345
329
|
"pluginEnabled": true
|
|
346
330
|
},
|
|
347
331
|
"expo-glass-effect": {
|
|
348
|
-
"version": "
|
|
332
|
+
"version": "0.1.10",
|
|
349
333
|
"hostApp": true,
|
|
350
334
|
"cliPush": true,
|
|
351
335
|
"agentOpenInYaver": true,
|
|
@@ -373,7 +357,7 @@
|
|
|
373
357
|
"pluginEnabled": false
|
|
374
358
|
},
|
|
375
359
|
"expo-image-picker": {
|
|
376
|
-
"version": "17.0.
|
|
360
|
+
"version": "17.0.11",
|
|
377
361
|
"hostApp": true,
|
|
378
362
|
"cliPush": true,
|
|
379
363
|
"agentOpenInYaver": true,
|
|
@@ -394,21 +378,21 @@
|
|
|
394
378
|
"pluginEnabled": false
|
|
395
379
|
},
|
|
396
380
|
"expo-linking": {
|
|
397
|
-
"version": "8.0.
|
|
381
|
+
"version": "8.0.12",
|
|
398
382
|
"hostApp": true,
|
|
399
383
|
"cliPush": true,
|
|
400
384
|
"agentOpenInYaver": true,
|
|
401
385
|
"pluginEnabled": false
|
|
402
386
|
},
|
|
403
387
|
"expo-local-authentication": {
|
|
404
|
-
"version": "17.0.
|
|
388
|
+
"version": "17.0.9",
|
|
405
389
|
"hostApp": true,
|
|
406
390
|
"cliPush": true,
|
|
407
391
|
"agentOpenInYaver": true,
|
|
408
392
|
"pluginEnabled": false
|
|
409
393
|
},
|
|
410
394
|
"expo-localization": {
|
|
411
|
-
"version": "17.0.
|
|
395
|
+
"version": "17.0.9",
|
|
412
396
|
"hostApp": true,
|
|
413
397
|
"cliPush": true,
|
|
414
398
|
"agentOpenInYaver": true,
|
|
@@ -422,14 +406,14 @@
|
|
|
422
406
|
"pluginEnabled": true
|
|
423
407
|
},
|
|
424
408
|
"expo-mail-composer": {
|
|
425
|
-
"version": "
|
|
409
|
+
"version": "15.0.8",
|
|
426
410
|
"hostApp": true,
|
|
427
411
|
"cliPush": true,
|
|
428
412
|
"agentOpenInYaver": true,
|
|
429
413
|
"pluginEnabled": true
|
|
430
414
|
},
|
|
431
415
|
"expo-notifications": {
|
|
432
|
-
"version": "0.32.
|
|
416
|
+
"version": "0.32.17",
|
|
433
417
|
"hostApp": true,
|
|
434
418
|
"cliPush": true,
|
|
435
419
|
"agentOpenInYaver": true,
|
|
@@ -443,7 +427,7 @@
|
|
|
443
427
|
"pluginEnabled": false
|
|
444
428
|
},
|
|
445
429
|
"expo-screen-orientation": {
|
|
446
|
-
"version": "9.0.
|
|
430
|
+
"version": "9.0.9",
|
|
447
431
|
"hostApp": true,
|
|
448
432
|
"cliPush": true,
|
|
449
433
|
"agentOpenInYaver": true,
|
|
@@ -513,7 +497,7 @@
|
|
|
513
497
|
"pluginEnabled": false
|
|
514
498
|
},
|
|
515
499
|
"expo-updates": {
|
|
516
|
-
"version": "29.0.
|
|
500
|
+
"version": "29.0.20",
|
|
517
501
|
"hostApp": true,
|
|
518
502
|
"cliPush": true,
|
|
519
503
|
"agentOpenInYaver": true,
|
|
@@ -534,7 +518,7 @@
|
|
|
534
518
|
"pluginEnabled": false
|
|
535
519
|
},
|
|
536
520
|
"expo-web-browser": {
|
|
537
|
-
"version": "15.0.
|
|
521
|
+
"version": "15.0.11",
|
|
538
522
|
"hostApp": true,
|
|
539
523
|
"cliPush": true,
|
|
540
524
|
"agentOpenInYaver": true,
|
|
@@ -583,7 +567,7 @@
|
|
|
583
567
|
"pluginEnabled": false
|
|
584
568
|
},
|
|
585
569
|
"react-native-keyboard-controller": {
|
|
586
|
-
"version": "1.
|
|
570
|
+
"version": "1.18.5",
|
|
587
571
|
"hostApp": true,
|
|
588
572
|
"cliPush": true,
|
|
589
573
|
"agentOpenInYaver": true,
|
|
@@ -716,7 +700,7 @@
|
|
|
716
700
|
"pluginEnabled": false
|
|
717
701
|
},
|
|
718
702
|
"react-native-worklets": {
|
|
719
|
-
"version": "0.
|
|
703
|
+
"version": "0.5.1",
|
|
720
704
|
"hostApp": true,
|
|
721
705
|
"cliPush": true,
|
|
722
706
|
"agentOpenInYaver": true,
|
package/src/agent-runtime.js
CHANGED
|
@@ -237,23 +237,17 @@ async function downloadAndCacheAgent(asset, { quiet }) {
|
|
|
237
237
|
if (process.platform !== 'win32') {
|
|
238
238
|
fs.chmodSync(binaryPath, 0o755);
|
|
239
239
|
}
|
|
240
|
-
//
|
|
241
|
-
//
|
|
242
|
-
//
|
|
243
|
-
//
|
|
244
|
-
//
|
|
245
|
-
//
|
|
246
|
-
// signature error 2"). codesign --force --sign - rebuilds a
|
|
247
|
-
// valid adhoc signature against the current bytes.
|
|
248
|
-
// Doing both here means the happy path never sees SIGKILL in the
|
|
249
|
-
// first place.
|
|
240
|
+
// Strip quarantine, but preserve a valid release signature. Since CLI
|
|
241
|
+
// 1.99.446 the macOS artifacts are Developer ID signed and notarized in
|
|
242
|
+
// release-cli.yml. The old unconditional `codesign --sign -` below erased
|
|
243
|
+
// that identity after every download and silently downgraded the installed
|
|
244
|
+
// binary to ad-hoc. Only repair the signature when verification proves the
|
|
245
|
+
// archive produced an invalid Mach-O.
|
|
250
246
|
if (process.platform === 'darwin') {
|
|
251
247
|
try {
|
|
252
248
|
spawnSync('xattr', ['-dr', 'com.apple.quarantine', binaryPath], { stdio: 'ignore' });
|
|
253
249
|
} catch (_err) {}
|
|
254
|
-
|
|
255
|
-
spawnSync('codesign', ['--force', '--sign', '-', binaryPath], { stdio: 'ignore' });
|
|
256
|
-
} catch (_err) {}
|
|
250
|
+
ensureValidMacSignature(binaryPath);
|
|
257
251
|
}
|
|
258
252
|
// Sanity-check the extracted binary. A truncated tarball or an
|
|
259
253
|
// HTML error page saved as ".tar.gz" can leave us with a file that
|
|
@@ -402,25 +396,14 @@ async function attemptSigkillRecovery(binaryPath, { quiet = false } = {}) {
|
|
|
402
396
|
} catch (_err) {}
|
|
403
397
|
try { fs.chmodSync(binaryPath, 0o755); } catch (_err) {}
|
|
404
398
|
|
|
405
|
-
// 3.
|
|
406
|
-
//
|
|
407
|
-
//
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
414
|
-
encoding: 'utf8',
|
|
415
|
-
});
|
|
416
|
-
if (result.status === 0) {
|
|
417
|
-
// Verify the resigned binary actually passes the kernel check
|
|
418
|
-
// now. If codesign succeeded we're done — the retry will work.
|
|
419
|
-
return 'resign-macos-adhoc';
|
|
420
|
-
}
|
|
421
|
-
// If codesign failed (e.g. missing developer tools), fall through
|
|
422
|
-
// to the quarantine-only return below.
|
|
423
|
-
} catch (_err) {}
|
|
399
|
+
// 3. Preserve a valid Developer ID signature. Only an actually invalid
|
|
400
|
+
// signature is replaced with an ad-hoc one. This keeps notarized release
|
|
401
|
+
// identity intact while retaining the self-heal for interrupted updates.
|
|
402
|
+
const signatureAction = ensureValidMacSignature(binaryPath);
|
|
403
|
+
if (signatureAction === 'preserve-valid-signature') {
|
|
404
|
+
return 'strip-macos-quarantine-preserve-signature';
|
|
405
|
+
}
|
|
406
|
+
if (signatureAction === 'resign-macos-adhoc') return signatureAction;
|
|
424
407
|
|
|
425
408
|
return 'strip-macos-quarantine';
|
|
426
409
|
}
|
|
@@ -746,10 +729,30 @@ async function extractTarball(archivePath, destDir) {
|
|
|
746
729
|
|
|
747
730
|
module.exports = {
|
|
748
731
|
ensureAgentBinary,
|
|
732
|
+
ensureValidMacSignature,
|
|
749
733
|
resolveAgentInfo,
|
|
750
734
|
runAgentCommand,
|
|
751
735
|
};
|
|
752
736
|
|
|
737
|
+
function ensureValidMacSignature(binaryPath, spawnImpl = spawnSync) {
|
|
738
|
+
try {
|
|
739
|
+
const verified = spawnImpl('codesign', ['--verify', '--strict', binaryPath], {
|
|
740
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
741
|
+
encoding: 'utf8',
|
|
742
|
+
});
|
|
743
|
+
if (verified.status === 0) return 'preserve-valid-signature';
|
|
744
|
+
} catch (_err) {}
|
|
745
|
+
|
|
746
|
+
try {
|
|
747
|
+
const repaired = spawnImpl('codesign', ['--force', '--sign', '-', binaryPath], {
|
|
748
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
749
|
+
encoding: 'utf8',
|
|
750
|
+
});
|
|
751
|
+
if (repaired.status === 0) return 'resign-macos-adhoc';
|
|
752
|
+
} catch (_err) {}
|
|
753
|
+
return 'signature-repair-failed';
|
|
754
|
+
}
|
|
755
|
+
|
|
753
756
|
function repoRoot() {
|
|
754
757
|
return path.resolve(__dirname, '..', '..');
|
|
755
758
|
}
|
package/src/discovery.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
const http = require('http');
|
|
2
2
|
const dgram = require('dgram');
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// Keep this aligned with desktop/agent's canonical HTTP listener. The old
|
|
5
|
+
// mobile-prototype port (8347) made every manual/LAN probe miss a healthy
|
|
6
|
+
// desktop agent on 18080.
|
|
7
|
+
const YAVER_PORT = 18080;
|
|
5
8
|
const BEACON_PORT = 19837;
|
|
6
9
|
const DISCOVERY_TIMEOUT = 1500;
|
|
7
10
|
const HEALTH_TIMEOUT = 1200;
|
|
@@ -25,12 +28,31 @@ async function discoverDevice(manualIp) {
|
|
|
25
28
|
|
|
26
29
|
throw new Error(
|
|
27
30
|
'No yaver.io device found on network.\n' +
|
|
28
|
-
' Make sure the
|
|
31
|
+
' Make sure the Yaver desktop agent is running on the same Wi-Fi.\n' +
|
|
29
32
|
' Or specify device IP: yaver push --device <ip>'
|
|
30
33
|
);
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
|
|
36
|
+
function deviceFromBeacon(msg, rinfo) {
|
|
37
|
+
try {
|
|
38
|
+
const beacon = JSON.parse(Buffer.isBuffer(msg) ? msg.toString() : String(msg));
|
|
39
|
+
if (beacon.v !== 1 || !beacon.p) return null;
|
|
40
|
+
const sender = rinfo && typeof rinfo.address === 'string' ? rinfo.address.trim() : '';
|
|
41
|
+
const advertised = typeof beacon.ip === 'string' ? beacon.ip.trim() : '';
|
|
42
|
+
const ip = advertised || sender;
|
|
43
|
+
if (!ip) return null;
|
|
44
|
+
return {
|
|
45
|
+
ip,
|
|
46
|
+
port: beacon.p,
|
|
47
|
+
name: beacon.n || 'Unknown Device',
|
|
48
|
+
id: beacon.id,
|
|
49
|
+
};
|
|
50
|
+
} catch {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Listen for UDP beacon from the Yaver desktop agent. */
|
|
34
56
|
function listenForBeacon(timeout) {
|
|
35
57
|
return new Promise((resolve) => {
|
|
36
58
|
const socket = dgram.createSocket({ type: 'udp4', reuseAddr: true });
|
|
@@ -39,20 +61,13 @@ function listenForBeacon(timeout) {
|
|
|
39
61
|
resolve(null);
|
|
40
62
|
}, timeout);
|
|
41
63
|
|
|
42
|
-
socket.on('message', (msg) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
ip: beacon.ip || socket.remoteAddress,
|
|
50
|
-
port: beacon.p,
|
|
51
|
-
name: beacon.n || 'Unknown Device',
|
|
52
|
-
id: beacon.id,
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
} catch {}
|
|
64
|
+
socket.on('message', (msg, rinfo) => {
|
|
65
|
+
const device = deviceFromBeacon(msg, rinfo);
|
|
66
|
+
if (device) {
|
|
67
|
+
clearTimeout(timer);
|
|
68
|
+
socket.close();
|
|
69
|
+
resolve(device);
|
|
70
|
+
}
|
|
56
71
|
});
|
|
57
72
|
|
|
58
73
|
socket.on('error', () => {
|
|
@@ -135,4 +150,4 @@ async function runLimited(items, limit, fn) {
|
|
|
135
150
|
await Promise.all(workers);
|
|
136
151
|
}
|
|
137
152
|
|
|
138
|
-
module.exports = { discoverDevice, fetchHealth, scanLAN, YAVER_PORT };
|
|
153
|
+
module.exports = { discoverDevice, deviceFromBeacon, fetchHealth, listenForBeacon, scanLAN, YAVER_PORT };
|