Website: milestones timeline builds itself from published GitHub releases

No more hand-maintained history on the about page — site.js renders one
timeline entry per published release (title, date, first paragraph of
the notes, link). Static entries remain only as an offline fallback.
This commit is contained in:
Duarte Santos committed 2026-07-23 15:58:06 +02:00
1 parent ae399cd1dd
commit df91727dcf
2 files changed
+53 -12

No files matched your search

+7 -12
View File
@@ -62,22 +62,17 @@
<p class="who" style="color:var(--faint)">— <a href="https://duarte-santos.ch" rel="noopener">Duarte Santos</a></p>
<h2>Milestones</h2>
<ul class="tl">
<!-- The releases below are a static fallback: site.js replaces them with the live list
of published GitHub releases, so this page never needs manual updating. Only the
first entry (pre-GitHub) is permanent. -->
<ul class="tl" id="milestones">
<li><b>The personal app</b><span class="when">early summer 2026</span>
<p>A hand-written vanilla-JS page on my own server. One user, zero ambitions.</p></li>
<li><b>v1.0 — open-sourced</b><span class="when">July 20, 2026</span>
<li data-fallback><b>v1.0.0 — open-sourced</b><span class="when">July 20, 2026</span>
<p>Docker-Compose self-hosting, passkey profiles, guided workouts, 1,324-exercise
library. AGPL from day one.</p></li>
<li><b>v1.1 — the community version</b><span class="when">July 21–22, 2026</span>
<p>Twelve UI languages, custom exercises, equipment filters, supersets &amp; cardio
polish, push notifications with workout reminders, an admin dashboard with
invite-only signup.</p></li>
<li><b>v1.2 — redesign, muscle map &amp; demo</b><span class="when">July 23, 2026</span>
<p>A full visual redesign with a hand-drawn icon set, the muscle-balance body map,
a browser demo, and importers that bring your history over from other apps.</p></li>
<li><b>v1.2.2 — the mobile app</b><span class="when">July 23, 2026</span>
<p>The standalone Android app: everything on your phone, no account, no server —
distributed as a plain APK from this site, deliberately store-free.</p></li>
<li data-fallback><b>Every release since</b><span class="when">ongoing</span>
<p>See the full list on <a href="https://github.com/DuarteSantos8/openGym/releases" rel="noopener">GitHub → Releases</a>.</p></li>
</ul>
<h2>Principles</h2>
+46
View File
@@ -18,3 +18,49 @@
set('issues-n', d.open_issues_count)
} catch (e) { /* offline / rate-limited — leave placeholders */ }
})()
// About page: build the milestones timeline from the published GitHub releases, so the
// page updates itself with every release. The static entries marked data-fallback stay
// in place when the API is unreachable; the hand-written first entry is always kept.
;(async () => {
const tl = document.getElementById('milestones')
if (!tl) return
try {
let rel = null
const cached = sessionStorage.getItem('gh_releases')
if (cached) rel = JSON.parse(cached)
else {
const r = await fetch('https://api.github.com/repos/DuarteSantos8/openGym/releases?per_page=100')
if (!r.ok) return
rel = (await r.json()).filter(x => !x.draft && !x.prerelease)
.map(x => ({ tag: x.tag_name, name: x.name, at: x.published_at, body: x.body || '', url: x.html_url }))
sessionStorage.setItem('gh_releases', JSON.stringify(rel))
}
if (!rel.length) return
const fmt = d => new Date(d).toLocaleDateString('en-GB', { year: 'numeric', month: 'long', day: 'numeric' })
// first paragraph of the notes (hard-wrapped lines rejoined), markdown crudely stripped
const blurb = md => {
const lines = md.replace(/\r/g, '').split('\n')
let start = lines.findIndex(l => l.trim() && !l.trim().startsWith('#'))
if (start < 0) return ''
let para = []
for (let i = start; i < lines.length && lines[i].trim(); i++) para.push(lines[i].trim())
const txt = para.join(' ').replace(/\[([^\]]*)\]\([^)]*\)/g, '$1').replace(/[*_`>]/g, '')
return txt.length > 220 ? txt.slice(0, 217).replace(/\s+\S*$/, '') + '…' : txt
}
tl.querySelectorAll('[data-fallback]').forEach(el => el.remove())
for (const x of rel.slice().reverse()) { // oldest → newest, matching the timeline
const li = document.createElement('li')
const title = x.name && x.name !== x.tag ? x.name : x.tag
li.innerHTML = '<b></b><span class="when"></span><p></p>'
li.querySelector('b').textContent = title.startsWith(x.tag) ? title : x.tag + ' — ' + title
li.querySelector('.when').textContent = fmt(x.at)
const p = li.querySelector('p')
p.textContent = blurb(x.body) + ' '
const a = document.createElement('a')
a.href = x.url; a.rel = 'noopener'; a.textContent = 'notes →'
p.appendChild(a)
tl.appendChild(li)
}
} catch (e) { /* fallback entries stay */ }
})()