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
Passkeys: say why sign-in or sign-up failed, in the app's language
Duarte Santos38bdfa6756e8
diff --git a/api/openapi.yaml b/api/openapi.yamlindex 6139e7c73..c58381890 100644--- a/api/openapi.yaml+++ b/api/openapi.yaml@@ -350,7 +350,7 @@ paths:content:application/json:schema: { $ref: '#/components/schemas/Error' }- example: { error: "a valid invite code is required" }+ example: { error: "a valid invite code is required", code: "invite" }/api/register/verify:post:@@ -398,13 +398,13 @@ paths:content:application/json:schema: { $ref: '#/components/schemas/Error' }- example: { error: "challenge expired, try again" }+ example: { error: "challenge expired, try again", code: "challenge-expired" }'403':description: Invite-only and the code became invalid since step 1.content:application/json:schema: { $ref: '#/components/schemas/Error' }- example: { error: "invite code is no longer valid, ask for a new one" }+ example: { error: "invite code is no longer valid, ask for a new one", code: "invite" }'409':description: This credential id is already registered.content:@@ -482,13 +482,13 @@ paths:content:application/json:schema: { $ref: '#/components/schemas/Error' }- example: { error: "this account has been disabled" }+ example: { error: "this account has been disabled", code: "disabled" }'404':description: The passkey's credential id is unknown to this instance.content:application/json:schema: { $ref: '#/components/schemas/Error' }- example: { error: "unknown passkey, create a profile first" }+ example: { error: "unknown passkey, create a profile first", code: "unknown-credential" }'500':description: Credential exists but its user record is missing (corrupt db).content:@@ -1207,7 +1207,7 @@ paths:content:application/json:schema: { $ref: '#/components/schemas/Error' }- example: { error: "challenge expired, try again" }+ example: { error: "challenge expired, try again", code: "challenge-expired" }'401':description: >-Not signed in — including a session that was ended ("sign out everywhere", adiff --git a/api/server.js b/api/server.jsindex 467a400e1..376863ca1 100644--- a/api/server.js+++ b/api/server.js@@ -1497,7 +1497,7 @@ const passkeyRoutes = {const c = takeChallenge(text(body.cid));if (!c || c.kind !== 'add' || c.uid !== user.id) {audit(req, 'auth.passkey.fail', { ok: false, user, msg: 'challenge-expired' });- return json(res, 400, { error: 'challenge expired, try again' });+ return json(res, 400, { error: 'challenge expired, try again', code: 'challenge-expired' });}const cred = await newPasskey(req, res, c, body, 'auth.passkey.fail', user);if (!cred) return;@@ -1610,7 +1610,7 @@ const passkeyRoutes = {}if (!c || c.kind !== 'link' || c.lh !== link.h || c.uid !== link.userId) {audit(req, 'auth.link.fail', { ok: false, uid: link.userId, msg: 'challenge-expired' });- return json(res, 400, { error: 'challenge expired, try again' });+ return json(res, 400, { error: 'challenge expired, try again', code: 'challenge-expired' });}const owner = db.users.find(u => u.id === link.userId);const cred = await newPasskey(req, res, c, body, 'auth.link.fail', owner || { id: link.userId });@@ -1815,7 +1815,7 @@ const routes = {if (INVITE_ONLY && !db.invites.some(i => i.code === code && !i.usedBy && !i.revoked)) {// The rejected code itself is never recorded — a near-miss guess in the log is a liability.audit(req, 'auth.register.denied', { ok: false, name, msg: 'invite-rejected' });- return json(res, 403, { error: 'a valid invite code is required' });+ return json(res, 403, { error: 'a valid invite code is required', code: 'invite' });}const uid = crypto.randomBytes(12).toString('base64url');const options = await generateRegistrationOptions({@@ -1834,7 +1834,7 @@ const routes = {const c = takeChallenge(body.cid);if (!c || c.kind !== 'register' || !c.uid) {audit(req, 'auth.register.fail', { ok: false, msg: 'challenge-expired' });- return json(res, 400, { error: 'challenge expired, try again' });+ return json(res, 400, { error: 'challenge expired, try again', code: 'challenge-expired' });}let verification;try {@@ -1865,7 +1865,7 @@ const routes = {invite = db.invites.find(i => i.code === c.code && !i.usedBy && !i.revoked);if (!invite) {audit(req, 'auth.register.fail', { ok: false, name: c.name, msg: 'invite-invalid' });- return json(res, 403, { error: 'invite code is no longer valid, ask for a new one' });+ return json(res, 403, { error: 'invite code is no longer valid, ask for a new one', code: 'invite' });}}const user = { id: c.uid, name: c.name, created: new Date().toISOString() };@@ -1898,7 +1898,7 @@ const routes = {const c = takeChallenge(body.cid);if (c?.kind !== 'login') {audit(req, 'auth.login.fail', { ok: false, msg: 'challenge-expired' });- return json(res, 400, { error: 'challenge expired, try again' });+ return json(res, 400, { error: 'challenge expired, try again', code: 'challenge-expired' });}const cred = db.creds.find(x => x.id === body.credential?.id);if (!cred) {@@ -1906,7 +1906,7 @@ const routes = {// would let an admin correlate an unknown device across attempts. Nothing here identifies// the caller beyond the timestamp (and the network, if AUDIT_IP is on).audit(req, 'auth.login.fail', { ok: false, msg: 'unknown-credential' });- return json(res, 404, { error: 'unknown passkey, create a profile first' });+ return json(res, 404, { error: 'unknown passkey, create a profile first', code: 'unknown-credential' });}let verification;try {@@ -1941,7 +1941,7 @@ const routes = {}if (user.disabled) {audit(req, 'auth.login.fail', { ok: false, user, msg: 'account-disabled' });- return json(res, 403, { error: 'this account has been disabled' });+ return json(res, 403, { error: 'this account has been disabled', code: 'disabled' });}audit(req, 'auth.login.ok', { user });json(res, 200, { user: { id: user.id, name: user.name, admin: isAdmin(user) } }, { 'Set-Cookie': sessionCookie(user) });diff --git a/api/test/server-passkeys.test.js b/api/test/server-passkeys.test.jsindex cee5f1552..2c351f486 100644--- a/api/test/server-passkeys.test.js+++ b/api/test/server-passkeys.test.js@@ -756,3 +756,25 @@ test('a Settings or device-link challenge never finishes a sign-up, a sign-in orassert.ok(made.cookie);assert.equal(h.db().users.length, 2);});++// The app says these in the UI language, so each refusal carries a stable code beside its English line.+test('passkey sign-up and sign-in refusals carry a code the app can translate', async t => {+ const known = softPasskey(), stranger = softPasskey();+ const h = await startServer(t, { env: { INVITE_ONLY: '1' }, users: [user('u1', 'Ana', { disabled: true })], creds: [known.row('u1')] });+ const reg = await h.req('POST', '/api/register/options', { body: { name: 'Bo', code: 'NOPE' } });+ assert.equal(reg.status, 403);+ assert.equal(reg.body.code, 'invite');+ const expired = await h.req('POST', '/api/register/verify', { body: { cid: 'gone', credential: stranger.attestation('x') } });+ assert.equal(expired.status, 400);+ assert.equal(expired.body.code, 'challenge-expired');+ const late = await h.req('POST', '/api/login/verify', { body: { cid: 'gone', credential: stranger.assertion('x') } });+ assert.equal(late.body.code, 'challenge-expired');+ let lo = (await h.req('POST', '/api/login/options', { body: {} })).body;+ const unknown = await h.req('POST', '/api/login/verify', { body: { cid: lo.cid, credential: stranger.assertion(lo.options.challenge) } });+ assert.equal(unknown.status, 404);+ assert.equal(unknown.body.code, 'unknown-credential');+ lo = (await h.req('POST', '/api/login/options', { body: {} })).body;+ const off = await h.req('POST', '/api/login/verify', { body: { cid: lo.cid, credential: known.assertion(lo.options.challenge) } });+ assert.equal(off.status, 403);+ assert.equal(off.body.code, 'disabled');+});diff --git a/frontend/src/components/ServerSync.jsx b/frontend/src/components/ServerSync.jsxindex a5368bc35..994a23168 100644--- a/frontend/src/components/ServerSync.jsx+++ b/frontend/src/components/ServerSync.jsx@@ -7,7 +7,7 @@ import { useStore } from '../store/useStore.js'import { useUI } from '../store/useUI.js'import { t, tn } from '../lib/i18n.js'import { fmtAgo, changeCount } from '../lib/format.js'-import { passkeyLogin, webauthnOK } from '../lib/api.js'+import { passkeyLogin, passkeyError, webauthnOK } from '../lib/api.js'import { MOBILE } from '../lib/mobile.js'import { syncMedia } from '../lib/media-sync.js'import { DEMO } from '../lib/demo.js'@@ -136,7 +136,7 @@ export async function passkeySignIn() {st.setUser(u, { adopt: true })await st.adoptProfile(askAddDeviceData)toast(t('Welcome back, {0}', u.name))- } catch (e) { if (e.name !== 'NotAllowedError' && e.name !== 'AbortError') toast(e.message || t('Sign-in failed')) }+ } catch (e) { if (e.name !== 'NotAllowedError' && e.name !== 'AbortError') toast(passkeyError(e, t('Sign-in failed'))) }}/* ---------------------------------------------------------- leaving the server ---------------diff --git a/frontend/src/lib/api.js b/frontend/src/lib/api.jsindex bb38a4a3c..7537cc660 100644--- a/frontend/src/lib/api.js+++ b/frontend/src/lib/api.js@@ -343,6 +343,18 @@ function credToJSON(cred) {}return out}+// A passkey sign-in or sign-up the server refused, in the UI language. The routes send a stable+// `code` beside their English message; an answer without one (an older server, a verify error)+// is shown as it came.+export function passkeyError(e, fallback) {+ switch (e?.data?.code) {+ case 'invite': return t('That invite code is not valid.')+ case 'unknown-credential': return t('This server doesn’t know that passkey. Make a profile first.')+ case 'disabled': return t('This account has been disabled.')+ case 'challenge-expired': return t('That took a little too long. Give it another go.')+ }+ return e?.message || fallback+}export async function passkeyRegister(name, code) {const { cid, options } = await api('/api/register/options', { method: 'POST', body: JSON.stringify({ name, code: code || '' }) })const cred = await navigator.credentials.create({ publicKey: toCreationOptions(options) })diff --git a/frontend/src/lib/api.test.js b/frontend/src/lib/api.test.jsindex 02cb9ef74..3c8455812 100644--- a/frontend/src/lib/api.test.js+++ b/frontend/src/lib/api.test.js@@ -1,6 +1,7 @@// @vitest-environment happy-domimport { afterEach, describe, expect, it, vi } from 'vitest'-import { webauthnOK, bio, vault, BIO, VAULT } from './api.js'+import { webauthnOK, bio, vault, BIO, VAULT, passkeyError } from './api.js'+import de from '../locales/de.js'import { _setLangState } from './i18n-core.js'const originalPublicKeyCredential = window.PublicKeyCredential@@ -185,3 +186,21 @@ describe('bio / vault', () => {expect(vault()).toBe('VAULT-de')})})++// The passkey routes answer in English with a stable `code`; the toast used to show the English+// line ("unknown passkey, create a profile first") in every language.+describe('passkeyError', () => {+ afterEach(() => _setLangState('en', {}, null, null))+ const refused = (code, message) => Object.assign(new Error(message), { status: 400, data: { error: message, code } })+ it('says each refusal in the UI language', () => {+ _setLangState('de', de, null, null)+ expect(passkeyError(refused('invite', 'a valid invite code is required'), 'x')).toBe(de['That invite code is not valid.'])+ expect(passkeyError(refused('unknown-credential', 'unknown passkey, create a profile first'), 'x')).toBe(de['This server doesn’t know that passkey. Make a profile first.'])+ expect(passkeyError(refused('disabled', 'this account has been disabled'), 'x')).toBe(de['This account has been disabled.'])+ expect(passkeyError(refused('challenge-expired', 'challenge expired, try again'), 'x')).toBe(de['That took a little too long. Give it another go.'])+ })+ it('an answer without a code is shown as it came, and nothing at all falls back', () => {+ expect(passkeyError(refused(undefined, 'credential already registered'), 'Sign-in failed')).toBe('credential already registered')+ expect(passkeyError({}, 'Sign-in failed')).toBe('Sign-in failed')+ })+})diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.jsindex 665829c46..be1fa9230 100644--- a/frontend/src/locales/ar.js+++ b/frontend/src/locales/ar.js@@ -1952,4 +1952,6 @@ export default {'That file isn’t an openGym backup.': 'هذا الملف ليس نسخة احتياطية من openGym.','That zip was repacked. Import the original backup file.': 'أُعيد ضغط ملف zip هذا. استورد ملف النسخة الاحتياطية الأصلي.','Couldn’t read that file.': 'تعذّرت قراءة هذا الملف.',+ 'This server doesn’t know that passkey. Make a profile first.': 'هذا الخادم لا يعرف مفتاح المرور هذا. أنشئ ملفًا شخصيًا أولًا.',+ 'That took a little too long. Give it another go.': 'استغرق ذلك وقتًا أطول قليلًا من اللازم. جرّب مرة أخرى.',}diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.jsindex 767023b71..945d8f0b0 100644--- a/frontend/src/locales/de.js+++ b/frontend/src/locales/de.js@@ -1919,4 +1919,6 @@ export default {'That file isn’t an openGym backup.': 'Diese Datei ist kein openGym-Backup.','That zip was repacked. Import the original backup file.': 'Dieses ZIP wurde neu gepackt. Importiere die originale Backup-Datei.','Couldn’t read that file.': 'Diese Datei lässt sich nicht lesen.',+ 'This server doesn’t know that passkey. Make a profile first.': 'Diesen Passkey kennt der Server nicht. Erstell zuerst ein Profil.',+ 'That took a little too long. Give it another go.': 'Das hat etwas zu lange gedauert. Versuch es gleich noch mal.',}diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.jsindex 6fe684644..5548441b3 100644--- a/frontend/src/locales/es.js+++ b/frontend/src/locales/es.js@@ -1899,4 +1899,6 @@ export default {'That file isn’t an openGym backup.': 'Ese archivo no es una copia de openGym.','That zip was repacked. Import the original backup file.': 'Ese zip se volvió a empaquetar. Importa el archivo de copia original.','Couldn’t read that file.': 'No se pudo leer ese archivo.',+ 'This server doesn’t know that passkey. Make a profile first.': 'Este servidor no conoce esa passkey. Crea un perfil primero.',+ 'That took a little too long. Give it another go.': 'Eso tardó un poco de más. Inténtalo otra vez.',}diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.jsindex f73d2d5a9..f9f7c4bb8 100644--- a/frontend/src/locales/fr.js+++ b/frontend/src/locales/fr.js@@ -1899,4 +1899,6 @@ export default {'That file isn’t an openGym backup.': 'Ce fichier n’est pas une sauvegarde openGym.','That zip was repacked. Import the original backup file.': 'Ce zip a été recompressé. Importe le fichier de sauvegarde d’origine.','Couldn’t read that file.': 'Impossible de lire ce fichier.',+ 'This server doesn’t know that passkey. Make a profile first.': 'Ce serveur ne connaît pas cette passkey. Crée d’abord un profil.',+ 'That took a little too long. Give it another go.': 'C’était un peu trop long. Réessaie.',}diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.jsindex a43a17207..816c701cf 100644--- a/frontend/src/locales/hi.js+++ b/frontend/src/locales/hi.js@@ -1899,4 +1899,6 @@ export default {'That file isn’t an openGym backup.': 'यह फ़ाइल openGym बैकअप नहीं है।','That zip was repacked. Import the original backup file.': 'यह zip दोबारा पैक की गई है। मूल बैकअप फ़ाइल इम्पोर्ट करें।','Couldn’t read that file.': 'यह फ़ाइल पढ़ी नहीं जा सकी।',+ 'This server doesn’t know that passkey. Make a profile first.': 'यह सर्वर इस पासकी को नहीं पहचानता। पहले एक प्रोफ़ाइल बनाएँ।',+ 'That took a little too long. Give it another go.': 'इसमें थोड़ा ज़्यादा समय लग गया। एक बार फिर कोशिश करें।',}diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.jsindex d9c98dbc3..a60013a59 100644--- a/frontend/src/locales/hu.js+++ b/frontend/src/locales/hu.js@@ -1902,4 +1902,6 @@ export default {'That file isn’t an openGym backup.': 'Ez a fájl nem openGym-mentés.','That zip was repacked. Import the original backup file.': 'Ezt a zipet újracsomagolták. Az eredeti mentésfájlt importáld.','Couldn’t read that file.': 'Ezt a fájlt nem sikerült beolvasni.',+ 'This server doesn’t know that passkey. Make a profile first.': 'Ez a szerver nem ismeri ezt a jelszókulcsot. Előbb hozz létre egy profilt.',+ 'That took a little too long. Give it another go.': 'Ez egy kicsit túl sokáig tartott. Próbáld újra.',}diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.jsindex 1e27740ee..679695e9f 100644--- a/frontend/src/locales/it.js+++ b/frontend/src/locales/it.js@@ -1899,4 +1899,6 @@ export default {'That file isn’t an openGym backup.': 'Questo file non è un backup di openGym.','That zip was repacked. Import the original backup file.': 'Questo zip è stato ricompresso. Importa il file di backup originale.','Couldn’t read that file.': 'Impossibile leggere questo file.',+ 'This server doesn’t know that passkey. Make a profile first.': 'Questo server non conosce questa passkey. Crea prima un profilo.',+ 'That took a little too long. Give it another go.': 'Ci è voluto un po’ troppo. Riprova.',}diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.jsindex 43f5eb0d2..050ae0692 100644--- a/frontend/src/locales/ko.js+++ b/frontend/src/locales/ko.js@@ -1899,4 +1899,6 @@ export default {'That file isn’t an openGym backup.': '이 파일은 openGym 백업이 아니에요.','That zip was repacked. Import the original backup file.': '이 zip은 다시 압축됐어요. 원본 백업 파일을 가져오세요.','Couldn’t read that file.': '이 파일을 읽을 수 없어요.',+ 'This server doesn’t know that passkey. Make a profile first.': '이 서버는 이 패스키를 몰라요. 먼저 프로필을 만들어 주세요.',+ 'That took a little too long. Give it another go.': '조금 너무 오래 걸렸어요. 다시 해 보세요.',}diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.jsindex 04ab83747..a36c60eea 100644--- a/frontend/src/locales/pl.js+++ b/frontend/src/locales/pl.js@@ -1899,4 +1899,6 @@ export default {'That file isn’t an openGym backup.': 'Ten plik nie jest kopią openGym.','That zip was repacked. Import the original backup file.': 'Ten zip został spakowany na nowo. Zaimportuj oryginalny plik kopii.','Couldn’t read that file.': 'Nie udało się odczytać tego pliku.',+ 'This server doesn’t know that passkey. Make a profile first.': 'Ten serwer nie zna tego passkey. Najpierw utwórz profil.',+ 'That took a little too long. Give it another go.': 'Trwało to trochę za długo. Spróbuj jeszcze raz.',}diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.jsindex 7c1a50d05..8b7736754 100644--- a/frontend/src/locales/pt-BR.js+++ b/frontend/src/locales/pt-BR.js@@ -1178,6 +1178,8 @@ export const PT_BR_OVERRIDES = {'That file isn’t an openGym backup.': 'Esse arquivo não é um backup do openGym.','That zip was repacked. Import the original backup file.': 'Esse zip foi recompactado. Importe o arquivo de backup original.','Couldn’t read that file.': 'Não foi possível ler esse arquivo.',+ 'This server doesn’t know that passkey. Make a profile first.': 'Este servidor não conhece essa chave de acesso. Crie um perfil primeiro.',+ 'That took a little too long. Give it another go.': 'Demorou um pouquinho demais. Tente de novo.',}export default { ...pt, ...PT_BR_OVERRIDES }diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.jsindex 66f6f57b0..d6e7b14fc 100644--- a/frontend/src/locales/pt.js+++ b/frontend/src/locales/pt.js@@ -1899,4 +1899,6 @@ export default {'That file isn’t an openGym backup.': 'Esse ficheiro não é uma cópia de segurança do openGym.','That zip was repacked. Import the original backup file.': 'Esse zip foi recompactado. Importa o ficheiro de cópia original.','Couldn’t read that file.': 'Não foi possível ler esse ficheiro.',+ 'This server doesn’t know that passkey. Make a profile first.': 'Este servidor não conhece essa passkey. Cria primeiro um perfil.',+ 'That took a little too long. Give it another go.': 'Demorou um bocadinho demais. Tenta outra vez.',}diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.jsindex 430191181..da02075a8 100644--- a/frontend/src/locales/ru.js+++ b/frontend/src/locales/ru.js@@ -1903,4 +1903,6 @@ export default {'That file isn’t an openGym backup.': 'Этот файл не резервная копия openGym.','That zip was repacked. Import the original backup file.': 'Этот zip перепаковали. Импортируй исходный файл резервной копии.','Couldn’t read that file.': 'Не удалось прочитать этот файл.',+ 'This server doesn’t know that passkey. Make a profile first.': 'Этот сервер не знает такой ключ доступа. Сначала создайте профиль.',+ 'That took a little too long. Give it another go.': 'Это заняло слишком много времени. Попробуйте ещё раз.',}diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.jsindex abdaa2c94..749728f10 100644--- a/frontend/src/locales/th.js+++ b/frontend/src/locales/th.js@@ -1910,4 +1910,6 @@ export default {'That file isn’t an openGym backup.': 'ไฟล์นี้ไม่ใช่ข้อมูลสำรองของ openGym','That zip was repacked. Import the original backup file.': 'zip นี้ถูกบีบอัดใหม่ นำเข้าไฟล์สำรองต้นฉบับแทน','Couldn’t read that file.': 'อ่านไฟล์นี้ไม่ได้',+ 'This server doesn’t know that passkey. Make a profile first.': 'เซิร์ฟเวอร์นี้ไม่รู้จักพาสคีย์นี้ สร้างโปรไฟล์ก่อนนะ',+ 'That took a little too long. Give it another go.': 'ใช้เวลานานไปหน่อย ลองอีกครั้งนะ',}diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.jsindex 5596b605b..092c1bf2c 100644--- a/frontend/src/locales/tr.js+++ b/frontend/src/locales/tr.js@@ -1899,4 +1899,6 @@ export default {'That file isn’t an openGym backup.': 'Bu dosya bir openGym yedeği değil.','That zip was repacked. Import the original backup file.': 'Bu zip yeniden paketlenmiş. Orijinal yedek dosyasını içe aktar.','Couldn’t read that file.': 'Bu dosya okunamadı.',+ 'This server doesn’t know that passkey. Make a profile first.': 'Bu sunucu o geçiş anahtarını tanımıyor. Önce bir profil oluştur.',+ 'That took a little too long. Give it another go.': 'Bu biraz fazla uzun sürdü. Bir kez daha dene.',}diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.jsindex 840accf63..d7ec9c903 100644--- a/frontend/src/locales/uk.js+++ b/frontend/src/locales/uk.js@@ -1896,4 +1896,6 @@ export default {'That file isn’t an openGym backup.': 'Цей файл не резервна копія openGym.','That zip was repacked. Import the original backup file.': 'Цей zip перепакували. Імпортуй оригінальний файл резервної копії.','Couldn’t read that file.': 'Не вдалося прочитати цей файл.',+ 'This server doesn’t know that passkey. Make a profile first.': 'Цей сервер не знає такого ключа доступу. Спершу створіть профіль.',+ 'That took a little too long. Give it another go.': 'Це тривало трохи задовго. Спробуйте ще раз.',}diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.jsindex cd82afd8b..02a163f00 100644--- a/frontend/src/locales/zh-TW.js+++ b/frontend/src/locales/zh-TW.js@@ -1892,4 +1892,6 @@ export default {'That file isn’t an openGym backup.': '這個檔案不是 openGym 備份。','That zip was repacked. Import the original backup file.': '這個 zip 被重新打包過。請匯入原始備份檔案。','Couldn’t read that file.': '無法讀取這個檔案。',+ 'This server doesn’t know that passkey. Make a profile first.': '這個伺服器不認得這個通行密鑰。請先建立個人檔案。',+ 'That took a little too long. Give it another go.': '花的時間有點太久了。再試一次吧。',}diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.jsindex 86a61d2fb..c662e4ed8 100644--- a/frontend/src/locales/zh.js+++ b/frontend/src/locales/zh.js@@ -1899,4 +1899,6 @@ export default {'That file isn’t an openGym backup.': '这个文件不是 openGym 备份。','That zip was repacked. Import the original backup file.': '这个 zip 被重新打包过。请导入原始备份文件。','Couldn’t read that file.': '无法读取这个文件。',+ 'This server doesn’t know that passkey. Make a profile first.': '这个服务器不认识这个通行密钥。请先创建个人资料。',+ 'That took a little too long. Give it another go.': '花的时间有点太长了。再试一次吧。',}diff --git a/frontend/src/views/Login.jsx b/frontend/src/views/Login.jsxindex acfb29863..714d9bf2b 100644--- a/frontend/src/views/Login.jsx+++ b/frontend/src/views/Login.jsx@@ -1,6 +1,6 @@import { useStore } from '../store/useStore.js'import { useUI } from '../store/useUI.js'-import { webauthnOK, passkeyLogin, passkeyRegister, bio } from '../lib/api.js'+import { webauthnOK, passkeyLogin, passkeyRegister, passkeyError, bio } from '../lib/api.js'import { hasData } from '../store/useStore.js'import { t } from '../lib/i18n.js'import { DEMO, REPO } from '../lib/demo.js'@@ -36,7 +36,7 @@ function RegisterSheet({ close }) {setUser(u); close()if (hasData(useStore.getState().S)) { await pushState(); useUI.getState().toast(t('Profile created, and this device’s data moved into it')) }else { await pullState(); useUI.getState().toast(t('Welcome, {0}', u.name)) }- } catch (e) { if (e.name !== 'NotAllowedError' && e.name !== 'AbortError') useUI.getState().toast(e.message || t('Registration failed')) }+ } catch (e) { if (e.name !== 'NotAllowedError' && e.name !== 'AbortError') useUI.getState().toast(passkeyError(e, t('Registration failed'))) }}const choose = pwOn && webauthnOK() && <><Segmented options={[{ value: 'passkey', label: t('Passkey'), icon: 'fingerprint' }, { value: 'password', label: t('Password'), icon: 'key' }]}@@ -73,7 +73,7 @@ export default function Login() {const register = () => useUI.getState().openSheet(close => <RegisterSheet close={close} />)const signIn = async () => {try { const u = await passkeyLogin(); setUser(u, { adopt: true }); await adoptProfile(askAddDeviceData); 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')) }+ catch (e) { if (e.name !== 'NotAllowedError' && e.name !== 'AbortError') useUI.getState().toast(passkeyError(e, t('Sign-in failed'))) }}const head = <><div style={{ fontSize: 54, display: 'flex', justifyContent: 'center', color: 'var(--acc)' }}><Icon name="dumbbell" /></div>diff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsxindex cb24cd86c..a9b26aeb4 100644--- a/frontend/src/views/Settings.jsx+++ b/frontend/src/views/Settings.jsx@@ -11,7 +11,7 @@ import { effortOf } from '../lib/history.js'import { unlock, playOnSilentSupported, vibrateSupported, appleTouchDevice } from '../lib/sound.js'import { scheduleModeOf, chooseFixedWeek, chooseRotation } from '../lib/rotation.js'import { queueOf } from '../lib/queue.js'-import { api, webauthnOK, passkeyRegister, IS_ANDROID } from '../lib/api.js'+import { api, webauthnOK, passkeyRegister, passkeyError, IS_ANDROID } from '../lib/api.js'import { pushSupported, enablePush, disablePush, sendTestPush, syncPushSubscription } from '../lib/push.js'import { wakeLockSupported } from '../lib/wakelock.js'import { t, tn, LANGS, INSTR_LANGS, EXERCISE_NAME_LANGS, baseLang, dateLocale } from '../lib/i18n.js'@@ -1236,7 +1236,7 @@ function RegisterInline({ close, setUser, pushState, pullState, toast }) {const u = await passkeyRegister(n, code.trim()); setUser(u); close()if (hasData(useStore.getState().S)) { await pushState(); toast(t('Profile created, and your data moved into it')) }else { await pullState(); toast(t('Welcome, {0}', u.name)) }- } catch (e) { if (e.name !== 'NotAllowedError' && e.name !== 'AbortError') toast(e.message || t('Registration failed')) }+ } catch (e) { if (e.name !== 'NotAllowedError' && e.name !== 'AbortError') toast(passkeyError(e, t('Registration failed'))) }}return <><h3>{t('Create your profile')}</h3>