Files
kuentagym/website/site.js
T
Duarte Santos becd2357ff Project website + one icon everywhere
website/ holds the source of opengym.duarte-santos.ch — landing with live
GitHub stats, docs and the story behind the app; no build step. The
native app icons are now generated (capacitor-assets) from the same
blocky dumbbell as the PWA icon, traced into resources/icon.svg, so the
APK, home-screen PWA, and website favicon all match.
2026-07-23 15:49:21 +02:00

21 lines
960 B
JavaScript

// Live GitHub numbers in the nav + open-source strip. Fails silently — the site
// works fine without them (unauthenticated API: 60 req/h per IP, cached below).
(async () => {
const set = (id, v) => document.querySelectorAll('[data-gh="' + id + '"]').forEach(el => { el.textContent = v })
try {
let d = null
const cached = sessionStorage.getItem('gh_repo')
if (cached) d = JSON.parse(cached)
else {
const r = await fetch('https://api.github.com/repos/DuarteSantos8/openGym')
if (!r.ok) return
d = await r.json()
sessionStorage.setItem('gh_repo', JSON.stringify({ stargazers_count: d.stargazers_count, forks_count: d.forks_count, open_issues_count: d.open_issues_count }))
}
set('stars', '★ ' + d.stargazers_count)
set('stars-n', d.stargazers_count)
set('forks-n', d.forks_count)
set('issues-n', d.open_issues_count)
} catch (e) { /* offline / rate-limited — leave placeholders */ }
})()