Website docs: sync between devices, offline mode, where push works and the reminder catch-up (v1.3.6)

This commit is contained in:
Duarte Santos committed 2026-09-12 23:14:00 +02:00
1 parent 32111dcad3
commit 6a8d2288ae
1 file changed
+22 -2
+22 -2
View File
@@ -493,6 +493,25 @@ docker compose up -d # restart alone does NOT re-read .env</code></pre>
<code>./data/vapid.json</code>, and each browser reports its own timezone. Set
<code>VAPID_SUBJECT=mailto:you@example.com</code> if you'd rather push services could
reach an inbox than your origin URL.</p>
<p>Where it works: any desktop browser, Android Chrome, and on iOS only the app <b>added to
the Home Screen</b> (a Safari tab has no Web Push). The Android APK doesn't use Web Push —
its reminder is a local notification scheduled on the phone. A reminder that was due while
the server was down or restarting is still sent up to 15 minutes late, once; the browser
re-registers its subscription with the server on every signed-in start, so one the server
lost heals itself; and a rest-timer alert belongs to the device that started the rest, so
finishing a rest on the desktop no longer silences the phone.</p>
<h3 id="sh-sync">Sync between devices</h3>
<p>Signed in, <b>the profile on the server is the truth</b>. Signing in on a device adopts it
— settings, plan, history — and if that device logged workouts while signed out, one
dialog asks whether to add them to the profile or keep the profile as it is. While the
app is open it asks the server every 30 seconds (and every time it comes back to the
foreground) whether anything changed and fetches only what did, so a session logged on the
phone shows up on the desktop within half a minute. Two devices that both changed
something are merged on the server's revision — every workout, routine and weigh-in from
both sides is kept, settings follow the newer copy — instead of one overwriting the other.
Without a network the app keeps working on the device and says so under the header; the
changes go up when the connection is back.</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,
@@ -587,8 +606,9 @@ ALLOW_GUEST=0 # remove "Continue without account"</code></pre>
<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
cross the network in plain text). A connected app keeps working without a network on the
last copy it synced — it shows an "Offline" line under the header and pushes your changes
as soon as the connection is back, 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>