Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ Dated history of structural work on this repo: the append-only narrative of what
operating facts live in `CLAUDE.md` and the docs ([`docs/README.md`](docs/README.md)).


## [1.12.0] - 2026-12-01

- **People: manage accounts from the page.** The install's first user is now its admin, and their profile has a
**People** sheet: add a person, rename or delete one, create machine tokens, and connect each person's own Strava and
Garmin, without a shell. Another user becomes an admin with `user.js admin <username> on`.
- **Password links.** The admin creates a one-time link for a person (valid 48 hours); the person opens it and chooses
their own password. The admin never knows it. `set-password` keeps working.
- **Coach view, by consent.** Each person has a **Share with my coach** switch in their profile, off by default. An
admin can open the page of a person who shares, read-only, under a banner that says whose page it is. Nothing can be
changed while viewing, and turning the switch off ends the view at once. The operator can set it for someone with
`user.js share <username> on|off`.
- `user.js list` shows two more columns (`admin`, `shares`), and `user.js delete` refuses the only admin.
- Upgrading: nothing to do besides pulling the images; the database gains three small migrations at start. Nobody
shares until they turn it on. See [`docs/guides/several-people.md`](docs/guides/several-people.md).

## [1.11.1] - 2026-11-30

- **Deleting a person while the server is busy leaves nothing behind.** A page build that was already waiting for that
Expand Down
4 changes: 2 additions & 2 deletions README.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ página) y la imagen `loop-web` (sirve la página).

```sh
mkdir loop && cd loop
curl -fsSLO https://raw.githubusercontent.com/mralexsaavedra/loop/v1.11.1/docker/docker-compose.yml
curl -fsSL -o .env https://raw.githubusercontent.com/mralexsaavedra/loop/v1.11.1/docker/example.env
curl -fsSLO https://raw.githubusercontent.com/mralexsaavedra/loop/v1.12.0/docker/docker-compose.yml
curl -fsSL -o .env https://raw.githubusercontent.com/mralexsaavedra/loop/v1.12.0/docker/example.env
mkdir -p files/import files/manuals files/documents
```

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ and the endpoint the iOS Shortcut sends your Apple Health data to. Three contain

```sh
mkdir loop && cd loop
curl -fsSLO https://raw.githubusercontent.com/mralexsaavedra/loop/v1.11.1/docker/docker-compose.yml
curl -fsSL -o .env https://raw.githubusercontent.com/mralexsaavedra/loop/v1.11.1/docker/example.env
curl -fsSLO https://raw.githubusercontent.com/mralexsaavedra/loop/v1.12.0/docker/docker-compose.yml
curl -fsSL -o .env https://raw.githubusercontent.com/mralexsaavedra/loop/v1.12.0/docker/example.env
mkdir -p files/import files/manuals files/documents
```

Expand Down
8 changes: 4 additions & 4 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ services:

loop-server:
# the published image (Docker Hub); `docker compose up -d --build` builds it from a clone instead
image: mralexandersaavedra/loop-server:${HC_VERSION:-1.11.1}
image: mralexandersaavedra/loop-server:${HC_VERSION:-1.12.0}
build:
context: ..
dockerfile: docker/loop-server.Dockerfile
args:
VERSION: ${HC_VERSION:-1.11.1}
VERSION: ${HC_VERSION:-1.12.0}
container_name: loop-server${HC_INSTANCE:+-${HC_INSTANCE}}
restart: unless-stopped
# SIGTERM lets in-flight requests finish for up to 10 s and stops a running build; docker waits this long
Expand Down Expand Up @@ -132,12 +132,12 @@ services:
loop-web:
# the published image (Docker Hub); `docker compose up -d --build` builds it from a clone instead. The nginx
# template and hosts.sh are baked in from services/loop-web (docker/loop-web.Dockerfile), never bind-mounted.
image: mralexandersaavedra/loop-web:${HC_VERSION:-1.11.1}
image: mralexandersaavedra/loop-web:${HC_VERSION:-1.12.0}
build:
context: ..
dockerfile: docker/loop-web.Dockerfile
args:
VERSION: ${HC_VERSION:-1.11.1}
VERSION: ${HC_VERSION:-1.12.0}
container_name: loop-web${HC_INSTANCE:+-${HC_INSTANCE}}
restart: unless-stopped
# The same hardening as services/loop-web/docker-compose.yml: a read-only root filesystem; tmpfs for what the
Expand Down
2 changes: 1 addition & 1 deletion docker/example.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# and is never committed (docker/.gitignore).

