From dbc5c38968a11ac17dc99723bc8866de9f739c28 Mon Sep 17 00:00:00 2001 From: Derf Null Date: Sun, 21 May 2023 19:44:43 +0200 Subject: get_user_status_json_v1: add public flag to hide actionTime --- lib/Travelynx.pm | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'lib/Travelynx.pm') diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm index c594e96..643024b 100755 --- a/lib/Travelynx.pm +++ b/lib/Travelynx.pm @@ -836,7 +836,7 @@ sub startup { return; } - my $status = $self->get_user_status_json_v1($uid); + my $status = $self->get_user_status_json_v1( uid => $uid ); my $header = {}; my $hook_body = { reason => $reason, @@ -1694,11 +1694,10 @@ sub startup { $self->helper( 'get_user_status_json_v1' => sub { - my ( $self, $uid ) = @_; + my ( $self, %opt ) = @_; + my $uid = $opt{uid}; my $status = $self->get_user_status($uid); - # TODO simplify lon/lat (can be returned from get_user_status) - my $ret = { deprecated => \0, checkedIn => ( @@ -1737,12 +1736,16 @@ sub startup { no => $status->{train_no}, id => $status->{train_id}, }, - actionTime => $status->{timestamp} - ? $status->{timestamp}->epoch - : undef, intermediateStops => [], }; + if ( not $opt{public} ) { + $ret->{actionTime} + = $status->{timestamp} + ? $status->{timestamp}->epoch + : undef; + } + for my $stop ( @{ $status->{route_after} // [] } ) { if ( $status->{arr_name} and $stop->[0] eq $status->{arr_name} ) { -- cgit v1.2.3