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, clickable: true,
draggable: false, draggable: false,
icon: { 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), size: new google.maps.Size(24, 32),
scaledSize: new google.maps.Size(24, 32), scaledSize: new google.maps.Size(24, 32),
anchor: new google.maps.Point(12, 32) anchor: new google.maps.Point(12, 32)
@ -248,7 +248,7 @@
clickable: false, clickable: false,
draggable: false, draggable: false,
icon: { 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), size: new google.maps.Size(24, 32),
scaledSize: new google.maps.Size(24, 32), scaledSize: new google.maps.Size(24, 32),
anchor: new google.maps.Point(12, 32), anchor: new google.maps.Point(12, 32),
@ -319,7 +319,7 @@
var round = Game.rounds[i]; var round = Game.rounds[i];
round.realMarker.setIcon({ 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), size: new google.maps.Size(24, 32),
scaledSize: new google.maps.Size(24, 32), scaledSize: new google.maps.Size(24, 32),
anchor: new google.maps.Point(12, 32), anchor: new google.maps.Point(12, 32),
@ -411,7 +411,7 @@
clickable: false, clickable: false,
draggable: true, draggable: true,
icon: { 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), size: new google.maps.Size(24, 32),
scaledSize: new google.maps.Size(24, 32), scaledSize: new google.maps.Size(24, 32),
anchor: new google.maps.Point(12, 32), anchor: new google.maps.Point(12, 32),

View File

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

View File

@ -17,7 +17,7 @@ $jsFiles = [
<div class="grid"> <div class="grid">
<h1> <h1>
<a href="/maps" title="Back to playable maps"> <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> <span>MapGuesser</span>
</a> </a>
</h1> </h1>

View File

@ -12,7 +12,7 @@ $jsFiles = [
<div class="grid"> <div class="grid">
<h1> <h1>
<a href="/maps" title="Back to playable maps"> <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> <span>MapGuesser</span>
</a> </a>
</h1> </h1>

View File

@ -1,7 +1,7 @@
<div class="header"> <div class="header">
<h1> <h1>
<a href="/" title="MapGuesser"> <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 MapGuesser
</a> </a>
</h1> </h1>

View File

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

View File

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