# The image tag: mralexandersaavedra/loop-server:<HC_VERSION> and mralexandersaavedra/loop-web:<HC_VERSION>
HC_VERSION=1.11.1
HC_VERSION=1.12.0
# Empty for the first install; a short name (e.g. second) for another install on the same host
HC_INSTANCE=

Expand Down
2 changes: 1 addition & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ test fails (`e2e/.report/`, `e2e/.results/`, both gitignored).
| Project | What it opens | Specs |
| --- | --- | --- |
| `static-phone` (Pixel 7), `static-desktop` (1280 × 800), `webkit-static` (iPhone 15), `webkit-static-es` (iPhone 15, the page built in Spanish, `es-ES` browser) | the example page (tracked seeds + the synthetic demo extract), built by `e2e/global-setup.mjs` into `web/.e2e-dist/<locale>-example/` (one per locale) and opened from `file://`, so every LAN-only feature is off | `e2e/static/`: tabs, dock, keys `1`–`4` and `?`, the URL hash and every deep link (`#detail/<metric>[/<date>]`, view keys, `#d=`, `#monitor`), every visible card's detail sheet on every tab and the ways to close it, the sheet's controls (day, range, window, month, info, learn more, history fold, trend), the ⓘ notes, tab links and folds, both Customize sheets (hide, move, kept after a reload), the Tonight, session and journal-insights views, the profile sheet, the day stepper, layout on both sides of the 900 px breakpoint; in `webkit-static-es` the same specs against the Spanish copy (`<html lang>`, month and date wording) |
| `lan-setup` → `lan-phone` (Pixel 7) → `webkit-lan` (iPhone 15, the same specs, after `lan-phone` because specs own whole days of the shared database) → `lan-last` (Pixel 7); only with `TEST_DATABASE_URL` (`E2E_LAN=0` leaves them out of a run) | the personal page a real data service builds and serves: [`e2e/lan/stack.mjs`](../e2e/lan/stack.mjs) (Playwright's `webServer`) creates a fresh empty database on that Postgres, seeds a synthetic Health extract ending today (the demo generator), runs `services/loop-ingest` in container mode (its real migrations, `scripts/refresh.mjs` building the page into a temporary `HC_SITE_DIR`) and an nginx stand-in on `127.0.0.1:18290` (`E2E_LAN_PORT`) that mirrors loop-web's template: the page, `status.json` and the manuals are asked of the service's `GET /site` and its `X-Accel-Redirect` is followed into the same `/_open/` and `/_user/` file patterns with the same headers (`/users/…` and everything else is a `404`; with the service down it falls back to the owner's files only while the open-mode marker exists, else `503`), and it proxies exactly the `/api` routes with their rewrites and headers (`scripts/loop-web-config.test.mjs` checks the stand-in against the template and runs it against a fake service); the shared stack stays in open mode, and `e2e/lan/multi-user.spec.mjs` boots its OWN second stack (its own database and port, `startStack({ port })`, passwords set with `runUserScript`) behind a login: signed-out visitor, own page, `/users/2/` 404; everything (processes, database, folders, a build lock a killed build left) is removed on exit, also when it is stopped during startup | `e2e/lan/`: the first-run assistant end to end (`lan-setup`) and its branches (back, Enter, refused steps, the pregnancy and under-18 stops, the medical / eating limits, maintain / cut / bulk, the adjust grid, a failed save, Later, the Edit chip); the food log (quick, basic, product and recipe entries, past days, per-meal add, the add sheet's keyboard, Atwater and Save anyway, 500 / 429 / offline saves, a failed day load and its retry, the empty day, delete); products (label, barcode and text search with Open Food Facts stubbed at the page's `/api/food/off`, log by serving, edit, archive, field errors, cancel); recipes (several products, a basic, batch, edit, archive, cancel); the journal (answers read back, another day, the drink stepper, a failed save, behaviours off and on, insights); the profile (goal, target weight, a refused save); the "+" menu, the freshness popover, Sync and its failures; Home on a past day with the server's data; and last (`lan-last`) the language switch, which rebuilds the shared page in the other locale and, between the two switches, logs and deletes a food entry and saves the journal in that language |
| `lan-setup` → `lan-phone` (Pixel 7) → `webkit-lan` (iPhone 15, the same specs, after `lan-phone` because specs own whole days of the shared database) → `lan-last` (Pixel 7); only with `TEST_DATABASE_URL` (`E2E_LAN=0` leaves them out of a run) | the personal page a real data service builds and serves: [`e2e/lan/stack.mjs`](../e2e/lan/stack.mjs) (Playwright's `webServer`) creates a fresh empty database on that Postgres, seeds a synthetic Health extract ending today (the demo generator), runs `services/loop-ingest` in container mode (its real migrations, `scripts/refresh.mjs` building the page into a temporary `HC_SITE_DIR`) and an nginx stand-in on `127.0.0.1:18290` (`E2E_LAN_PORT`) that mirrors loop-web's template: the page, `status.json` and the manuals are asked of the service's `GET /site` and its `X-Accel-Redirect` is followed into the same `/_open/` and `/_user/` file patterns with the same headers (`/users/…` and everything else is a `404`; with the service down it falls back to the owner's files only while the open-mode marker exists, else `503`), and it proxies exactly the `/api` routes with their rewrites and headers (`scripts/loop-web-config.test.mjs` checks the stand-in against the template and runs it against a fake service); the shared stack stays in open mode, and `e2e/lan/multi-user.spec.mjs` boots its OWN second stack (its own database and port, `startStack({ port })`, passwords set with `runUserScript`) behind a login: signed-out visitor, own page, `/users/2/` 404, the admin adding a person and issuing a one-time password link, the person choosing a password through it and signing in, turning "Share with my coach" on and having no People area, the admin viewing them (banner, a refused write and its notice, back to their own page; screenshots `people-phone`, `people-person-phone`, `set-password-phone`, `set-password-done-phone`, `profile-share-phone`, `coach-banner-phone` in `e2e/.results/shots/`); everything (processes, database, folders, a build lock a killed build left) is removed on exit, also when it is stopped during startup | `e2e/lan/`: the first-run assistant end to end (`lan-setup`) and its branches (back, Enter, refused steps, the pregnancy and under-18 stops, the medical / eating limits, maintain / cut / bulk, the adjust grid, a failed save, Later, the Edit chip); the food log (quick, basic, product and recipe entries, past days, per-meal add, the add sheet's keyboard, Atwater and Save anyway, 500 / 429 / offline saves, a failed day load and its retry, the empty day, delete); products (label, barcode and text search with Open Food Facts stubbed at the page's `/api/food/off`, log by serving, edit, archive, field errors, cancel); recipes (several products, a basic, batch, edit, archive, cancel); the journal (answers read back, another day, the drink stepper, a failed save, behaviours off and on, insights); the profile (goal, target weight, a refused save); the "+" menu, the freshness popover, Sync and its failures; Home on a past day with the server's data; and last (`lan-last`) the language switch, which rebuilds the shared page in the other locale and, between the two switches, logs and deletes a food entry and saves the journal in that language |
| `docker` (Pixel 7); only with `E2E_DOCKER_URL`, and then the only project | a running Docker stack's loop-web: `scripts/image-smoke.sh` with `SMOKE_BROWSER=1` points it at the stack it started | `e2e/docker/`: what only the published images can break — loop-web's security headers as served, the page clean of console errors and CSP violations, a food entry saved and deleted through nginx, Sync rebuilding the page inside loop-server |

