feat: Add Swarm Hardware Specs (RAM & CPU counting) #53
+164
−92
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a new feature that tracks the total computing power of the swarm. The dashboard will now be able to display the total RAM (in GB) and CPU Cores of all connected nodes combined.
Changes Made
I updated the following files to pass hardware statistics through the P2P network:
src/core/identity.js: Added logic to capture the local node's total RAM and CPU count using theosmodule.src/p2p/swarm.js: Updated the initial handshake and heartbeat messages to broadcast these hardware stats to peers.src/p2p/messaging.js: Updated the input validation to allow thehardwareproperty in incoming messages.src/state/peers.js: Added agetSwarmStats()function to sum up the resources of all known peers.src/web/routes.js: Exposed these new totals in the/api/statsendpoint and the SSE event stream for the frontend.Motivation
In the spirit of "The Homelab Must Grow," users can now see exactly how much total compute power is currently being wasted by the swarm.
Note
These changes were made via the GitHub Web Editor. I have not run a local build. Also, this was vibe coded by Gemini. 🤖✨