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
Fix media paths on routine detail, map the Hevy names that fell through
Duarte Santosa7d7f5c24b1d
diff --git a/docs/SELF_HOSTING.md b/docs/SELF_HOSTING.mdindex d130cfe9a..695317fc5 100644--- a/docs/SELF_HOSTING.md+++ b/docs/SELF_HOSTING.md@@ -178,3 +178,14 @@ downloaded media are untouched.| Day reminder fires at the wrong time | Toggle it off and on in Settings so it re-detects your browser's timezone (also happens automatically on every app load — see section 6). || Want to reset a stuck login | Delete the cookie in your browser; sessions are just signed cookies. || `docker compose pull` fails with "denied" / "unauthorized" | The prebuilt images aren't published yet, or need to be, or the GHCR package is still private — build from source instead (`docker compose up -d --build`). |+| Exercise images/GIFs blank when a routine is open | Fixed in current images (issue #79). On an older build, see the note below. |++### `VITE_IMG_BASE` / `VITE_GIF_BASE` are build-time, not run-time++These two are read by Vite when the frontend is **compiled**, so their values are baked into+the shipped JavaScript bundle. Setting them in the `.env` next to `docker compose` has no+effect on an already-built image — the bundle has already made up its mind.++They are only useful if you build the frontend yourself (`docker compose up -d --build`, or a+`npm run build` with the variables exported). If you need to redirect media on a prebuilt+image, do it in your reverse proxy instead.diff --git a/frontend/src/lib/exercises.js b/frontend/src/lib/exercises.jsindex f47cb88f4..27ec70145 100644--- a/frontend/src/lib/exercises.js+++ b/frontend/src/lib/exercises.js@@ -50,9 +50,14 @@ export const allExercises = st => [...(st.customEx || []), ...EXDB]// 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 plain// Node; the guard keeps this module loadable without Vite.+// The defaults are absolute on purpose (issue #79). A bare 'img/' resolves against the+// current document's directory, so on the one two-segment route in the app, /plan/r/:id,+// every request went to /plan/r/img/… and 404'd — and nginx's extension block has no+// try_files, so it 404s rather than falling through to index.html, leaving a blank image+// and nothing in the console.const ENV = import.meta.env || {}-const IMG_BASE = ENV.VITE_IMG_BASE || 'img/'-const GIF_BASE = ENV.VITE_GIF_BASE || 'gif/'+const IMG_BASE = ENV.VITE_IMG_BASE || '/img/'+const GIF_BASE = ENV.VITE_GIF_BASE || '/gif/'export const imgSrc = ex => IMG_BASE + ex.imgexport const gifSrc = ex => GIF_BASE + ex.gifdiff --git a/frontend/src/lib/import-csv.js b/frontend/src/lib/import-csv.jsindex 125ca588c..b09f9840b 100644--- a/frontend/src/lib/import-csv.js+++ b/frontend/src/lib/import-csv.js@@ -173,6 +173,17 @@ const ALIAS_EX = {'tricep pushdown': '0241', 'triceps pushdown': '0241', pushdown: '0241',skullcrusher: '0060', 'skull crusher': '0060', 'lying triceps extension': '0061',lunge: '0054', lunges: '0054', 'cable crossover': '1269', 'cable cross over': '1269',+ 'goblet squat': '1760', 'dumbbell goblet squat': '1760', 'kettlebell goblet squat': '0534',+ // Reported in issue #74: these come out of Hevy under names no word-overlap can reach, so+ // they landed as custom exercises. The catalogue's cardio vocabulary is thin (29 of 1,324+ // entries), so each of these is the *only* candidate rather than the best of several.+ treadmill: '3666', 'treadmill walk': '3666', 'treadmill run': '3666',+ cycling: '2331', 'cross trainer': '2331', elliptical: '2141',+ 'stationary bike': '2138', 'exercise bike': '2138', 'stepmill': '2311',+ // The catalogue has only band Pallof presses, so a cable one resolves to the band entry:+ // same movement, wrong equipment label, which beats leaving it uncategorised.+ 'pallof press': '0979', 'cable pallof press': '0979', 'vertical pallof press': '1015',+ 'cable core pallof press': '0979', 'core pallof press': '0979',}let ALIAS_IDX = nulldiff --git a/frontend/src/lib/import-match.test.js b/frontend/src/lib/import-match.test.jsnew file mode 100644index 000000000..631b66710--- /dev/null+++ b/frontend/src/lib/import-match.test.js@@ -0,0 +1,50 @@+import { describe, it, expect } from 'vitest'+import { matchExercise } from './import-csv.js'+import { EXIDX } from './exercises.js'++// The names other apps actually export, and the catalogue entry each has to land on.+// Everything here was reported as arriving in the app as a *custom* exercise (issue #74):+// the alias table is the intended place to fix that, so these pin it.+const MAPS = {+ Treadmill: '3666',+ 'Goblet Squat': '1760',+ Cycling: '2331',+ 'Cable Core Pallof Press': '0979',+ Elliptical: '2141',+ 'Stationary Bike': '2138',+}++describe('foreign exercise names resolve to the catalogue', () => {+ for (const [name, id] of Object.entries(MAPS)) {+ it(`maps "${name}" to ${id}`, () => {+ expect(matchExercise(name)).toBe(id)+ expect(EXIDX[id]).toBeTruthy() // an alias pointing at a dropped id is worse than no alias+ })+ }++ // Equipment qualifiers must still beat the bare alias, or an import files years of+ // dumbbell work under the barbell lift.+ it('keeps the qualified variants distinct', () => {+ expect(matchExercise('Kettlebell Goblet Squat')).toBe('0534')+ expect(matchExercise('Dumbbell Goblet Squat')).toBe('1760')+ })++ // The word-bag is order-insensitive, which is what lets one alias cover the two ways+ // exporters write the same movement.+ it('ignores word order and case', () => {+ expect(matchExercise('Squat (Barbell)')).toBe(matchExercise('Barbell Squat'))+ })++ // Regression guard for the aliases added above: the common lifts must not have moved.+ it('leaves the established aliases alone', () => {+ expect(matchExercise('Bench Press')).toBe('0025')+ expect(matchExercise('Squat')).toBe('0043')+ expect(matchExercise('Barbell Row')).toBe('0027')+ expect(matchExercise('Deadlift')).toBe('0032')+ })++ it('still refuses to guess', () => {+ expect(matchExercise('Some Movement I Invented')).toBe(null)+ expect(matchExercise('')).toBe(null)+ })+})