Shared rules ([`e2e/fixtures.mjs`](../e2e/fixtures.mjs), [`e2e/lan/fixtures.mjs`](../e2e/lan/fixtures.mjs)): the
Expand Down
26 changes: 23 additions & 3 deletions docs/guides/several-people.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,31 @@ docker compose exec -it loop-server node services/loop-ingest/scripts/user.js de
- Puedes borrar a una persona con el servidor en marcha, también mientras se construye su página: el servidor no arranca
una construcción que la estuviera esperando y elimina lo que deje una construcción en curso.

## Desde la página: Personas, enlaces de contraseña y el modo entrenador

Desde la 1.12.0 el primer usuario de la instalación es su **administrador**, y casi todo lo anterior se puede hacer
desde la página en vez de con una terminal.

- **Personas.** El administrador abre su perfil → **Personas** → **Gestionar**. Ahí añade a una persona, la renombra o
la borra, crea tokens de máquina (se muestran una vez: cópialo en ese momento) y conecta el Strava propio de esa
persona (su id de cliente, luego el enlace de autorización, luego el secreto de cliente y el código) y su clave de
Garmin.
- **Enlace de contraseña.** En el panel de una persona, **Enlace de contraseña** crea un enlace que sirve una vez y
durante 48 horas. Se lo envías; lo abre y elige su propia contraseña. Un enlace nuevo anula el anterior.
- **Modo entrenador.** Cada persona puede activar **Compartir con mi entrenador** en su perfil (apagado por defecto).
El administrador ve entonces **Ver su página** en el panel de esa persona: la página se abre en solo lectura bajo una
barra con el botón **Volver a mi página**. Mientras se mira no se puede cambiar nada, y la persona puede dejar de
compartir cuando quiera, lo que termina la vista.
- Otro administrador: `user.js admin <username> on` (y `off`; al único administrador no se le puede quitar). Compartir
en nombre de alguien que te lo ha pedido: `user.js share <username> on`.

