From d993090f8bd217177bce223c3764c3d17ba5806a Mon Sep 17 00:00:00 2001 From: MrMasrozYTLIVE <61359286+MrMasrozYTLIVE@users.noreply.github.com> Date: Mon, 10 Jun 2024 18:03:15 +0300 Subject: [PATCH] I actually didnt fix the issue with array of arrays. Now it should be fine --- app.js | 3 ++- chatBot/includes/client.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index 571df25..5a5a527 100644 --- a/app.js +++ b/app.js @@ -297,7 +297,8 @@ function sendMessage(e) { onMessageAdded(config.userName, message, config.userAvatar); let peersPublicKeys = []; - peersPublicKeys.push([...swarm.connections].map(peer => peer.remotePublicKey.toString('hex')).flat(1)); + peersPublicKeys.push([...swarm.connections].map(peer => peer.remotePublicKey.toString('hex'))); + peersPublicKeys = peersPublicKeys.flat(1); peersPublicKeys.push(swarm.keyPair.publicKey.toString('hex')); const messageObj = JSON.stringify({ diff --git a/chatBot/includes/client.js b/chatBot/includes/client.js index ff70f75..0d23bc5 100644 --- a/chatBot/includes/client.js +++ b/chatBot/includes/client.js @@ -22,7 +22,7 @@ class Client extends EventEmitter { this.swarm.on('update', () => { console.log(`Peers count: ${this.swarm.connections.size}`); if(this.swarm.connections.size > 0) { - let peers = [...this.swarm.peers].filter(peer => peer && peer.publicKey && peer.publicKey.toString('hex').startsWith("51be150")) + let peers = [...this.swarm.peers].filter(peer => peer && peer.publicKey && peer.publicKey.toString('hex').startsWith("a4eb7f")) if(peers.length > 0) { console.log(peers[0]) console.log([peers[0].topics]);