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
Code health: drop exports nothing imports any more (vault, gymReminderAvailable, pushPermission, REPORT_RANGES, matchesExerciseSearch)
Duarte Santos3cfaa9bd6557
diff --git a/frontend/src/lib/api.js b/frontend/src/lib/api.jsindex 20d0b7ceb..bee8e221e 100644--- a/frontend/src/lib/api.js+++ b/frontend/src/lib/api.js@@ -7,12 +7,10 @@ import { nativeFetch } from './capacitor-fetch.js'export const IS_APPLE = /iPhone|iPad|iPod|Macintosh/.test(navigator.userAgent)export const IS_ANDROID = /Android/.test(navigator.userAgent)export const BIO = IS_APPLE ? 'Face ID / Touch ID' : IS_ANDROID ? 'fingerprint or face unlock' : 'your fingerprint, face or PIN'-export const VAULT = IS_APPLE ? 'iCloud Keychain' : IS_ANDROID ? 'Google Password Manager' : 'your password manager'-// The same phrases in the UI language. They go into translated sentences ("confirm with {0}"),-// so the English constants above left an English phrase in the middle of every other language.+// The same phrase in the UI language. It goes into translated sentences ("confirm with {0}"),+// so the English constant above left an English phrase in the middle of every other language.// Functions, not constants: the pack is loaded after this module is.export const bio = () => (IS_APPLE ? t('Face ID / Touch ID') : IS_ANDROID ? t('fingerprint or face unlock') : t('your fingerprint, face or PIN'))-export const vault = () => (IS_APPLE ? t('iCloud Keychain') : IS_ANDROID ? t('Google Password Manager') : t('your password manager'))// PublicKeyCredential is the WebAuthn-specific capability signal. Do not also gate the UI on// navigator.credentials: some browsers expose WebAuthn while that generic Credential Management// API check produces a false negative (notably Chrome on iOS). The real create/get calls still rundiff --git a/frontend/src/lib/api.test.js b/frontend/src/lib/api.test.jsindex 3c8455812..ec64e7cff 100644--- a/frontend/src/lib/api.test.js+++ b/frontend/src/lib/api.test.js@@ -1,6 +1,6 @@// @vitest-environment happy-domimport { afterEach, describe, expect, it, vi } from 'vitest'-import { webauthnOK, bio, vault, BIO, VAULT, passkeyError } from './api.js'+import { webauthnOK, bio, BIO, passkeyError } from './api.js'import de from '../locales/de.js'import { _setLangState } from './i18n-core.js'@@ -176,14 +176,12 @@ describe('passkeyAssertion', () => {// QA 1.3.9: "confirm with {0}" was translated and {0} was not — a German sign-in page read// "…bestätige mit your fingerprint, face or PIN".-describe('bio / vault', () => {+describe('bio', () => {afterEach(() => _setLangState('en', {}, null, null))it('reads the platform phrase in the UI language', () => {expect(bio()).toBe(BIO)- expect(vault()).toBe(VAULT)- _setLangState('de', { [BIO]: 'BIO-de', [VAULT]: 'VAULT-de' }, null, null)+ _setLangState('de', { [BIO]: 'BIO-de' }, null, null)expect(bio()).toBe('BIO-de')- expect(vault()).toBe('VAULT-de')})})diff --git a/frontend/src/lib/exercises.js b/frontend/src/lib/exercises.jsindex 12585a9b4..1f18230c1 100644--- a/frontend/src/lib/exercises.js+++ b/frontend/src/lib/exercises.js@@ -137,8 +137,7 @@ function isSubsequence(needle, hay) {// field prefix, then word-boundary starts, then substrings (closer to the start scores// better), and finally typo-tolerant ordered subsequences. Fields are weighted - the name// dominates, target/equipment matter, muscles and description are supporting evidence.-// 0 means no match, so matchesExerciseSearch stays a boolean filter while the picker can-// rank results by score.+// 0 means no match, so a filter can test `> 0` while the picker ranks results by score.export function searchScore(exercise, query) {const needle = searchableText(query).toLowerCase().trim()if (!needle) return 1@@ -167,10 +166,6 @@ export function searchScore(exercise, query) {return total}-export function matchesExerciseSearch(exercise, query) {- return searchScore(exercise, query) > 0-}-// Media normally sits next to the app (img/ and gif/, mounted into the web container).// A build can point them somewhere else — the demo build pulls them off a CDN instead of// shipping ~140 MB of images into the deployment. `import.meta.env` is undefined in plaindiff --git a/frontend/src/lib/gym-reminder.js b/frontend/src/lib/gym-reminder.jsindex 2144735f0..2e3d55711 100644--- a/frontend/src/lib/gym-reminder.js+++ b/frontend/src/lib/gym-reminder.js@@ -165,11 +165,6 @@ const gymPlugin = () => pluginP || (pluginP = (async () => {return { GymReminder: registerPlugin('GymReminder'), platform: p }})().catch(() => null))-/** Whether this device can have a gym reminder at all: the phone app, nothing else. */-export async function gymReminderAvailable() {- return !!(await gymPlugin())-}-/*** The config as the native side holds it (it outlives an evicted WebView storage), falling back* to this page's mirror. Returns { config, permission }.diff --git a/frontend/src/lib/push.js b/frontend/src/lib/push.jsindex 2b37e2933..a35ed7749 100644--- a/frontend/src/lib/push.js+++ b/frontend/src/lib/push.js@@ -6,7 +6,6 @@ import { api } from './api.js'// worker and `navigator.serviceWorker.ready` never settles — the toggle looked usable and hung.const secureOrigin = () => typeof location === 'undefined' || location.protocol === 'https:'export const pushSupported = () => 'serviceWorker' in navigator && 'PushManager' in window && 'Notification' in window && secureOrigin()-export const pushPermission = () => (pushSupported() ? Notification.permission : 'unsupported')const urlBase64ToUint8Array = b64 => {const padded = (b64 + '='.repeat((4 - b64.length % 4) % 4)).replace(/-/g, '+').replace(/_/g, '/')diff --git a/frontend/src/lib/report.js b/frontend/src/lib/report.jsindex 2d7e83abf..f0fab86b2 100644--- a/frontend/src/lib/report.js+++ b/frontend/src/lib/report.js@@ -18,7 +18,6 @@ import { isAssisted } from './exercises.js'import { weighInAt } from './bodyweight.js'import { isoOf, todayISO, weekKey, weekStartOf } from './format.js'-export const REPORT_RANGES = ['7d', '4w', '3m', 'custom']const DAY = 86400000const dateOf = iso => new Date(iso + 'T12:00:00')