Loading lib/Travelynx/Controller/Traveling.pm +4 −8 Original line number Diff line number Diff line Loading @@ -594,13 +594,9 @@ sub geolocation { if ($dbris_service) { $self->render_later; Travel::Status::DE::DBRIS->new_p( promise => 'Mojo::Promise', user_agent => Mojo::UserAgent->new, geoSearch => { $self->dbris->geosearch_p( latitude => $lat, longitude => $lon } )->then( sub { my ($dbris) = @_; Loading Loading @@ -2486,7 +2482,7 @@ sub edit_journey { uid => $uid, db => $db, id => $journey->{id}, $key => $self->param($key) $key => $self->param($key), ); if ($error) { last; Loading lib/Travelynx/Helper/DBRIS.pm +25 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,31 @@ sub new { return bless( \%opt, $class ); } sub geosearch_p { my ( $self, %opt ) = @_; my $agent = $self->{user_agent}; my $proxy; if ( my @proxies = @{ $self->{service_config}{'bahn.de'}{proxies} // [] } ) { $proxy = $proxies[ int( rand( scalar @proxies ) ) ]; } elsif ( my $p = $self->{service_config}{'bahn.de'}{proxy} ) { $proxy = $p; } if ($proxy) { $agent = Mojo::UserAgent->new; $agent->proxy->http($proxy); $agent->proxy->https($proxy); } return Travel::Status::DE::DBRIS->new_p( promise => 'Mojo::Promise', user_agent => $agent, geoSearch => \%opt, ); } sub get_station_id_p { my ( $self, $station_name ) = @_; Loading Loading
lib/Travelynx/Controller/Traveling.pm +4 −8 Original line number Diff line number Diff line Loading @@ -594,13 +594,9 @@ sub geolocation { if ($dbris_service) { $self->render_later; Travel::Status::DE::DBRIS->new_p( promise => 'Mojo::Promise', user_agent => Mojo::UserAgent->new, geoSearch => { $self->dbris->geosearch_p( latitude => $lat, longitude => $lon } )->then( sub { my ($dbris) = @_; Loading Loading @@ -2486,7 +2482,7 @@ sub edit_journey { uid => $uid, db => $db, id => $journey->{id}, $key => $self->param($key) $key => $self->param($key), ); if ($error) { last; Loading
lib/Travelynx/Helper/DBRIS.pm +25 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,31 @@ sub new { return bless( \%opt, $class ); } sub geosearch_p { my ( $self, %opt ) = @_; my $agent = $self->{user_agent}; my $proxy; if ( my @proxies = @{ $self->{service_config}{'bahn.de'}{proxies} // [] } ) { $proxy = $proxies[ int( rand( scalar @proxies ) ) ]; } elsif ( my $p = $self->{service_config}{'bahn.de'}{proxy} ) { $proxy = $p; } if ($proxy) { $agent = Mojo::UserAgent->new; $agent->proxy->http($proxy); $agent->proxy->https($proxy); } return Travel::Status::DE::DBRIS->new_p( promise => 'Mojo::Promise', user_agent => $agent, geoSearch => \%opt, ); } sub get_station_id_p { my ( $self, $station_name ) = @_; Loading