Skip to content

Commit 18e5ce0

Browse files
Andrewruvnet
authored andcommitted
fix: register PIN with API server and poll for pairing completion
- PairingWizard now calls initPINPairing() to get server-assigned PIN - Polls checkPairingStatus() instead of relying on local Express callback - Express server on port 3000 is now non-fatal (EADDRINUSE won't block pairing) - Emits qrUrl (deep link) for QR code display - Added diagnostic logging for pairing flow Co-Authored-By: claude-flow <ruv@ruv.net>
1 parent 19c3067 commit 18e5ce0

File tree

2 files changed

+206
-74
lines changed

2 files changed

+206
-74
lines changed

src/daemon.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,10 @@ export class DeviceDaemon extends EventEmitter {
514514
api: this._api,
515515
credentialBackend: this._credentialBackend,
516516
port: this._pairingPort,
517+
deviceName: this._deviceName,
517518
});
518519

519-
const self = this;
520+
var self = this;
520521

521522
this._pairingWizard.on('paired', function (credentials) {
522523
self._pairingWizard = null;
@@ -528,16 +529,16 @@ export class DeviceDaemon extends EventEmitter {
528529
});
529530

530531
try {
531-
const info = await this._pairingWizard.start();
532+
var info = await this._pairingWizard.start();
532533

533-
// Emit event so platform layer can show the PIN
534-
// In Desktop Mode: open browser to info.url
535-
// In Game Mode: show PIN on SDL2 overlay
534+
// Emit event so platform layer can show the PIN and QR code
535+
// qrUrl is the deep link: https://app.allow2.com/pair?pin=XXXXXX
536536
this.emit('pairing-required', {
537537
wizard: this._pairingWizard,
538538
pin: info.pin,
539539
port: info.port,
540540
url: info.url,
541+
qrUrl: info.qrUrl,
541542
});
542543
} catch (err) {
543544
this.emit('pairing-error', err);

0 commit comments

Comments
 (0)