diff --git a/src/pages/for/networks.astro b/src/pages/for/networks.astro index c8fef30..0b60df2 100644 --- a/src/pages/for/networks.astro +++ b/src/pages/for/networks.astro @@ -8,10 +8,12 @@ const title = "Networks - Live Networks on Pilot Protocol"; const description = "30+ networks running on Pilot Protocol - each with its own membership rules, trust model, and purpose."; const canonicalUrl = "https://pilotprotocol.network/for/networks"; -// Live Backbone count = total network (every agent starts there) +// Live Backbone count = total network (every agent starts there). +// 2026-06-07: switched from /api/stats (now admin-gated) to +// /api/public-stats, which exposes total_nodes + active_nodes only. let backboneCount = '~60K'; try { - const res = await fetch('https://polo.pilotprotocol.network/api/stats', { + const res = await fetch('https://polo.pilotprotocol.network/api/public-stats', { headers: { 'User-Agent': 'pilotprotocol-web' }, }); if (res.ok) { diff --git a/src/pages/index.astro b/src/pages/index.astro index 0725689..cde3a21 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -4,14 +4,22 @@ import Nav from '../components/Nav.astro'; import Footer from '../components/Footer.astro'; import '../styles/system.css'; -// Live stats - graceful fallback at build time +// Live stats - graceful fallback at build time. +// +// 2026-06-07: switched from /api/stats (now admin-gated as part of the +// polo public-stats lockdown) to /api/public-stats, which exposes only +// a curated payload — server_time, uptime_seconds, active_nodes, +// total_nodes, components{}. No 30-day history, no total_requests +// counter, so growth-% and lifetime-request-count headline figures +// were removed from the page. liveRequests is kept as a static +// "5B+" fallback purely because the page copy still references it +// in places; the dynamic figure is no longer fetched. let liveAgents = '~35,000'; let liveAgentsExact = '34,812'; let liveRequests = '5B+'; -let growthPct = '+50%'; try { - const res = await fetch('https://polo.pilotprotocol.network/api/stats', { + const res = await fetch('https://polo.pilotprotocol.network/api/public-stats', { headers: { 'User-Agent': 'pilotprotocol-web' }, }); if (res.ok) { @@ -26,38 +34,6 @@ try { else liveAgents = `${activeN}`; liveAgentsExact = activeN.toLocaleString('en-US'); } - - // total requests → "X.YB+" - if (typeof s.total_requests === 'number') { - const n = s.total_requests; - if (n >= 1_000_000_000) liveRequests = `${(n / 1_000_000_000).toFixed(1).replace(/\.0$/, '')}B+`; - else if (n >= 1_000_000) liveRequests = `${Math.round(n / 1_000_000)}M+`; - else liveRequests = `${n}`; - } - - // growth - 7-day: compare the daily[] entry ~7 days ago to the latest - if (Array.isArray(s.daily) && s.daily.length >= 2) { - const last = s.daily[s.daily.length - 1]; - const targetTs = Number(last?.ts) - 7 * 86400; - let ref = s.daily[Math.max(0, s.daily.length - 8)]; - let bestDelta = Infinity; - for (const e of s.daily) { - const d = Math.abs(Number(e?.ts) - targetTs); - if (Number.isFinite(d) && d < bestDelta) { bestDelta = d; ref = e; } - } - // Per-day rows carry `online_nodes` (not `total_nodes`); fall back to - // current top-level total_nodes as the latest if the last row is missing it. - const aField = (e: any) => Number(e?.online_nodes ?? e?.total_nodes); - const a = aField(ref); - const bRaw = aField(last); - const b = Number.isFinite(bRaw) && bRaw > 0 - ? bRaw - : (typeof s.total_nodes === 'number' ? s.total_nodes : NaN); - if (Number.isFinite(a) && Number.isFinite(b) && a > 0) { - const pct = ((b - a) / a) * 100; - if (Number.isFinite(pct) && pct > 0) growthPct = `+${Math.round(pct)}%`; - } - } } } catch {} --- @@ -120,7 +96,6 @@ try {
@@ -449,12 +424,6 @@ try {