From 4eb7a98330c0b173759ca3a36ebbf62e66e61bc1 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Fri, 23 Oct 2026 01:19:42 +0200 Subject: [PATCH] Website: "Playing now" on the home page, from the telemetry server's live count The home page's "At a glance" list gets a fifth row with how many play right now, read from https://telemetry.playhorizon.dev/v1/live (3 s timeout, again every minute while the tab is visible). It stays hidden while nobody plays or the server doesn't answer. The FAQ no longer says the "I'm playing" ping is off: the server is live since #1276. Co-Authored-By: Claude Opus 5.5 --- website/docs/faq.md | 2 +- website/src/index.html | 1 + website/src/main.js | 32 +++++++++++++++++++++++++++++++- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/website/docs/faq.md b/website/docs/faq.md index 3bde1e7ea..6421a1083 100644 --- a/website/docs/faq.md +++ b/website/docs/faq.md @@ -56,7 +56,7 @@ In part. Horizon runs the full-screen effects of Java shader packs, not their ge ## Does Horizon collect data? -Only if you say yes, and each kind has its own switch. Everything is off by default. The game has an anonymous "I'm playing" ping for a live player count, but it is off today: no server receives it yet, so the game sends nothing. See [Privacy](/privacy). +Only if you say yes, and each kind has its own switch. Everything is off by default. The one thing sent without asking is an anonymous "I'm playing" ping, for the count of how many play right now: it holds a random number made each time the game starts, the version, your OS and whether a world is open to LAN, and nothing about you. See [Privacy](/privacy). ## How often does it update? diff --git a/website/src/index.html b/website/src/index.html index a36f6ff2a..9c7c3ca3e 100644 --- a/website/src/index.html +++ b/website/src/index.html @@ -96,6 +96,7 @@
  • 02Differential harnesses{{HARNESSES}}
  • 03Drawn by Horizon5 shots
  • 04Recently addedReleases
  • +

    Unofficial. Not an official Minecraft product. Not approved by or associated with Mojang or Microsoft.

    diff --git a/website/src/main.js b/website/src/main.js index e04e85eae..4298cf1fd 100644 --- a/website/src/main.js +++ b/website/src/main.js @@ -1,5 +1,6 @@ // The page's behaviour: the download buttons for this platform, the latest releases, the -// links and contributors, the navigation, the menus' tabs, the lightbox and the motion. +// links and contributors, how many play now, the navigation, the menus' tabs, the lightbox +// and the motion. // Everything degrades to the baked-in content when GitHub can't be reached. import { escape } from "./markdown.js"; import { recentHtml } from "./releases.js"; @@ -103,6 +104,34 @@ async function setUpLinks() { }); } +// --- Playing now --------------------------------------------------------------------- + +const TELEMETRY = "https://telemetry.playhorizon.dev"; + +// How many play right now, from the games' anonymous "I'm playing" pings (Privacy explains them). The +// server rounds it and makes it again at most every 15 seconds; the row stays hidden while nobody plays +// or the server doesn't answer. +async function setUpLive() { + const row = document.querySelector("[data-live]"); + if (!row) return; + const update = async () => { + try { + const res = await fetch(`${TELEMETRY}/v1/live`, { signal: AbortSignal.timeout(3000) }); + if (!res.ok) throw new Error(String(res.status)); + const { playing } = await res.json(); + if (!Number.isInteger(playing) || playing < 1) throw new Error("nobody"); + row.querySelector("[data-live-count]").textContent = playing.toLocaleString("en"); + row.hidden = false; + // It shows up after the others came in, so it skips their entrance. + row.classList.add("is-visible"); + } catch { + row.hidden = true; + } + }; + await update(); + setInterval(() => document.visibilityState === "visible" && update(), 60_000); +} + // --- Navigation ---------------------------------------------------------------------- function setUpNav() { @@ -235,3 +264,4 @@ setUpDownload(); setUpRecent(); setUpLinks(); setUpContributors(); +setUpLive();