mobile: cache-bust static assets so browser picks up CSS/JS edits

User reported phone still showing old behaviour (Qty/Avg portfolio
columns visible) even though the server-side JS had been updated.
Root cause: every <link>/<script> URL was a plain
/static/css/foo.css with no query string, so mobile Chrome served
the file from its HTTP cache rather than refetching it.

Adds a process-startup timestamp to the Jinja environment as
ASSET_VERSION (computed once when templates_env is imported). Every
<link>/<script> reference now appends `?v={{ ASSET_VERSION }}` so a
container restart bumps the URL and the browser refetches. 38 URLs
across 8 templates updated via sed; tests still pass.

Side benefit: future CSS/JS edits no longer require users to hard-
refresh.
This commit is contained in:
Giorgio Gilestro 2026-05-28 19:20:49 +02:00
parent 1a20f0a15b
commit daa3f79a52
9 changed files with 47 additions and 38 deletions

View file

@ -36,16 +36,16 @@
} catch (e) { document.documentElement.dataset.theme = 'light'; }
})();
</script>
<link rel="stylesheet" href="{{ url_for('static', path='/css/tokens.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', path='/css/layout.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', path='/css/panels.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', path='/css/dashboard.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', path='/css/portfolio.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', path='/css/log-chat.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', path='/css/auth.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', path='/css/settings.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', path='/css/news.css') }}" />
<script src="{{ url_for('static', path='/js/htmx.min.js') }}" defer></script>
<link rel="stylesheet" href="{{ url_for('static', path='/css/tokens.css') }}?v={{ ASSET_VERSION }}" />
<link rel="stylesheet" href="{{ url_for('static', path='/css/layout.css') }}?v={{ ASSET_VERSION }}" />
<link rel="stylesheet" href="{{ url_for('static', path='/css/panels.css') }}?v={{ ASSET_VERSION }}" />
<link rel="stylesheet" href="{{ url_for('static', path='/css/dashboard.css') }}?v={{ ASSET_VERSION }}" />
<link rel="stylesheet" href="{{ url_for('static', path='/css/portfolio.css') }}?v={{ ASSET_VERSION }}" />
<link rel="stylesheet" href="{{ url_for('static', path='/css/log-chat.css') }}?v={{ ASSET_VERSION }}" />
<link rel="stylesheet" href="{{ url_for('static', path='/css/auth.css') }}?v={{ ASSET_VERSION }}" />
<link rel="stylesheet" href="{{ url_for('static', path='/css/settings.css') }}?v={{ ASSET_VERSION }}" />
<link rel="stylesheet" href="{{ url_for('static', path='/css/news.css') }}?v={{ ASSET_VERSION }}" />
<script src="{{ url_for('static', path='/js/htmx.min.js') }}?v={{ ASSET_VERSION }}" defer></script>
<script>
// Inject the user's preferred TONE (NOVICE | INTERMEDIATE) into every
// HTMX request so AI-generated panels resolve to the right cached