Garmin Connect as the third connected-services provider (spec: garmin-import). The interesting parts: - Push-first ingestion: Garmin has no list endpoint. The webhook normalizes ping (callbackURL) and push (inline) notification batches into events; the slow work (authorized FIT download, FIT→GPX via the shared converter, activity creation) runs in a garmin-import-activity pg-boss job so the webhook answers fast. Callback URLs are validated against Garmin's API host before any fetch (SSRF guard). - History via backfill requests: /sync/import/garmin is a date-range requester with honest async progress (no pick list — the concept doesn't exist in a push model). Ranges chunk to Garmin's 90-day cap; overlaps are free via sync_imports dedupe. Requests persist in import_batches via two new nullable columns (range_start/range_end). - OAuth2 + PKCE on the existing oauth credential kind. Design correction from apply: the verifier rides a short-lived httpOnly cookie scoped to the callback path — the state param is visible in redirect URLs and must never carry it. Manifests opt in via pkce:true. - Deregistration notifications flip the connection to 'revoked' (row kept for audit, imports retained, re-connect prompt shown). - Framework evolutions, all additive: parseWebhook returns WebhookEvent[] (Garmin batches; Wahoo adapted), manifest gains configured()/importUrl/pkce, importActivity accepts summary stats for FIT-less imports, manager gains markRevoked. - Env-gated: no GARMIN_CLIENT_ID → provider hidden on /settings/connections. Privacy manifest entry (DE+EN). i18n en+de. Rollout (§6) stays gated on the Garmin Developer Program application (submitted 2026-06-07). Fixtures are doc-shaped; the staging soak swaps in recorded payloads if shapes differ. Gate: typecheck ✓ lint ✓ unit+integration ✓ e2e 70/72 + both known flakes green isolated ✓ openspec validate ✓ Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
63 lines
3.3 KiB
Text
63 lines
3.3 KiB
Text
# Journal local-dev environment.
|
|
# Copy to `.env` (gitignored) and edit. Most contributors don't need
|
|
# anything in this file — the journal app boots on plain HTTP at
|
|
# http://localhost:3000 with sensible defaults.
|
|
|
|
# ────────────────────────────────────────────────────────────────────
|
|
# DO NOT SET unless you know you need it
|
|
# ────────────────────────────────────────────────────────────────────
|
|
#
|
|
# `ORIGIN` is what the WebAuthn ceremony uses as `expectedOrigin`.
|
|
# When unset it defaults to `http://localhost:3000`, which is what
|
|
# Playwright sends and what the browser sees in plain-HTTP dev.
|
|
#
|
|
# The ONLY reason to set this is if you're running the dev server
|
|
# over HTTPS (see HTTPS=1 below) and want passkey registration to
|
|
# succeed against the HTTPS origin. If you set it to `https://...`
|
|
# without also running the server over HTTPS, you'll get
|
|
# "Unexpected registration response origin" errors in dev and the
|
|
# local e2e suite (which always hits HTTP) will fail registration.
|
|
#
|
|
# ORIGIN=https://localhost:3000
|
|
|
|
# Flagship marker. Renders the project marketing block on the
|
|
# anonymous home and gates a few "this is the canonical instance"
|
|
# behaviors. Self-hosted instances leave this unset; flagship CI
|
|
# sets it to `true`. Either is fine for local dev — set it if you
|
|
# want to see the full marketing layout, leave it unset if you
|
|
# want the self-host home view.
|
|
# IS_FLAGSHIP=true
|
|
|
|
# ────────────────────────────────────────────────────────────────────
|
|
# Wahoo OAuth (only needed when actively testing the Wahoo import)
|
|
# ────────────────────────────────────────────────────────────────────
|
|
#
|
|
# Wahoo's OAuth flow is the one feature that genuinely needs HTTPS
|
|
# locally: the provider rejects `http://` redirect URIs. To exercise
|
|
# the connect/disconnect/import flow end-to-end, you need:
|
|
#
|
|
# 1. Local HTTPS dev server: run `HTTPS=1 pnpm --filter
|
|
# @trails-cool/journal dev` (the basic-ssl plugin in
|
|
# vite.config.ts wires up the cert; see the comment there for
|
|
# the ALPN workaround).
|
|
# 2. ORIGIN=https://localhost:3000 (uncomment above).
|
|
# 3. Wahoo client credentials below, and a redirect URI of
|
|
# `https://localhost:3000/api/sync/callback/wahoo` registered
|
|
# in your Wahoo developer dashboard.
|
|
#
|
|
# WAHOO_CLIENT_ID=
|
|
# WAHOO_CLIENT_SECRET=
|
|
# WAHOO_WEBHOOK_TOKEN=
|
|
|
|
# Garmin Connect Developer Program credentials (spec: garmin-import).
|
|
# Requires an approved program application; without these the Garmin
|
|
# provider is hidden on /settings/connections. The OAuth callback to
|
|
# register with Garmin is `<origin>/api/sync/callback/garmin`, the
|
|
# notification endpoint `<origin>/api/sync/webhook/garmin`.
|
|
# GARMIN_CLIENT_ID=
|
|
# GARMIN_CLIENT_SECRET=
|
|
|
|
# Integration test secret (only needed if running the integration
|
|
# test suite that drives the API directly). Generate with
|
|
# `openssl rand -hex 32`.
|
|
# INTEGRATION_SECRET=
|