diff --git a/.env.example b/.env.example index 13732c1..2b6a2a8 100644 --- a/.env.example +++ b/.env.example @@ -7,6 +7,8 @@ APP_URL= CURRENT_TRIP_ID= PAST_TRIP_IDS= +PRIVACY_LAT_LONS= + MAIL_MAILER=mailjet MAILJET_APIKEY= MAILJET_APISECRET= diff --git a/config/app.php b/config/app.php index 41a0865..65dbc7b 100644 --- a/config/app.php +++ b/config/app.php @@ -76,6 +76,8 @@ return [ 'past_trip_ids' => explode(',', env('PAST_TRIP_IDS')), + 'privacy_lat_lons' => explode(';', env('PRIVACY_LAT_LONS')), + /* |-------------------------------------------------------------------------- | Digest Mailing Lists diff --git a/resources/views/tracker.blade.php b/resources/views/tracker.blade.php index 0985cdd..12e2b75 100644 --- a/resources/views/tracker.blade.php +++ b/resources/views/tracker.blade.php @@ -65,6 +65,22 @@ L.polyline([ @foreach(array_slice($trip->locations, $idx, 100) as $location) @if(!in_array($location->id, config('app.current_trip_ignore'))) + + @php + // Privacy zones + $privacyLatLons = config('app.privacy_lat_lons'); + $latLon = explode(',', $privacyLatLons[0]); + if ( + !( + ( $location->latitude - $latLon[0] > 0.01 ) || ( $location->latitude - $latLon[0] < -0.01 ) || + ( $location->longitude - $latLon[1] > 0.01 ) || ( $location->longitude - $latLon[1] < -0.01 ) + ) + ) { + $location->latitude = $location->latitude + ((rand(0,2)-1)/100); + $location->longitude = $location->longitude + ((rand(0,2)-1)/100); + } + @endphp + [{{ $location->latitude }}, {{ $location->longitude }}], @endif