Rebrand to KuentaGYM, and start a new profile in pounds and Spanish

The app is now KuentaGYM everywhere a user can see it, and a fresh profile no
longer starts on upstream's English/kg defaults. Both are this fork's decisions,
so both are pinned by tests rather than left to a find-and-replace.

Rename (1,270 references, 149 files)

- Visible surfaces: the Login/Home/mobile-onboarding wordmark, the Settings
  version line, the printed plan, the PWA title + manifest, and the 17 branded
  strings across all 14 locale packs.
- Infrastructure: repo links, the container images and the release endpoints now
  name git.dploy.lol/dsantillan/kuentagym; .gitea/workflows/docker-publish.yml
  publishes to this forge's registry instead of gitea.com.
- The Android/iOS application id stays ch.duartesantos.opengym on purpose:
  changing it would make the mobile app a different app that could never update
  an installed copy.

Three things the mechanical pass would have broken, fixed here

- The update check asked gitlab.com for upstream's releases and would have
  installed upstream's APK, putting the old name back on the phone. It now reads
  this fork's Gitea releases API (the assets shape differs), with the tests
  rewritten to the payload Gitea actually returns.
- Renaming the mobile state/pairing files (opengym-state.json,
  opengym-remote.json) would lose the on-device copy of a history whose WebView
  storage may have been evicted, and silently unpair the device. Both are read
  under their old names and written forward under the new ones.
- Renaming the exported plan-file marker (openGym_plan) rejected every plan
  shared before the rename as "not a plan file". Both markers are accepted.

Defaults: pounds and Spanish

- DEF.unit = 'lb', DEF.lang = 'es', plus every fallback that independently
  assumed en/kg (the <html lang> attribute, the Settings pickers, the Store, the
  MCP, the Coach payload).
- Server-generated push copy existed only in English and pt-BR, so a Spanish
  profile would have been notified in English; Spanish added.
- The demo seed states unit: 'kg' — its seeded numbers are kilograms, and
  inheriting the new default would have introduced an 82.4 lb lifter benching 60.
- The module-level language in i18n-core stays English: it is the only language
  whose strings need no pack, so `t()`, dates, numbers and lists agree before a
  pack loads. Starting there on 'es' formats a Spanish-shaped UI with English
  strings.

Also
- api/package.json's test glob missed push-messages.test.js and
  verify-error.test.js, which sat beside the modules they cover and never ran.
- README, docs/, website/ and the issue templates no longer describe upstream's
  GitLab/GitHub pipeline, Discord, sponsorship or public demo as if they were
  this fork's; upstream history and attribution are preserved (NOTICE.md).
This commit is contained in:
dsantillan committed 2026-09-21 14:29:54 -04:00
1 parent f91cde15a1
commit 87bfd6d4c4
152 files changed
+1784 -1604

No files matched your search

