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>
85 lines
5 KiB
TypeScript
85 lines
5 KiB
TypeScript
import { type RouteConfig, index, route } from "@react-router/dev/routes";
|
|
|
|
export default [
|
|
index("routes/home.tsx"),
|
|
route(".well-known/trails-cool", "routes/api.well-known.trails-cool.ts"),
|
|
route(".well-known/webfinger", "routes/api.well-known.webfinger.ts"),
|
|
route(".well-known/nodeinfo", "routes/api.well-known.nodeinfo.ts"),
|
|
route("nodeinfo/2.1", "routes/api.nodeinfo.ts"),
|
|
route("users/:username/inbox", "routes/users.$username.inbox.ts"),
|
|
route("users/:username/outbox", "routes/users.$username.outbox.ts"),
|
|
route("oauth/authorize", "routes/oauth.authorize.tsx"),
|
|
route("oauth/token", "routes/oauth.token.ts"),
|
|
route("auth/register", "routes/auth.register.tsx"),
|
|
route("auth/login", "routes/auth.login.tsx"),
|
|
route("auth/verify", "routes/auth.verify.tsx"),
|
|
route("auth/logout", "routes/auth.logout.tsx"),
|
|
route("auth/accept-terms", "routes/auth.accept-terms.tsx"),
|
|
route("api/auth/register", "routes/api.auth.register.ts"),
|
|
route("api/auth/login", "routes/api.auth.login.ts"),
|
|
route("routes", "routes/routes._index.tsx"),
|
|
route("routes/new", "routes/routes.new.tsx"),
|
|
route("routes/:id", "routes/routes.$id.tsx"),
|
|
route("routes/:id/edit", "routes/routes.$id.edit.tsx"),
|
|
route("api/e2e/seed", "routes/api.e2e.seed.ts"),
|
|
route("api/e2e/route/:id", "routes/api.e2e.route.$id.ts"),
|
|
route("api/e2e/komoot", "routes/api.e2e.komoot.ts"),
|
|
route("api/routes/:id/callback", "routes/api.routes.$id.callback.ts"),
|
|
route("api/routes/:id/edit-in-planner", "routes/api.routes.$id.edit-in-planner.ts"),
|
|
route("api/routes/:id/gpx", "routes/api.routes.$id.gpx.ts"),
|
|
route("activities", "routes/activities._index.tsx"),
|
|
route("activities/new", "routes/activities.new.tsx"),
|
|
route("activities/:id", "routes/activities.$id.tsx"),
|
|
route("users/:username", "routes/users.$username.tsx"),
|
|
route("users/:username/followers", "routes/users.$username.followers.tsx"),
|
|
route("users/:username/following", "routes/users.$username.following.tsx"),
|
|
route("api/users/:username/follow", "routes/api.users.$username.follow.ts"),
|
|
route("api/users/:username/unfollow", "routes/api.users.$username.unfollow.ts"),
|
|
route("follows/requests", "routes/follows.requests.tsx"),
|
|
route("follows/outgoing", "routes/follows.outgoing.tsx"),
|
|
route("api/follows/:id/approve", "routes/api.follows.$id.approve.ts"),
|
|
route("api/follows/:id/reject", "routes/api.follows.$id.reject.ts"),
|
|
route("feed", "routes/feed.tsx"),
|
|
route("explore", "routes/explore.tsx"),
|
|
route("api/events", "routes/api.events.ts"),
|
|
route("notifications", "routes/notifications.tsx"),
|
|
route("api/notifications/:id/read", "routes/api.notifications.$id.read.ts"),
|
|
route("api/notifications/read-all", "routes/api.notifications.read-all.ts"),
|
|
route("settings", "routes/settings.tsx", [
|
|
index("routes/settings._index.tsx"),
|
|
route("profile", "routes/settings.profile.tsx"),
|
|
route("account", "routes/settings.account.tsx"),
|
|
route("security", "routes/settings.security.tsx"),
|
|
route("connections", "routes/settings.connections.tsx"),
|
|
route("connections/komoot", "routes/settings.connections.komoot.tsx"),
|
|
]),
|
|
route("api/settings/profile", "routes/api.settings.profile.ts"),
|
|
route("api/settings/email", "routes/api.settings.email.ts"),
|
|
route("api/settings/passkey/delete", "routes/api.settings.passkey.delete.ts"),
|
|
route("api/settings/delete-account", "routes/api.settings.delete-account.ts"),
|
|
route("sync/import/komoot", "routes/sync.import.komoot.tsx"),
|
|
route("sync/import/garmin", "routes/sync.import.garmin.tsx"),
|
|
route("sync/import/:provider", "routes/sync.import.$provider.tsx"),
|
|
route("api/sync/komoot/verify", "routes/api.sync.komoot.verify.ts"),
|
|
route("api/sync/komoot/connect", "routes/api.sync.komoot.connect.ts"),
|
|
route("api/sync/komoot/import", "routes/api.sync.komoot.import.ts"),
|
|
route("api/sync/komoot/import-status", "routes/api.sync.komoot.import-status.ts"),
|
|
route("api/sync/connect/:provider", "routes/api.sync.connect.$provider.ts"),
|
|
route("api/sync/callback/:provider", "routes/api.sync.callback.$provider.ts"),
|
|
route("api/sync/disconnect/:provider", "routes/api.sync.disconnect.$provider.ts"),
|
|
route("api/sync/webhook/:provider", "routes/api.sync.webhook.$provider.ts"),
|
|
route("api/sync/push/:provider/:routeId", "routes/api.sync.push.$provider.$routeId.ts"),
|
|
route("privacy", "routes/privacy.tsx"),
|
|
route("legal/imprint", "routes/legal.imprint.tsx"),
|
|
route("legal/terms", "routes/legal.terms.tsx"),
|
|
route("legal/privacy", "routes/legal.privacy.tsx"),
|
|
// REST API v1
|
|
route("api/v1/routes", "routes/api.v1.routes._index.ts"),
|
|
route("api/v1/routes/compute", "routes/api.v1.routes.compute.ts"),
|
|
route("api/v1/routes/:id", "routes/api.v1.routes.$id.ts"),
|
|
route("api/v1/activities", "routes/api.v1.activities._index.ts"),
|
|
route("api/v1/activities/:id", "routes/api.v1.activities.$id.ts"),
|
|
route("api/v1/auth/devices", "routes/api.v1.auth.devices.ts"),
|
|
route("api/v1/auth/devices/:id", "routes/api.v1.auth.devices.$id.ts"),
|
|
route("api/v1/uploads", "routes/api.v1.uploads.ts"),
|
|
] satisfies RouteConfig;
|