@konemono/nostr-login 1.10.14 → 1.10.15
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/dist/index.esm.js +2 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/unpkg.js +2 -2
- package/package.json +1 -1
- package/src/modules/AuthNostrService.ts +27 -2
package/package.json
CHANGED
|
@@ -725,9 +725,34 @@ class AuthNostrService extends EventEmitter implements Signer {
|
|
|
725
725
|
}
|
|
726
726
|
|
|
727
727
|
// リレー接続を確認・再接続
|
|
728
|
-
|
|
729
|
-
|
|
728
|
+
const stats = this.ndk.pool.stats();
|
|
729
|
+
console.log('NDK pool stats:', stats);
|
|
730
|
+
|
|
731
|
+
if (stats.connected === 0) {
|
|
732
|
+
console.log('NDK relays disconnected, forcing reconnection...');
|
|
733
|
+
|
|
734
|
+
// 既存のリレーを一度切断してから再接続
|
|
735
|
+
for (const relay of this.ndk.pool.relays.values()) {
|
|
736
|
+
try {
|
|
737
|
+
relay.disconnect();
|
|
738
|
+
} catch (e) {
|
|
739
|
+
console.log('Error disconnecting relay:', e);
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
// 少し待ってから再接続
|
|
744
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
730
745
|
await this.ndk.connect();
|
|
746
|
+
|
|
747
|
+
// 接続を待つ
|
|
748
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
749
|
+
|
|
750
|
+
const newStats = this.ndk.pool.stats();
|
|
751
|
+
console.log('NDK pool stats after reconnect:', newStats);
|
|
752
|
+
|
|
753
|
+
if (newStats.connected === 0) {
|
|
754
|
+
throw new Error('Failed to reconnect to relays');
|
|
755
|
+
}
|
|
731
756
|
}
|
|
732
757
|
}
|
|
733
758
|
|