feat(train): the instance's own map tiles, drawn by Train's style (ADR 0030, D50)

Protomaps' basemap cut for Europe and served by pmtiles beside Train's server
(compose.maps.yaml), drawn by Train's own style, light and dark, which the
server serves. Only people signed in get tiles: map.source hands a key that
Caddy has the server check before each tile; nothing logs a tile.

Also fixes .dockerignore, which left apps/train/ out of the build context, so
Train's server's and BRouter's images couldn't have been built.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-29 16:04:05 +01:00
commit 190c3872f4
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -84,6 +84,7 @@ void main() {
RecordingDevice? recording,
WorkoutRepository? workouts,
bool mapReachable = true,
MapSource? mapSource,
HealthConnect? health,
ProfileRepository? profile,
DayRepository? days,
@ -208,7 +209,9 @@ void main() {
health: health,
loop: loop,
maps: MapSourceRepository(
_FakeMapSourceGateway(mapReachable ? openFreeMap : null),
_FakeMapSourceGateway(
mapReachable ? mapSource ?? openFreeMap : null,
),
),
// No tiles: widget tests reach no network.
mapTiles: (source) => const SizedBox.shrink(),
@ -2604,6 +2607,35 @@ void main() {
expect(find.text('Pace'), findsOneWidget);
});
testWidgets("drawn from the instance's own tiles, the page says the "
'instance keeps nothing of the area shown (D50)', (tester) async {
await saveRun(DateTime(2026, 10, 27, 7, 30));
await start(
tester,
usedBefore: true,
workouts: workouts,
mapSource: MapSource(
name: 'train.example.org',
styleUrl: 'https://train.example.org/map/style/light.json',
darkStyleUrl: 'https://train.example.org/map/style/dark.json',
attribution: '© OpenStreetMap contributors · Protomaps',
tileKey: 'm1.20000.mac',
),
);
await tester.tap(find.text('Morning run'));
await tester.pumpAndSettle();
expect(
find.text(
'Map by your instance, train.example.org, from OpenStreetMap: it '
'keeps nothing of the area shown.',
),
findsOneWidget,
);
expect(find.textContaining('sees your device'), findsNothing);
});
testWidgets("a workout with a strap shows the heart's average and highest "
'rate, by split too, and its chart', (tester) async {
await saveRun(DateTime(2026, 10, 27, 7, 30), strap: true);