Skip to content

Implement Dreeve connector, add import ride dialog - #83

Merged
pepperstm merged 5 commits into
pepperstm:mainfrom
joern-h:feature/connectors-dreeve
Nov 12, 2026
Merged

pepperstm merged 5 commits into
pepperstm:mainfrom
joern-h:feature/connectors-dreeve

Conversation

@joern-h

@joern-h joern-h commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

What and why

Adds Dreeve, a self-hosted dashboard, as the second connector after Strava.

  • Upload each ride's FIT file to your instance (URL + API key), one click or automatic
  • Race your Dreeve rides as ghosts ("From Dreeve…"), the ones that fit the route first
  • Import a Dreeve ride as a route ("Import from Dreeve…" on the routes page; needs Dreeve 5.4+)
  • Server URLs must be https (plain http only for localhost), so the key isn't sent unencrypted
  • New optional trait part imports_routes / ride_gpx; not the same as lists_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 rides

  • Upload 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 check passes locally

  • Tested on: Linux (Arch)

Documentation

  • README (features / project status) updated, or not needed
  • Wiki source in docs/wiki/ updated, or not needed
  • HANDOFF.md updated if structure, formats, decisions or traps changed
  • Cache format version bumped if cached data changed shape (not needed: no cached data changed)

Anything unfinished or risky?

  • Uploads go through connector_upload, which locks the ride list; a Dreeve upload racing a Strava one is covered by that
  • The route import lists at most 20 pages of rides; older ones aren't shown
VeloPopuli_import-dreeve

joern-h and others added 3 commits November 12, 2026 15:00
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 pepperstm left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
  • connect checks 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.

@pepperstm
pepperstm merged commit 4007254 into pepperstm:main Nov 12, 2026
9 of 10 checks passed
@pepperstm pepperstm mentioned this pull request Nov 12, 2026
pepperstm added a commit that referenced this pull request Nov 12, 2026
Version 0.3.10: laps (#68, by Rallensooo), Herne Hill Velodrome (#75), signposted road routes (#77), your Strava routes (#78), the Dreeve connector and pluggable connectors (#74, #83, by Jörn), remembered sensors (#79), smooth bends with lean (#81) and the Linux Bluetooth fix (#84).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dreeve connector: upload rides, race and import your Dreeve rides

2 participants