Repository navigation
Implement Dreeve connector, add import ride dialog - #83
Conversation
Rides can now be sent to a self-hosted Dreeve instance, the second connector after Strava: an instance URL and a drv_ API key, checked with GET /api/v1/status (must answer as Dreeve with canUpload, i.e. IMPORT_MODE=files) and uploaded as a multipart "file" part to POST /api/v1/activity/upload. Dreeve queues the file and has no activity page, so the ride records the server's message instead of a link. The server URL must be https, so the API key isn't sent unencrypted; plain http is only accepted for localhost, for development (connectors::secure_server_url). Tests cover URL checking (https only), the key format, error mapping (the server's own message and code first), configure keeping a saved key and never echoing it, and the connect/upload requests against an in-process fake HTTP server. Wiki page, README and HANDOFF mention Dreeve; the connector guide's CSS step now says to define a --<id> colour variable. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Dreeve now lists the rider's rides and hands over a ride's GPS track, so a past Dreeve ride can be picked under "From Dreeve…" when setting up a ride, with the rides that follow the route listed first. The list is GET /api/v1/activities, one page of 100 at a time (RidePage, with "more"), filtered by the server to the cycling sport types and to rides with a GPS track. Each ride carries its encoded polyline as the outline, which find_rides matches against the route. The track comes from the activity's latLng and timeInSeconds streams, lined up by index, with points that have no fix skipped. Dreeve's local start time has no zone, which is fine because ghosts only use the differences between timestamps. Tested against the in-process fake server: request paths and the bearer header, the sport-type and GPS filtering, paging, the outline, the track assembly and the id check. An ignored live test (live_dreeve_lists_rides_and_tracks, needs DREEVE_URL and DREEVE_API_KEY, optionally DREEVE_ROUTE_RIDE) runs against a real instance. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
"Import from Dreeve…" on the routes page opens a dialog listing every
ride on the instance, with a search by name or date, a bike filter and a
distance range, and imports the picked rides as routes.
Importing a ride as a route is a new optional part of the connector
trait (imports_routes, ride_gpx); its default says the service can't.
Dreeve implements it with its GPX export (GET /api/v1/activities/{id}/gpx,
Dreeve 5.4 and later), which carries elevation, so the GPX goes through
the same import as a file. connectors::list_rides pages through all
rides (at most twenty pages) and adds a thinned outline for the preview.
Rides now carry their sport type so they can be filtered by bike.
This is not lists_routes (Find a route, Strava): that lists routes the
rider planned, this turns a ride the rider has ridden into a route. The
connector guide and the routes wiki page explain the difference.
The distance range is drawn from plain elements: two overlapping native
range inputs can't share the pointer in WebKitGTK.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pepperstm
left a comment
There was a problem hiding this comment.
This is in good shape, thanks. I've been through all of it, and CI passes on every platform.
Security: no problems found.
- The URL check runs before the key is saved, and the key only goes over https (or to this machine).
- It's sent as a bearer token, so it isn't passed on if the server redirects elsewhere.
- It's never sent back to the page, and its format is checked.
- Activity ids are checked before going into a path.
connectchecks the server really is Dreeve (app == "dreeve") before marking it verified.
Fit with main: it merges cleanly with the current main and the open fixes. The imports_routes / ride_gpx split from lists_routes makes sense: past rides versus planned routes.
One optional thought, not blocking: connect refuses unless canUpload is true. Someone whose Dreeve doesn't run with IMPORT_MODE=files could still race their rides and import them as routes, but at the moment they can't connect at all. It might be worth connecting anyway and only turning off uploads, with the IMPORT_MODE hint shown when they try to upload. Fine as a follow-up.
It needs updating from main before it can merge (branch protection wants it up to date). I'll do that from here and merge once CI is green.
What and why
Adds Dreeve, a self-hosted dashboard, as the second connector after Strava.
imports_routes/ride_gpx; not the same aslists_routes(planned routes, Add your Strava routes to Find a route #78)Fixes #80
How it was tested
Unit tests against an in-process fake Dreeve server: request shapes, error mapping, paging, outline, track assembly, URL check
Live test (
live_dreeve_lists_rides_and_tracks, ignored by default): connect, list rides, fetch a track, find the rides that fit a route. Run against Dreeve v5.8.2 with about 190 ridesUpload tried by hand against a real instance
Not tested: macOS and Windows, and the route import dialog on a real instance end to end
npm run checkpasses locallyTested on: Linux (Arch)
Documentation
docs/wiki/updated, or not neededHANDOFF.mdupdated if structure, formats, decisions or traps changedAnything unfinished or risky?
connector_upload, which locks the ride list; a Dreeve upload racing a Strava one is covered by that