MAPG-28 fix static asset paths (add STATIC_ROOT and REVISION)

This commit is contained in:
Bence Pőcze 2020-06-12 20:13:43 +02:00
parent 06a0722899
commit 2ef67d53f4
7 changed files with 19 additions and 15 deletions

View File

@ -229,7 +229,7 @@
clickable: true,
draggable: false,
icon: {
url: '/static/img/markers/marker-green.svg',
url: STATIC_ROOT + '/img/markers/marker-green.svg?rev=' + REVISION,
size: new google.maps.Size(24, 32),
scaledSize: new google.maps.Size(24, 32),
anchor: new google.maps.Point(12, 32)
@ -248,7 +248,7 @@
clickable: false,
draggable: false,
icon: {
url: '/static/img/markers/marker-gray-empty.svg',
url: STATIC_ROOT + '/img/markers/marker-gray-empty.svg?rev=' + REVISION,
size: new google.maps.Size(24, 32),
scaledSize: new google.maps.Size(24, 32),
anchor: new google.maps.Point(12, 32),
@ -319,7 +319,7 @@
var round = Game.rounds[i];
round.realMarker.setIcon({
url: '/static/img/markers/marker-green-empty.svg',
url: STATIC_ROOT + '/img/markers/marker-green-empty.svg?rev=' + REVISION,
size: new google.maps.Size(24, 32),
scaledSize: new google.maps.Size(24, 32),
anchor: new google.maps.Point(12, 32),
@ -411,7 +411,7 @@
clickable: false,
draggable: true,
icon: {
url: '/static/img/markers/marker-gray-empty.svg',
url: STATIC_ROOT + '/img/markers/marker-gray-empty.svg?rev=' + REVISION,
size: new google.maps.Size(24, 32),
scaledSize: new google.maps.Size(24, 32),
anchor: new google.maps.Point(12, 32),

View File

@ -327,17 +327,17 @@
var IconCollection = {
iconGreen: L.icon({
iconUrl: '/static/img/markers/marker-green.svg',
iconUrl: STATIC_ROOT + '/img/markers/marker-green.svg?rev' + REVISION,
iconSize: [24, 32],
iconAnchor: [12, 32]
}),
iconRed: L.icon({
iconUrl: '/static/img/markers/marker-red.svg',
iconUrl: STATIC_ROOT + '/img/markers/marker-red.svg?rev=' + REVISION,
iconSize: [24, 32],
iconAnchor: [12, 32]
}),
iconBlue: L.icon({
iconUrl: '/static/img/markers/marker-blue.svg',
iconUrl: STATIC_ROOT + '/img/markers/marker-blue.svg?rev=' + REVISION,
iconSize: [24, 32],
iconAnchor: [12, 32]
}),

View File

@ -17,7 +17,7 @@ $jsFiles = [
<div class="grid">
<h1>
<a href="/maps" title="Back to playable maps">
<img class="inline" src="/static/img/icon.svg">
<img class="inline" src="<?= $_ENV['STATIC_ROOT'] ?>/img/icon.svg?rev=<?= REVISION ?>">
<span>MapGuesser</span>
</a>
</h1>

View File

@ -12,7 +12,7 @@ $jsFiles = [
<div class="grid">
<h1>
<a href="/maps" title="Back to playable maps">
<img class="inline" src="/static/img/icon.svg">
<img class="inline" src="<?= $_ENV['STATIC_ROOT'] ?>/img/icon.svg?rev=<?= REVISION ?>">
<span>MapGuesser</span>
</a>
</h1>

View File

@ -1,7 +1,7 @@
<div class="header">
<h1>
<a href="/" title="MapGuesser">
<img class="inline" src="/static/img/icon.svg">
<img class="inline" src="<?= $_ENV['STATIC_ROOT'] ?>/img/icon.svg?rev=<?= REVISION ?>">
MapGuesser
</a>
</h1>

View File

@ -1,3 +1,7 @@
<script>
const STATIC_ROOT = '<?= $_ENV['STATIC_ROOT'] ?>';
const REVISION = '<?= REVISION ?>';
</script>
<?php if (isset($jsFiles)) : ?>
<?php foreach ($jsFiles as $jsFile) : ?>
<?php

View File

@ -16,12 +16,12 @@
<?php endforeach; ?>
<?php endif; ?>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;500&display=swap" rel="stylesheet">
<link rel="icon" type="image/png" sizes="192x192" href="/static/img/favicon/192x192.png">
<link rel="icon" type="image/png" sizes="96x96" href="/static/img/favicon/96x96.png">
<link rel="icon" type="image/png" sizes="32x32" href="/static/img/favicon/32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/static/img/favicon/16x16.png">
<link rel="icon" type="image/png" sizes="192x192" href="<?= $_ENV['STATIC_ROOT'] ?>/img/favicon/192x192.png?rev=<?= REVISION ?>">
<link rel="icon" type="image/png" sizes="96x96" href="<?= $_ENV['STATIC_ROOT'] ?>/img/favicon/96x96.png?rev=<?= REVISION ?>">
<link rel="icon" type="image/png" sizes="32x32" href="<?= $_ENV['STATIC_ROOT'] ?>/img/favicon/32x32.png?rev=<?= REVISION ?>">
<link rel="icon" type="image/png" sizes="16x16" href="<?= $_ENV['STATIC_ROOT'] ?>/img/favicon/16x16.png?rev=<?= REVISION ?>">
</head>
<body>
<div id="loading">
<img src="/static/img/loading.svg">
<img src="<?= $_ENV['STATIC_ROOT'] ?>/img/loading.svg?rev=<?= REVISION ?>">
</div>