✨ Route all rail data through the Better Rail server (GTFS migration)#631
✨ Route all rail data through the Better Rail server (GTFS migration)#631planecore wants to merge 4 commits into
Conversation
- Point the JS client, iOS widget/watch/watch-widget, and the Android widget at the server's /rail-api endpoint instead of calling rail.co.il directly; drop the API key and the direct→proxy 403 fallback. - Timetable is served by the server's GTFS-backed searchTrainForMobile (same response shape); announcements / popup messages / station info are proxied through the same server route.
There was a problem hiding this comment.
Code Review
This pull request migrates the client to route all Israel Railways data through the Better Rail server, removing direct calls to rail.co.il and eliminating the embedded API key across Android, iOS, and web services. While these changes simplify the API client logic and remove the need for a 403 fallback mechanism, several improvements should be made: the hardcoded environment variable in the API configuration should be made dynamic to avoid dead code, the force-unwrapped dynamic URL in the watch model should be safely handled to prevent runtime crashes, and the redundant 403 fallback logic in the Android native service should be cleaned up.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
- api-config: drop the dead non-production branch (single server URL) - watch CriticalAlertsModel: guard let instead of force-unwrapping the URL - Android RailApiService: remove the now-redundant 403→proxy fallback (both timetable URLs are identical) and the unused buildConfig field
What & why
Companion to the server's GTFS migration (better-rail/server#28). The app no longer talks to the Israel Railways API (
rail-api.rail.co.il) directly — all rail data now flows through the Better Rail server, including the calls we didn't migrate (announcements, popup messages, station info), which the server proxies upstream.Because the server emulates the legacy
searchTrainForMobileJSON shape, this is mostly a base-URL change plus dropping theOcp-Apim-Subscription-Keyheader and the 403→proxy fallback. The canonical3700-style station IDs are unchanged, so decoders and Better Rail Live stay as-is.Changes
config/api-config.tspoints the timetable + rail-api at the server and drops the API key and the direct/proxy split;services/api/route-api.tsandservices/api/rail-api.tsupdated to match.RouteModel.swift, plus the WatchCriticalAlertsModel.swift, now hit the server and drop the subscription-key header (decoders unchanged thanks to shape emulation).plugins/withBetterRailAndroid/withAndroidGradle.jstimetable URLs point at the server;RailApiService.ktdrops the key header and the 403→proxy fallback.3700-style IDs); the route JSON is now ultimately GTFS-sourced via the server. Delays show0until SIRI lands.Depends on
Test plan
rail-api.rail.co.il(network inspector) — only the Better Rail server.🤖 Generated with Claude Code