@gethashd/bytecave-browser 1.0.9 → 1.0.10

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.
@@ -6588,15 +6588,17 @@ Nonce: ${nonce}`;
6588
6588
  const existing = this.knownPeers.get(announcement.peerId);
6589
6589
  const peerInfo = {
6590
6590
  peerId: announcement.peerId,
6591
- publicKey: existing?.publicKey || "",
6591
+ publicKey: announcement.publicKey || existing?.publicKey || "",
6592
6592
  contentTypes: announcement.contentTypes || "all",
6593
- connected: this.node?.getPeers().some((p) => p.toString() === announcement.peerId) || false
6593
+ connected: this.node?.getPeers().some((p) => p.toString() === announcement.peerId) || false,
6594
+ nodeId: announcement.nodeId || existing?.nodeId,
6595
+ // Store all health data from announcement
6596
+ availableStorage: announcement.availableStorage,
6597
+ blobCount: announcement.blobCount,
6598
+ timestamp: announcement.timestamp,
6599
+ multiaddrs: announcement.multiaddrs,
6600
+ relayAddrs: announcement.relayAddrs || existing?.relayAddrs
6594
6601
  };
6595
- if (announcement.relayAddrs && announcement.relayAddrs.length > 0) {
6596
- peerInfo.relayAddrs = announcement.relayAddrs;
6597
- } else if (existing && existing.relayAddrs) {
6598
- peerInfo.relayAddrs = existing.relayAddrs;
6599
- }
6600
6602
  this.knownPeers.set(announcement.peerId, peerInfo);
6601
6603
  this.emit("peerAnnounce", peerInfo);
6602
6604
  }
package/dist/index.cjs CHANGED
@@ -6641,15 +6641,17 @@ Nonce: ${nonce}`;
6641
6641
  const existing = this.knownPeers.get(announcement.peerId);
6642
6642
  const peerInfo = {
6643
6643
  peerId: announcement.peerId,
6644
- publicKey: existing?.publicKey || "",
6644
+ publicKey: announcement.publicKey || existing?.publicKey || "",
6645
6645
  contentTypes: announcement.contentTypes || "all",
6646
- connected: this.node?.getPeers().some((p) => p.toString() === announcement.peerId) || false
6646
+ connected: this.node?.getPeers().some((p) => p.toString() === announcement.peerId) || false,
6647
+ nodeId: announcement.nodeId || existing?.nodeId,
6648
+ // Store all health data from announcement
6649
+ availableStorage: announcement.availableStorage,
6650
+ blobCount: announcement.blobCount,
6651
+ timestamp: announcement.timestamp,
6652
+ multiaddrs: announcement.multiaddrs,
6653
+ relayAddrs: announcement.relayAddrs || existing?.relayAddrs
6647
6654
  };
6648
- if (announcement.relayAddrs && announcement.relayAddrs.length > 0) {
6649
- peerInfo.relayAddrs = announcement.relayAddrs;
6650
- } else if (existing && existing.relayAddrs) {
6651
- peerInfo.relayAddrs = existing.relayAddrs;
6652
- }
6653
6655
  this.knownPeers.set(announcement.peerId, peerInfo);
6654
6656
  this.emit("peerAnnounce", peerInfo);
6655
6657
  }
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  useHashdImage,
14
14
  useHashdMedia,
15
15
  useHashdUrl
16
- } from "./chunk-M2EMK4BM.js";
16
+ } from "./chunk-DJDKXTUN.js";
17
17
  import {
18
18
  clearHashdCache,
19
19
  createHashdUrl,
@@ -8,7 +8,7 @@ import {
8
8
  useHashdImage,
9
9
  useHashdMedia,
10
10
  useHashdUrl
11
- } from "../chunk-M2EMK4BM.js";
11
+ } from "../chunk-DJDKXTUN.js";
12
12
  import "../chunk-EEZWRIUI.js";
13
13
  export {
14
14
  HashdAudio,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gethashd/bytecave-browser",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "ByteCave browser client for WebRTC P2P connections to storage nodes",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
package/src/client.ts CHANGED
@@ -810,30 +810,26 @@ Nonce: ${nonce}`;
810
810
  });
811
811
  }
812
812
 
813
- private async handlePeerAnnouncement(announcement: {
814
- peerId: string;
815
- timestamp?: number;
816
- relayAddrs?: string[];
817
- contentTypes?: string[] | 'all';
818
- }): Promise<void> {
813
+ private async handlePeerAnnouncement(announcement: any): Promise<void> {
819
814
  console.log('[ByteCave] Received announcement from peer:', announcement.peerId.slice(0, 12), announcement);
820
815
 
821
816
  const existing = this.knownPeers.get(announcement.peerId);
822
817
 
823
- const peerInfo: PeerInfo = {
818
+ // Store ALL announcement data, not just PeerInfo fields
819
+ const peerInfo: any = {
824
820
  peerId: announcement.peerId,
825
- publicKey: existing?.publicKey || '',
821
+ publicKey: announcement.publicKey || existing?.publicKey || '',
826
822
  contentTypes: announcement.contentTypes || 'all',
827
- connected: this.node?.getPeers().some(p => p.toString() === announcement.peerId) || false
823
+ connected: this.node?.getPeers().some(p => p.toString() === announcement.peerId) || false,
824
+ nodeId: announcement.nodeId || existing?.nodeId,
825
+ // Store all health data from announcement
826
+ availableStorage: announcement.availableStorage,
827
+ blobCount: announcement.blobCount,
828
+ timestamp: announcement.timestamp,
829
+ multiaddrs: announcement.multiaddrs,
830
+ relayAddrs: announcement.relayAddrs || (existing as any)?.relayAddrs
828
831
  };
829
832
 
830
- // Preserve relay addresses from existing peer info if new announcement doesn't have them
831
- if (announcement.relayAddrs && announcement.relayAddrs.length > 0) {
832
- (peerInfo as any).relayAddrs = announcement.relayAddrs;
833
- } else if (existing && (existing as any).relayAddrs) {
834
- (peerInfo as any).relayAddrs = (existing as any).relayAddrs;
835
- }
836
-
837
833
  this.knownPeers.set(announcement.peerId, peerInfo);
838
834
 
839
835
  this.emit('peerAnnounce', peerInfo);