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

@ -14,12 +14,12 @@
} 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/auth.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', path='/css/settings.css') }}" />
<link rel="stylesheet" href="{{ url_for('static', path='/css/public.css') }}" />
<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/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/public.css') }}?v={{ ASSET_VERSION }}" />
</head>
<body class="public-page">
<div class="public-shell">