diff options
| author | Birte Kristina Friesel <derf@finalrewind.org> | 2025-04-18 11:53:40 +0200 | 
|---|---|---|
| committer | Birte Kristina Friesel <derf@finalrewind.org> | 2025-04-18 11:53:40 +0200 | 
| commit | 34200455012766f404eeb47b1aa68b2a2566de5f (patch) | |
| tree | 9e853e4a0471530592baa498d925689876172d57 | |
| parent | a7b155b1bcb488f9da28a7e6f2a3cfaec8d3a5ce (diff) | |
DBRIS: respect proxy settings for journey requests as well4.36.8
| -rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 12 | ||||
| -rw-r--r-- | lib/DBInfoscreen/Helper/DBRIS.pm | 20 | 
2 files changed, 20 insertions, 12 deletions
| diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index afcb293..d05a5b1 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -1300,17 +1300,7 @@ sub train_details_dbris {  	$self->render_later; -	Travel::Status::DE::DBRIS->new_p( -		journey     => $trip_id, -		cache       => $self->app->cache_iris_rt, -		lwp_options => { -			timeout => 10, -			agent   => 'dbf.finalrewind.org/2' -		}, -		promise        => 'Mojo::Promise', -		user_agent     => Mojo::UserAgent->new, -		developer_mode => 1, -	)->then( +	$self->dbris->get_journey_p( id => $trip_id )->then(  		sub {  			my ($dbris) = @_;  			my $trip = $dbris->result; diff --git a/lib/DBInfoscreen/Helper/DBRIS.pm b/lib/DBInfoscreen/Helper/DBRIS.pm index 17f0084..e780213 100644 --- a/lib/DBInfoscreen/Helper/DBRIS.pm +++ b/lib/DBInfoscreen/Helper/DBRIS.pm @@ -29,6 +29,25 @@ sub new {  } +sub get_journey_p { +	my ( $self, %opt ) = @_; + +	my $agent = $self->{user_agent}; + +	if ( my $proxy = $ENV{DBFAKEDISPLAY_DBRIS_PROXY} ) { +		$agent = Mojo::UserAgent->new; +		$agent->proxy->http($proxy); +		$agent->proxy->https($proxy); +	} + +	return Travel::Status::DE::DBRIS->new_p( +		journey    => $opt{id}, +		cache      => $self->{realtime_cache}, +		promise    => 'Mojo::Promise', +		user_agent => $agent->request_timeout(10) +	); +} +  # Input: TripID  # Output: Promise returning a Travel::Status::DE::DBRIS::Journey instance on success  sub get_polyline_p { @@ -40,7 +59,6 @@ sub get_polyline_p {  	my $agent = $self->{user_agent};  	if ( my $proxy = $ENV{DBFAKEDISPLAY_DBRIS_PROXY} ) { -		say "set up proxy $proxy";  		$agent = Mojo::UserAgent->new;  		$agent->proxy->http($proxy);  		$agent->proxy->https($proxy); | 