Quien administra la instalación siempre puede leer la base de datos: el interruptor de compartir trata de lo que la
página enseña y a quién, no es una barrera frente al operador.

## Lo que no existe

- **No hay registro propio**, ni restablecimiento de contraseña desde la página: lo hace el operador con la
herramienta.
- **No hay botón "conectar Strava"** en la página: el operador lo conecta con `strava` y `garmin`, como arriba.
- **No hay registro propio**: un administrador añade a cada persona. Una contraseña olvidada se resuelve con un enlace
de contraseña nuevo del administrador (o con `set-password`).
- Una instalación en modo host (los servicios se ejecutan desde un clon) no admite contraseñas ni varias personas: usa
las imágenes.

Expand Down
23 changes: 21 additions & 2 deletions docs/guides/several-people.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,29 @@ docker compose exec -it loop-server node services/loop-ingest/scripts/user.js de
- You can delete a person while the server is running, also while their page is being built: the server does not start a
build that was waiting for them, and removes what a build in progress leaves behind.

## From the page: the People sheet, password links and the coach view

Since 1.12.0 the install's first user is its **admin**, and most of the above can be done from the page instead of a
shell.

- **People.** The admin opens their profile → **People** → **Manage**. There they add a person, rename or delete one,
create machine tokens (shown once: copy it then), and connect that person's own Strava (their client id, then the
authorisation link, then the client secret and the code) and Garmin key.
- **Password link.** In a person's panel, **Password link** makes a link that works once and for 48 hours. Send it to
them; they open it and choose their own password. A new link cancels the previous one.
- **Coach view.** Each person can turn on **Share with my coach** in their profile (off by default). The admin then
sees **View their page** in that person's panel: the page opens read-only under a banner with a **Back to my page**
button. Nothing can be changed while viewing, and the person can turn sharing off at any time, which ends the view.
- Another admin: `user.js admin <username> on` (and `off`; the only admin cannot be turned off). Sharing for someone
who asked you to: `user.js share <username> on`.

The person who runs the install can always read the database: the sharing switch is about what the page shows and to
whom, not a barrier against the operator.

## What is not there

- **No self sign-up**, and no password reset from the page: the operator does it with the tool.
- **No "connect Strava" button** in the page: the operator connects it with `strava` and `garmin` above.
- **No self sign-up**: an admin adds each person. A forgotten password is a new password link from the admin (or
`set-password`).
- A host-mode install (the services run from a clone) does not support passwords or several people: use the images.

## Security notes
Expand Down
Loading