chore(web): cache-bust own static assets with build SHA

Append ?v=<git_commit_short> to /static/app.css, /static/app.js,
/static/map.js. Each deploy ⇒ new SHA ⇒ new URL ⇒ browsers re-fetch
on any reload, no Ctrl+Shift+R required. Symptom that prompted this:
fresh JS shipped to prod but the user kept running the cached one
because plain Ctrl+R can serve from disk cache when responses lack
explicit Cache-Control. Login page (which doesn't pass
git_commit_short) falls back to 'dev'.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
EiSiMo 2026-04-23 12:59:20 +02:00
parent 0b73bafa81
commit dc5f850d3a

View file

@ -12,9 +12,12 @@
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin=""> integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin="">
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js" <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script> integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
<link rel="stylesheet" href="/static/app.css"> {# Cache-bust own static assets per deploy: SHA changes ⇒ URL changes ⇒
<script src="/static/app.js" defer></script> browsers always pull fresh JS/CSS without a Ctrl+Shift+R. #}
<script src="/static/map.js" defer></script> {% set _v = git_commit_short or 'dev' %}
<link rel="stylesheet" href="/static/app.css?v={{ _v }}">
<script src="/static/app.js?v={{ _v }}" defer></script>
<script src="/static/map.js?v={{ _v }}" defer></script>
</head> </head>
<body class="min-h-screen"> <body class="min-h-screen">
{% block body %}{% endblock %} {% block body %}{% endblock %}