Loading index.pl +10 −8 Original line number Original line Diff line number Diff line Loading @@ -10,7 +10,7 @@ use Travel::Status::DE::IRIS::Stations; use 5.014; use 5.014; use utf8; use utf8; no if $] >= 5.018, warnings => "experimental::smartmatch"; no if $] >= 5.018, warnings => 'experimental::smartmatch'; our $VERSION = qx{git describe --dirty} || '0.05'; our $VERSION = qx{git describe --dirty} || '0.05'; Loading @@ -22,6 +22,7 @@ sub log_api_access { $counter = read_file( $ENV{DBFAKEDISPLAY_STATS} ) + 1; $counter = read_file( $ENV{DBFAKEDISPLAY_STATS} ) + 1; } } write_file( $ENV{DBFAKEDISPLAY_STATS}, $counter ); write_file( $ENV{DBFAKEDISPLAY_STATS}, $counter ); return; } } sub get_results_for { sub get_results_for { Loading Loading @@ -208,7 +209,7 @@ sub handle_request { my @results = @{$results_ref}; my @results = @{$results_ref}; if ( not @results and $template ~~ [qw[json marudor_v1 marudor]] ) { if ( not @results and $template ~~ [qw[json marudor_v1 marudor]] ) { $self->res->headers->access_control_allow_origin('*'); $self->res->headers->access_control_allow_origin(q{*}); my $json; my $json; if ($errstr) { if ($errstr) { $json = $self->render_to_string( $json = $self->render_to_string( Loading Loading @@ -348,7 +349,7 @@ sub handle_request { if ( $result->isa('Travel::Status::DE::IRIS::Result') ) { if ( $result->isa('Travel::Status::DE::IRIS::Result') ) { @route = $result->route_post; @route = $result->route_post; } } if ( not( List::MoreUtils::any { $_ =~ m{$via}io } @route ) ) { if ( not( List::MoreUtils::any { m{$via}i } @route ) ) { next; next; } } } } Loading Loading @@ -472,15 +473,15 @@ sub handle_request { if ( $template eq 'clean' if ( $template eq 'clean' and $info and $info and $info =~ s{ (?: ca \. \s* )? \+ (\d+) :? \s* }{}x ) and $info =~ s{ (?: ca [.] \s* )? [+] (\d+) :? \s* }{}x ) { { $delay = $1; $delay = $1; } } if ( $hide_low_delay and $info ) { if ( $hide_low_delay and $info ) { $info =~ s{ (?: ca\. \s* )? \+ [ 1 2 3 4 ] $ }{}x; $info =~ s{ (?: ca [.] \s* )? [+] [ 1 2 3 4 ] $ }{}x; } } if ($info) { if ($info) { $info =~ s{ (?: ca\. \s* )? \+ (\d+) }{Verspätung ca $1 Min.}x; $info =~ s{ (?: ca [.] \s* )? [+] (\d+) }{Verspätung ca $1 Min.}x; } } if ( $template eq 'marudor' ) { if ( $template eq 'marudor' ) { Loading Loading @@ -667,7 +668,7 @@ sub handle_request { } } if ( $template eq 'json' ) { if ( $template eq 'json' ) { $self->res->headers->access_control_allow_origin('*'); $self->res->headers->access_control_allow_origin(q{*}); my $json = $self->render_to_string( my $json = $self->render_to_string( json => { json => { api_version => $api_version, api_version => $api_version, Loading @@ -690,7 +691,7 @@ sub handle_request { } } } } elsif ( $template eq 'marudor' ) { elsif ( $template eq 'marudor' ) { $self->res->headers->access_control_allow_origin('*'); $self->res->headers->access_control_allow_origin(q{*}); my $json = $self->render_to_string( my $json = $self->render_to_string( json => { json => { departures => \@departures, departures => \@departures, Loading Loading @@ -741,6 +742,7 @@ sub handle_request { show_realtime => $show_realtime, show_realtime => $show_realtime, ); ); } } return; } } get '/_redirect' => sub { get '/_redirect' => sub { Loading Loading
index.pl +10 −8 Original line number Original line Diff line number Diff line Loading @@ -10,7 +10,7 @@ use Travel::Status::DE::IRIS::Stations; use 5.014; use 5.014; use utf8; use utf8; no if $] >= 5.018, warnings => "experimental::smartmatch"; no if $] >= 5.018, warnings => 'experimental::smartmatch'; our $VERSION = qx{git describe --dirty} || '0.05'; our $VERSION = qx{git describe --dirty} || '0.05'; Loading @@ -22,6 +22,7 @@ sub log_api_access { $counter = read_file( $ENV{DBFAKEDISPLAY_STATS} ) + 1; $counter = read_file( $ENV{DBFAKEDISPLAY_STATS} ) + 1; } } write_file( $ENV{DBFAKEDISPLAY_STATS}, $counter ); write_file( $ENV{DBFAKEDISPLAY_STATS}, $counter ); return; } } sub get_results_for { sub get_results_for { Loading Loading @@ -208,7 +209,7 @@ sub handle_request { my @results = @{$results_ref}; my @results = @{$results_ref}; if ( not @results and $template ~~ [qw[json marudor_v1 marudor]] ) { if ( not @results and $template ~~ [qw[json marudor_v1 marudor]] ) { $self->res->headers->access_control_allow_origin('*'); $self->res->headers->access_control_allow_origin(q{*}); my $json; my $json; if ($errstr) { if ($errstr) { $json = $self->render_to_string( $json = $self->render_to_string( Loading Loading @@ -348,7 +349,7 @@ sub handle_request { if ( $result->isa('Travel::Status::DE::IRIS::Result') ) { if ( $result->isa('Travel::Status::DE::IRIS::Result') ) { @route = $result->route_post; @route = $result->route_post; } } if ( not( List::MoreUtils::any { $_ =~ m{$via}io } @route ) ) { if ( not( List::MoreUtils::any { m{$via}i } @route ) ) { next; next; } } } } Loading Loading @@ -472,15 +473,15 @@ sub handle_request { if ( $template eq 'clean' if ( $template eq 'clean' and $info and $info and $info =~ s{ (?: ca \. \s* )? \+ (\d+) :? \s* }{}x ) and $info =~ s{ (?: ca [.] \s* )? [+] (\d+) :? \s* }{}x ) { { $delay = $1; $delay = $1; } } if ( $hide_low_delay and $info ) { if ( $hide_low_delay and $info ) { $info =~ s{ (?: ca\. \s* )? \+ [ 1 2 3 4 ] $ }{}x; $info =~ s{ (?: ca [.] \s* )? [+] [ 1 2 3 4 ] $ }{}x; } } if ($info) { if ($info) { $info =~ s{ (?: ca\. \s* )? \+ (\d+) }{Verspätung ca $1 Min.}x; $info =~ s{ (?: ca [.] \s* )? [+] (\d+) }{Verspätung ca $1 Min.}x; } } if ( $template eq 'marudor' ) { if ( $template eq 'marudor' ) { Loading Loading @@ -667,7 +668,7 @@ sub handle_request { } } if ( $template eq 'json' ) { if ( $template eq 'json' ) { $self->res->headers->access_control_allow_origin('*'); $self->res->headers->access_control_allow_origin(q{*}); my $json = $self->render_to_string( my $json = $self->render_to_string( json => { json => { api_version => $api_version, api_version => $api_version, Loading @@ -690,7 +691,7 @@ sub handle_request { } } } } elsif ( $template eq 'marudor' ) { elsif ( $template eq 'marudor' ) { $self->res->headers->access_control_allow_origin('*'); $self->res->headers->access_control_allow_origin(q{*}); my $json = $self->render_to_string( my $json = $self->render_to_string( json => { json => { departures => \@departures, departures => \@departures, Loading Loading @@ -741,6 +742,7 @@ sub handle_request { show_realtime => $show_realtime, show_realtime => $show_realtime, ); ); } } return; } } get '/_redirect' => sub { get '/_redirect' => sub { Loading