Versione del gioco (src/version.js, 0.1.0): immagini, musiche e voci con ?v=<versione> e cache lunga in nginx; scripts/bump.sh e make bump per le versioni nuove

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018ks2K99uqCZjAxvy7Rdj1R
This commit is contained in:
2026-10-25 10:10:51 +01:00
co-authored by Claude Opus 5.5
parent 4467909237
commit 12c6357cbc
12 changed files with 98 additions and 19 deletions
+6 -5
View File
@@ -6,6 +6,7 @@ import { render, loadAssets, hasBackground, WIDTH, HEIGHT } from './engine/rende
import { readSave, writeSave, clearSave, readAudio, writeAudio, saveFile, saveFileName, readSaveFile } from './engine/storage.js';
import { Music, trackFor } from './engine/music.js';
import { Voices } from './engine/voices.js';
import { versioned } from './version.js';
const $ = id => document.getElementById(id);
const canvas = $('scene'), ctx = canvas.getContext('2d');
@@ -40,7 +41,7 @@ $('voice-volume').addEventListener('input', e => { voices.setVolume(e.target.val
showSound();
window.music = music; // per i test nel browser
fetch('assets/voices/index.json').then(r => r.ok ? r.json() : {}).then(index => { voices.index = index; }).catch(() => {});
fetch(versioned('assets/voices/index.json')).then(r => r.ok ? r.json() : {}).then(index => { voices.index = index; }).catch(() => {});
window.voices = voices;
let voiced = null;
const say = (who, text) => voices.play(who, text, music.muted);
@@ -156,7 +157,7 @@ function rollCredits() {
rolling = requestAnimationFrame(step);
}
function showFace({ name, face }) {
$('face').querySelector('img').src = face;
$('face').querySelector('img').src = versioned(face);
$('face').querySelector('img').classList.toggle('palio', face.endsWith('palio.png'));
$('face').querySelector('figcaption').textContent = name;
$('face').hidden = false;
@@ -185,7 +186,7 @@ function openMap() {
b.classList.toggle('here', p.here);
const img = document.createElement('img');
img.alt = '';
if (p.mini) img.src = p.mini;
if (p.mini) img.src = versioned(p.mini);
const name = document.createElement('span');
name.textContent = p.name;
b.append(img, name);
@@ -432,7 +433,7 @@ function updateInventory() {
let icon;
if (item.icon?.src) {
icon = document.createElement('img');
icon.src = item.icon.src;
icon.src = versioned(item.icon.src);
icon.alt = '';
} else {
icon = document.createElement('i');
@@ -595,7 +596,7 @@ function showSplash() {
reveal();
};
// La musichetta: senza un gesto del giocatore il browser può non lasciarla partire, e allora il cartello resta muto.
const jingle = story.music?.splash ? new Audio(story.music.splash) : null;
const jingle = story.music?.splash ? new Audio(versioned(story.music.splash)) : null;
if (jingle) {
jingle.volume = music.muted ? 0 : music.volume;
jingle.play().catch(() => {});