+9 -148
View File
@@ -1,18 +1,12 @@
// Behaviour for the openGym site: the header's navigation sheet, the contents
// drawer and its scrollspy, the scroll reveals, the demo frame, and the two things
// that come from the GitHub API (repo counts, release timeline).
// Every one of them fails soft — the page is complete without any of this running.
const GH_REPO = 'https://api.github.com/repos/DuarteSantos8/openGym'
// Discord publishes an invite's guild counts to anyone who asks for the invite with
// ?with_counts=1 — no bot token, no widget to enable, and the API reflects the caller's
// Origin, so the browser is allowed to read it. The code is the permanent invite in the
// nav; if that invite is ever revoked this returns 404 and the count simply stays blank.
const DC_INVITE = 'https://discord.com/api/v10/invites/e62jY6fwVb?with_counts=1'
// The two network lookups below are decoration; they wait until the page is idle so they
// never compete with the stylesheet, the hero image or the demo frame.
const whenIdle = (fn) => ('requestIdleCallback' in window ? requestIdleCallback(fn, { timeout: 2500 }) : setTimeout(fn, 1200))
// Behaviour for the KuentaGYM site: the header's navigation sheet, the contents
// drawer and its scrollspy, the scroll reveals, the chapter groups and the feature rail.
// Every piece of it fails soft — the page is complete without any of this running.
//
// Nothing here talks to another host. The repo counts, the member count and the release
// timeline that used to decorate these pages read APIs belonging to the upstream project —
// api.github.com and discord.com — so on a fork they could only ever report the wrong
// project's numbers, or nothing at all. They are gone: the site issues no third-party
// request whatsoever.
/* ------------------------------------------------------- one panel controller
The navigation sheet and the contents drawer are the same object with different
@@ -199,139 +193,6 @@ function panel({ opener, panelEl, flag, closeBtn }) {
items.forEach(el => io.observe(el))
})()
/* ------------------------------------------------------------------ demo frame
The demo is the whole frontend bundle. It is only worth loading when the framed
phone is actually on screen, and never on a narrow viewport, where the CSS hides
the frame in favour of a plain "open it full-screen" card. */
;(() => {
const slot = document.querySelector('[data-demo]')
if (!slot) return
const mount = () => {
if (slot.dataset.mounted) return
if (!slot.offsetParent) return // frame hidden — phone layout
slot.dataset.mounted = '1'
const f = document.createElement('iframe')
f.src = slot.dataset.demo
f.title = 'openGym live demo'
f.loading = 'lazy'
f.style.cssText = 'width:100%;height:100%;border:0;display:block;border-radius:34px;background:#000'
slot.appendChild(f)
}
if (!('IntersectionObserver' in window)) { mount(); return }
const io = new IntersectionObserver((entries, obs) => {
for (const e of entries) if (e.isIntersecting) { mount(); obs.disconnect() }
}, { rootMargin: '600px' }) // load just before it scrolls into view
io.observe(slot)
// A rotation or a resized window can reveal the frame long after that first check.
addEventListener('resize', mount, { passive: true })
})()
/* ------------------------------------------------------- repo counts (nav + specs)
Back on api.github.com since 2026-09-11 — GitHub is the home of the project again and
GitLab only mirrors it. Unauthenticated, 60 requests an hour per IP, which the
sessionStorage cache keeps us well under.
The cache keys carry a _gh2 suffix: a visitor with a still-warm entry from the GitLab
weeks would otherwise be read with the old field names and show NaN. */
;whenIdle(async () => {
const set = (id, v) => document.querySelectorAll('[data-gh="' + id + '"]').forEach(el => { el.textContent = v })
try {
let d = null
const cached = sessionStorage.getItem('repo_meta_gh2')
if (cached) d = JSON.parse(cached)
else {
const r = await fetch(GH_REPO)
if (!r.ok) return
const j = await r.json()
// open_issues_count counts open pull requests too — GitHub's own repo header does the
// same, so the number matches what a visitor sees over there.
d = { stars_count: j.stargazers_count, forks_count: j.forks_count, open_issues_count: j.open_issues_count }
sessionStorage.setItem('repo_meta_gh2', JSON.stringify(d))
}
set('stars', '★ ' + d.stars_count)
set('stars-n', d.stars_count)
set('forks-n', d.forks_count)
// Leave the placeholder standing rather than writing an empty box.
if (d.open_issues_count !== '' && d.open_issues_count != null) set('issues-n', d.open_issues_count)
} catch (e) { /* offline / rate-limited — leave placeholders */ }
})
/* --------------------------------------------------- Discord members (nav + specs)
Same shape as the repo counts above, and just as optional: the placeholder next to
the Discord link is empty, so a blocked or rate-limited request leaves the link
reading exactly as it did before anyone counted anything. */
;whenIdle(async () => {
const set = (id, v) => document.querySelectorAll('[data-dc="' + id + '"]').forEach(el => { el.textContent = v })
try {
let n = null
const cached = sessionStorage.getItem('discord_members')
if (cached) n = JSON.parse(cached)
else {
const r = await fetch(DC_INVITE)
if (!r.ok) return
const j = await r.json()
n = j.approximate_member_count
if (typeof n !== 'number') return
sessionStorage.setItem('discord_members', JSON.stringify(n))
}
// Grouped like the other four-figure numbers on the page (1,324 exercises).
const fmt = n.toLocaleString('en-US')
set('members', fmt)
set('members-n', fmt)
} catch (e) { /* offline / blocked — the link keeps its plain label */ }
})
/* -------------------------------------------------------------- about timeline
Built 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.
Drafts and pre-releases are skipped; the notes are `body`, the date `published_at`. */
;(async () => {
const tl = document.getElementById('milestones')
if (!tl) return
try {
let rel = null
const cached = sessionStorage.getItem('repo_releases_gh2')
if (cached) rel = JSON.parse(cached)
else {
const r = await fetch(GH_REPO + '/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 || x.tag_name, at: x.published_at, body: x.body || '', url: x.html_url }))
sessionStorage.setItem('repo_releases_gh2', 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 */ }
})()
/* The "and the rest of it" rail: arrows for pointers that cannot swipe. The cards are plain
reading, so there is nothing to activate on them. */
;(() => {