fix: serve admin bundle as hashed immutable assets
The lazy-loaded admin CSS/JS resolved to bare runtime names served no-store, the same scheme that left the main bundle vulnerable to stale CSS in iOS WebViews after a deploy. The original reason for keeping them bare (hashed admin files could 404 when nginx fronts aiohttp) no longer holds: the backend image now carries the same deterministically hashed assets nginx serves, and the App.svelte loader already falls back to the bare name if a hashed asset ever 404s. Resolve the admin assets through the same hashed/version-stable path as the main bundle so they are emitted as immutable, cache-busting URLs. Also drop the inert <meta http-equiv="Cache-Control/Pragma/Expires"> tags from the shell: browsers ignore http-equiv caching directives for the document and use the real HTTP headers, which are already set.
This commit is contained in:
@@ -1454,10 +1454,15 @@ def _resolve_webapp_js_asset_name() -> str:
|
||||
|
||||
|
||||
def _resolve_webapp_admin_js_asset_name() -> str:
|
||||
# The admin bundle is lazy-loaded from the already running Mini App. In
|
||||
# deployments where nginx serves static files in front of aiohttp, stale
|
||||
# hashed admin filenames can 404 even though the runtime build asset exists.
|
||||
return _set_cached_asset_name("admin-js", "subscription_webapp_admin.js")
|
||||
# The admin bundle is lazy-loaded from the already running Mini App. It now
|
||||
# ships content-hashed alongside the main bundle (same build, deterministic
|
||||
# hashes, served immutable), so iOS WebViews fetch fresh admin assets on every
|
||||
# deploy. The App.svelte loader falls back to the bare runtime build name if a
|
||||
# hashed asset ever 404s.
|
||||
return _resolve_hashed_js_asset_name(
|
||||
kind="admin-js",
|
||||
base_name="subscription_webapp_admin",
|
||||
)
|
||||
|
||||
|
||||
def _resolve_hashed_js_asset_name(*, kind: str, base_name: str) -> str:
|
||||
@@ -1487,9 +1492,11 @@ def _resolve_webapp_css_asset_name() -> str:
|
||||
|
||||
|
||||
def _resolve_webapp_admin_css_asset_name() -> str:
|
||||
# Keep the lazy-loaded admin stylesheet on the stable build filename for
|
||||
# the same reason as the JS bundle above.
|
||||
return _set_cached_asset_name("admin-css", "subscription_webapp_admin.css")
|
||||
# Content-hashed and immutable, same rationale as the admin JS bundle above.
|
||||
return _resolve_hashed_css_asset_name(
|
||||
kind="admin-css",
|
||||
base_name="subscription_webapp_admin",
|
||||
)
|
||||
|
||||
|
||||
def _resolve_hashed_css_asset_name(*, kind: str, base_name: str) -> str:
|
||||
|
||||
Reference in New Issue
Block a user