[PR #30] [MERGED] Players page (/stats): the live count, its history and the official server's #32

Closed
opened 2026-11-03 04:02:30 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon-site/pull/30
Author: @ludovic111
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: feat/stats-page


📝 Commits (1)

  • 490e981 Players page (/stats): the live count, its history and the official server's

📊 Changes

10 files changed (+559 additions, -13 deletions)

View changed files

📝 Caddyfile (+2 -1)
📝 build.mjs (+7 -5)
📝 src/index.html (+2 -2)
📝 src/main.js (+3 -3)
📝 src/privacy.html (+2 -2)
➕ src/stats-page.js (+171 -0)
➕ src/stats.html (+95 -0)
➕ src/stats.js (+180 -0)
➕ src/stats.test.mjs (+76 -0)
📝 src/style.css (+21 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Ludovic asked (2026-10-31) for a live, shareable view of how many play Horizon and its peaks over time, plus the official server's players. This is the site half; the data comes from the telemetry server changes in horizon-rust/horizon#5217 (exact count, history, GET /v1/live/history) and #5235 (the official server's series). Merge this after both are deployed on Railway, or the charts say "The history isn't available right now".

The page (/stats, "Players" in the footers)

  • Tiles: playing now (exact, GET /v1/live, refreshed every minute), today's peak (the reader's day, to the minute), the all-time peak with its date, and how many have a world open to LAN or friends.
  • "Over time": 24 hours / 7 days / 30 days / All tabs (aria-pressed buttons, as on Releases). Inline SVG drawn by src/stats.js, no library or CDN: one y axis from 0, the highest count per point as an area (--chart-1) and the average as a dashed line (--chart-2), the staff charts' validated colours for both themes. A tooltip follows the pointer; the chart is focusable and the arrow keys/Home/End move the cursor (announced in a live region). A "Table" disclosure lists every point. Gaps where the server wasn't recording break the line. The chart is drawn at its own width, so the axis text stays readable on a phone.
  • "The official server": now, today's peak, all-time peak and the same chart for its player count (the telemetry server's status ping every minute).
  • "By platform": the live split per system.
  • Home's "Playing now" row now opens /stats; Privacy says the count is exact and what the server writes down each minute (totals only). /stats is in the Caddyfile (rewrite, no-cache) and the sitemap. No new origin: telemetry.playhorizon.dev was already in the CSP.

Checks

  • node --test src/ scripts/: 71 pass (new src/stats.test.mjs: number format, axis top, gaps, the SVG stays in its frame, the table, local-hour ticks, today's peak, the platform split, titles).
  • node build.mjs: builds.
  • Checked locally against a local telemetry server (synthetic 40 days for the players' series; the official series includes real samples from horizon.bunchy7s.dev): no console errors, light and dark, 1280 px and 390 px, every tab, the tooltip and the keyboard cursor.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon-site/pull/30 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/stats-page` --- ### 📝 Commits (1) - [`490e981`](https://github.com/horizon-rust/horizon-site/commit/490e981d5fbe922316c46aeaa7c161c4aac9168a) Players page (/stats): the live count, its history and the official server's ### 📊 Changes **10 files changed** (+559 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `Caddyfile` (+2 -1) 📝 `build.mjs` (+7 -5) 📝 `src/index.html` (+2 -2) 📝 `src/main.js` (+3 -3) 📝 `src/privacy.html` (+2 -2) ➕ `src/stats-page.js` (+171 -0) ➕ `src/stats.html` (+95 -0) ➕ `src/stats.js` (+180 -0) ➕ `src/stats.test.mjs` (+76 -0) 📝 `src/style.css` (+21 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Ludovic asked (2026-10-31) for a live, shareable view of how many play Horizon and its peaks over time, plus the official server's players. This is the site half; the data comes from the telemetry server changes in horizon-rust/horizon#5217 (exact count, history, `GET /v1/live/history`) and #5235 (the official server's series). **Merge this after both are deployed on Railway**, or the charts say "The history isn't available right now". ## The page (`/stats`, "Players" in the footers) - Tiles: playing now (exact, `GET /v1/live`, refreshed every minute), today's peak (the reader's day, to the minute), the all-time peak with its date, and how many have a world open to LAN or friends. - "Over time": 24 hours / 7 days / 30 days / All tabs (`aria-pressed` buttons, as on Releases). Inline SVG drawn by `src/stats.js`, no library or CDN: one y axis from 0, the highest count per point as an area (`--chart-1`) and the average as a dashed line (`--chart-2`), the staff charts' validated colours for both themes. A tooltip follows the pointer; the chart is focusable and the arrow keys/Home/End move the cursor (announced in a live region). A "Table" disclosure lists every point. Gaps where the server wasn't recording break the line. The chart is drawn at its own width, so the axis text stays readable on a phone. - "The official server": now, today's peak, all-time peak and the same chart for its player count (the telemetry server's status ping every minute). - "By platform": the live split per system. - Home's "Playing now" row now opens `/stats`; Privacy says the count is exact and what the server writes down each minute (totals only). `/stats` is in the Caddyfile (rewrite, `no-cache`) and the sitemap. No new origin: `telemetry.playhorizon.dev` was already in the CSP. ## Checks - `node --test src/ scripts/`: 71 pass (new `src/stats.test.mjs`: number format, axis top, gaps, the SVG stays in its frame, the table, local-hour ticks, today's peak, the platform split, titles). - `node build.mjs`: builds. - Checked locally against a local telemetry server (synthetic 40 days for the players' series; the official series includes real samples from horizon.bunchy7s.dev): no console errors, light and dark, 1280 px and 390 px, every tab, the tooltip and the keyboard cursor. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:02:30 +07:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon-site#32
No description provided.