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.
JavaScript apple-watchbodyweightdockerfitnessfitness-trackergymhealthiosmcpnodejspasskeysprogressive-web-applicationspwareactself-hostedself-hostingvitewebauthnweightliftingworkout-tracker
Gastmodus abschaltbar: ALLOW_GUEST=0 nimmt die Tuer ohne Konto raus (#42)
Duarte Santos9daf637044dd
diff --git a/.env.example b/.env.exampleindex ac3773c49..380e6a0bf 100644--- a/.env.example+++ b/.env.example@@ -33,6 +33,14 @@ RP_NAME=openGym# generate the codes from the admin dashboard):## INVITE_ONLY=1+#+# Remove the "Continue without account" button, so a profile is the only way in.+# Guest mode keeps everything in the browser and never touches this server, but+# on an instance meant for a known set of people it is still the wrong front+# door. Anyone already inside as a guest is signed out on their next visit; the+# data they made stays in that browser. Defaults to on (guests allowed):+#+# ALLOW_GUEST=0# ── Session length (optional) ──────────────────────────────────────────────# How long a sign-in lasts, in days. Default 90 — long enough that people whodiff --git a/CHANGELOG.md b/CHANGELOG.mdindex d46674e0e..3a2881622 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -2,7 +2,27 @@## v1.2.6 — 2026-08-07-A freestyle session no longer starts from blanks. Nothing else in the app changed.+A freestyle session no longer starts from blanks, and a self-hosted instance can finally insist+that everyone using it has an account.++### An instance can require an account (#42)++- 🔒 **`ALLOW_GUEST=0` removes the "Continue without account" button.** Guest mode keeps everything+ in the browser and never touches the server — no account, no sync, nothing the admin dashboard+ can see — so on an instance meant for a known set of people it was a door leading nowhere+ useful, and until now there was no way to close it.+- **It also ends guest sessions that already exist.** Guests never authenticate, so there is no+ request for the server to start refusing; the switch reaches someone already inside on their+ next visit, when the app checks the config and returns them to the login screen. Their data is+ not deleted — it stays in that browser, and moves into a real profile if they create one on the+ same device.+- **A server it cannot reach is not a server that said no.** The button is only withdrawn on an+ explicit `allow_guest: false`; a failed config request, or a server too old to send the flag at+ all, leaves guest mode exactly as it was. An instance that is merely offline for a moment does+ not lock out everyone who never made an account.+- **Default is on, so nothing changes for existing instances.** Set it alongside `INVITE_ONLY=1`:+ invite-only governs who may *create a profile* and says nothing about the guest button, which+ never creates one.### Freestyle sessions start where you left offdiff --git a/README.md b/README.mdindex cfff49159..4da510bb3 100644--- a/README.md+++ b/README.md@@ -155,6 +155,7 @@ All via `.env` (see `.env.example`):| `RP_NAME` | Name shown in the passkey prompt | `openGym` || `ADMIN_UIDS` | User ids that get the admin dashboard (comma-separated) | *(none)* || `INVITE_ONLY` | Require an invite code to create a profile | *(off)* |+| `ALLOW_GUEST` | Offer "Continue without account" — set `0` to require a profile | *(on)* |Push notification keys are generated on first run and saved to `./data/vapid.json` — nothing to set.diff --git a/api/server.js b/api/server.jsindex e2dce6620..80af0e5e7 100644--- a/api/server.js+++ b/api/server.js@@ -19,6 +19,11 @@ const RP_NAME = process.env.RP_NAME || 'openGym';// code the admin generates. Both default off so a fresh self-hosted instance stays open.const ADMIN_UIDS = (process.env.ADMIN_UIDS || '').split(',').map(s => s.trim()).filter(Boolean);const INVITE_ONLY = /^(1|true|yes|on)$/i.test(process.env.INVITE_ONLY || '');+// Guest mode ("Continue without account") keeps everything in the browser and never touches this+// server — but on an instance meant for a known set of people, an entrance nobody can walk back+// out of is still the wrong front door (#42). Default ON, so existing instances are unchanged;+// the polarity is inverted from INVITE_ONLY because the safe default here is the permissive one.+const ALLOW_GUEST = !/^(0|false|no|off)$/i.test(process.env.ALLOW_GUEST || '');// 90 days keeps someone who trains a few times a week permanently signed in without a stolen// cookie staying good for a year. Overridable because a family instance and one on the open// internet don't want the same number. Only affects cookies minted from now on — the expiry is@@ -256,7 +261,7 @@ const routes = {'GET /api/health': async (req, res) => json(res, 200, { ok: true, users: db.users.length }),// Public config the login screen needs before anyone is signed in.- 'GET /api/config': async (req, res) => json(res, 200, { invite_only: INVITE_ONLY }),+ 'GET /api/config': async (req, res) => json(res, 200, { invite_only: INVITE_ONLY, allow_guest: ALLOW_GUEST }),'GET /api/me': async (req, res) => {const user = readSession(req);diff --git a/docs/SELF_HOSTING.md b/docs/SELF_HOSTING.mdindex da61930e0..d130cfe9a 100644--- a/docs/SELF_HOSTING.md+++ b/docs/SELF_HOSTING.md@@ -90,11 +90,12 @@ Visit `https://gym.example.com`, create your profile, and add it to your home scAnyone who can reach the URL can create their own profile — each gets isolated data. That's thedefault: open signup, no admin.-If you'd rather control who gets in, two optional settings in `.env` turn that around:+If you'd rather control who gets in, three optional settings in `.env` turn that around:```bashADMIN_UIDS=youruserid # comma-separated; these users get the admin dashboardINVITE_ONLY=1 # new profiles need an invite code+ALLOW_GUEST=0 # remove "Continue without account"```Register your own passkey profile first, then find your id in `./data/db.json` under `users[].id`@@ -104,6 +105,16 @@ out and locked out everywhere until you re-enable it), and — with `INVITE_ONLYrevoking invite codes. Existing accounts keep working when you switch invite-only on. Admin accessis gated by your passkey and enforced server-side, so it needs no separate login.+`INVITE_ONLY=1` and `ALLOW_GUEST=0` answer different questions and are usually set together.+Invite-only controls who may *create a profile*; it says nothing about the **Continue without+account** button, which never creates one. Guest mode keeps everything in that browser and never+talks to the server — there is no account, no sync and nothing for the admin dashboard to show —+so on an instance meant for a known set of people it is a door that leads nowhere useful. With+`ALLOW_GUEST=0` the button is gone, and anyone already using the app as a guest is returned to the+login screen on their next visit. Their data is not deleted: it stays in that browser and comes+back if you ever switch guests on again, or moves into a real profile if they create one on the+same device.+Prefer to keep the whole thing off the open internet? A VPN or an auth proxy (Authelia, CloudflareAccess…) in front still works, and composes with the above.diff --git a/frontend/src/lib/guest.js b/frontend/src/lib/guest.jsnew file mode 100644index 000000000..17c309fe9--- /dev/null+++ b/frontend/src/lib/guest.js@@ -0,0 +1,15 @@+/**+ * Whether "Continue without account" may be offered, given the public config from /api/config.+ *+ * Guest mode is allowed unless the server has *positively* said otherwise. That asymmetry is the+ * whole point: a config we could not fetch — offline, server restarting, request failed — is not+ * the same answer as `allow_guest: false`, and treating it as one would lock people out of an+ * instance whose admin never disabled anything. An instance that really did disable guests says+ * so on the next successful boot, and the session is ended then (see useStore.boot).+ *+ * Older servers predate the flag and send no `allow_guest` at all; they mean "allowed".+ *+ * @param {{allow_guest?: boolean}|null|undefined} config Parsed /api/config body, or null.+ * @returns {boolean} true when the guest entrance may be shown and used.+ */+export const guestAllowed = config => !(config && config.allow_guest === false)diff --git a/frontend/src/lib/guest.test.js b/frontend/src/lib/guest.test.jsnew file mode 100644index 000000000..8e76ec912--- /dev/null+++ b/frontend/src/lib/guest.test.js@@ -0,0 +1,36 @@+import { describe, expect, it } from 'vitest'+import { guestAllowed } from './guest.js'++// The flag is the easy half. The half worth pinning down is what happens when the server did not+// answer: a failed config fetch must not be read as "guests are disabled", or an instance that is+// merely unreachable locks out everyone who never made an account (#42).+describe('guestAllowed', () => {+ it('allows guests when the server says so', () => {+ expect(guestAllowed({ allow_guest: true })).toBe(true)+ })++ it('refuses guests only on an explicit false', () => {+ expect(guestAllowed({ allow_guest: false })).toBe(false)+ })++ it('allows guests when the config could not be fetched', () => {+ expect(guestAllowed(null)).toBe(true)+ expect(guestAllowed(undefined)).toBe(true)+ })++ it('allows guests against a server too old to send the flag', () => {+ expect(guestAllowed({ invite_only: true })).toBe(true)+ })++ // A missing key and a falsy-but-not-false value are different things. Only `false` — what the+ // server actually serialises — closes the door; anything else stays open rather than guessing.+ it('does not treat other falsy values as a refusal', () => {+ for (const v of [0, '', null, undefined, NaN]) {+ expect(guestAllowed({ allow_guest: v })).toBe(true)+ }+ })++ it('treats the string "false" as the misconfiguration it is, not as a refusal', () => {+ expect(guestAllowed({ allow_guest: 'false' })).toBe(true)+ })+})diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.jsindex d62b7c5df..3520ec0af 100644--- a/frontend/src/locales/de.js+++ b/frontend/src/locales/de.js@@ -236,6 +236,7 @@ export default {'Sign in with passkey': 'Mit Passkey anmelden','Create new profile': 'Neues Profil erstellen',"This browser doesn't support passkeys — you can still use openGym locally on this device.": 'Dieser Browser unterstützt keine Passkeys — du kannst openGym trotzdem lokal auf diesem Gerät nutzen.',+ "This browser doesn't support passkeys, and this instance requires an account. Try a browser or device with passkey support.": 'Dieser Browser unterstützt keine Passkeys, und dieser Server verlangt ein Konto. Probier einen Browser oder ein Gerät mit Passkey-Unterstützung.','Continue without account': 'Ohne Konto fortfahren','Passkeys use {0} — no passwords.': 'Passkeys nutzen {0} — keine Passwörter.','Each profile keeps its own plan, workouts & body weight.': 'Jedes Profil hat seinen eigenen Plan, Trainings & Körpergewicht.',diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.jsindex 27c17f01b..d2d06fb90 100644--- a/frontend/src/locales/es.js+++ b/frontend/src/locales/es.js@@ -223,6 +223,7 @@ export default {'Sign in with passkey': 'Iniciar sesión con passkey','Create new profile': 'Crear perfil nuevo',"This browser doesn't support passkeys — you can still use openGym locally on this device.": 'Este navegador no admite passkeys — aun así puedes usar openGym localmente en este dispositivo.',+ "This browser doesn't support passkeys, and this instance requires an account. Try a browser or device with passkey support.": 'Este navegador no admite passkeys y este servidor requiere una cuenta. Prueba con un navegador o dispositivo compatible con passkeys.','Continue without account': 'Continuar sin cuenta','Passkeys use {0} — no passwords.': 'Las passkeys usan {0} — sin contraseñas.','Each profile keeps its own plan, workouts & body weight.': 'Cada perfil guarda su propio plan, entrenamientos y peso corporal.',diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.jsindex 9b1de4455..40ee43180 100644--- a/frontend/src/locales/fr.js+++ b/frontend/src/locales/fr.js@@ -223,6 +223,7 @@ export default {'Sign in with passkey': 'Se connecter avec une passkey','Create new profile': 'Créer un nouveau profil',"This browser doesn't support passkeys — you can still use openGym locally on this device.": 'Ce navigateur ne prend pas en charge les passkeys — tu peux quand même utiliser openGym localement sur cet appareil.',+ "This browser doesn't support passkeys, and this instance requires an account. Try a browser or device with passkey support.": 'Ce navigateur ne prend pas en charge les passkeys, et ce serveur exige un compte. Essaie un navigateur ou un appareil compatible avec les passkeys.','Continue without account': 'Continuer sans compte','Passkeys use {0} — no passwords.': 'Les passkeys utilisent {0} — pas de mots de passe.','Each profile keeps its own plan, workouts & body weight.': 'Chaque profil garde son plan, ses séances et son poids corporel.',diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.jsindex 163cb93f7..08b9c01fc 100644--- a/frontend/src/locales/hi.js+++ b/frontend/src/locales/hi.js@@ -223,6 +223,7 @@ export default {'Sign in with passkey': 'पासकी से साइन इन करें','Create new profile': 'नई प्रोफ़ाइल बनाएँ',"This browser doesn't support passkeys — you can still use openGym locally on this device.": 'यह ब्राउज़र पासकी सपोर्ट नहीं करता — फिर भी आप इस डिवाइस पर openGym लोकली इस्तेमाल कर सकते हैं।',+ "This browser doesn't support passkeys, and this instance requires an account. Try a browser or device with passkey support.": 'यह ब्राउज़र पासकी सपोर्ट नहीं करता, और इस सर्वर के लिए खाता ज़रूरी है। पासकी सपोर्ट वाला ब्राउज़र या डिवाइस आज़माएँ।','Continue without account': 'बिना खाते के जारी रखें','Passkeys use {0} — no passwords.': 'पासकी {0} का उपयोग करती हैं — कोई पासवर्ड नहीं।','Each profile keeps its own plan, workouts & body weight.': 'हर प्रोफ़ाइल की अपनी योजना, वर्कआउट और वज़न होते हैं।',diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.jsindex af7318242..f7298722a 100644--- a/frontend/src/locales/it.js+++ b/frontend/src/locales/it.js@@ -223,6 +223,7 @@ export default {'Sign in with passkey': 'Accedi con passkey','Create new profile': 'Crea nuovo profilo',"This browser doesn't support passkeys — you can still use openGym locally on this device.": 'Questo browser non supporta le passkey — puoi comunque usare openGym localmente su questo dispositivo.',+ "This browser doesn't support passkeys, and this instance requires an account. Try a browser or device with passkey support.": 'Questo browser non supporta le passkey e questo server richiede un account. Prova un browser o un dispositivo che supporti le passkey.','Continue without account': 'Continua senza account','Passkeys use {0} — no passwords.': 'Le passkey usano {0} — niente password.','Each profile keeps its own plan, workouts & body weight.': 'Ogni profilo ha il proprio piano, allenamenti e peso corporeo.',diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.jsindex c6a6431f9..4c02ef8cd 100644--- a/frontend/src/locales/ko.js+++ b/frontend/src/locales/ko.js@@ -223,6 +223,7 @@ export default {'Sign in with passkey': '패스키로 로그인','Create new profile': '새 프로필 만들기',"This browser doesn't support passkeys — you can still use openGym locally on this device.": '이 브라우저는 패스키를 지원하지 않아요 — 그래도 이 기기에서 openGym을 로컬로 사용할 수 있습니다.',+ "This browser doesn't support passkeys, and this instance requires an account. Try a browser or device with passkey support.": '이 브라우저는 패스키를 지원하지 않고, 이 서버는 계정이 필요합니다. 패스키를 지원하는 브라우저나 기기를 사용해 보세요.','Continue without account': '계정 없이 계속','Passkeys use {0} — no passwords.': '패스키는 {0}을(를) 사용합니다 — 비밀번호 없음.','Each profile keeps its own plan, workouts & body weight.': '프로필마다 자신의 계획, 운동, 체중을 보관합니다.',diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.jsindex 5d0fc10a3..f94057dd8 100644--- a/frontend/src/locales/pl.js+++ b/frontend/src/locales/pl.js@@ -223,6 +223,7 @@ export default {'Sign in with passkey': 'Zaloguj się passkey','Create new profile': 'Utwórz nowy profil',"This browser doesn't support passkeys — you can still use openGym locally on this device.": 'Ta przeglądarka nie obsługuje passkey — mimo to możesz używać openGym lokalnie na tym urządzeniu.',+ "This browser doesn't support passkeys, and this instance requires an account. Try a browser or device with passkey support.": 'Ta przeglądarka nie obsługuje passkey, a ten serwer wymaga konta. Spróbuj przeglądarki lub urządzenia z obsługą passkey.','Continue without account': 'Kontynuuj bez konta','Passkeys use {0} — no passwords.': 'Passkey używa: {0} — bez haseł.','Each profile keeps its own plan, workouts & body weight.': 'Każdy profil ma własny plan, treningi i masę ciała.',diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.jsindex e7e9d0c3f..590d2ec00 100644--- a/frontend/src/locales/pt.js+++ b/frontend/src/locales/pt.js@@ -223,6 +223,7 @@ export default {'Sign in with passkey': 'Entrar com passkey','Create new profile': 'Criar novo perfil',"This browser doesn't support passkeys — you can still use openGym locally on this device.": 'Este navegador não suporta passkeys — ainda assim podes usar o openGym localmente neste dispositivo.',+ "This browser doesn't support passkeys, and this instance requires an account. Try a browser or device with passkey support.": 'Este navegador não suporta passkeys e este servidor exige uma conta. Experimenta um navegador ou dispositivo com suporte a passkeys.','Continue without account': 'Continuar sem conta','Passkeys use {0} — no passwords.': 'As passkeys usam {0} — sem palavras-passe.','Each profile keeps its own plan, workouts & body weight.': 'Cada perfil guarda o seu plano, treinos e peso corporal.',diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.jsindex 98a9a7c65..2265f9119 100644--- a/frontend/src/locales/ru.js+++ b/frontend/src/locales/ru.js@@ -223,6 +223,7 @@ export default {'Sign in with passkey': 'Войти по ключу доступа','Create new profile': 'Создать новый профиль',"This browser doesn't support passkeys — you can still use openGym locally on this device.": 'Этот браузер не поддерживает ключи доступа — но openGym можно использовать локально на этом устройстве.',+ "This browser doesn't support passkeys, and this instance requires an account. Try a browser or device with passkey support.": 'Этот браузер не поддерживает ключи доступа, а на этом сервере нужен аккаунт. Попробуйте браузер или устройство с поддержкой ключей доступа.','Continue without account': 'Продолжить без аккаунта','Passkeys use {0} — no passwords.': 'Ключи доступа используют {0} — без паролей.','Each profile keeps its own plan, workouts & body weight.': 'У каждого профиля свой план, тренировки и вес тела.',diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.jsindex a5853bf70..fd4fb343b 100644--- a/frontend/src/locales/tr.js+++ b/frontend/src/locales/tr.js@@ -223,6 +223,7 @@ export default {'Sign in with passkey': 'Geçiş anahtarıyla giriş yap','Create new profile': 'Yeni profil oluştur',"This browser doesn't support passkeys — you can still use openGym locally on this device.": 'Bu tarayıcı geçiş anahtarlarını desteklemiyor — yine de openGym’i bu cihazda yerel olarak kullanabilirsin.',+ "This browser doesn't support passkeys, and this instance requires an account. Try a browser or device with passkey support.": 'Bu tarayıcı geçiş anahtarlarını desteklemiyor ve bu sunucu bir hesap gerektiriyor. Geçiş anahtarı destekleyen bir tarayıcı veya cihaz dene.','Continue without account': 'Hesapsız devam et','Passkeys use {0} — no passwords.': 'Geçiş anahtarları {0} kullanır — şifre yok.','Each profile keeps its own plan, workouts & body weight.': 'Her profilin kendi planı, antrenmanları ve vücut ağırlığı vardır.',diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.jsindex 518427a57..55defc016 100644--- a/frontend/src/locales/zh.js+++ b/frontend/src/locales/zh.js@@ -223,6 +223,7 @@ export default {'Sign in with passkey': '用通行密钥登录','Create new profile': '创建新档案',"This browser doesn't support passkeys — you can still use openGym locally on this device.": '此浏览器不支持通行密钥——你仍可在本设备上本地使用 openGym。',+ "This browser doesn't support passkeys, and this instance requires an account. Try a browser or device with passkey support.": '此浏览器不支持通行密钥,且此服务器需要账户。请换用支持通行密钥的浏览器或设备。','Continue without account': '不用账号继续','Passkeys use {0} — no passwords.': '通行密钥使用{0}——没有密码。','Each profile keeps its own plan, workouts & body weight.': '每个档案有自己的计划、训练和体重。',diff --git a/frontend/src/store/useStore.js b/frontend/src/store/useStore.jsindex 2b4163378..6da600e30 100644--- a/frontend/src/store/useStore.js+++ b/frontend/src/store/useStore.js@@ -3,6 +3,7 @@ import { api } from '../lib/api.js'import { localTZ } from '../lib/format.js'import { registerCustom } from '../lib/exercises.js'import { DEMO, DEMO_SEEDED } from '../lib/demo.js'+import { guestAllowed } from '../lib/guest.js'import { MOBILE, nativeLoad, nativeSave, syncReminder } from '../lib/mobile.js'const KEY = 'gym_state_v1'@@ -95,6 +96,16 @@ export const useStore = create((set, get) => {isGuest: () => localStorage.getItem('gym_guest') === '1',setGuest(v) { if (v) localStorage.setItem('gym_guest', '1'); else localStorage.removeItem('gym_guest'); set({}) },+ // Public config from /api/config (invite_only, allow_guest). null until the first successful+ // fetch — the login screen and boot both read it, so it is fetched once and cached here+ // rather than by each screen that happens to need it.+ config: null,+ async loadConfig() {+ if (get().config) return get().config+ try { const c = await api('/api/config'); set({ config: c }); return c }+ catch { return null }+ },+setUser(u) {if (u) { localStorage.setItem('gym_user', JSON.stringify(u)); localStorage.removeItem('gym_guest') }else localStorage.removeItem('gym_user')@@ -172,6 +183,12 @@ export const useStore = create((set, get) => {set({ ready: true })return}+ // Guests never authenticate, so an instance that turned guest mode off has no request to+ // refuse — the only way the switch reaches someone already inside is here, on their next+ // boot. Ending the session needs a positive `allow_guest: false`; see lib/guest.js for why+ // an unreachable server must not be allowed to lock anyone out (#42).+ const cfg = await get().loadConfig()+ if (!guestAllowed(cfg)) get().setGuest(false)try {const me = await api('/api/me')get().setUser(me.user)diff --git a/frontend/src/views/Login.jsx b/frontend/src/views/Login.jsxindex 43fe940d4..0df9748c1 100644--- a/frontend/src/views/Login.jsx+++ b/frontend/src/views/Login.jsx@@ -1,21 +1,25 @@import { useStore } from '../store/useStore.js'import { useUI } from '../store/useUI.js'-import { webauthnOK, passkeyLogin, passkeyRegister, api, BIO } from '../lib/api.js'+import { webauthnOK, passkeyLogin, passkeyRegister, BIO } from '../lib/api.js'import { hasData } from '../store/useStore.js'import { t } from '../lib/i18n.js'import { DEMO, REPO } from '../lib/demo.js'+import { guestAllowed } from '../lib/guest.js'import { useState, useRef, useEffect } from 'react'import Icon from '../components/Icon.jsx'import { Button } from '../components/ui.jsx'function RegisterSheet({ close }) {- const { setUser, pushState, pullState } = useStore()+ const { setUser, pushState, pullState, loadConfig } = useStore()+ const config = useStore(s => s.config)const [name, setName] = useState('')const [code, setCode] = useState('')- const [inviteOnly, setInviteOnly] = useState(false)+ const inviteOnly = !!config?.invite_onlyconst ref = useRef(null)useEffect(() => { setTimeout(() => ref.current?.focus(), 250) }, [])- useEffect(() => { api('/api/config').then(c => setInviteOnly(!!c.invite_only)).catch(() => {}) }, [])+ // Boot already fetched this; retry here only if that attempt failed, so the invite field still+ // appears on an instance whose config arrived late rather than never.+ useEffect(() => { loadConfig() }, [loadConfig])const go = async () => {const n = name.trim()if (!n) { useUI.getState().toast(t('Enter a name')); return }@@ -44,6 +48,8 @@ function RegisterSheet({ close }) {export default function Login() {const { setUser, pullState, setGuest } = useStore()+ const config = useStore(s => s.config)+ const canGuest = guestAllowed(config)const signIn = async () => {try { const u = await passkeyLogin(); setUser(u); await pullState(); useUI.getState().toast(t('Welcome back, {0}', u.name)) }catch (e) { if (e.name !== 'NotAllowedError' && e.name !== 'AbortError') useUI.getState().toast(e.message || t('Sign-in failed')) }@@ -77,9 +83,13 @@ export default function Login() {<Button variant="primary" icon="person" onClick={signIn}>{t('Sign in with passkey')}</Button><div style={{ height: 10 }} /><Button icon="sparkles" onClick={() => useUI.getState().openSheet(close => <RegisterSheet close={close} />)}>{t('Create new profile')}</Button>- <div style={{ height: 10 }} />- </> : <div className="card small muted" style={{ textAlign: 'left' }}>{t("This browser doesn't support passkeys — you can still use openGym locally on this device.")}</div>}- <Button variant="ghost" className="dim" onClick={() => setGuest(true)}>{t('Continue without account')}</Button>+ {canGuest && <div style={{ height: 10 }} />}+ </> : <div className="card small muted" style={{ textAlign: 'left' }}>{canGuest+ ? t("This browser doesn't support passkeys — you can still use openGym locally on this device.")+ // Without passkeys and without the guest entrance there is no way in from this browser,+ // so say that plainly instead of offering a local profile that cannot be created.+ : t("This browser doesn't support passkeys, and this instance requires an account. Try a browser or device with passkey support.")}</div>}+ {canGuest && <Button variant="ghost" className="dim" onClick={() => setGuest(true)}>{t('Continue without account')}</Button>}<div className="dim small" style={{ marginTop: 26, lineHeight: 1.5 }}>{t('Passkeys use {0} — no passwords.', BIO)}<br />{t('Each profile keeps its own plan, workouts & body weight.')}</div></div>)