Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

website: one header on every page, one contents drawer that starts closed

Duarte Santos523cfc9df7cb
diff --git a/scripts/build-api-docs.mjs b/scripts/build-api-docs.mjs
index 3f3e9bf01..fefd3e870 100644
--- a/scripts/build-api-docs.mjs
+++ b/scripts/build-api-docs.mjs
@@ -420,89 +420,14 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
.sch > summary { grid-template-columns: minmax(0, 1fr) auto; }
.sch .ep-sum { grid-column: 1 / -1; }
-/* --------------------------------------------------- contents drawer (rail)
- The chapter rail is closed by default. Below 980px it is the hamburger sheet
- the whole site uses; from 980px up a quiet "Contents" pill opens it as a
- drawer over the left edge, with a close button inside. The .toc-btn /
- .rail-close / body.contents-open classes are the reusable pattern. */
-.toc-btn { display: none; }
-@media (min-width: 980px) {
- .toc-btn {
- position: fixed; left: 18px; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 62;
- display: inline-flex; align-items: center; gap: 8px;
- padding: 10px 17px 10px 15px; border-radius: 999px; cursor: pointer;
- background: rgba(23, 24, 27, .85);
- backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
- border: 1px solid var(--hair); color: var(--fg-2);
- font-size: 13.5px; font-weight: 500; letter-spacing: -.01em;
- transition: color .2s var(--ease), border-color .2s var(--ease), background-color .2s var(--ease);
- }
- .toc-btn:hover { color: var(--fg); border-color: rgba(255, 255, 255, .25); background: rgba(32, 33, 37, .92); }
- .toc-btn svg { width: 15px; height: 15px; }
-
- body.topnav .side {
- display: block; position: fixed; left: 0; right: auto; top: 0; bottom: 0; z-index: 80;
- width: min(320px, 86vw); max-height: none;
- padding: 58px 24px calc(34px + env(safe-area-inset-bottom)) calc(26px + env(safe-area-inset-left));
- background: #0a0b0c; border-right: 1px solid var(--hair-soft); border-bottom: 0;
- overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
- box-shadow: 40px 0 80px rgba(0, 0, 0, .5);
- transform: translateX(-102%); visibility: hidden; opacity: 1; pointer-events: auto;
- transition: transform .32s var(--ease), visibility .32s;
- }
- body.topnav.contents-open .side { transform: none; visibility: visible; }
- body.contents-open::after {
- content: ""; position: fixed; inset: 0; z-index: 75;
- background: rgba(0, 0, 0, .55);
- backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
- opacity: 1; pointer-events: auto;
- }
- .rail-close {
- position: absolute; top: 14px; right: 12px; width: 34px; height: 34px;
- display: flex; align-items: center; justify-content: center;
- border-radius: 9px; color: var(--fg-3); cursor: pointer;
- transition: color .2s var(--ease), background-color .2s var(--ease);
- }
- .rail-close:hover { color: var(--fg); background: rgba(255, 255, 255, .06); }
- .rail-close svg { width: 15px; height: 15px; }
-}
-@media (max-width: 979.98px) { .rail-close { display: none; } }
-/* Self-sufficiency: with the rail closed the page never reserves rail space. */
-@media (min-width: 1300px) { body.topnav { padding-left: 0; } }
-@media (prefers-reduced-motion: reduce) { body.topnav .side { transition-duration: .01ms; } }
+/* The header, the navigation sheet and the contents drawer belong to the site, not
+ to this page: .navsheet, .toc-btn, .side and .rail-close live in styles.css and
+ site.js and behave identically here, on the docs page and on the home page. This
+ file deliberately adds nothing of its own to them — one implementation is the
+ only way the two rail pages can feel like the same rail. */
`
const js = `
-/* Contents drawer (>=980px; below that the hamburger sheet in site.js owns the rail). */
-;(() => {
- const body = document.body
- const btn = document.querySelector('.toc-btn')
- const menu = document.getElementById('menu')
- if (!btn || !menu) return
- const set = open => {
- body.classList.toggle('contents-open', open)
- btn.setAttribute('aria-expanded', String(open))
- body.style.overflow = open ? 'hidden' : ''
- }
- btn.addEventListener('click', e => { e.stopPropagation(); set(!body.classList.contains('contents-open')) })
- menu.querySelector('.rail-close')?.addEventListener('click', () => set(false))
- document.addEventListener('click', e => {
- if (!body.classList.contains('contents-open')) return
- if (e.target.closest('#menu') || e.target.closest('.toc-btn')) return
- set(false)
- })
- menu.addEventListener('click', e => { if (e.target.closest('a')) set(false) })
- document.addEventListener('keydown', e => { if (e.key === 'Escape') set(false) })
- addEventListener('resize', () => {
- if (innerWidth < 980) set(false)
- else {
- // crossing up: make sure a hamburger-opened sheet doesn't linger
- body.classList.remove('menu-open'); menu.classList.remove('open')
- if (!body.classList.contains('contents-open')) body.style.overflow = ''
- }
- })
-})()
-
/* Jumping to an anchor inside a collapsed card opens the card — and re-aligns, since
the browser scrolled to where the target was while it was still collapsed. */
;(() => {
@@ -555,7 +480,7 @@ const html = `<!DOCTYPE html>
<link rel="icon" type="image/png" sizes="512x512" href="icon-512.png">
<link rel="icon" type="image/png" sizes="180x180" href="icon-180.png">
<link rel="apple-touch-icon" href="icon-180.png">
-<link rel="stylesheet" href="styles.css?v=11">
+<link rel="stylesheet" href="styles.css?v=12">
<script>document.documentElement.className += ' js'</script>
<!-- Umami web analytics for opengym.duarte-santos.ch (self-hosted, cookieless). -->
<script defer src="https://stats.duarte-santos.ch/script.js" data-website-id="db36019e-50f4-453c-9c56-d0588aefe233"></script>
@@ -572,37 +497,58 @@ const html = `<!DOCTYPE html>
<a class="ql site" href="/#features">Features</a>
<a class="ql site" href="/#screens">Screenshots</a>
<a class="ql site" href="/#demo">Demo</a>
- <a class="ql site" href="docs.html">Docs</a>
- <a class="ql site" href="api.html">API</a>
- <a class="ql site" href="about.html">About</a>
+ <a class="ql site" href="/docs.html">Docs</a>
+ <a class="ql site" href="/api.html">API</a>
+ <a class="ql site" href="/about.html">About</a>
<a class="ql" href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">GitLab <span data-gh="stars"></span></a>
<a class="ql" href="https://discord.gg/e62jY6fwVb" rel="noopener">Discord</a>
<a class="cta" href="/#download">Download</a>
</div>
- <button class="nav-toggle" aria-expanded="false" aria-controls="menu" aria-label="Menu">
+ <button class="nav-toggle" id="navtoggle" aria-expanded="false" aria-controls="sitemenu" aria-label="Menu">
<span></span><span></span>
</button>
</div></nav>
-<!-- The chapter rail. Closed by default: the Contents pill opens it as a drawer
- from 980px up; below that it is the hamburger sheet like everywhere else. -->
-<aside class="side" id="menu" aria-label="API chapters">
- <button class="rail-close" aria-label="Close contents"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M5 5l14 14M19 5L5 19"/></svg></button>
+<!-- The navigation sheet: the header's links again, for the widths where the bar has
+ room only for the brand and the download. Byte-identical on every page, like the
+ bar above it — nothing is ever dropped because of which page you are on. -->
+<div class="navsheet" id="sitemenu" role="navigation" aria-label="Site" aria-hidden="true">
+ <div class="nl-rows">
+ <a class="nl" href="/#features">Features</a>
+ <a class="nl" href="/#screens">Screenshots</a>
+ <a class="nl" href="/#demo">Demo</a>
+ <a class="nl" href="/docs.html">Docs</a>
+ <a class="nl" href="/api.html">API</a>
+ <a class="nl" href="/about.html">About</a>
+ <a class="nl" href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">GitLab <span data-gh="stars"></span></a>
+ <a class="nl" href="https://discord.gg/e62jY6fwVb" rel="noopener">Discord</a>
+ </div>
+</div>
+
+<!-- The one control that opens the contents, at every width. The drawer it opens is
+ closed in CSS, so it is shut on first paint whether or not the script runs. -->
+<button class="toc-btn" id="tocbtn" aria-expanded="false" aria-controls="menu">
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" aria-hidden="true"><path d="M4 6.5h16M4 12h16M4 17.5h10"/></svg>
+ Contents
+</button>
+
+<!-- The contents drawer: one list, one way in, one way out. Closed by default at
+ every width, and no preference is remembered — see .side in styles.css. -->
+<aside class="side" id="menu" aria-label="Contents" aria-hidden="true">
+ <div class="side-top">
+ <p class="side-title">Contents</p>
+ <button class="rail-close" aria-label="Close contents"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M5 5l14 14M19 5L5 19"/></svg></button>
+ </div>
<p class="side-label">On this page</p>
<a class="side-link" href="#overview"><b>Overview</b><span>Auth model, sessions, conventions</span></a>
${railTags}
<a class="side-link" href="#schemas"><b>Schemas</b><span>The state blob, the error shape &amp; co.</span></a>
<p class="side-label">More</p>
<a class="side-link" href="/"><b>Home</b><span>The tour, the demo, the download</span></a>
- <a class="side-link" href="docs.html"><b>Docs</b><span>Install, self-host, import</span></a>
- <a class="side-link" href="about.html"><b>About</b><span>The story and the milestones</span></a>
+ <a class="side-link" href="/docs.html"><b>Docs</b><span>Install, self-host, import</span></a>
+ <a class="side-link" href="/about.html"><b>About</b><span>The story and the milestones</span></a>
</aside>
-<button class="toc-btn" aria-controls="menu" aria-expanded="false">
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M4 6h16M4 12h16M4 18h10"/></svg>
- Contents
-</button>
-
<main class="api-main">
<h1>API</h1>
<p class="lead">Every route the openGym backend serves — passkey auth, state sync,
@@ -660,7 +606,7 @@ ${schemaCards}
</div>
</div></footer>
-<script src="site.js?v=11" defer></script>
+<script src="site.js?v=12" defer></script>
<script>${js}</script>
</body>
</html>
diff --git a/website/about.html b/website/about.html
index ce7978b54..4460df995 100644
--- a/website/about.html
+++ b/website/about.html
@@ -6,15 +6,25 @@
<title>About — openGym</title>
<meta name="description" content="The story behind openGym: a gym tracker that started as a tiny personal app on a homelab server and grew into an open-source project.">
<meta name="theme-color" content="#000000">
+<meta property="og:title" content="About openGym">
+<meta property="og:description" content="How openGym came to be: a tracker built for one user, open-sourced under the AGPL, with every release documented.">
+<meta property="og:image" content="https://opengym.duarte-santos.ch/img/banner.png">
+<meta property="og:url" content="https://opengym.duarte-santos.ch/about.html">
+<meta property="og:type" content="website">
+<meta property="og:site_name" content="openGym">
+<meta name="twitter:card" content="summary_large_image">
+<meta name="twitter:title" content="About openGym">
+<meta name="twitter:image" content="https://opengym.duarte-santos.ch/img/banner.png">
+<link rel="canonical" href="https://opengym.duarte-santos.ch/about.html">
<link rel="icon" type="image/png" sizes="512x512" href="icon-512.png">
<link rel="icon" type="image/png" sizes="180x180" href="icon-180.png">
<link rel="apple-touch-icon" href="icon-180.png">
-<link rel="stylesheet" href="styles.css?v=10">
+<link rel="stylesheet" href="styles.css?v=12">
<script>document.documentElement.className += ' js'</script>
<!-- Umami web analytics for opengym.duarte-santos.ch (self-hosted, cookieless). -->
<script defer src="https://stats.duarte-santos.ch/script.js" data-website-id="db36019e-50f4-453c-9c56-d0588aefe233"></script>
</head>
-<body>
+<body class="topnav">
<nav><div class="wrap nav-in">
<a class="brand" href="/">
@@ -22,19 +32,51 @@
openGym
</a>
<div class="nav-quick">
- <a class="ql site" href="api.html">API</a>
+ <a class="ql site" href="/#features">Features</a>
+ <a class="ql site" href="/#screens">Screenshots</a>
+ <a class="ql site" href="/#demo">Demo</a>
+ <a class="ql site" href="/docs.html">Docs</a>
+ <a class="ql site" href="/api.html">API</a>
+ <a class="ql site" href="/about.html">About</a>
<a class="ql" href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">GitLab <span data-gh="stars"></span></a>
<a class="ql" href="https://discord.gg/e62jY6fwVb" rel="noopener">Discord</a>
<a class="cta" href="/#download">Download</a>
</div>
- <button class="nav-toggle" aria-expanded="false" aria-controls="menu" aria-label="Menu">
+ <button class="nav-toggle" id="navtoggle" aria-expanded="false" aria-controls="sitemenu" aria-label="Menu">
<span></span><span></span>
</button>
</div></nav>
-<!-- The topic rail: a fixed column beside the page on a wide screen, the hamburger
- sheet everywhere else. One markup, two layouts — see .side in styles.css. -->
-<aside class="side" id="menu" aria-label="Topics">
+<!-- The navigation sheet: the header's links again, for the widths where the bar has
+ room only for the brand and the download. Byte-identical on every page, like the
+ bar above it — nothing is ever dropped because of which page you are on. -->
+<div class="navsheet" id="sitemenu" role="navigation" aria-label="Site" aria-hidden="true">
+ <div class="nl-rows">
+ <a class="nl" href="/#features">Features</a>
+ <a class="nl" href="/#screens">Screenshots</a>
+ <a class="nl" href="/#demo">Demo</a>
+ <a class="nl" href="/docs.html">Docs</a>
+ <a class="nl" href="/api.html">API</a>
+ <a class="nl" href="/about.html">About</a>
+ <a class="nl" href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">GitLab <span data-gh="stars"></span></a>
+ <a class="nl" href="https://discord.gg/e62jY6fwVb" rel="noopener">Discord</a>
+ </div>
+</div>
+
+<!-- The one control that opens the contents, at every width. The drawer it opens is
+ closed in CSS, so it is shut on first paint whether or not the script runs. -->
+<button class="toc-btn" id="tocbtn" aria-expanded="false" aria-controls="menu">
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" aria-hidden="true"><path d="M4 6.5h16M4 12h16M4 17.5h10"/></svg>
+ Contents
+</button>
+
+<!-- The contents drawer: one list, one way in, one way out. Closed by default at
+ every width, and no preference is remembered — see .side in styles.css. -->
+<aside class="side" id="menu" aria-label="Contents" aria-hidden="true">
+ <div class="side-top">
+ <p class="side-title">Contents</p>
+ <button class="rail-close" aria-label="Close contents"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M5 5l14 14M19 5L5 19"/></svg></button>
+ </div>
<p class="side-label">On this page</p>
<a class="side-link" href="#milestones-h"><b>Milestones</b><span>Every release, straight from GitLab</span></a>
<a class="side-link" href="#principles"><b>Principles</b><span>The rules that don't move</span></a>
@@ -121,6 +163,6 @@
</div>
</div></footer>
-<script src="site.js?v=10" defer></script>
+<script src="site.js?v=12" defer></script>
</body>
</html>
diff --git a/website/api.html b/website/api.html
index a55f2da41..353e3f4b8 100644
--- a/website/api.html
+++ b/website/api.html
@@ -22,7 +22,7 @@
<link rel="icon" type="image/png" sizes="512x512" href="icon-512.png">
<link rel="icon" type="image/png" sizes="180x180" href="icon-180.png">
<link rel="apple-touch-icon" href="icon-180.png">
-<link rel="stylesheet" href="styles.css?v=11">
+<link rel="stylesheet" href="styles.css?v=12">
<script>document.documentElement.className += ' js'</script>
<!-- Umami web analytics for opengym.duarte-santos.ch (self-hosted, cookieless). -->
<script defer src="https://stats.duarte-santos.ch/script.js" data-website-id="db36019e-50f4-453c-9c56-d0588aefe233"></script>
@@ -140,56 +140,11 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
.sch > summary { grid-template-columns: minmax(0, 1fr) auto; }
.sch .ep-sum { grid-column: 1 / -1; }
-/* --------------------------------------------------- contents drawer (rail)
- The chapter rail is closed by default. Below 980px it is the hamburger sheet
- the whole site uses; from 980px up a quiet "Contents" pill opens it as a
- drawer over the left edge, with a close button inside. The .toc-btn /
- .rail-close / body.contents-open classes are the reusable pattern. */
-.toc-btn { display: none; }
-@media (min-width: 980px) {
- .toc-btn {
- position: fixed; left: 18px; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 62;
- display: inline-flex; align-items: center; gap: 8px;
- padding: 10px 17px 10px 15px; border-radius: 999px; cursor: pointer;
- background: rgba(23, 24, 27, .85);
- backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
- border: 1px solid var(--hair); color: var(--fg-2);
- font-size: 13.5px; font-weight: 500; letter-spacing: -.01em;
- transition: color .2s var(--ease), border-color .2s var(--ease), background-color .2s var(--ease);
- }
- .toc-btn:hover { color: var(--fg); border-color: rgba(255, 255, 255, .25); background: rgba(32, 33, 37, .92); }
- .toc-btn svg { width: 15px; height: 15px; }
-
- body.topnav .side {
- display: block; position: fixed; left: 0; right: auto; top: 0; bottom: 0; z-index: 80;
- width: min(320px, 86vw); max-height: none;
- padding: 58px 24px calc(34px + env(safe-area-inset-bottom)) calc(26px + env(safe-area-inset-left));
- background: #0a0b0c; border-right: 1px solid var(--hair-soft); border-bottom: 0;
- overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
- box-shadow: 40px 0 80px rgba(0, 0, 0, .5);
- transform: translateX(-102%); visibility: hidden; opacity: 1; pointer-events: auto;
- transition: transform .32s var(--ease), visibility .32s;
- }
- body.topnav.contents-open .side { transform: none; visibility: visible; }
- body.contents-open::after {
- content: ""; position: fixed; inset: 0; z-index: 75;
- background: rgba(0, 0, 0, .55);
- backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
- opacity: 1; pointer-events: auto;
- }
- .rail-close {
- position: absolute; top: 14px; right: 12px; width: 34px; height: 34px;
- display: flex; align-items: center; justify-content: center;
- border-radius: 9px; color: var(--fg-3); cursor: pointer;
- transition: color .2s var(--ease), background-color .2s var(--ease);
- }
- .rail-close:hover { color: var(--fg); background: rgba(255, 255, 255, .06); }
- .rail-close svg { width: 15px; height: 15px; }
-}
-@media (max-width: 979.98px) { .rail-close { display: none; } }
-/* Self-sufficiency: with the rail closed the page never reserves rail space. */
-@media (min-width: 1300px) { body.topnav { padding-left: 0; } }
-@media (prefers-reduced-motion: reduce) { body.topnav .side { transition-duration: .01ms; } }
+/* The header, the navigation sheet and the contents drawer belong to the site, not
+ to this page: .navsheet, .toc-btn, .side and .rail-close live in styles.css and
+ site.js and behave identically here, on the docs page and on the home page. This
+ file deliberately adds nothing of its own to them — one implementation is the
+ only way the two rail pages can feel like the same rail. */
</style>
</head>
<body class="topnav">
@@ -203,22 +158,48 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<a class="ql site" href="/#features">Features</a>
<a class="ql site" href="/#screens">Screenshots</a>
<a class="ql site" href="/#demo">Demo</a>
- <a class="ql site" href="docs.html">Docs</a>
- <a class="ql site" href="api.html">API</a>
- <a class="ql site" href="about.html">About</a>
+ <a class="ql site" href="/docs.html">Docs</a>
+ <a class="ql site" href="/api.html">API</a>
+ <a class="ql site" href="/about.html">About</a>
<a class="ql" href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">GitLab <span data-gh="stars"></span></a>
<a class="ql" href="https://discord.gg/e62jY6fwVb" rel="noopener">Discord</a>
<a class="cta" href="/#download">Download</a>
</div>
- <button class="nav-toggle" aria-expanded="false" aria-controls="menu" aria-label="Menu">
+ <button class="nav-toggle" id="navtoggle" aria-expanded="false" aria-controls="sitemenu" aria-label="Menu">
<span></span><span></span>
</button>
</div></nav>
-<!-- The chapter rail. Closed by default: the Contents pill opens it as a drawer
- from 980px up; below that it is the hamburger sheet like everywhere else. -->
-<aside class="side" id="menu" aria-label="API chapters">
- <button class="rail-close" aria-label="Close contents"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M5 5l14 14M19 5L5 19"/></svg></button>
+<!-- The navigation sheet: the header's links again, for the widths where the bar has
+ room only for the brand and the download. Byte-identical on every page, like the
+ bar above it — nothing is ever dropped because of which page you are on. -->
+<div class="navsheet" id="sitemenu" role="navigation" aria-label="Site" aria-hidden="true">
+ <div class="nl-rows">
+ <a class="nl" href="/#features">Features</a>
+ <a class="nl" href="/#screens">Screenshots</a>
+ <a class="nl" href="/#demo">Demo</a>
+ <a class="nl" href="/docs.html">Docs</a>
+ <a class="nl" href="/api.html">API</a>
+ <a class="nl" href="/about.html">About</a>
+ <a class="nl" href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">GitLab <span data-gh="stars"></span></a>
+ <a class="nl" href="https://discord.gg/e62jY6fwVb" rel="noopener">Discord</a>
+ </div>
+</div>
+
+<!-- The one control that opens the contents, at every width. The drawer it opens is
+ closed in CSS, so it is shut on first paint whether or not the script runs. -->
+<button class="toc-btn" id="tocbtn" aria-expanded="false" aria-controls="menu">
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" aria-hidden="true"><path d="M4 6.5h16M4 12h16M4 17.5h10"/></svg>
+ Contents
+</button>
+
+<!-- The contents drawer: one list, one way in, one way out. Closed by default at
+ every width, and no preference is remembered — see .side in styles.css. -->
+<aside class="side" id="menu" aria-label="Contents" aria-hidden="true">
+ <div class="side-top">
+ <p class="side-title">Contents</p>
+ <button class="rail-close" aria-label="Close contents"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M5 5l14 14M19 5L5 19"/></svg></button>
+ </div>
<p class="side-label">On this page</p>
<a class="side-link" href="#overview"><b>Overview</b><span>Auth model, sessions, conventions</span></a>
<a class="side-link" href="#meta"><b>Meta</b><span>Health &amp; public config</span></a>
@@ -231,15 +212,10 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
<a class="side-link" href="#schemas"><b>Schemas</b><span>The state blob, the error shape &amp; co.</span></a>
<p class="side-label">More</p>
<a class="side-link" href="/"><b>Home</b><span>The tour, the demo, the download</span></a>
- <a class="side-link" href="docs.html"><b>Docs</b><span>Install, self-host, import</span></a>
- <a class="side-link" href="about.html"><b>About</b><span>The story and the milestones</span></a>
+ <a class="side-link" href="/docs.html"><b>Docs</b><span>Install, self-host, import</span></a>
+ <a class="side-link" href="/about.html"><b>About</b><span>The story and the milestones</span></a>
</aside>
-<button class="toc-btn" aria-controls="menu" aria-expanded="false">
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M4 6h16M4 12h16M4 18h10"/></svg>
- Contents
-</button>
-
<main class="api-main">
<h1>API</h1>
<p class="lead">Every route the openGym backend serves — passkey auth, state sync,
@@ -2229,38 +2205,8 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
</div>
</div></footer>
-<script src="site.js?v=11" defer></script>
+<script src="site.js?v=12" defer></script>
<script>
-/* Contents drawer (>=980px; below that the hamburger sheet in site.js owns the rail). */
-;(() => {
- const body = document.body
- const btn = document.querySelector('.toc-btn')
- const menu = document.getElementById('menu')
- if (!btn || !menu) return
- const set = open => {
- body.classList.toggle('contents-open', open)
- btn.setAttribute('aria-expanded', String(open))
- body.style.overflow = open ? 'hidden' : ''
- }
- btn.addEventListener('click', e => { e.stopPropagation(); set(!body.classList.contains('contents-open')) })
- menu.querySelector('.rail-close')?.addEventListener('click', () => set(false))
- document.addEventListener('click', e => {
- if (!body.classList.contains('contents-open')) return
- if (e.target.closest('#menu') || e.target.closest('.toc-btn')) return
- set(false)
- })
- menu.addEventListener('click', e => { if (e.target.closest('a')) set(false) })
- document.addEventListener('keydown', e => { if (e.key === 'Escape') set(false) })
- addEventListener('resize', () => {
- if (innerWidth < 980) set(false)
- else {
- // crossing up: make sure a hamburger-opened sheet doesn't linger
- body.classList.remove('menu-open'); menu.classList.remove('open')
- if (!body.classList.contains('contents-open')) body.style.overflow = ''
- }
- })
-})()
-
/* Jumping to an anchor inside a collapsed card opens the card — and re-aligns, since
the browser scrolled to where the target was while it was still collapsed. */
;(() => {
diff --git a/website/docs.html b/website/docs.html
index 591c3695a..89a487523 100644
--- a/website/docs.html
+++ b/website/docs.html
@@ -4,17 +4,30 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
<title>Docs — openGym</title>
-<meta name="description" content="How to install openGym on Android, use it on iPhone, self-host it with Docker, import your training history, and keep backups.">
+<meta name="description" content="The complete openGym reference: every feature, installing on Android and iPhone, self-hosting with Docker, every .env setting, the AI Coach, importing from FitNotes/Strong/Hevy, backups, the MCP server, and how it's built.">
<meta name="theme-color" content="#000000">
+<meta property="og:title" content="openGym Docs — the complete reference">
+<meta property="og:description" content="The complete openGym reference: every feature, self-hosting with Docker, every setting, the AI Coach, imports, backups, MCP, troubleshooting.">
+<meta property="og:image" content="https://opengym.duarte-santos.ch/img/banner.png">
+<meta property="og:url" content="https://opengym.duarte-santos.ch/docs.html">
+<meta property="og:type" content="website">
+<meta property="og:site_name" content="openGym">
+<meta name="twitter:card" content="summary_large_image">
+<meta name="twitter:title" content="openGym Docs — the complete reference">
+<meta name="twitter:image" content="https://opengym.duarte-santos.ch/img/banner.png">
+<link rel="canonical" href="https://opengym.duarte-santos.ch/docs.html">
<link rel="icon" type="image/png" sizes="512x512" href="icon-512.png">
<link rel="icon" type="image/png" sizes="180x180" href="icon-180.png">
<link rel="apple-touch-icon" href="icon-180.png">
-<link rel="stylesheet" href="styles.css?v=10">
+<link rel="stylesheet" href="styles.css?v=12">
<script>document.documentElement.className += ' js'</script>
<!-- Umami web analytics for opengym.duarte-santos.ch (self-hosted, cookieless). -->
<script defer src="https://stats.duarte-santos.ch/script.js" data-website-id="db36019e-50f4-453c-9c56-d0588aefe233"></script>
+<script type="application/ld+json">
+{"@context": "https://schema.org", "@type": "FAQPage", "mainEntity": [{"@type": "Question", "name": "Is openGym really free?", "acceptedAnswer": {"@type": "Answer", "text": "Yes — free as in cost and as in freedom (AGPL-3.0). No pro tier, no locked features, no ads, and the license keeps every fork open source too."}}, {"@type": "Question", "name": "Why isn't openGym on the Play Store or App Store?", "acceptedAnswer": {"@type": "Answer", "text": "By choice (and on iOS, by Apple's rules for sideloading). Store accounts cost money, impose terms that sit badly with the AGPL, and put a gatekeeper between you and an app whose whole point is that your data is yours. The signed Android APK is a direct download."}}, {"@type": "Question", "name": "Should I pick the mobile app or self-host?", "acceptedAnswer": {"@type": "Answer", "text": "To simply track your training: the mobile app. For data on your own hardware, synced across devices, with profiles for the people you train with: self-host with Docker. The backup file migrates everything between the two, or pair the app to your server."}}, {"@type": "Question", "name": "What's on the openGym roadmap?", "acceptedAnswer": {"@type": "Answer", "text": "Percentage/training-max programming (5/3/1-style), more starter plans, body measurements alongside weight, per-exercise notes and a plate calculator, more instruction languages. Community-driven — ideas and merge requests welcome."}}, {"@type": "Question", "name": "Where does the exercise database come from?", "acceptedAnswer": {"@type": "Answer", "text": "From hasaneyldrm/exercises-dataset: 1,324 exercises with animations and instructions. The metadata and instruction text are MIT; the images and animations are third-party media that openGym never redistributes — your instance downloads them from upstream on first run."}}, {"@type": "Question", "name": "What does the AGPL license mean for me?", "acceptedAnswer": {"@type": "Answer", "text": "You can self-host, use, modify and share openGym freely. Only if you run a modified version as a network service must you offer that version's source under the same license. Using or self-hosting it unmodified obliges you to nothing."}}]}
+</script>
</head>
-<body>
+<body class="topnav">
<nav><div class="wrap nav-in">
<a class="brand" href="/">
@@ -22,28 +35,137 @@
openGym
</a>
<div class="nav-quick">
- <a class="ql" href="api.html">API</a>
+ <a class="ql site" href="/#features">Features</a>
+ <a class="ql site" href="/#screens">Screenshots</a>
+ <a class="ql site" href="/#demo">Demo</a>
+ <a class="ql site" href="/docs.html">Docs</a>
+ <a class="ql site" href="/api.html">API</a>
+ <a class="ql site" href="/about.html">About</a>
<a class="ql" href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">GitLab <span data-gh="stars"></span></a>
<a class="ql" href="https://discord.gg/e62jY6fwVb" rel="noopener">Discord</a>
<a class="cta" href="/#download">Download</a>
</div>
- <button class="nav-toggle" aria-expanded="false" aria-controls="menu" aria-label="Menu">
+ <button class="nav-toggle" id="navtoggle" aria-expanded="false" aria-controls="sitemenu" aria-label="Menu">
<span></span><span></span>
</button>
</div></nav>
-<!-- The topic rail: a fixed column beside the page on a wide screen, the hamburger
- sheet everywhere else. One markup, two layouts — see .side in styles.css. -->
-<aside class="side" id="menu" aria-label="Topics">
- <p class="side-label">Docs</p>
- <a class="side-link" href="#android"><b>Android</b><span>Install the signed APK</span></a>
- <a class="side-link" href="#iphone"><b>iPhone</b><span>A home-screen app instead</span></a>
- <a class="side-link" href="#selfhost"><b>Self-hosting</b><span>Docker Compose and passkeys</span></a>
- <a class="side-link" href="#mcp"><b>Ask an AI</b><span>The read-only MCP bridge</span></a>
- <a class="side-link" href="#import"><b>Import your history</b><span>FitNotes, Strong, Hevy, Health</span></a>
- <a class="side-link" href="#backup"><b>Backups</b><span>One JSON file, yours</span></a>
- <a class="side-link" href="#build"><b>Build it yourself</b><span>Everything from the public repo</span></a>
- <a class="side-link" href="#faq"><b>FAQ</b><span>Free, private, no stores</span></a>
+<!-- The navigation sheet: the header's links again, for the widths where the bar has
+ room only for the brand and the download. Byte-identical on every page, like the
+ bar above it — nothing is ever dropped because of which page you are on. -->
+<div class="navsheet" id="sitemenu" role="navigation" aria-label="Site" aria-hidden="true">
+ <div class="nl-rows">
+ <a class="nl" href="/#features">Features</a>
+ <a class="nl" href="/#screens">Screenshots</a>
+ <a class="nl" href="/#demo">Demo</a>
+ <a class="nl" href="/docs.html">Docs</a>
+ <a class="nl" href="/api.html">API</a>
+ <a class="nl" href="/about.html">About</a>
+ <a class="nl" href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">GitLab <span data-gh="stars"></span></a>
+ <a class="nl" href="https://discord.gg/e62jY6fwVb" rel="noopener">Discord</a>
+ </div>
+</div>
+
+<!-- The one control that opens the contents, at every width. The drawer it opens is
+ closed in CSS, so it is shut on first paint whether or not the script runs. -->
+<button class="toc-btn" id="tocbtn" aria-expanded="false" aria-controls="menu">
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" aria-hidden="true"><path d="M4 6.5h16M4 12h16M4 17.5h10"/></svg>
+ Contents
+</button>
+
+<!-- The contents drawer: one list, one way in, one way out. Closed by default at
+ every width, and no preference is remembered — see .side in styles.css. -->
+<aside class="side" id="menu" aria-label="Contents" aria-hidden="true">
+ <div class="side-top">
+ <p class="side-title">Contents</p>
+ <button class="rail-close" aria-label="Close contents"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M5 5l14 14M19 5L5 19"/></svg></button>
+ </div>
+ <p class="side-label">Documentation</p>
+ <div class="side-group">
+ <a class="side-link" href="#flavors"><b>Which openGym?</b></a>
+ </div>
+ <div class="side-group">
+ <a class="side-link" href="#android"><b>Install on Android</b></a>
+ </div>
+ <div class="side-group">
+ <a class="side-link" href="#iphone"><b>Use on iPhone</b></a>
+ </div>
+ <div class="side-group">
+ <a class="side-link" href="#features"><b>Feature guide</b></a>
+ <div class="side-subs">
+ <a class="side-sub" href="#f-home">Home &amp; the weekly plan</a>
+ <a class="side-sub" href="#f-plan">Routines &amp; plan builder</a>
+ <a class="side-sub" href="#f-prog">Progression</a>
+ <a class="side-sub" href="#f-workout">Running a workout</a>
+ <a class="side-sub" href="#f-stats">Statistics</a>
+ <a class="side-sub" href="#f-looks">Looks &amp; languages</a>
+ </div>
+ </div>
+ <div class="side-group">
+ <a class="side-link" href="#selfhost"><b>Self-hosting</b></a>
+ <div class="side-subs">
+ <a class="side-sub" href="#sh-passkey">The passkey rule</a>
+ <a class="side-sub" href="#sh-https">HTTPS on your domain</a>
+ <a class="side-sub" href="#sh-notify">Notifications</a>
+ <a class="side-sub" href="#sh-stack">In an existing stack</a>
+ <a class="side-sub" href="#sh-update">Updating</a>
+ </div>
+ </div>
+ <div class="side-group">
+ <a class="side-link" href="#env"><b>Every setting</b></a>
+ </div>
+ <div class="side-group">
+ <a class="side-link" href="#admin"><b>Admin &amp; multi-user</b></a>
+ <div class="side-subs">
+ <a class="side-sub" href="#admin-log">The activity log</a>
+ </div>
+ </div>
+ <div class="side-group">
+ <a class="side-link" href="#mobile-server"><b>Phone ↔ server</b></a>
+ </div>
+ <div class="side-group">
+ <a class="side-link" href="#coach"><b>AI Coach</b></a>
+ <div class="side-subs">
+ <a class="side-sub" href="#coach-how">How it works</a>
+ <a class="side-sub" href="#coach-providers">Providers</a>
+ <a class="side-sub" href="#coach-local">Fully local</a>
+ <a class="side-sub" href="#coach-phone">On the phone</a>
+ <a class="side-sub" href="#coach-privacy">Privacy and limits</a>
+ </div>
+ </div>
+ <div class="side-group">
+ <a class="side-link" href="#mcp"><b>Ask an AI (MCP)</b></a>
+ </div>
+ <div class="side-group">
+ <a class="side-link" href="#import"><b>Import your history</b></a>
+ <div class="side-subs">
+ <a class="side-sub" href="#imp-hevy">Hevy, over the API</a>
+ <a class="side-sub" href="#imp-csv">Your own CSV</a>
+ <a class="side-sub" href="#imp-plans">Importing plans</a>
+ </div>
+ </div>
+ <div class="side-group">
+ <a class="side-link" href="#backup"><b>Backups &amp; your data</b></a>
+ </div>
+ <div class="side-group">
+ <a class="side-link" href="#arch"><b>How it's built</b></a>
+ </div>
+ <div class="side-group">
+ <a class="side-link" href="#build"><b>Build it yourself</b></a>
+ </div>
+ <div class="side-group">
+ <a class="side-link" href="#troubleshoot"><b>Troubleshooting</b></a>
+ <div class="side-subs">
+ <a class="side-sub" href="#tr-passkey">Passkeys fail</a>
+ <a class="side-sub" href="#tr-rest">Everything else</a>
+ </div>
+ </div>
+ <div class="side-group">
+ <a class="side-link" href="#privacy"><b>Privacy</b></a>
+ </div>
+ <div class="side-group">
+ <a class="side-link" href="#faq"><b>FAQ</b></a>
+ </div>
<p class="side-label">More</p>
<a class="side-link" href="/"><b>Home</b><span>The tour, the demo, the download</span></a>
<a class="side-link" href="api.html"><b>API</b><span>Every route, as an OpenAPI spec</span></a>
@@ -52,20 +174,22 @@
<main class="wrap prose">
<h1>Docs</h1>
- <p class="lead">Everything you need to get openGym running — on a phone, or on your own
- server. The deeper, maintainer-level docs live
- <a href="https://gitlab.com/DuarteSantos8/opengym/-/blob/main/docs" rel="noopener">in the repository</a>.</p>
+ <p class="lead">The complete reference — every feature, every setting, every way to run
+ openGym. The same documents live
+ <a href="https://gitlab.com/DuarteSantos8/opengym/-/blob/main/docs" rel="noopener">in the repository</a>,
+ next to the code they describe.</p>
- <div class="toc">
- <a href="#android">Android</a>
- <a href="#iphone">iPhone</a>
- <a href="#selfhost">Self-hosting</a>
- <a href="#mcp">Ask an AI</a>
- <a href="#import">Import your history</a>
- <a href="#backup">Backups</a>
- <a href="#build">Build it yourself</a>
- <a href="#faq">FAQ</a>
- </div>
+ <h2 id="flavors">Which openGym? The three flavors</h2>
+ <p>One codebase, three ways to run it. Everything below applies to all of them unless a
+ section says otherwise.</p>
+ <table class="cfg">
+ <tr><td><b>Mobile app</b></td><td>A sideloadable Android APK (and a buildable iOS app). No account, no server, no sync — the phone <i>is</i> the account, data lives in the app's private storage, workout-day reminders are native notifications. Install-and-done.</td></tr>
+ <tr><td><b>Self-hosted</b></td><td>Two Docker containers on your own machine. Adds passkey profiles, sync across devices, installable as a home-screen PWA, optional admin dashboard, web push notifications. The flavor for households and training groups.</td></tr>
+ <tr><td><b>Demo</b></td><td><a href="/demo/">The in-browser demo</a> — the real app seeded with example data, storing everything in your browser only. Useful to try before installing, and as a free plan editor (see <a href="#import">Import</a>).</td></tr>
+ </table>
+ <p>You can start with the mobile app and move to a server later (or the other way round) —
+ the <a href="#backup">backup file</a> migrates everything, and the mobile app can also
+ <a href="#mobile-server">connect directly to your server</a>.</p>
<h2 id="android">Install on Android</h2>
<ol>
@@ -78,8 +202,22 @@
<div class="note">openGym is deliberately <b>not</b> on the Play Store — no store account
between you and an open-source app. The APK is signed; updates install over the old
version and keep your data.</div>
- <p>Everything is stored on the phone itself. The only things fetched from the internet are
- the exercise images and animations (from a CDN, on demand).</p>
+ <p>The same signed APK exists in three places, all the same file:</p>
+ <ul>
+ <li>This site's <a href="/#download">download button</a>.</li>
+ <li><a href="https://gitlab.com/DuarteSantos8/opengym/-/packages" rel="noopener">GitLab's package registry</a> —
+ every version under <code>opengym-android/&lt;version&gt;/</code>, with a
+ <code>.sha256</code> checksum beside it.</li>
+ <li>The <a href="https://gitlab.com/DuarteSantos8/opengym/-/releases" rel="noopener">GitLab release</a> for that version, which links to both.</li>
+ </ul>
+ <p>Got the file from anywhere else? Verify it against the registry's <code>.sha256</code>
+ before installing. Updates: download the new APK and install it over the old one — same
+ signing key, data stays. Everything is stored on the phone itself; the only network
+ traffic is fetching exercise images and animations from a CDN, on demand.</p>
+ <p>The app requests notification permission only when you switch the workout-day reminder
+ on, and declares <code>SCHEDULE_EXACT_ALARM</code> so reminders fire to the minute.
+ Reminders are scheduled per calendar date — a day you already trained, or rescheduled
+ away, stays quiet.</p>
<h2 id="iphone">Use on iPhone</h2>
<p>Apple does not allow installing apps outside the App Store, so there is no iOS download —
@@ -88,111 +226,645 @@
<li><b>Self-host + home screen (recommended):</b> open your own openGym instance in
Safari → <b>Share</b> → <b>Add to Home Screen</b>. You get a full-screen app with its
own icon, passkey sign-in and sync — no expiry, no fees.</li>
- <li><b>Build it onto your own iPhone:</b> with a Mac and Xcode, the native app runs on
- your device with a free Apple ID (Apple expires the signature after 7 days; re-run
- from Xcode to renew). See
- <a href="https://gitlab.com/DuarteSantos8/opengym/-/blob/main/docs/MOBILE.md" rel="noopener">docs/MOBILE.md</a>.</li>
+ <li><b>Build it onto your own iPhone:</b> with a Mac and Xcode 15+, the native Capacitor
+ app runs on your device with a free Apple ID (Apple expires the signature after
+ 7 days; re-run from Xcode to renew — <b>AltStore</b> can automate that re-signing over
+ Wi-Fi). See <a href="https://gitlab.com/DuarteSantos8/opengym/-/blob/main/docs/MOBILE.md" rel="noopener">docs/MOBILE.md</a>.</li>
<li><b>Just looking?</b> Try the <a href="/demo/">in-browser demo</a> — the real app with
- example data, no account and nothing to install. The Android app above needs no account either.</li>
+ example data, no account and nothing to install.</li>
+ </ul>
+
+ <h2 id="features">The app, feature by feature</h2>
+ <p>What's actually inside, grouped the way you'll meet it. All of it ships in every flavor.</p>
+
+ <h3 id="f-home">Home &amp; the weekly plan</h3>
+ <ul>
+ <li><b>A routine per weekday.</b> The home screen knows what day it is, shows this week
+ with what's done and what's planned, and starts today's session with one tap.</li>
+ <li><b>Reschedule any day.</b> Sick, missed a session, fewer gym days this week? Move a
+ workout to another date without touching the weekly plan itself — the override applies
+ to that date only.</li>
+ <li><b>Body weight on the home screen:</b> your latest weigh-in, the trend, and how far
+ you are from the goal you set.</li>
+ <li><b>Streaks:</b> consecutive training weeks, workouts this week, and totals.</li>
+ </ul>
+
+ <h3 id="f-plan">Routines &amp; the plan builder</h3>
+ <ul>
+ <li><b>1,324 exercises</b> — searchable, with animated demonstrations and step-by-step
+ instructions, plus a <b>filter for the equipment you actually own</b> (the filter
+ options adapt to what you've picked, so every combination on screen has results).</li>
+ <li><b>Your own exercises:</b> a name and a body part is enough; they behave like built-in
+ ones everywhere, with an optional description instead of an animation.</li>
+ <li><b>Supersets:</b> plan them into a routine, or pair two exercises <i>mid-session</i>
+ with "make superset with previous/next" — then work through the group back-to-back
+ with a single rest at the end of each round. Unpair any time; a group of one
+ dissolves itself.</li>
+ <li><b>Warm-up sets:</b> mark the ramp-up rows as warm-ups and they stay out of every
+ number that shouldn't see them — no effect on estimated 1RM, progression, or the
+ fatigue map, while still being right there in the session. A weight change cascades
+ down the rows that share its phase, not across the divide.</li>
+ <li><b>Timed exercises:</b> planks, hangs, wall sits and loaded carries are logged by
+ time, not reps — with a work timer that counts the set itself (separate from the rest
+ timer) and logs the time you actually held. They can carry weight too.</li>
+ <li><b>Cardio:</b> logged as time + speed, not weight × reps.</li>
+ <li><b>Bodyweight exercises, logged as bodyweight:</b> push-ups, pull-ups, dips and
+ 300-odd others arrive knowing they carry no load — no weight column, no working-weight
+ prompt, one stepper for the reps. Add a dip belt and it reads as an addition.</li>
+ <li><b>Reps per side:</b> for lunges, single-arm rows and the rest. You log the total,
+ the app shows the split ("8 per side"), and targets step in twos so they never land
+ on a number one side can't have.</li>
+ <li><b>Rest per exercise:</b> heavy triples and curls don't want the same break — give any
+ exercise its own rest time and it overrides the global timer for that exercise. A
+ superset rests once, taking the longest. Travels with shared plans.</li>
+ <li><b>Share a plan:</b> send someone your routines and week schedule as a small file
+ (no workouts, no weigh-ins), or print it as a clean PDF. Importing merges — their own
+ plan is never overwritten.</li>
+ <li><b>Muscle preview:</b> while you build a routine, the body diagram shows what it
+ hits.</li>
+ </ul>
+
+ <h3 id="f-prog">Progression — weights that follow a rule</h3>
+ <ul>
+ <li>Pick a progression program <b>per routine, overridable per exercise</b>:
+ <ul>
+ <li><b>Linear</b> — add a fixed increment when you hit your reps.</li>
+ <li><b>Greyskull LP</b> — AMRAP top set, double jumps for beating the target big,
+ 10&nbsp;% resets on a stall.</li>
+ <li><b>Double progression</b> — through a visible rep range (both bounds editable);
+ reps climb first, then the weight steps and reps reset. Per-side exercises step
+ in twos.</li>
+ <li><b>Timed progression</b> — adding seconds instead of weight.</li>
+ </ul></li>
+ <li>Your weights are already right when the session opens, and <b>every target says
+ why</b> it's that number. Missed reps never advance the load; stalls trigger a deload;
+ bodyweight exercises progress in reps instead — and past a rep ceiling you set, a set
+ is added instead of a rep, up to the point where the honest advice is load or a harder
+ variation.</li>
+ <li><b>Planned deloads:</b> flag a routine as excluded from automatic progression — its
+ sessions open with the routine's own target weights, stay in your history and
+ statistics, and never become the baseline your next regular session progresses
+ from.</li>
+ </ul>
+
+ <h3 id="f-workout">Running a workout</h3>
+ <ul>
+ <li><b>Guided sessions:</b> today's routine opens with weights pre-filled from last time,
+ animated demos, a rest timer, and PR detection as you log.</li>
+ <li><b>It asks your body weight first</b> — one habit, one chart.</li>
+ <li><b>The screen stays awake while you train</b> — on for as long as a workout runs,
+ released the moment you finish, switchable off in Settings. (Needs HTTPS or
+ localhost; iOS refuses the wake lock in Low Power Mode.)</li>
+ <li><b>Change your mind mid-session:</b> add an exercise you decided to do, or remove one
+ you didn't, without ending the workout. Removing a member of a superset asks which
+ one.</li>
+ <li><b>Freestyle sessions:</b> train without a plan and pick exercises as you go — each
+ arrives prefilled from the last time you did it, same sets, same reps and weights by
+ position.</li>
+ <li><b>Log a past workout:</b> forgot your phone, trained on paper, switched apps? Add a
+ session after the fact from History — date, start time, duration, routine or
+ freestyle, then the normal workout screen. If that day already has a workout you
+ choose: replace, keep both, or cancel. Backfilled sessions never claim PRs against
+ workouts that came later.</li>
+ <li><b>Effort per set, in your scale:</b> an optional third column rating how hard a set
+ was, as <b>RIR</b> (reps left in the tank) or <b>RPE</b> (the same judgement on a
+ 10-point scale). Off by default; each set keeps the scale it was logged with, and
+ nothing else reads the value — progression and 1RM are unaffected.</li>
+ <li><b>See the timer end, not just hear it:</b> an opt-in screen flash when a rest or
+ work timer finishes — for loud gyms and headphones.</li>
+ <li><b>Rest-timer push notifications</b> even with the app closed (self-hosted; the
+ mobile app uses native notifications).</li>
+ </ul>
+
+ <h3 id="f-stats">Statistics</h3>
+ <ul>
+ <li><b>Activity heatmap:</b> a GitHub-style year view, shaded by time spent training.</li>
+ <li><b>Estimated 1RM</b> per exercise, from your best eligible set (it names which one),
+ with its own progress curve and a calculator for sets you haven't done. It won't
+ guess above 12 reps, and warm-up sets don't count.</li>
+ <li><b>Muscle map, three ways</b> — a front-and-back body diagram (male or female figure,
+ your pick) readable as:
+ <ul>
+ <li><b>Balance</b> — where the volume went, over a week, a month or all time,
+ naming the muscles you <i>haven't</i> trained;</li>
+ <li><b>Fatigue</b> — what is still recovering, weighted by how close each set was to
+ your maximum, decaying smoothly rather than expiring at a window edge;</li>
+ <li><b>Strength</b> — how long since you trained each muscle, and behind every one
+ the exercises that built it with their estimated 1RM.</li>
+ </ul>
+ It also previews what a routine hits while you build it, and shows what you just
+ trained when you finish.</li>
+ <li><b>Body-weight chart</b> with a goal line you set — gains and losses colored by
+ whether they move toward it.</li>
+ <li><b>PRs</b> detected as you train, listed per exercise.</li>
+ </ul>
+
+ <h3 id="f-looks">Looks, languages &amp; little things</h3>
+ <ul>
+ <li><b>Light/dark themes and 8 accent colors</b>, saved to your profile, over a
+ hand-drawn icon set instead of emoji — it looks the same on every phone.</li>
+ <li><b>14 languages</b> — EN, DE, ES, FR, IT, PT (Portugal), PT (Brazil), PL, TR, RU,
+ ZH, KO, HI, TH, HU. Exercise instructions are localized in 12 of them, and built-in
+ exercise names show bilingually in PT-BR and HU. Translations load on demand, so the
+ app stays fast.</li>
+ <li><b>kg or lb</b> — pick your unit; imports convert.</li>
+ <li><b>Workout-day reminder:</b> an optional notification on days you have a workout
+ planned but haven't logged one. It fires at <i>your</i> local time — each device
+ reports its own timezone — and follows you if you travel.</li>
+ <li><b>Installable PWA</b> (self-hosted): add it to your home screen from any browser and
+ it opens full-screen with its own icon.</li>
</ul>
<h2 id="selfhost">Self-host with Docker</h2>
- <p>The self-hosted flavor adds passkey profiles, sync across devices, and (optionally) an
- admin dashboard. You need <a href="https://docs.docker.com/get-docker/" rel="noopener">Docker</a>
- with Compose:</p>
+ <p>The self-hosted flavor is two small containers (web + API) and a folder of your data.
+ You need <a href="https://docs.docker.com/get-docker/" rel="noopener">Docker</a> with
+ Compose:</p>
<pre><code>git clone https://gitlab.com/DuarteSantos8/opengym
cd openGym
cp .env.example .env
docker compose pull # prebuilt images (amd64 + arm64) — skip to build from source
docker compose up -d</code></pre>
<p>Open <code>http://localhost:8080</code>, tap <b>Create profile</b>, and you're in. The
- first launch downloads the exercise media (~140&nbsp;MB) once.</p>
- <div class="note">Want it reachable from your phone with passkeys? You'll need an HTTPS
- domain — a two-line change in <code>.env</code>. The full guide, including reverse-proxy
- examples and the invite-only/admin options, is in
- <a href="https://gitlab.com/DuarteSantos8/opengym/-/blob/main/docs/SELF_HOSTING.md" rel="noopener">docs/SELF_HOSTING.md</a>.</div>
-
- <h3>Settings worth knowing about</h3>
- <p>All of these live in <code>.env</code>; the defaults are what you get if you touch nothing.</p>
+ first launch downloads the exercise media (~140&nbsp;MB) once into <code>media/img</code>
+ and <code>media/gif</code>. Check it's healthy:</p>
+ <pre><code>docker compose ps
+curl http://localhost:8080/api/health # {"ok":true,...}</code></pre>
+ <p>Logs: <code>docker compose logs -f</code> · stop: <code>docker compose down</code> ·
+ build from source instead of pulling: skip the <code>pull</code> and run
+ <code>docker compose up -d --build</code> — no Node needed locally either way.</p>
+
+ <h3 id="sh-passkey">The passkey rule (read this before opening a port)</h3>
+ <p>openGym signs you in with <b>passkeys</b> (WebAuthn — Face ID, fingerprint, or your
+ password manager). Browsers enforce two rules: a passkey is bound to an exact
+ <b>hostname</b>, and it only works over <b>HTTPS</b> — with one exception,
+ <code>http://localhost</code>.</p>
+ <p>So <code>http://localhost:8080</code> works on the Docker machine, but your phone
+ <b>cannot</b> use <code>http://192.168.x.x:8080</code> — that's neither localhost nor
+ HTTPS, and the passkey prompt won't appear. To use openGym from your phone you need a
+ real HTTPS hostname (below). Until then, LAN devices can still use <b>guest mode</b>
+ (data stays in that browser) or the <a href="#mobile-server">mobile app's pairing
+ mode</a>.</p>
+
+ <h3 id="sh-https">HTTPS on your own domain</h3>
+ <p>Put anything that terminates TLS in front of the <code>web</code> container. Pick
+ whichever you already run:</p>
+ <ul>
+ <li><b>Cloudflare Tunnel</b> (no open ports): route <code>gym.example.com</code> →
+ <code>http://&lt;docker-host&gt;:8080</code>. HTTPS comes with it.</li>
+ <li><b>Caddy</b> (automatic Let's Encrypt): <code>gym.example.com { reverse_proxy localhost:8080 }</code></li>
+ <li><b>Traefik / nginx / Nginx Proxy Manager:</b> route the HTTPS hostname to
+ <code>web:80</code> or <code>&lt;docker-host&gt;:8080</code>. Any proxy works.</li>
+ </ul>
+ <p>Then set the domain in <code>.env</code> and apply it:</p>
+ <pre><code># .env
+RP_ID=gym.example.com
+ORIGIN=https://gym.example.com
+
+docker compose up -d # restart alone does NOT re-read .env</code></pre>
+ <p>Visit your domain, create your profile, add it to the home screen (iOS: Share → Add to
+ Home Screen · Android: ⋮ → Add to Home screen).</p>
+ <div class="note">Changing <code>RP_ID</code> later invalidates existing passkeys — they
+ were bound to the old hostname, and everyone registers again. Settle the domain before
+ people join.</div>
+ <p>Want a valid certificate <b>without</b> exposing anything to the internet — HTTPS on a
+ LAN-only address? That works too (wildcard cert via a DNS challenge, Caddy in front):
+ <a href="https://gitlab.com/DuarteSantos8/opengym/-/blob/main/docs/SELF_HOSTING_HTTPS.md" rel="noopener">docs/SELF_HOSTING_HTTPS.md</a>.
+ A VPN or an auth proxy (Authelia, Cloudflare Access…) in front composes with all of
+ this.</p>
+
+ <h3 id="sh-notify">Notifications</h3>
+ <p>A self-hosted instance can push two kinds of alert to your phone or desktop, even with
+ the app closed: <b>rest timer over</b>, and the <b>workout-day reminder</b>. Turn them on
+ per profile in <b>Settings → Notifications</b> (needs a signed-in profile and HTTPS).
+ Nothing to configure server-side: VAPID keys are generated on first run and saved to
+ <code>./data/vapid.json</code>, and each browser reports its own timezone. Set
+ <code>VAPID_SUBJECT=mailto:[email protected]</code> if you'd rather push services could
+ reach an inbox than your origin URL.</p>
+
+ <h3 id="sh-stack">Fitting it into an existing stack</h3>
+ <p>The defaults assume openGym is alone: a service called <code>api</code> on port 3000,
+ nginx on 80 inside the web container. Merging into a compose file that already has an
+ <code>api</code>, or fronting it with your own proxy on another port, is four
+ <code>.env</code> settings — <code>WEB_PORT</code>, <code>NGINX_PORT</code>,
+ <code>BACKEND</code>, <code>PORT</code>. The web image renders its nginx config from
+ these <i>at container start</i>, so they work on a prebuilt image, no rebuild.</p>
+
+ <h3 id="sh-update">Updating</h3>
+ <pre><code>git pull # picks up compose/config changes
+docker compose pull # (or: docker compose up -d --build, if building from source)
+docker compose up -d</code></pre>
+ <p>Your <code>./data</code> and the downloaded media are untouched; the app shell is
+ versioned so clients pick up changes on next load. Releases are announced on
+ <a href="https://gitlab.com/DuarteSantos8/opengym/-/releases" rel="noopener">GitLab</a>
+ and <a href="https://discord.gg/e62jY6fwVb" rel="noopener">Discord</a>; container images
+ (amd64 + arm64) are published to
+ <a href="https://gitlab.com/DuarteSantos8/opengym/container_registry" rel="noopener">GitLab's registry</a>
+ on every release.</p>
+
+ <h2 id="env">Every setting</h2>
+ <p>All configuration is one <code>.env</code> file (see <code>.env.example</code>); the
+ defaults are what you get if you touch nothing.</p>
<table class="cfg">
- <tr><td><code>RP_ID</code> / <code>ORIGIN</code></td><td>The domain passkeys are bound to, and the full URL you serve from. The two must agree, or sign-in fails.</td></tr>
+ <tr><td><code>RP_ID</code></td><td>Hostname passkeys are bound to. A <b>bare hostname</b>: no scheme, no port, no slash. Default <code>localhost</code>.</td></tr>
+ <tr><td><code>ORIGIN</code></td><td>Full URL the app is served from — <i>with</i> scheme, <i>without</i> trailing slash. Must match the address bar exactly. Default <code>http://localhost:8080</code>.</td></tr>
+ <tr><td><code>RP_NAME</code></td><td>Name shown in the passkey prompt. Default <code>openGym</code>.</td></tr>
<tr><td><code>WEB_PORT</code></td><td>Host port for the web UI. Default <code>8080</code>.</td></tr>
- <tr><td><code>INVITE_ONLY</code></td><td>Set <code>1</code> and new profiles need an invite code you generate.</td></tr>
- <tr><td><code>ALLOW_GUEST</code></td><td>Set <code>0</code> to remove <b>Continue without account</b>, so everyone using the instance has a profile.</td></tr>
- <tr><td><code>ADMIN_UIDS</code></td><td>Which user ids get the admin dashboard.</td></tr>
- <tr><td><code>SESSION_DAYS</code></td><td>How long a sign-in lasts. Default <code>90</code>.</td></tr>
- <tr><td><code>BACKEND</code> / <code>PORT</code> / <code>NGINX_PORT</code></td><td>For fitting openGym into a stack that already has an <code>api</code> service, or putting it behind your own proxy on another port. The web container renders its nginx config at start-up, so these work on a prebuilt image.</td></tr>
+ <tr><td><code>NGINX_PORT</code></td><td>Port the web container listens on, inside the container. Default <code>80</code>.</td></tr>
+ <tr><td><code>BACKEND</code></td><td>Name of the API service <code>/api</code> is proxied to — change it if yours isn't called <code>api</code>.</td></tr>
+ <tr><td><code>PORT</code></td><td>Port the API listens on; the web container proxies to the same value. Default <code>3000</code>.</td></tr>
+ <tr><td><code>SESSION_DAYS</code></td><td>How long a sign-in lasts, in days. Default <code>90</code>.</td></tr>
+ <tr><td><code>ADMIN_UIDS</code></td><td>Comma-separated user ids that get the <a href="#admin">admin dashboard</a>. Default: none — a fresh instance has no admin.</td></tr>
+ <tr><td><code>INVITE_ONLY</code></td><td>Set <code>1</code> and new profiles need an invite code you generate from the dashboard. Existing accounts keep working. Default: off.</td></tr>
+ <tr><td><code>ALLOW_GUEST</code></td><td>Set <code>0</code> to remove <b>Continue without account</b>. Guest data isn't deleted — it stays in that browser and returns if you re-enable guests, or moves into a profile created on the same device. Default: on.</td></tr>
+ <tr><td><code>AUDIT_LOG</code></td><td>Record sign-ins and admin actions to the <a href="#admin-log">activity log</a> — set <code>0</code> to record nothing. Default: on.</td></tr>
+ <tr><td><code>AUDIT_MAX</code></td><td>Events kept in the activity log; <code>0</code> for no limit. Default <code>5000</code>.</td></tr>
+ <tr><td><code>AUDIT_DAYS</code></td><td>Days kept in the activity log; <code>0</code> to keep until <code>AUDIT_MAX</code>. Default <code>90</code>.</td></tr>
+ <tr><td><code>AUDIT_IP</code></td><td>Record the caller's address: <code>off</code>, <code>net</code> (network only, e.g. <code>203.0.113.0/24</code>) or <code>full</code>. Default <code>off</code>.</td></tr>
+ <tr><td><code>VAPID_SUBJECT</code></td><td>Contact URL sent with push notifications. Default: your <code>ORIGIN</code>.</td></tr>
+ <tr><td><code>COACH_DISABLED</code></td><td>Set <code>1</code> to switch the <a href="#coach">AI Coach</a> off harder than any toggle. <code>COACH_JOB_TIMEOUT_MS</code> raises the job budget for slow local models.</td></tr>
</table>
+ <p>Two things that look like settings but aren't: <code>DATA_DIR</code> is pinned to
+ <code>/data</code> by <code>docker-compose.yml</code> and mapped to <code>./data</code> —
+ change the host side of that volume, not the variable. And
+ <code>VITE_IMG_BASE</code>/<code>VITE_GIF_BASE</code> are <b>build-time</b> values baked
+ into the frontend bundle — setting them next to <code>docker compose</code> does nothing
+ to a prebuilt image (see <a href="#troubleshoot">Troubleshooting</a>).</p>
+
+ <h2 id="admin">Multiple users, admin &amp; the activity log</h2>
+ <p>Anyone who can reach the URL can create their own profile — each gets isolated data.
+ That's the default: open signup, no admin. To control who gets in:</p>
+ <pre><code>ADMIN_UIDS=youruserid # your id is in ./data/db.json under users[].id
+INVITE_ONLY=1 # new profiles need an invite code
+ALLOW_GUEST=0 # remove "Continue without account"</code></pre>
+ <p>Register your own passkey profile <i>first</i>, then put your id in
+ <code>ADMIN_UIDS</code>. You'll get an <b>Admin dashboard</b> link in Settings: who's
+ training right now, each user's workout history and body weight, disabling an account
+ (signed out and locked out everywhere until re-enabled), and — with invite-only on —
+ generating and revoking invite codes. Admin access rides on your passkey and is enforced
+ server-side; there is no separate admin login.</p>
+ <p><code>INVITE_ONLY</code> and <code>ALLOW_GUEST</code> answer different questions and are
+ usually set together: invite-only controls who may <i>create a profile</i>; the guest
+ button never creates one — guest mode keeps everything in that browser and never talks
+ to the server at all.</p>
+ <h3 id="admin-log">The activity log</h3>
+ <p>The dashboard keeps an activity log: sign-ins, sign-outs, failed attempts, refused
+ signups, and every admin action. It lives in <code>./data/audit.log</code> as one JSON
+ object per line — <code>tail -f</code> and <code>jq</code> work on it directly, and the
+ dashboard reads the same file. On by default, keeping the last 5,000 events or 90 days,
+ whichever comes first.</p>
+ <p>What it deliberately does <b>not</b> record: IP addresses (unless you opt in via
+ <code>AUDIT_IP</code>), browser user-agents (a fingerprint), and the passkey id of a
+ failed sign-in (it would let you follow an unknown device between attempts). Guests
+ never appear — nothing they do touches the server. Clearing the log records the clear
+ itself, and event ids keep counting, so a gap is always visible.</p>
- <h2 id="mcp">Ask an AI about your training</h2>
+ <h2 id="mobile-server">Connecting the mobile app to your server</h2>
+ <p>The mobile app normally keeps everything on the phone. It can instead <b>connect to
+ your self-hosted instance</b> — your data then lives there, synced like the browser PWA.
+ Same app, not a different download; offered on first launch and under Settings →
+ <b>Connect to my server</b>.</p>
+ <p>Passkeys can't work inside the app's WebView (it never runs at your real hostname), so
+ the device is <b>paired</b> instead:</p>
+ <ol>
+ <li>In a browser that's already signed in: Settings → <b>Pair the mobile app</b> — shows
+ a one-time code, valid 5 minutes.</li>
+ <li>In the app: enter your server's address and that code. Done.</li>
+ </ol>
+ <p>Worth knowing: the pairing exchanges the code for a bearer token that is the same signed
+ value a session cookie carries — so <b>"sign out everywhere"</b> in the browser revokes
+ paired apps too. Use an HTTPS address if at all possible (the token would otherwise
+ cross the network in plain text). A connected app needs network access while in use —
+ no offline mirror, same as the browser PWA. Settings → <b>Disconnect</b> syncs one last
+ time, then drops the device cleanly back to local mode. (For the curious: it's
+ <code>POST /api/pair/create</code> + <code>/api/pair/redeem</code> in
+ <code>api/server.js</code>.)</p>
+
+ <h2 id="coach">Let an AI coach write your plan</h2>
+ <p>Separate from the read-only bridge above, openGym has an optional <b>AI Coach</b>. Answer a
+ few questions — goal, days a week, session length, equipment, anything to work around — and
+ it designs a week of routines. Later it reviews what you actually logged and proposes
+ changes; you can also ask it to look at <b>one workout</b> (a debrief: a score, what went
+ well, what to watch, what to do next time) or to <b>improve a single routine</b> and leave
+ the rest alone. If the admin allows it and at least three people opt in, it can show
+ anonymous medians so you can see how you sit against the others on your instance.</p>
+
+ <h3 id="coach-how">How it works</h3>
+ <p>The Coach is a chat. The first visit is a short intake, one question per screen; after
+ that, every request works the same way:</p>
+ <ol>
+ <li>The server builds a JSON payload from a <b>by-name allowlist</b>: your plan, the sets
+ you logged in the review window, weigh-ins, your intake answers, and a few preferences —
+ under a pseudonym. Your name, e-mail, passkeys and everyone else's data are not in it,
+ by construction: fields are copied in one by one, nothing is passed through.</li>
+ <li>That payload goes to the provider <b>you</b> configured — there is no openGym service in
+ the middle.</li>
+ <li>The answer is parsed and <b>validated against a closed list of change types</b> (add,
+ remove or swap an exercise, sets, reps, schedule, progression policy…). An answer that
+ names an exercise that doesn't exist, invents a change type, or breaks a rule is
+ refused — it gets exactly one repair round, then the job fails rather than guessing.</li>
+ <li>What survives is shown to you as a card, <b>one checkbox per change</b>, each with the
+ evidence behind it. Nothing touches your plan until you accept it, every proposal stays
+ in the chat history whether you said yes or no, and the last accepted change-set can be
+ undone in one tap.</li>
+ </ol>
+
+ <h3 id="coach-providers">Providers</h3>
+ <p>It is <b>off by default</b>. An admin turns it on in <b>Settings → Admin → AI Coach</b> and
+ picks who answers:</p>
+ <table class="cfg">
+ <tr><td><b>Anthropic, OpenAI, Google&nbsp;Gemini</b></td><td>Paste an API key from the provider's console. Plain HTTPS from the api process — runs on the default image.</td></tr>
+ <tr><td><b>OpenAI-compatible endpoint</b></td><td>Any server that speaks the Chat Completions API: <b>Ollama</b>, <b>LM Studio</b>, <b>vLLM</b>, <b>OpenRouter</b>, a gateway of your own. A key only if the endpoint wants one. Also the default image.</td></tr>
+ <tr><td><b>Claude Agent SDK / Codex CLI</b></td><td>Run a real AI runtime inside the container — the one case that needs the bigger build: <code>API_TARGET=coach docker compose up -d --build api</code></td></tr>
+ </table>
+
+ <h3 id="coach-local">Run it fully local — no cloud, no cost</h3>
+ <p>A model on your own hardware is just the compatible endpoint with no key. The usual way is
+ an Ollama container next to openGym:</p>
+ <pre><code># docker-compose.yml — add next to the openGym services (same file = same network)
+ ollama:
+ image: ollama/ollama
+ restart: unless-stopped
+ volumes:
+ - ./data/ollama:/root/.ollama
+ environment:
+ - OLLAMA_KEEP_ALIVE=-1 # keep the model (and its prompt cache) loaded
+ - OLLAMA_NUM_PARALLEL=1
+ mem_limit: 4g</code></pre>
+ <pre><code>docker exec -it &lt;ollama container&gt; ollama pull qwen2.5:3b</code></pre>
+ <p>Then in <b>Settings → Admin → AI Coach</b>: provider <b>OpenAI-compatible endpoint</b> →
+ Base URL <code>http://ollama:11434</code> → <b>List models</b> → pick the model →
+ <b>Test the Coach</b>. That's the whole setup.</p>
+ <p><b>Any model you can pull, you can use.</b> <code>ollama pull</code> whatever you like and
+ it appears under <i>List models</i> — the admin is free to run anything the box can hold,
+ and each provider remembers its own model choice, so switching around never loses one.
+ Honest sizing, from measuring exactly this on a small box:</p>
+ <ul>
+ <li>A <b>~3B model at Q4</b> (like <code>qwen2.5:3b</code>) fits a 4–6&nbsp;GB container and
+ answers a review in <b>one to a few minutes</b> once its cache is warm — a modern 4-core
+ CPU sits at the fast end, an old low-power box at the slow one.</li>
+ <li>A <b>4B model needs ~6&nbsp;GB+</b> for its container. Squeezed into less, it doesn't
+ fail — it thrashes, generating at ~1 token/second. Smaller and comfortable beats bigger
+ and swapping.</li>
+ <li>The <b>first request after a restart is slow once</b>: the model loads and reads the
+ Coach's rules. The api pre-warms that cache at boot and every half hour, so in practice
+ people hit the warm path.</li>
+ <li>On a genuinely slow box, raise the job budget with <code>COACH_JOB_TIMEOUT_MS</code>
+ in <code>.env</code>.</li>
+ </ul>
+ <p>A GPU machine elsewhere on your LAN works the same way: run Ollama or LM Studio there and
+ point the Base URL at it, e.g. <code>http://192.168.1.50:11434</code>.</p>
+
+ <h3 id="coach-phone">On the phone</h3>
+ <p><b>Settings → AI Coach</b> offers two ways in: pair the phone with your self-hosted
+ instance and the Coach runs there under the rules above, or bring your own API key and the
+ phone calls the provider directly — same allowlist, same validator, key in the platform's
+ secure storage, ten runs a day.</p>
+
+ <h3 id="coach-privacy">Privacy and limits</h3>
+ <p>Before anyone uses it, a consent screen lists exactly which categories of data leave the
+ server — generated from the same module that builds the payloads, so it cannot drift from
+ what actually happens. The admin can cap runs per person and per instance per day, and
+ <code>COACH_DISABLED=1</code> in the environment switches the feature off harder than any
+ toggle. The Coach is not a doctor or a physiotherapist — if something hurts, ask a
+ professional. Full details, including exactly what is sent and how credentials are stored:
+ <a href="https://gitlab.com/DuarteSantos8/opengym/-/blob/main/docs/AI_COACH.md" rel="noopener">docs/AI_COACH.md</a>.</p>
+
+ <h2 id="mcp">Ask an AI about your training (MCP)</h2>
<p>openGym ships an optional <b>MCP server</b>: a small read-only bridge that lets a client
- like Claude Desktop or Cursor answer questions from your actual log — <i>"what did I bench
- last week?"</i>, <i>"which muscle have I not trained this month?"</i>, <i>"what's my
- estimated 1RM on squats?"</i></p>
- <p>It runs on your machine, is spawned by the client, and reads your exported data directly.
- Nothing is sent anywhere, and it is <b>not part of the Docker build</b> — if you don't use
- an AI assistant, it simply isn't there. Setup is a few lines of client config:
+ like Claude Desktop, Cursor or Cline answer questions from your actual log — <i>"what
+ did I bench last week?"</i>, <i>"which muscle have I not trained this month?"</i>. It
+ runs on your machine, is spawned by the client over stdio, reads the same
+ <code>./data</code> files the API writes, and its numbers come from the <b>same pure
+ functions the Stats screen uses</b> — so the answers match the app exactly.</p>
+ <p>Eight tools in v1:</p>
+ <table class="cfg">
+ <tr><td><code>list_routines</code></td><td>What routines are saved? (names + exercise counts)</td></tr>
+ <tr><td><code>get_routine</code></td><td>What does one routine prescribe, set by set?</td></tr>
+ <tr><td><code>get_week_plan</code></td><td>This week's plan, including any date override.</td></tr>
+ <tr><td><code>list_workouts</code></td><td>Recent sessions — dates, sets done/planned, volume, duration, PRs.</td></tr>
+ <tr><td><code>get_workout</code></td><td>Full set-by-set breakdown of one session, by id or date.</td></tr>
+ <tr><td><code>get_bodyweight</code></td><td>Weigh-ins, the goal line, deltas vs goal.</td></tr>
+ <tr><td><code>estimate_1rm</code></td><td>Best 1RM for an exercise + trend, or a PR table across all.</td></tr>
+ <tr><td><code>muscle_balance</code></td><td>Muscles trained this week/month/all-time, ranked — and the neglected ones.</td></tr>
+ </table>
+ <p>It is <b>not part of the Docker build</b> — if you don't use an AI assistant, it simply
+ isn't there. No new auth (the filesystem is the boundary), no telemetry, no network; the
+ LLM never sees passkeys or session secrets. Setup is <code>cd mcp &amp;&amp; npm
+ install</code> plus a few lines of client config:
<a href="https://gitlab.com/DuarteSantos8/opengym/-/blob/main/mcp/README.md" rel="noopener">mcp/README.md</a>.</p>
<h2 id="import">Import your training history</h2>
- <p>Coming from another tracker? <b>Settings → Data → Import from another app</b> reads:</p>
- <ul>
- <li><b>FitNotes</b> (both the Android and the FitNotes 2 iOS export)</li>
- <li><b>Strong</b> and <b>Hevy</b> (CSV exports — session lengths carry over, so the
- activity heatmap fills in properly)</li>
- <li><b>Apple Health</b> (body-weight history from the XML export)</li>
- <li>…and anything else with date, exercise-name and weight/reps columns</li>
- </ul>
- <p>Exercise names are matched against the 1,324-exercise library; anything genuinely
- ambiguous becomes one of your own custom exercises instead of being guessed at. A summary
- shows exactly what will happen before anything is written, and importing is idempotent —
+ <p>Coming from another tracker? <b>Settings → Data → Import from another app</b> reads a
+ CSV export; these apps work without touching the file:</p>
+ <table class="cfg">
+ <tr><td><b>FitNotes</b> (Android)</td><td>Settings → Backup/Export → Spreadsheet Export</td></tr>
+ <tr><td><b>FitNotes 2</b> (iOS)</td><td>Export workouts as CSV</td></tr>
+ <tr><td><b>Strong</b></td><td>Settings → Export Data</td></tr>
+ <tr><td><b>Hevy</b></td><td>Settings → Export &amp; Import Data (workouts or measurements) — or skip the CSV entirely, below</td></tr>
+ <tr><td><b>Gravl</b></td><td>Profile → Export Data</td></tr>
+ <tr><td><b>Apple Health</b></td><td>Body-weight history straight out of the XML export</td></tr>
+ </table>
+ <p>Exercise names are matched against the library; anything genuinely ambiguous becomes one
+ of your own custom exercises instead of being guessed at — nothing in the file is
+ dropped. Session lengths and the RPE they record carry over. A summary shows exactly
+ what will happen before anything is written, and importing is <b>idempotent</b> —
running it twice never duplicates a workout.</p>
+ <h3 id="imp-hevy">Hevy, directly over the API</h3>
+ <p>With <b>Hevy Pro</b>, skip the CSV: create an API key under
+ <a href="https://hevy.com/settings?developer" rel="noopener">Hevy → Settings → Developer</a>,
+ then in openGym use <b>Settings → Import from Hevy</b>, paste the key (used only for that
+ import — never saved), and choose any mix of <b>workouts</b>, <b>routines</b> and
+ <b>weigh-ins</b>. Workout days that already have data here are left alone; imported
+ routines are always added as new plans.</p>
+ <h3 id="imp-csv">Rolling your own CSV</h3>
+ <p>Anything with date, exercise-name and weight/reps columns imports. Minimal example:</p>
+ <pre><code>workout name,exercise,date,weight kg,reps
+Leg Day,Squat,2026-08-21,120,5
+Leg Day,Squat,2026-08-21,125,4
+Leg Day,Leg Press,2026-08-21,200,1</code></pre>
+ <p>Recognised headers (first match wins) for each field: <i>exercise</i> (also
+ <code>exercise name/title</code>), <i>date</i> (<code>workout date</code>),
+ <i>start/end time</i>, <i>workout name</i> (<code>title</code>, <code>workout</code>),
+ <i>category</i> (<code>body part</code>, <code>muscle group</code>), <i>weight</i>
+ (<code>weight kg</code>, <code>weight lbs</code>, plus a <code>weight unit</code>
+ column), <i>reps</i> (<code>repetitions</code>), <i>rpe</i>, <i>rir</i>
+ (<code>reps in reserve</code>), <i>distance</i> (<code>distance km</code> + unit),
+ <i>seconds</i> (<code>duration seconds</code>, <code>set duration sec</code>),
+ <i>time</i> (<code>duration</code>), <i>set type</i>, <i>note</i>
+ (<code>comment(s)</code>, <code>notes</code>, <code>workout notes</code>). The full
+ table lives in
+ <a href="https://gitlab.com/DuarteSantos8/opengym/-/blob/main/docs/DATA_IMPORTS.md" rel="noopener">docs/DATA_IMPORTS.md</a>.</p>
+ <h3 id="imp-plans">Importing plans</h3>
+ <p>Routines travel as their own small JSON file (<b>Share a plan</b> exports every current
+ routine; importing merges). Don't want to share everything? Edit the JSON, or use the
+ <a href="/demo/">demo</a> as a free plan editor: import there, prune, export a fresh
+ file. The demo stores everything in your browser — nothing is public or shared.</p>
- <h2 id="backup">Backups</h2>
+ <h2 id="backup">Backups &amp; your data</h2>
+ <h3>Per user</h3>
<p><b>Settings → Data → Export backup (JSON)</b> writes your entire log — plan, workouts,
weights, settings — into one file. On the mobile app it goes out through the share sheet
(Files, AirDrop, mail…); in the browser it downloads. <b>Import backup</b> restores it
anywhere: another phone, your self-hosted instance, or a fresh install. That file is the
whole point of openGym — your training log as a file <i>you</i> own.</p>
+ <h3>Per instance (self-hosted)</h3>
+ <p>Everything lives in <code>./data</code> on your host:</p>
+ <table class="cfg">
+ <tr><td><code>db.json</code></td><td>Profiles and <b>public</b> passkeys. Private keys never touch the server — they stay in your phone's secure hardware or password manager.</td></tr>
+ <tr><td><code>state-&lt;user&gt;.json</code></td><td>One file per user: plan, workouts, body weight, settings.</td></tr>
+ <tr><td><code>audit.log</code></td><td>The activity log (if on) — one JSON object per line.</td></tr>
+ <tr><td><code>secret</code></td><td>The session-cookie signing key.</td></tr>
+ <tr><td><code>vapid.json</code></td><td>Push-notification keys, generated on first run.</td></tr>
+ </table>
+ <pre><code>tar czf opengym-backup-$(date +%F).tar.gz data/</code></pre>
+ <p>That archive is everything — profiles, passkeys, history. It also contains
+ <code>audit.log</code> with everyone's sign-in times; worth knowing before shipping it
+ to a backup service you don't run. Restore by unpacking into the project folder.</p>
+
+ <h2 id="arch">How it's built</h2>
+ <p>Two containers, one folder, no database server:</p>
+ <ul>
+ <li><b>frontend/</b> — React 19 + Vite (React Router, Zustand), built to static files
+ <i>inside Docker</i>. The app ships no runtime dependencies beyond React, the router
+ and Zustand.</li>
+ <li><b>api/</b> — Node with <b>no framework</b> and two dependencies
+ (<code>@simplewebauthn/server</code> for passkeys, <code>web-push</code> for
+ notifications), storing everything as plain JSON files under <code>./data</code>.</li>
+ <li><b>web/</b> — a multi-stage image that builds the frontend and serves it with nginx,
+ proxying <code>/api</code> to the backend so it's all on <b>one origin</b> (passkeys
+ require this).</li>
+ </ul>
+ <p>The training logic — progression rules, 1RM estimation, how a logged session is read
+ back — lives in pure functions under <code>frontend/src/lib/</code> with tests next to
+ them; the MCP server and the mobile app import the very same functions. CI on GitLab
+ runs the full suites (frontend, api, mcp) on every commit, builds the amd64+arm64
+ images, signs the APK, and publishes releases — tagging <code>vX.Y.Z</code> is what
+ ships everything.</p>
+ <p>The exercise database comes from
+ <a href="https://github.com/hasaneyldrm/exercises-dataset" rel="noopener">hasaneyldrm/exercises-dataset</a>:
+ 1,324 exercises with animations and instructions. The metadata and instruction text are
+ MIT; the images and animations are third-party media that openGym never redistributes —
+ your instance downloads them from upstream on first run (see the
+ <a href="#faq">FAQ</a> for the licensing details).</p>
<h2 id="build">Build it yourself</h2>
<p>Everything on this page is built from the public repo:</p>
<ul>
<li><b>Web / self-host:</b> <code>docker compose up -d --build</code> builds the frontend
inside the container — no local Node needed.</li>
- <li><b>Android APK / iOS app:</b> the Capacitor projects live in <code>frontend/android</code>
- and <code>frontend/ios</code> — build, signing and distribution notes are in
+ <li><b>Android APK:</b> <code>npm run build:mobile</code> in <code>frontend/</code>, then
+ Gradle + <code>zipalign</code> + <code>apksigner</code> with your own keystore
+ (keep it — updates must carry the same signature). Step-by-step:
<a href="https://gitlab.com/DuarteSantos8/opengym/-/blob/main/docs/MOBILE.md" rel="noopener">docs/MOBILE.md</a>.</li>
+ <li><b>iOS app:</b> the Capacitor project in <code>frontend/ios</code> — open in Xcode,
+ set your (free) team, run on your device. Same doc.</li>
+ <li><b>Development:</b> Node 20+; <code>npm test</code> in <code>frontend/</code>,
+ <code>api/</code> and <code>mcp/</code> runs the suites. Contributions welcome —
+ <a href="https://gitlab.com/DuarteSantos8/opengym/-/blob/main/CONTRIBUTING.md" rel="noopener">CONTRIBUTING.md</a>.</li>
+ </ul>
+
+ <h2 id="troubleshoot">Troubleshooting</h2>
+ <h3 id="tr-passkey">Passkeys fail even though the config looks right</h3>
+ <p>The most common support question — work through these in order:</p>
+ <ol>
+ <li><b>Ask the server what it actually loaded:</b>
+ <code>docker compose logs api | grep 'gym-api on'</code> prints the
+ <code>rpID</code>/<code>origin</code> it runs with. If that disagrees with your
+ <code>.env</code>: <code>docker compose restart</code> does <b>not</b> re-read
+ <code>.env</code> — use <code>docker compose up -d</code>.</li>
+ <li><b>Check the exact shape:</b> <code>RP_ID</code> is a bare hostname
+ (<code>gym.example.com</code> — no <code>https://</code>, no port, no slash);
+ <code>ORIGIN</code> is the full origin with scheme and without trailing slash. Both
+ must match the address bar exactly.</li>
+ <li><b>Behind a tunnel/proxy, use the public hostname</b> — never the container name,
+ LAN IP or internal port. The tunnel's own route may point wherever it likes.</li>
+ <li><b><code>www.</code> is a different host.</b> A passkey registered on
+ <code>gym.example.com</code> won't work on <code>www.gym.example.com</code> — pick
+ one, redirect the other.</li>
+ <li><b>Changing the hostname invalidates existing passkeys.</b> Everyone registers
+ again.</li>
+ </ol>
+ <h3 id="tr-rest">Everything else</h3>
+ <table class="cfg">
+ <tr><td>No passkey prompt on my phone</td><td>You're on <code>http://</code> or a bare IP. Passkeys need HTTPS or localhost — set up a domain, or use guest mode / the mobile app.</td></tr>
+ <tr><td>"verification failed" on login</td><td><code>RP_ID</code>/<code>ORIGIN</code> don't match the address bar — see the checklist above, starting with what the server logged.</td></tr>
+ <tr><td>Media didn't download</td><td><code>docker compose logs media</code>, re-run <code>docker compose up -d</code>, or run <code>./scripts/fetch-media.sh</code>.</td></tr>
+ <tr><td>Port 8080 already used</td><td><code>WEB_PORT=9090</code> in <code>.env</code> (and update <code>ORIGIN</code> for local testing).</td></tr>
+ <tr><td>No "Notifications" option in Settings</td><td>Needs a signed-in profile and HTTPS (or localhost) — guest mode and plain HTTP over LAN can't subscribe.</td></tr>
+ <tr><td>Day reminder fires at the wrong time</td><td>Toggle it off and on so it re-detects your browser's timezone (also happens on every app load).</td></tr>
+ <tr><td>"Keep screen awake" shows as unsupported</td><td>The Wake Lock API needs HTTPS or localhost; iOS also refuses it in Low Power Mode.</td></tr>
+ <tr><td>Want to reset a stuck login</td><td>Delete the cookie — sessions are just signed cookies. "Sign out everywhere" in Settings ends every session (and paired apps) at once.</td></tr>
+ <tr><td><code>docker compose pull</code> says "denied"</td><td>Build from source instead: <code>docker compose up -d --build</code>.</td></tr>
+ <tr><td>Exercise images blank in an old build</td><td>Fixed in current images. <code>VITE_IMG_BASE</code>/<code>VITE_GIF_BASE</code> are <b>build-time</b>: they're baked into the bundle when the frontend compiles, so setting them at runtime does nothing to a prebuilt image — redirect media in your reverse proxy instead, or rebuild.</td></tr>
+ </table>
+ <p>Still stuck? The <a href="https://discord.gg/e62jY6fwVb" rel="noopener">Discord</a> is
+ the quickest way to get an answer;
+ <a href="https://gitlab.com/DuarteSantos8/opengym/-/issues" rel="noopener">issues</a> are
+ better for anything the next person should find by searching.</p>
+
+ <h2 id="privacy">Privacy — the complete list</h2>
+ <ul>
+ <li><b>The app collects nothing.</b> No telemetry, no analytics, no crash reporting, no
+ accounts on anyone else's server. The mobile app's only network traffic is fetching
+ exercise media from a CDN; a self-hosted instance talks only to your own server.</li>
+ <li><b>Passkey private keys never leave your device</b> — the server stores only public
+ keys.</li>
+ <li><b>The optional activity log</b> (self-hosted, admin feature) records sign-in events
+ but no IP addresses, user-agents or failed-attempt passkey ids unless the operator
+ opts in — <a href="#admin-log">details above</a>.</li>
+ <li><b>The AI Coach is opt-in twice over</b> — an admin has to enable it, and a consent
+ screen lists exactly which data categories leave the server before anyone uses it.
+ Off, nothing is ever sent anywhere — <a href="#coach-privacy">details above</a>.</li>
+ <li><b>The MCP server</b> is read-only, local, and never puts your data on the
+ network.</li>
+ <li><b>This website</b> uses self-hosted, cookieless <a href="https://umami.is" rel="noopener">Umami</a>
+ page-view counting — no cookies, no cross-site tracking, and it never sees anything
+ from inside the app or the demo.</li>
</ul>
<h2 id="faq">FAQ</h2>
<h3>Is it really free?</h3>
<p>Yes — free as in cost <i>and</i> as in freedom (AGPL-3.0). No pro tier, no locked
- features, no ads, and the license keeps every fork open source too.</p>
- <h3>What data does openGym collect?</h3>
- <p>None. There is no telemetry, no analytics, no crash reporting. The mobile app's only
- network traffic is fetching exercise media from a CDN; a self-hosted instance talks only
- to your own server.</p>
+ features, no ads, and the license keeps every fork open source too. If it replaced a
+ paid tracker for you, there's a <a href="https://buymeacoffee.com/duartesantos" rel="noopener">coffee button</a> —
+ a star, a bug report or a merge request is worth just as much.</p>
<h3>Why isn't it on the Play Store / App Store?</h3>
<p>By choice (and on iOS, by Apple's rules for sideloading). Store accounts cost money,
impose terms that sit badly with the AGPL, and put a gatekeeper between you and an app
whose whole point is that your data is yours.</p>
<h3>Mobile app or self-hosted — which one should I pick?</h3>
<p>If you just want to track your training: the mobile app. If you want your data on your
- own hardware, synced across devices, with profiles for the people you train with: self-host.
- You can start with the app and move to a server later — the backup file migrates everything.</p>
+ own hardware, synced across devices, with profiles for the people you train with:
+ self-host. You can start with the app and move to a server later — the backup file
+ migrates everything, or <a href="#mobile-server">pair the app to your server</a> and
+ keep using it.</p>
+ <h3>What's on the roadmap?</h3>
+ <p>Rough and community-driven: percentage/training-max programming (5/3/1-style) on top of
+ the progression engine, more starter plans, body measurements alongside weight,
+ per-exercise notes and a plate calculator, more instruction languages. Ideas and merge
+ requests welcome — the up-to-date list is in the
+ <a href="https://gitlab.com/DuarteSantos8/opengym#roadmap" rel="noopener">README</a>.</p>
<h3>Where does the exercise database come from?</h3>
<p>From <a href="https://github.com/hasaneyldrm/exercises-dataset" rel="noopener">hasaneyldrm/exercises-dataset</a>:
- 1,324 exercises with animations and instructions in 11 languages, including openGym's
- separately curated Brazilian Portuguese translation. In pt-BR, built-in exercise names
- show Portuguese first and the canonical English title in parentheses. That dataset licenses the two
- halves differently, and so does openGym: the exercise metadata and instruction text are
- <b>MIT</b>, while the images and animations are
- <b>© <a href="https://gymvisual.com/" rel="noopener">Gym visual</a></b>, used under the
- dataset's terms rather than openGym's AGPL.</p>
- <p>openGym does not redistribute that media — your instance downloads it from the upstream source on
- first run. If you want to reuse it yourself, commercially or otherwise, get your own licence from
- Gym visual first (<a href="https://gymvisual.com/content/3-terms-and-conditions-of-use" rel="noopener">terms&nbsp;&amp;&nbsp;conditions</a>).</p>
+ 1,324 exercises with animations and instructions, localized in 12 of openGym's 14 UI
+ languages — including openGym's separately curated Brazilian Portuguese translation.
+ That dataset licenses the two halves differently, and so does openGym: the exercise
+ metadata and instruction text are <b>MIT</b>, while the images and animations are
+ third-party media used under the dataset's terms rather than openGym's AGPL — their
+ ownership is currently disputed between
+ <a href="https://gymvisual.com/" rel="noopener">Gym visual</a> and ExerciseDB, and a
+ clarification has been requested.</p>
+ <p>openGym does not redistribute that media — your instance downloads it from the upstream
+ source on first run. If you want to reuse it yourself, commercially or otherwise, clear
+ it with the rights holder first. Full third-party notices, including the body-diagram
+ geometry, are in
+ <a href="https://gitlab.com/DuarteSantos8/opengym/-/blob/main/NOTICE.md" rel="noopener">NOTICE.md</a>.</p>
+ <h3>What does the AGPL mean for me?</h3>
+ <p>You can self-host, use, modify and share openGym freely. If you run a <i>modified</i>
+ version as a network service, you must offer that version's source under the same
+ license — that's the clause that keeps openGym from ever becoming someone's closed,
+ proprietary product. Just using or self-hosting it unmodified obliges you to
+ nothing.</p>
</main>
<footer><div class="wrap foot">
@@ -206,6 +878,6 @@ docker compose up -d</code></pre>
</div>
</div></footer>
-<script src="site.js?v=10" defer></script>
+<script src="site.js?v=12" defer></script>
</body>
</html>
diff --git a/website/index.html b/website/index.html
index 2d767b944..aab86eea2 100644
--- a/website/index.html
+++ b/website/index.html
@@ -6,15 +6,20 @@
<title>openGym — free, open-source gym &amp; body-weight tracker</title>
<meta name="description" content="openGym is a free, open-source gym & body-weight tracker. Download the Android app or self-host it with Docker — no account, no cloud, no telemetry.">
<meta name="theme-color" content="#000000">
+<meta name="twitter:card" content="summary_large_image">
+<meta name="twitter:title" content="openGym — your workouts, your weights, your data">
+<meta name="twitter:description" content="Free, open-source gym & body-weight tracker. Android APK or self-hosted with Docker. No account, no cloud, no telemetry.">
+<meta name="twitter:image" content="https://opengym.duarte-santos.ch/img/banner.png">
<meta property="og:title" content="openGym — your workouts, your weights, your data">
<meta property="og:description" content="Free, open-source gym & body-weight tracker. Android APK or self-hosted with Docker. No account, no cloud, no telemetry.">
<meta property="og:image" content="https://opengym.duarte-santos.ch/img/banner.png">
<meta property="og:url" content="https://opengym.duarte-santos.ch/">
+<link rel="canonical" href="https://opengym.duarte-santos.ch/">
<meta property="og:type" content="website">
<link rel="icon" type="image/png" sizes="512x512" href="icon-512.png">
<link rel="icon" type="image/png" sizes="180x180" href="icon-180.png">
<link rel="apple-touch-icon" href="icon-180.png">
-<link rel="stylesheet" href="styles.css?v=10">
+<link rel="stylesheet" href="styles.css?v=12">
<!-- Marks that JS is alive before first paint, so the scroll-reveal styles never
hide content from a browser that will not run them. -->
<script>
@@ -38,10 +43,11 @@ try {
"license":"https://www.gnu.org/licenses/agpl-3.0.html",
"url":"https://opengym.duarte-santos.ch/",
"downloadUrl":"https://opengym.duarte-santos.ch/openGym.apk",
- "author":{"@type":"Person","name":"Duarte Santos","url":"https://duarte-santos.ch"}}
+ "author":{"@type":"Person","name":"Duarte Santos","url":"https://duarte-santos.ch"},
+ "sameAs":["https://gitlab.com/DuarteSantos8/opengym","https://discord.gg/e62jY6fwVb"]}
</script>
</head>
-<body>
+<body class="topnav">
<!-- Icon set: one sprite, referenced with <use>. Line icons at 24×24, stroke 1.7. -->
<svg width="0" height="0" style="position:absolute" aria-hidden="true" focusable="false"><defs>
@@ -77,19 +83,51 @@ try {
openGym
</a>
<div class="nav-quick">
- <a class="ql site" href="api.html">API</a>
+ <a class="ql site" href="/#features">Features</a>
+ <a class="ql site" href="/#screens">Screenshots</a>
+ <a class="ql site" href="/#demo">Demo</a>
+ <a class="ql site" href="/docs.html">Docs</a>
+ <a class="ql site" href="/api.html">API</a>
+ <a class="ql site" href="/about.html">About</a>
<a class="ql" href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">GitLab <span data-gh="stars"></span></a>
<a class="ql" href="https://discord.gg/e62jY6fwVb" rel="noopener">Discord</a>
- <a class="cta" href="#download">Download</a>
+ <a class="cta" href="/#download">Download</a>
</div>
- <button class="nav-toggle" aria-expanded="false" aria-controls="menu" aria-label="Menu">
+ <button class="nav-toggle" id="navtoggle" aria-expanded="false" aria-controls="sitemenu" aria-label="Menu">
<span></span><span></span>
</button>
</div></nav>
-<!-- The topic rail: a fixed column beside the page on a wide screen, the hamburger
- sheet everywhere else. One markup, two layouts — see .side in styles.css. -->
-<aside class="side" id="menu" aria-label="Topics">
+<!-- The navigation sheet: the header's links again, for the widths where the bar has
+ room only for the brand and the download. Byte-identical on every page, like the
+ bar above it — nothing is ever dropped because of which page you are on. -->
+<div class="navsheet" id="sitemenu" role="navigation" aria-label="Site" aria-hidden="true">
+ <div class="nl-rows">
+ <a class="nl" href="/#features">Features</a>
+ <a class="nl" href="/#screens">Screenshots</a>
+ <a class="nl" href="/#demo">Demo</a>
+ <a class="nl" href="/docs.html">Docs</a>
+ <a class="nl" href="/api.html">API</a>
+ <a class="nl" href="/about.html">About</a>
+ <a class="nl" href="https://gitlab.com/DuarteSantos8/opengym" rel="noopener">GitLab <span data-gh="stars"></span></a>
+ <a class="nl" href="https://discord.gg/e62jY6fwVb" rel="noopener">Discord</a>
+ </div>
+</div>
+
+<!-- The one control that opens the contents, at every width. The drawer it opens is
+ closed in CSS, so it is shut on first paint whether or not the script runs. -->
+<button class="toc-btn" id="tocbtn" aria-expanded="false" aria-controls="menu">
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" aria-hidden="true"><path d="M4 6.5h16M4 12h16M4 17.5h10"/></svg>
+ Contents
+</button>
+
+<!-- The contents drawer: one list, one way in, one way out. Closed by default at
+ every width, and no preference is remembered — see .side in styles.css. -->
+<aside class="side" id="menu" aria-label="Contents" aria-hidden="true">
+ <div class="side-top">
+ <p class="side-title">Contents</p>
+ <button class="rail-close" aria-label="Close contents"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M5 5l14 14M19 5L5 19"/></svg></button>
+ </div>
<p class="side-label">On this page</p>
<a class="side-link" href="#features"><b>Features</b><span>Built on the gym floor</span></a>
<a class="side-link" href="#screens"><b>Screenshots</b><span>Five screens, that's the app</span></a>
@@ -429,15 +467,6 @@ try {
<span class="pad-go">Open the repo</span>
</a>
- <a class="pad github dead" href="https://github.com/DuarteSantos8/openGym" rel="noopener">
- <span class="pad-ic"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="#i-github"/></svg></span>
- <span class="pad-body">
- <b>GitHub <span class="tag">404</span></b>
- <span>Where openGym was open-sourced — and where a lot of links still point.</span>
- <span class="rest">The account is suspended, so this one goes nowhere.</span>
- </span>
- <span class="pad-go">Dead link, kept honest</span>
- </a>
<a class="pad bmc" href="https://buymeacoffee.com/duartesantos" rel="noopener">
<span class="pad-ic"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="#i-bmc"/></svg></span>
@@ -475,6 +504,6 @@ try {
</div>
</div></footer>
-<script src="site.js?v=10" defer></script>
+<script src="site.js?v=12" defer></script>
</body>
</html>
diff --git a/website/site.js b/website/site.js
index 24dd86a24..620a2b745 100644
--- a/website/site.js
+++ b/website/site.js
@@ -1,45 +1,112 @@
-// Behaviour for the openGym site: the topic-rail menu and its scrollspy, the scroll
-// reveals, the demo frame, and the two things that come from the GitLab API (repo
-// counts, release timeline).
+// 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 GitLab API (repo counts, release timeline).
// Every one of them fails soft — the page is complete without any of this running.
const GL_PROJECT = 'https://gitlab.com/api/v4/projects/DuarteSantos8%2Fopengym'
-/* ------------------------------------------------------------------ phone menu */
-;(() => {
- const btn = document.querySelector('.nav-toggle')
- const menu = document.getElementById('menu')
- if (!btn || !menu) return
-
- const close = () => {
- menu.classList.remove('open')
- btn.setAttribute('aria-expanded', 'false')
- // menu-open drives the dimming scrim; overflow keeps the page still underneath.
- document.body.classList.remove('menu-open')
- document.body.style.overflow = ''
+/* ------------------------------------------------------- one panel controller
+ The navigation sheet and the contents drawer are the same object with different
+ contents: one opener, one close button, Escape, a tap outside, focus held inside
+ while open and handed back to the opener on close. Writing it once is the only
+ way the two of them can stay indistinguishable to a reader.
+
+ Both are CLOSED in CSS, so a panel is shut on first paint whatever this script
+ does — and nothing is read back from storage to reopen one. */
+const FOCUSABLE = 'a[href],button:not([disabled]),input,select,textarea,[tabindex]:not([tabindex="-1"])'
+
+function panel({ opener, panelEl, flag, closeBtn }) {
+ if (!opener || !panelEl) return null
+ const body = document.body
+ let lastFocus = null
+
+ const isOpen = () => body.classList.contains(flag)
+
+ const set = open => {
+ if (open === isOpen()) return
+ if (open) lastFocus = document.activeElement
+ body.classList.toggle(flag, open)
+ opener.setAttribute('aria-expanded', String(open))
+ panelEl.setAttribute('aria-hidden', String(!open))
+ // The panel scrolls on its own; letting the page scroll behind it is the classic
+ // menu bug where the reader loses their place on close.
+ body.style.overflow = open ? 'hidden' : ''
+ if (open) {
+ // The close button first: it is the answer to "how do I get out of this".
+ const first = panelEl.querySelector(closeBtn) || panelEl.querySelector(FOCUSABLE)
+ first && first.focus({ preventScroll: true })
+ } else if (lastFocus && document.contains(lastFocus)) {
+ lastFocus.focus({ preventScroll: true })
+ }
}
- btn.addEventListener('click', () => {
- const open = menu.classList.toggle('open')
- btn.setAttribute('aria-expanded', String(open))
- document.body.classList.toggle('menu-open', open)
- // The sheet scrolls on its own; letting the page scroll behind it is the classic
- // mobile-menu bug where the reader loses their place on close.
- document.body.style.overflow = open ? 'hidden' : ''
- })
- // The scrim is body::after, so it has no element of its own to listen on — a tap
- // that lands outside both the sheet and the button is a tap on the scrim.
+
+ opener.addEventListener('click', e => { e.stopPropagation(); set(!isOpen()) })
+ panelEl.querySelector(closeBtn)?.addEventListener('click', () => set(false))
+ // Tapping a link inside navigates, so the panel has to get out of the way —
+ // in-page anchors especially, which do not reload anything.
+ panelEl.addEventListener('click', e => { if (e.target.closest('a')) set(false) })
+ // The scrim is body::after, so it has no element of its own to listen on — a click
+ // that lands outside both the panel and its opener is a click on the scrim.
document.addEventListener('click', e => {
- if (!document.body.classList.contains('menu-open')) return
- if (e.target.closest('#menu') || e.target.closest('.nav-toggle')) return
- close()
+ if (!isOpen()) return
+ if (e.target.closest('#' + panelEl.id) || e.target.closest('#' + opener.id)) return
+ set(false)
+ })
+ document.addEventListener('keydown', e => {
+ if (!isOpen()) return
+ if (e.key === 'Escape') { e.preventDefault(); set(false); return }
+ if (e.key !== 'Tab') return
+ // Focus trap: Tab cycles inside the open panel instead of wandering the page
+ // behind the scrim, where nothing is clickable anyway.
+ const items = [...panelEl.querySelectorAll(FOCUSABLE)].filter(el => el.offsetParent !== null)
+ if (!items.length) return
+ const first = items[0]
+ const last = items[items.length - 1]
+ if (e.shiftKey && document.activeElement === first) { e.preventDefault(); last.focus() }
+ else if (!e.shiftKey && document.activeElement === last) { e.preventDefault(); first.focus() }
+ })
+ return { set, isOpen }
+}
+
+;(() => {
+ const nav = panel({
+ opener: document.querySelector('.nav-toggle'),
+ panelEl: document.getElementById('sitemenu'),
+ flag: 'menu-open',
+ closeBtn: '.nl' // the hamburger itself is the ✕; focus the first link
+ })
+ const toc = panel({
+ opener: document.querySelector('.toc-btn'),
+ panelEl: document.getElementById('menu'),
+ flag: 'contents-open',
+ closeBtn: '.rail-close'
+ })
+ // Only one at a time: opening either closes the other, so there is never a
+ // question of which panel a tap outside belongs to.
+ document.querySelector('.nav-toggle')?.addEventListener('click', () => toc?.set(false))
+ document.querySelector('.toc-btn')?.addEventListener('click', () => nav?.set(false))
+ // Growing past the header breakpoint puts the links back in the bar, which would
+ // leave the page scroll-locked behind a sheet nobody can see.
+ addEventListener('resize', () => { if (innerWidth >= 1000) nav?.set(false) })
+
+ // An earlier build remembered an open rail across visits. It no longer does, and
+ // the stale key would otherwise sit in the browser forever.
+ try { localStorage.removeItem('og_rail') } catch (e) {}
+})()
+
+/* --------------------------------------------------------------- you are here
+ Marked at runtime rather than baked into each page: that is what lets all four
+ pages ship the byte-identical header the whole site is built around. Only links
+ to a page (not to a section of one) can be "the page you are on". */
+;(() => {
+ const here = location.pathname.replace(/\/index\.html$/, '/')
+ document.querySelectorAll('.nav-quick .ql, .navsheet .nl').forEach(a => {
+ const href = a.getAttribute('href') || ''
+ if (href.includes('#') || /^https?:/.test(href)) return
+ if (new URL(a.href).pathname.replace(/\/index\.html$/, '/') === here) {
+ a.setAttribute('aria-current', 'page')
+ }
})
- // Tapping a link inside the sheet navigates, so the sheet has to get out of the way —
- // in-page anchors especially, which do not reload anything.
- menu.addEventListener('click', e => { if (e.target.closest('a')) close() })
- document.addEventListener('keydown', e => { if (e.key === 'Escape') close() })
- // Growing past the breakpoint turns the sheet into the fixed rail while it is open,
- // which would leave the body scroll-locked with no visible sheet to close.
- addEventListener('resize', () => { if (innerWidth >= 1300) close() })
})()
/* ------------------------------------------------------------------- scrollspy
@@ -71,6 +138,39 @@ const GL_PROJECT = 'https://gitlab.com/api/v4/projects/DuarteSantos8%2Fopengym'
spy()
})()
+/* ------------------------------------------------------------ chapter groups
+ Where a rail has chapters with subchapters (.side-group / .side-subs), the group
+ being read unfolds and the others stay closed, so a long contents list is never
+ a wall. A no-op on the pages whose rail is a flat list. */
+;(() => {
+ const groups = [...document.querySelectorAll('.side-group')]
+ if (!groups.length) return
+ const openGroup = g => groups.forEach(x => x.classList.toggle('open', x === g))
+ groups.forEach(g => {
+ g.querySelector('.side-link')?.addEventListener('click', () => openGroup(g))
+ })
+ const target = a => a && document.getElementById(a.getAttribute('href').slice(1))
+ const chapPairs = groups
+ .map(g => [target(g.querySelector('.side-link[href^="#"]')), g])
+ .filter(([t]) => t)
+ const subPairs = [...document.querySelectorAll('.side-sub[href^="#"]')]
+ .map(a => [target(a), a])
+ .filter(([t]) => t)
+ let raf = 0
+ const spy = () => {
+ raf = 0
+ const y = scrollY + innerHeight * .33
+ let curG = null
+ for (const [t, g] of chapPairs) if (t.getBoundingClientRect().top + scrollY <= y) curG = g
+ if (curG && !curG.classList.contains('open')) openGroup(curG)
+ let curS = null
+ for (const [t, a] of subPairs) if (t.getBoundingClientRect().top + scrollY <= y) curS = a
+ subPairs.forEach(([, a]) => a.classList.toggle('on', a === curS && !!curS && curS.closest('.side-group') === curG))
+ }
+ addEventListener('scroll', () => { if (!raf) raf = requestAnimationFrame(spy) }, { passive: true })
+ spy()
+})()
+
/* --------------------------------------------------------------- scroll reveal */
;(() => {
const items = document.querySelectorAll('.rv')
diff --git a/website/styles.css b/website/styles.css
index ca2a9775b..49f96dff9 100644
--- a/website/styles.css
+++ b/website/styles.css
@@ -12,7 +12,7 @@
--fg: #f5f5f7;
--fg-2: #a1a1a6;
- --fg-3: #6e6e73;
+ --fg-3: #7d7d85; /* >=4.5:1 on every panel — WCAG AA for small text */
--acc: #32d74b;
--acc-ink: #04150a;
@@ -128,8 +128,12 @@ h3 { font-size: clamp(19px, 2.3vw, 21px); letter-spacing: -.02em; line-height: 1
/* ----------------------------------------------------------------- nav bar */
+/* The bar is the one fixed point of the site: the same links in the same order on
+ every page, and nothing ever slides out of it. It therefore outranks the
+ navigation sheet, the contents drawer and their scrim — none of them may cover
+ it, so a reader always knows where they are and how to get out. */
nav {
- position: sticky; top: 0; z-index: 60;
+ position: sticky; top: 0; z-index: 90;
background: rgba(0, 0, 0, .68);
backdrop-filter: saturate(180%) blur(20px);
-webkit-backdrop-filter: saturate(180%) blur(20px);
@@ -145,9 +149,11 @@ nav {
.brand:hover { text-decoration: none; }
.brand img { width: 24px; height: 24px; border-radius: 6px; }
-/* The bar keeps only the three things worth reaching from anywhere: the repo, the
- Discord, and the download. Everything else lives in the topic rail. */
-.nav-quick { display: flex; align-items: center; gap: 24px; }
+/* One header, everywhere. Every page carries this identical set of links in this
+ identical order; which page you are on is marked at runtime with aria-current,
+ never by adding or dropping links. Below 1000px they fold into the navigation
+ sheet — the same links again, nothing lost. */
+.nav-quick { display: flex; align-items: center; gap: 20px; }
.nav-quick .ql {
color: var(--fg-2); font-size: 14px; font-weight: 400; letter-spacing: 0;
transition: color .2s var(--ease);
@@ -160,15 +166,23 @@ nav {
padding: 7px 15px; border-radius: 999px;
}
.nav-quick .cta:hover { background: #4ade63; text-decoration: none; }
-@media (max-width: 620px) { .nav-quick .ql { display: none; } }
+.nav-quick .ql[aria-current="page"] { color: var(--fg); }
.nav-toggle {
display: none;
position: relative;
- width: 42px; height: 42px; margin-right: -9px;
+ width: 44px; height: 44px; margin-right: -11px;
align-items: center; justify-content: center;
border-radius: 10px; cursor: pointer;
}
+
+/* One breakpoint for the whole header: above it the links are in the bar, below it
+ they are in the sheet. No page has a second answer. Placed after .nav-toggle's
+ own rule — same specificity, so the later one has to be the one that wins. */
+@media (max-width: 999.98px) {
+ .nav-quick .ql { display: none; }
+ .nav-toggle { display: flex; }
+}
.nav-toggle span {
position: absolute; width: 18px; height: 1.5px; border-radius: 2px; background: var(--fg);
transition: transform .3s var(--ease);
@@ -178,10 +192,135 @@ nav {
.nav-toggle[aria-expanded="true"] span:first-child { transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { transform: rotate(-45deg); }
-/* ---------------------------------------------------------------- topic rail
- One list of everything on the site — a title with a one-line subtitle per topic.
- On a wide screen it is a fixed column beside the page; below that, the exact
- same markup is the sheet behind the hamburger. */
+/* ------------------------------------------------------- navigation sheet
+ The header's links, for the widths where the bar shows only the brand and the
+ download. Same links, same order — the sheet is the bar, folded. It drops from
+ under the bar, and the hamburger it came from turns into the ✕ that closes it. */
+
+.navsheet {
+ position: fixed; left: 0; right: 0; top: 54px; z-index: 80;
+ padding: 12px var(--pad) calc(20px + env(safe-area-inset-bottom));
+ background: #000;
+ border-bottom: 1px solid var(--hair-soft);
+ box-shadow: 0 30px 60px rgba(0, 0, 0, .8);
+ max-height: calc(100dvh - 54px); overflow-y: auto; overscroll-behavior: contain;
+ transform: translateY(-8px); opacity: 0; visibility: hidden; pointer-events: none;
+ /* visibility is switched at one instant, never interpolated: transitioning it
+ leaves the panel hidden through its own opening animation — it would pop in
+ at the end, and nothing inside it could take focus until then. Zero delay on
+ the way in, the full duration on the way out. */
+ transition: opacity .28s var(--ease), transform .28s var(--ease), visibility 0s linear .28s;
+}
+body.menu-open .navsheet {
+ transform: none; opacity: 1; visibility: visible; pointer-events: auto;
+ transition: opacity .28s var(--ease), transform .28s var(--ease), visibility 0s;
+}
+@media (min-width: 1000px) { .navsheet { display: none; } }
+
+/* A row per link, comfortably past the 44px touch target. */
+.navsheet .nl {
+ display: flex; align-items: center; justify-content: space-between; gap: 16px;
+ min-height: 52px; padding: 0 12px; margin: 0 -12px; border-radius: 12px;
+ color: var(--fg); font-size: 17px; font-weight: 500; letter-spacing: -.02em;
+ border-bottom: 1px solid var(--hair-soft);
+ transition: background-color .2s var(--ease);
+}
+.navsheet .nl:last-of-type { border-bottom: 0; }
+.navsheet .nl:hover { text-decoration: none; background: rgba(255, 255, 255, .05); }
+.navsheet .nl[aria-current="page"] { color: var(--acc); }
+.navsheet .nl [data-gh] { color: var(--fg-3); font-size: 14px; font-variant-numeric: tabular-nums; }
+/* No second Download button in here: the bar keeps its own at every width, a
+ finger-width above, and two identical green calls to action is one too many. */
+
+/* -------------------------------------------------------- contents drawer
+ Every page that has one gets the same one: closed on load, at every width,
+ with no remembered state. The Contents pill opens it; the ✕ inside it, Escape,
+ or a tap on the dimmed page closes it. Nothing else opens or closes it. */
+
+.toc-btn {
+ position: fixed; z-index: 62;
+ left: max(16px, env(safe-area-inset-left));
+ bottom: max(16px, env(safe-area-inset-bottom));
+ display: inline-flex; align-items: center; gap: 9px;
+ min-height: 44px; padding: 0 19px 0 16px; border-radius: 999px; cursor: pointer;
+ /* Opaque enough to read against running text on its own, so the pill still works
+ where backdrop-filter does not. */
+ background: rgba(20, 21, 24, .94);
+ backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
+ border: 1px solid var(--hair);
+ color: var(--fg-2); font-size: 14px; font-weight: 500; letter-spacing: -.01em;
+ box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
+ transition: color .2s var(--ease), background-color .2s var(--ease),
+ border-color .2s var(--ease), opacity .2s var(--ease);
+}
+.toc-btn:hover { color: var(--fg); border-color: rgba(255, 255, 255, .25); background: rgba(32, 33, 37, .92); }
+.toc-btn svg { width: 16px; height: 16px; }
+/* The pill steps aside whenever a panel is up: with the drawer open the ✕ inside it
+ is the control, and under the navigation sheet it is just a shape behind glass. */
+body.contents-open .toc-btn, body.menu-open .toc-btn { opacity: 0; pointer-events: none; }
+
+.side {
+ position: fixed; left: 0; top: 54px; bottom: 0; z-index: 80;
+ width: min(340px, 88vw);
+ padding: 0 24px calc(30px + env(safe-area-inset-bottom)) calc(24px + env(safe-area-inset-left));
+ background: #0a0b0c;
+ border-right: 1px solid var(--hair-soft);
+ box-shadow: 40px 0 80px rgba(0, 0, 0, .5);
+ overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
+ transform: translateX(-102%); visibility: hidden;
+ /* Same one-instant switch as the sheet above, for the same two reasons. */
+ transition: transform .32s var(--ease), visibility 0s linear .32s;
+}
+body.contents-open .side {
+ transform: none; visibility: visible;
+ transition: transform .32s var(--ease), visibility 0s;
+}
+
+/* The close button rides along at the top of a long chapter list, so it is never
+ more than a glance away. */
+.side-top {
+ position: sticky; top: 0; z-index: 1;
+ display: flex; align-items: center; justify-content: space-between;
+ margin: 0 -24px 8px calc(-24px - env(safe-area-inset-left));
+ padding: 12px 14px 12px calc(24px + env(safe-area-inset-left));
+ background: #0a0b0c;
+ border-bottom: 1px solid var(--hair-soft);
+}
+.side-title { font-size: 15px; font-weight: 600; letter-spacing: -.02em; color: var(--fg); }
+.rail-close {
+ flex: none;
+ display: flex; align-items: center; justify-content: center;
+ width: 44px; height: 44px; margin: -6px -8px -6px 0;
+ border-radius: 11px; color: var(--fg-2); cursor: pointer;
+ transition: color .2s var(--ease), background-color .2s var(--ease);
+}
+.rail-close:hover { color: var(--fg); background: rgba(255, 255, 255, .07); }
+.rail-close svg { width: 17px; height: 17px; }
+
+/* Whatever the sheet or the drawer does not cover is dimmed, so the page behind
+ stops competing for attention and a tap out there reads as "close". It starts
+ below the bar: the header stays legible whatever is open. */
+body::after {
+ content: ""; position: fixed; inset: 54px 0 0; z-index: 70;
+ background: rgba(0, 0, 0, .55);
+ backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
+ opacity: 0; pointer-events: none;
+ transition: opacity .3s var(--ease);
+}
+body.menu-open::after, body.contents-open::after { opacity: 1; pointer-events: auto; }
+
+/* The panels still open and close, they just stop travelling. The delay has to go
+ with the duration: it is what holds visibility back until a slide has finished,
+ and there is no slide left to wait for. */
+@media (prefers-reduced-motion: reduce) {
+ .side, .navsheet, .toc-btn, body::after {
+ transition-duration: .01ms !important;
+ transition-delay: 0s !important;
+ }
+}
+
+/* --------------------------------------------------------------- rail contents
+ One list per page — a title with a one-line subtitle per topic. */
.side-label {
font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
@@ -190,7 +329,9 @@ nav {
}
.side-label:first-child { margin-top: 0; }
.side-link {
- display: block; padding: 9px 12px; margin: 0 -12px; border-radius: 10px;
+ display: flex; flex-direction: column; justify-content: center;
+ min-height: 44px; /* a chapter without a subtitle is still tappable */
+ padding: 8px 12px; margin: 0 -12px; border-radius: 10px;
color: var(--fg);
transition: background-color .2s var(--ease);
}
@@ -203,55 +344,10 @@ nav {
.side-link.on, .side-link[aria-current="page"] { background: rgba(255, 255, 255, .045); }
.side-link.on b, .side-link[aria-current="page"] b { color: var(--acc); }
-@media (min-width: 1300px) {
- .nav-toggle { display: none !important; }
- /* The rail owns the left edge; the page centres in what is left. */
- body { padding-left: calc(264px + env(safe-area-inset-left)); }
- .side {
- position: fixed; left: 0; top: 0; bottom: 0; z-index: 70;
- width: calc(264px + env(safe-area-inset-left));
- padding: 30px 24px 34px calc(26px + env(safe-area-inset-left));
- overflow-y: auto; overscroll-behavior: contain;
- background: #060707;
- border-right: 1px solid var(--hair-soft);
- scrollbar-width: thin;
- }
-}
-
-@media (max-width: 1299.98px) {
- .nav-toggle { display: flex; }
- .side {
- position: fixed; left: 0; right: 0; top: 54px; z-index: 55;
- padding: 20px var(--pad) calc(28px + env(safe-area-inset-bottom));
- background: #000;
- border-bottom: 1px solid var(--hair-soft);
- box-shadow: 0 30px 60px rgba(0, 0, 0, .8);
- max-height: calc(100dvh - 54px); overflow-y: auto;
- transform: translateY(-8px); opacity: 0; pointer-events: none;
- transition: opacity .28s var(--ease), transform .28s var(--ease);
- }
- .side.open { transform: none; opacity: 1; pointer-events: auto; }
-
- /* Whatever the sheet does not cover is dimmed, so the page behind it stops
- competing for attention and a tap out there reads as "close". */
- body::after {
- content: ""; position: fixed; inset: 0; z-index: 50;
- background: rgba(0, 0, 0, .55);
- backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
- opacity: 0; pointer-events: none;
- transition: opacity .3s var(--ease);
- }
- body.menu-open::after { opacity: 1; pointer-events: auto; }
-}
-/* A tablet-wide sheet with one narrow column looks abandoned; two columns fill it. */
-@media (min-width: 640px) and (max-width: 1299.98px) {
- .side { display: grid; grid-template-columns: 1fr 1fr; column-gap: 36px; align-items: start; }
- .side-label { grid-column: 1 / -1; }
- .side-label + .side-link { margin-top: 0; }
-}
-
-@media (prefers-reduced-motion: reduce) {
- .side, body::after { transition-duration: .01ms !important; }
+/* A wide sheet with one narrow column of links looks abandoned; two columns fill it. */
+@media (min-width: 640px) and (max-width: 999.98px) {
+ .navsheet .nl { border-bottom: 0; }
+ .navsheet .nl-rows { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; }
}
/* --------------------------------------------------------------------- hero */
@@ -640,6 +736,10 @@ code { font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, mo
p code, li code, td code {
background: var(--surface-2); border-radius: 6px; padding: 2px 6px;
font-size: .88em; color: #e4e4e8;
+ /* An env var or a URL in running text is one unbreakable word wider than a
+ 320px phone; without this it pushes the whole page sideways. A <pre> block is
+ left alone — it scrolls inside its own box. */
+ overflow-wrap: anywhere;
}
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 4px; }
@@ -783,3 +883,34 @@ table.cfg td:first-child { white-space: nowrap; width: 1%; padding-right: 26px;
.js.intro .hero .actions,
.js.intro .hero-stage { opacity: 1; animation: none; }
}
+
+/* ------------------------------------------------------- rail: subchapters
+ Chapters are .side-link rows inside a .side-group; the group's subchapters sit
+ in .side-subs and unfold for the chapter being read (scrollspy) or on tap. */
+.side-group .side-subs {
+ display: none;
+ margin: 2px 0 6px;
+}
+.side-group.open .side-subs { display: block; }
+.side-sub {
+ display: block; padding: 5px 12px 5px 24px; margin: 0 -12px; border-radius: 8px;
+ color: var(--fg-2); font-size: 13px; line-height: 1.4;
+ transition: color .2s var(--ease), background-color .2s var(--ease);
+}
+.side-sub:hover { text-decoration: none; color: var(--fg); background: rgba(255, 255, 255, .04); }
+.side-sub.on { color: var(--acc); }
+/* A subchapter is a tap target too, not just a line of text. */
+@media (pointer: coarse) { .side-sub { padding-top: 9px; padding-bottom: 9px; } }
+
+/* --------------------------------------------------------- a11y: link affordance
+ Links inside running text can't rely on color alone (WCAG 1.4.1 / Lighthouse
+ link-in-text-block): give them a quiet underline. Nav, cards and the rail keep
+ their color-only look — they are recognisable as controls by placement. */
+.prose p a, .prose li a, .prose td a, .foot .c a, .note a {
+ text-decoration: underline;
+ text-decoration-color: rgba(50, 215, 75, .45);
+ text-underline-offset: 2.5px;
+}
+.prose p a:hover, .prose li a:hover, .prose td a:hover, .foot .c a:hover, .note a:hover {
+ text-decoration-color: currentColor;
+}