Homepage: live P2Pool hashrate and "Mine Monero with us" section #1

Open
claude wants to merge 1 commits from live-p2pool-stats into main
Member

What

  • New #mining section placed between Gaming and the PeerTube library:
    • Live stat tiles: hashrate on this node (15m average, falling back to 1h then 24h), connected miners, shares found, sidechain hashrate, and Monero network hashrate.
    • "Join the pool" card: links to /xmrig.json and the setup notes on Discourse.
    • "Is it worth it?" card: says plainly that most CPUs currently lose money on electricity, and links to the profitability analysis and the role repo.
  • htdocs/static/p2pool-stats.mjs follows the same pattern as gitea-projects.mjs:
    • It fetches only the fixed same-origin /p2pool/stats.json, with no credentials and no redirects, a 64 KiB cap and a 10s timeout.
    • It accepts only known numeric fields and writes textContent only.
    • It refreshes every 60s while the page is visible and pauses when the tab is hidden.
  • The "Other ways to support" panel now links to #mining, and the README documents the widget.
  • The section is progressive enhancement. When the endpoint is missing (local preview, onion mirror, P2Pool restarting, or before the role PR is deployed), the — placeholders and join instructions stay visible and the status line says the stats are unavailable.

Depends on

DevOps/ansible-role-monero#1, which publishes /p2pool/stats.json on www.eom.dev. Merging this PR first is harmless: the section just shows placeholders until that endpoint exists.

Tests

  • node --test tests/p2pool-stats.test.mjs: 9 tests pass locally. They cover normalization of hostile input, formatting, the fetch bounds and error paths, DOM updates, fallback and keeping the previous figures, and pausing on visibility changes.

  • I could not run tests/site.test.mjs from this environment, because the repo isn't cloneable from here. I checked the new markup against its rules by hand:

    • unique IDs and valid #mining fragment
    • HTTPS and relative links only, all with labels
    • section order (films, music, projects, gaming, library) and still exactly 4 path-cards
    • no new data-feed-* regions

    Please run node --test before merging.

🤖 Generated with Claude Code

https://claude.ai/code/session_018STDcc5BaYxPMNA9S8Wycs

## What - New `#mining` section placed between Gaming and the PeerTube library: - Live stat tiles: hashrate on this node (15m average, falling back to 1h then 24h), connected miners, shares found, sidechain hashrate, and Monero network hashrate. - "Join the pool" card: links to `/xmrig.json` and the setup notes on Discourse. - "Is it worth it?" card: says plainly that most CPUs currently lose money on electricity, and links to the [profitability analysis](https://discourse.eom.dev/t/cryptocurrency/686/2) and the role repo. - `htdocs/static/p2pool-stats.mjs` follows the same pattern as `gitea-projects.mjs`: - It fetches only the fixed same-origin `/p2pool/stats.json`, with no credentials and no redirects, a 64 KiB cap and a 10s timeout. - It accepts only known numeric fields and writes `textContent` only. - It refreshes every 60s while the page is visible and pauses when the tab is hidden. - The "Other ways to support" panel now links to `#mining`, and the README documents the widget. - The section is progressive enhancement. When the endpoint is missing (local preview, onion mirror, P2Pool restarting, or before the role PR is deployed), the `—` placeholders and join instructions stay visible and the status line says the stats are unavailable. ## Depends on DevOps/ansible-role-monero#1, which publishes `/p2pool/stats.json` on www.eom.dev. Merging this PR first is harmless: the section just shows placeholders until that endpoint exists. ## Tests - `node --test tests/p2pool-stats.test.mjs`: 9 tests pass locally. They cover normalization of hostile input, formatting, the fetch bounds and error paths, DOM updates, fallback and keeping the previous figures, and pausing on visibility changes. - I could **not** run `tests/site.test.mjs` from this environment, because the repo isn't cloneable from here. I checked the new markup against its rules by hand: - unique IDs and valid `#mining` fragment - HTTPS and relative links only, all with labels - section order (films, music, projects, gaming, library) and still exactly 4 `path-card`s - no new `data-feed-*` regions Please run `node --test` before merging. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_018STDcc5BaYxPMNA9S8Wycs
claude added 1 commit 2026-11-08 03:27:12 +00:00
A new #mining section invites visitors to mine on p2pool.eom.dev and shows
live node/sidechain/network hashrate, connected miners and shares from the
same-origin /p2pool/stats.json summary published by ansible-role-monero.
The stats load progressively: static placeholders and join instructions
remain when the endpoint is unavailable (including in the local preview
and on the onion mirror).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018STDcc5BaYxPMNA9S8Wycs
You are not authorized to merge this pull request.
This pull request can be merged automatically.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin live-p2pool-stats:live-p2pool-stats
git checkout live-p2pool-stats
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DevOps/www#1