5c69540f62b52e4bd71431230a77e8d1cbadd15e
7
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
aa6ec8ef22 |
Salud: a card opens onto the day, hour by hour, and onto the days before it
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
Reported as "le doy a cualquier actividad y solo me presenta los pasos de hoy… debiera presentarme una medida por hora, y no me da el histórico". Two separate things, and only one of them was the app's fault. **The history was the automation's setting.** With Date Range on its default (`Today`) every sync carries today and nothing else, so there is exactly one day in the file to draw. That is why a card looked frozen: not a rendering bug, a range that was never sent. The setup steps now say `Previous 7 Days` and say why. **The hours were thrown away by us.** Even when the phone sends 288 readings a day, the receiver folded every one of them into a single day aggregate, so "8,123 steps today" was all there could ever be — a number you cannot look into. Worse, the recommended setting was Time Grouping `Days`, which sends one point per metric per day: the intraday detail never arrived in the first place. The recommendation is now `Hours`, and the storage keeps the hours. The merge rule for them is the same shape as the day rule, for the same reason: a payload whose datapoints all sit on the hour is HAE's own hour grouping, and the hour *in progress* grows on every run of a five-minute automation, so it is replaced and never unioned — 500 + 900 + 1,340 steps in one hour is a number no watch recorded. The day is then recomputed as the sum of its hours, which is what keeps the card and the detail from ever disagreeing, and which also makes switching an automation from Days to Hours mid-day converge instead of double-count. Raw samples (real timestamps) still union by instant plus numbers, and they now land in their own hour, which is where intraday detail comes from when nothing is grouped. Three things that would have been silent bugs, caught while writing it: - The hour rule is decided from the **whole payload**, never from one timestamp. A five-minute automation produces samples that sit exactly on the hour, and reading one of those as an hour total wipes the hour it belongs to. There is a test with a 09:00:00 and a 09:05:00 sample in one payload, and it fails against the per-point version of the rule. - A day that arrived as a day total keeps its hours beside it, and a day stored before this existed keeps its aggregate when the first hour shows up — recomputing it from hours it does not have would delete 2,000 steps. Both are mutation-checked (removing either guard fails a test). - A payload grouped by hour writes the ledger row anyway, because a later payload with real minutes can describe the same instant and the union path can only see the ledger. Without it the raw-sample route test double-counts a single sample. The hours are the bulky part of this data, so they are kept for a week (the day aggregates still live the full 400 days), pruned when the night's file is written, and fetched one metric and one day at a time — `GET /api/vitals/hours`. A screen listing forty cards downloads none of them; the day view carries only a count per day, which is what tells the sheet whether it is worth asking. The sheet draws the hours, the days before it (tapping one moves the hour list to that day), and every field the watch sent; when the automation groups by Days it says so instead of leaving a gap where a chart should be. Coverage: 6 new tests in `api/test/vitals.test.js` (19 total) and a route test in `api/test/server-vitals.test.js` (5), the hour/history model in `vitals-view.test.js` (31), three render tests through the real sheet, the route documented in `api/openapi.yaml` and `website/api.html`, and `docs/HEALTH.md` with the settings, the new merge row and the two symptoms now in Troubleshooting. |
||
|
|
caed0cbaa0 |
Música: a playlist screen per profile, with Apple's limits stated plainly
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
The idea was "each person types their Apple Music username and their public playlists appear". Apple does not allow that, and it is worth writing down rather than discovering later: there is no API for another person's public playlists — their own developer forums answer that request with "you can't" (threads 692941 and 123894) — and a profile page is rendered by JavaScript with nothing behind it to call. MusicKit offers the catalog and the *signed-in* user's own library, and the second needs an Apple Developer Program membership for a developer token plus a Music-User-Token per person: a private key and a third-party secret in an app that holds none, to fetch something other than what was asked for. What a self-hosted app can do is the share link, which every playlist has: Music → Share → Copy Link. So the Música screen (next to Salud in Home's header, plus a section in Settings) keeps a list of them per profile, in the profile document like the routines — so they sync to the other devices and travel in a backup — and tapping one opens it in Apple Music on the iPhone. The username is a link to the person's public profile. The list is nicer than a column of URLs because the API reads each link's public page for a title, artwork and track count. That is scraping, so it is built to lose: a page that says nothing leaves the card showing the name its owner typed, and nothing on the screen depends on it. `POST /api/music/lookup` is host-allowlisted to Apple's music hosts — https only, checked again on the URL a redirect lands on — because the api container sits on the same network as everything else the owner runs, and a route that fetches whatever it is handed is a request-forgery lever. That boundary has its own tests, including the LAN addresses it must refuse. The parsing lives in api/music.js rather than in both halves: two copies of a parser kept in step by hand is a bomb, and this is the same shape as vitals.js. It is in the Dockerfile's COPY for the same reason vitals.js had to be. |
||
|
|
c3c1c2836c |
Salud: Today by default, chart panels, and an aura behind the whole app
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
Three things the screen was missing, plus the launch photo.
**Today.** The period filter started at 30 days, which buried the question a five-minute
cadence exists to answer: what do the numbers say right now? "Today" is now first and the
default, and it means today — the grid drops metrics nobody has measured today (the scale
is not stepped on every morning), and if nothing has come in yet the grid falls back to
everything and says so rather than showing an empty screen. The number on every card was
always the newest reading; what is new is that the card says which day it is and when it
landed ("hoy · hace 12 min"), so the claim can be checked instead of trusted. The screen
also refreshes itself every minute while it is open, which is what makes a five-minute
cadence visible.
The filter and the charts want different windows, and the view keeps them apart: a
sparkline or a trend needs history, so the fetch never asks for less than a week even in
"Today", and anything labelled with a window says which one it is. (The alternative —
fetching one day and drawing nothing — would have made Today the one mode with no charts.)
**Chart panels.** Every tile carries a 52px sparkline, which shows a shape and cannot be
read. The first few metrics in the catalogue's own order now get a full-width panel each:
axes, the window's min / avg / max, and the card's own colour, so a panel and its tile are
recognisably the same metric.
**The aura.** index.html carries the three "Diamond Weave" layers and index.css puts the
base colour on `body` where the blend modes composite against it, with `#app` lifted to
z-index 1 so the absolutely-positioned layers cannot paint over the page (everything modal
was already higher). Dark keeps `screen`; the light theme switches the same layers to
`multiply`, because screened amber over white is amber that has been washed away. The blur
radii follow the spec per breakpoint, and the layers are fixed rather than absolute so
scrolling never repaints two 200px blurs.
**The launch screen.** assets/splash.jpg is a 3862×5786 photograph from a camera, so
nothing ships it raw: build-app-icons.mjs now derives public/splash.webp (1170px wide, 62 KB
— WebP because it is a photo) for the boot screen and resources/splash.jpg (2732×2732,
fitted on the aura's base colour rather than cropped, so a portrait composition survives)
for @capacitor/assets. The 12 MB original is gitignored: the derived files are committed,
so a clone still builds, and the script says what is missing when regeneration is asked for
without it.
|
||
|
|
691e664d3f |
Apple Health (Salud): a per-profile ingest endpoint, and a tab that draws it
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
An iOS automation in Health Auto Export POSTs Apple Health to /api/vitals/ingest, and the new Salud tab (next to Plan) draws whatever arrived: steps, heart rate, sleep, weight, oxygen, workouts and every other metric HAE can export, grouped into cards with a trend, a sparkline and a 7/30/90/365-day range. Nothing on that screen is an input, and the watch's workouts stay out of the history on purpose — they carry no sets and no weights, so folding them into progression, PRs and the recovery model would be inventing data. The interesting part is duplicates. A five-minute automation re-sends overlapping windows: with Date Range "Today", appending would count a day of steps again on every run, and with "Since Last Sync", replacing would throw away everything but the last five minutes. So the endpoint decides per payload instead. Datapoints that sit on midnight are HAE's own day grouping, i.e. a *total*, and a day total replaces the day it names — re-sending the same day all afternoon converges on that day's total. Anything else is a real sample, identified by its instant plus its numbers and stored once, which is right for overlapping and disjoint windows alike. Every sync answers with a receipt (received / duplicates / stored), so a misconfigured automation is visible rather than silent, and day keys come from the date the phone wrote — never the server's clock, or every evening's steps would land on tomorrow. Per profile and private by construction. Each profile mints its own ingest key (Salud → ⚙), which is write-only: it can add to that one profile's health file and cannot read a single number back, so a key leaking out of a phone is a nuisance rather than a disclosure. It is its own credential, so rotating it disconnects a phone without signing anybody out anywhere. The data lives in data/vitals-<uid>.json, outside the synced state document, so a year of heart rate never round-trips through localStorage on every device, and it is bounded on write: 400 days per metric, a 72 h dedupe ledger, the newest 300 workouts. Two traps that only exist in production, both fixed here and both of which would have shipped broken. api/Dockerfile copies the modules server.js imports by name, and vitals.js was not on that list — a container that boots straight into ERR_MODULE_NOT_FOUND. And the web container's nginx capped every /api body at 5 MB, which a health export with Summarize Data off exceeds; that one route now gets the API's own 32 MB while every other path keeps 5 MB, with the shared proxy settings hoisted to server level so the two locations cannot drift apart. Coverage: vitals.js (13 tests — overlapping, disjoint, day-grouped, raw, heart rate, sleep, blood pressure, pruning, timezones), the routes against a real server (4 — isolation between profiles, a key that cannot read, ten re-sends changing nothing), the card model (18) and the screen (4). docs/HEALTH.md has the Health Auto Export settings and the merge table; the five endpoints are in api/openapi.yaml under the health tag, and website/api.html is rebuilt from it. |
||
|
|
87bfd6d4c4 |
Rebrand to KuentaGYM, and start a new profile in pounds and Spanish
The app is now KuentaGYM everywhere a user can see it, and a fresh profile no longer starts on upstream's English/kg defaults. Both are this fork's decisions, so both are pinned by tests rather than left to a find-and-replace. Rename (1,270 references, 149 files) - Visible surfaces: the Login/Home/mobile-onboarding wordmark, the Settings version line, the printed plan, the PWA title + manifest, and the 17 branded strings across all 14 locale packs. - Infrastructure: repo links, the container images and the release endpoints now name git.dploy.lol/dsantillan/kuentagym; .gitea/workflows/docker-publish.yml publishes to this forge's registry instead of gitea.com. - The Android/iOS application id stays ch.duartesantos.opengym on purpose: changing it would make the mobile app a different app that could never update an installed copy. Three things the mechanical pass would have broken, fixed here - The update check asked gitlab.com for upstream's releases and would have installed upstream's APK, putting the old name back on the phone. It now reads this fork's Gitea releases API (the assets shape differs), with the tests rewritten to the payload Gitea actually returns. - Renaming the mobile state/pairing files (opengym-state.json, opengym-remote.json) would lose the on-device copy of a history whose WebView storage may have been evicted, and silently unpair the device. Both are read under their old names and written forward under the new ones. - Renaming the exported plan-file marker (openGym_plan) rejected every plan shared before the rename as "not a plan file". Both markers are accepted. Defaults: pounds and Spanish - DEF.unit = 'lb', DEF.lang = 'es', plus every fallback that independently assumed en/kg (the <html lang> attribute, the Settings pickers, the Store, the MCP, the Coach payload). - Server-generated push copy existed only in English and pt-BR, so a Spanish profile would have been notified in English; Spanish added. - The demo seed states unit: 'kg' — its seeded numbers are kilograms, and inheriting the new default would have introduced an 82.4 lb lifter benching 60. - The module-level language in i18n-core stays English: it is the only language whose strings need no pack, so `t()`, dates, numbers and lists agree before a pack loads. Starting there on 'es' formats a Spanish-shaped UI with English strings. Also - api/package.json's test glob missed push-messages.test.js and verify-error.test.js, which sat beside the modules they cover and never ran. - README, docs/, website/ and the issue templates no longer describe upstream's GitLab/GitHub pipeline, Discord, sponsorship or public demo as if they were this fork's; upstream history and attribution are preserved (NOTICE.md). |
||
|
|
7d2460c2c2 |
Merge merge request !20 (intensifiers, pairing, theme, security hardening)
Takes the nine commits as submitted, with three adjustments: - remote.test.js ran in the node environment while remote.js pulls in api.js, which reads navigator.userAgent at module scope — the file failed to import. Same @vitest-environment happy-dom pragma the api tests use. - Drops skills-lock.json. It pins a personal Claude Code skill chain to third-party GitHub repos by hash; that is contributor tooling, not a project artefact, and this project's GitHub access is gone. CLAUDE.md itself is kept — it is an accurate description of the repo. - Corrects two stale claims in that CLAUDE.md: the website deploys from .gitlab-ci.yml, not GitHub Pages, and the CI gate is GitLab, not Gitea Actions with a dormant GitHub copy. pt-BR: 23 of the 44 new pt strings are European (ficheiro, telemóvel, Definições, «guillemets», tu-forms), so they get Brazilian overrides rather than being inherited; fingerprint re-baselined. |
||
|
|
41061c1754 |
Claude Code: Projektdoku (CLAUDE.md) und Skills fuer Tests, A11y, Vite und Changelog installiert
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> |