diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-04-02 21:40:18 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-04-02 21:40:18 +0200 |
commit | b8254210a97e833fbf396f0af9aa9e49339d8284 (patch) | |
tree | 44e53d03e874d6987523f916dd9980680b01a9dd /lib/DBInfoscreen | |
parent | 8fe91bd6645e69ac576998abf00779aaf1f019aa (diff) |
Pass HAFAS service on to geostop
Diffstat (limited to 'lib/DBInfoscreen')
-rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 305035c..60a15d5 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -1818,14 +1818,23 @@ sub handle_result { sub stations_by_coordinates { my $self = shift; - my $lon = $self->param('lon'); - my $lat = $self->param('lat'); + my $lon = $self->param('lon'); + my $lat = $self->param('lat'); + my $hafas = $self->param('hafas'); if ( not $lon or not $lat ) { $self->render( json => { error => 'Invalid lon/lat received' } ); return; } + my $service = 'DB'; + if ( $hafas + and $hafas ne '1' + and Travel::Status::DE::HAFAS::get_service($hafas) ) + { + $service = $hafas; + } + $self->render_later; my @iris = map { @@ -1846,6 +1855,7 @@ sub stations_by_coordinates { Travel::Status::DE::HAFAS->new_p( promise => 'Mojo::Promise', user_agent => $self->ua, + service => $service, geoSearch => { lat => $lat, lon => $lon @@ -1858,7 +1868,7 @@ sub stations_by_coordinates { name => $_->name, eva => $_->eva, distance => $_->distance_m / 1000, - hafas => 1 + hafas => $service, } } $hafas->results; if ( @hafas > 10 ) { |