Compare commits

..

No commits in common. "28971a88763b887ed52c2616a044edc6e7f2d80a" and "2687b6a6ea8c2ce63ea8b2650c31362106982d7f" have entirely different histories.

6 changed files with 53 additions and 63 deletions

1
.gitignore vendored
View file

@ -5,7 +5,6 @@
/public/*/videos
/public/*/audio
/storage/*.key
/backup
/vendor
.phpunit.result.cache
Homestead.json

View file

@ -30,7 +30,7 @@ class Kernel extends ConsoleKernel
});
$schedule->command('digest:send --fortnightly')
->twiceMonthly(1, 16, '13:00')
->twiceMonthly(1,16,'13:00')
->onFailure(function () {
Log::error("Fortnightly email digest send failed");
});

View file

@ -49,8 +49,7 @@ class TrackerController extends Controller
return view(
'error',
[
'message' => "App timed out whilst downloading trip data" .
" from Wayward's servers. They may be down currently."
'message' => "App timed out whilst downloading trip data from Wayward's servers. They may be down currently."
]
);
}

View file

@ -2,12 +2,8 @@
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build",
"deploy": "rsync --delete -rP app artisan bootstrap composer.* config database lang resources routes storage tests ovhvps:~/track",
"deploy:public": "rsync --delete -rP public ovhvps:~/track",
"deploy:dependencies": "rsync --delete -rP vendor ovhvps:~/track",
"deploy:full": "npm run deploy && npm run deploy:public && npm run deploy:dependencies && npm run deploy:finish",
"deploy:finish": "ssh ovhvps 'cd track && docker compose down && docker system prune -f && docker compose up -d --build'",
"build": "vite build && rsync --delete -rP app artisan bootstrap composer.* config database lang public resources routes storage tests vendor ovhvps:~/track",
"sync": "rsync -rP ./public/ ovhvps:~/track/public",
"lint": "npm run lint:php; npm run lint:css",
"lint:fix": "npm run lint:php:fix; npm run lint:css:fix",
"lint:php": "./vendor/bin/phpcs",

View file

@ -18,8 +18,6 @@
<script src="https://unpkg.com/leaflet@1.8.0/dist/leaflet.js"
integrity="sha512-BB3hKbKWOc9Ez/TAwyWxNXeoV9c1v6FIeYiBieIWkpLjauysF18NzgR1MBNBXf8/KABdlkX68nAhlwcDFLGPCQ=="
crossorigin=""></script>
<script src='https://api.mapbox.com/mapbox.js/plugins/leaflet-fullscreen/v1.0.1/Leaflet.fullscreen.min.js'></script>
<link href='https://api.mapbox.com/mapbox.js/plugins/leaflet-fullscreen/v1.0.1/leaflet.fullscreen.css' rel='stylesheet' />
@vite(['resources/css/app.css', 'resources/js/app.js'])
</head>

View file

@ -52,7 +52,7 @@
/*
* Initialise the map
*/
var map = L.map('map', { fullscreenControl: true });
var map = L.map('map');
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: 'OpenStreetMap'
@ -82,7 +82,7 @@
/*
* Populate all the checkins and popup texts.
*/
*
var checkinMarkers = [];
var marker = null, popupMarkup = null;
var markerIcon = L.icon({
@ -94,44 +94,43 @@
shadowUrl: "images/marker-shadow.png",
tooltipAnchor: [16, -28]
});
@foreach($trip->checkins as $checkin)
marker = L.marker([{{ $checkin->location->latitude }}, {{ $checkin->location->longitude }}],
{
icon: markerIcon
});
marker = L.marker([{{ $checkin->location->latitude }}, {{ $checkin->location->longitude }}],
{
icon: markerIcon
}).addTo(map);
@php
$popupContent = null;
$embed = null;
if (preg_match("/\[\[([^\]]+)\]\]/", $checkin->note, $filepath)) {
if (preg_match("/\.webm/", $filepath[1])) {
$embed = '<video class="popup__video" controls>';
$embed .= '<source src="' . url("/videos/" . $filepath[1]) . '" type="video/webm">';
$embed .= '<p>Your browser doesn\'t support HTML video. Here is a <a href="';
$embed .= url("/videos/" . $filepath[1]) . '">link to the video</a> instead.</p>';
$embed .= '</video>';
} elseif (preg_match("/\.ogg/", $filepath[1])) {
$embed = '<audio class="popup__audio" controls>';
$embed .= '<source src="' . url("/audio/" . $filepath[1]) . '" type="audio/ogg">';
$embed .= '<p>Download <a href="' . url("/audio/" . $filepath[1]) . '">OGG</a> audio.</p>';
$embed .= '</audio>';
}
$checkin->note = preg_replace("/\[\[[^\]]+\]\]/", $embed, $checkin->note);
}
$popupContent ='<p class="popup__note">' . $checkin->note . '</p>';
@endphp
@php $popupContent = null; @endphp
@php
$embed = null;
if (preg_match("/\[\[([^\]]+)\]\]/", $checkin->note, $filepath)) {
if (preg_match("/\.webm/", $filepath[1])) {
$embed = '<video class="popup__video" controls>';
$embed .= '<source src="' . url("/videos/" . $filepath[1]) . '" type="video/webm">';
$embed .= '<p>Your browser doesn\'t support HTML video. Here is a <a href="' . url("/videos/" . $filepath[1]) . '">link to the video</a> instead.</p>';
$embed .= '</video>';
} elseif (preg_match("/\.ogg/", $filepath[1])) {
$embed = '<audio class="popup__audio" controls>';
$embed .= '<source src="' . url("/audio/" . $filepath[1]) . '" type="audio/ogg">';
$embed .= '<p>Download <a href="' . url("/audio/" . $filepath[1]) . '">OGG</a> audio.</p>';
$embed .= '</audio>';
}
$checkin->note = preg_replace("/\[\[[^\]]+\]\]/", $embed, $checkin->note);
}
@endphp
popupMarkup = `<h2 class="popup__title">{!! $checkin->title ?? "<i>Untitled</i>" !!}</h2>`;
popupMarkup += `{!! $popupContent !!}`;
@if($checkin->image_url)
popupMarkup += '<img class="popup__image" src="{{ $checkin->image_url }}">';
@endif
marker.bindPopup(popupMarkup).openPopup();
@php $popupContent ='<p class="popup__note">' . $checkin->note . '</p>'; @endphp
checkinMarkers[{{ $checkin->id }}] = marker;
popupMarkup = `<h2 class="popup__title">{!! $checkin->title ?? "<i>Untitled</i>" !!}</h2>`;
popupMarkup += `{!! $popupContent !!}`;
@if($checkin->image_url)
popupMarkup += '<img class="popup__image" src="{{ $checkin->image_url }}">';
@endif
marker.bindPopup(popupMarkup).openPopup();
checkinMarkers[{{ $checkin->id }}] = marker;
@endforeach
*/
/*
* Fit the map to the last 25 locations, and then zoom out
* (to help provide context).
@ -153,6 +152,7 @@
* Add the current location marker.
*
* If this goes before the `fitBounds()`, it ends up uncentered.
* TODO: Revisit once fixed with other popups.
*/
var currLocationMarker = L.icon({
iconUrl: 'images/current-location-icon.png',
@ -165,26 +165,24 @@
icon: currLocationMarker
}
).addTo(map).setZIndexOffset(1000);
@if($trip->is_active) currLocation.bindPopup('<p>Current location</p>').openPopup(); @endif
currLocation.bindPopup('<p>Current location</p>').openPopup();
/*
* Changes the currently-selected popup.
*/
function toggleCheckin(isOpen, checkinId) {
if (isOpen) {
const checkins = document.querySelectorAll('details');
var checkins = document.querySelectorAll('details');
checkinMarkers[checkinId].openPopup();
checkinMarkers[checkinId].addTo(map);
for (checkin of checkins) {
checkins.forEach(checkin => {
if (checkin.id != checkinId && checkin.open) checkin.open = false;
}
});
console.log(checkinMarkers[checkinId].getLatLng());
map.setView(new L.LatLng(checkinMarkers[checkinId].getLatLng().lat + 0.03, checkinMarkers[checkinId].getLatLng().lng));
} else {
checkinMarkers[checkinId].closePopup();
checkinMarkers[checkinId].removeFrom(map);
}
}
</script>