Add cache-busting ?v= to template CSS/JS, bump version
All static asset references now include ?v={{ version }} to force
browser to reload on deploy instead of serving cached versions.
Increment TEMPLATE_VERSION in server.py on each deploy.
This commit is contained in:
@@ -49,6 +49,10 @@ from ..midi.handler import MIDIHandler
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# ── Cache buster version (bumped on deploy) ─────────────────────────
|
||||
# Increment this when template/static changes need to bypass browser cache
|
||||
TEMPLATE_VERSION = "7"
|
||||
|
||||
# ── Defaults ─────────────────────────────────────────────────────────────────
|
||||
|
||||
DEFAULT_HOST = "0.0.0.0"
|
||||
@@ -312,6 +316,8 @@ class WebServer:
|
||||
def _build_app(self) -> FastAPI:
|
||||
|
||||
templates = Jinja2Templates(directory=str(TEMPLATES_DIR))
|
||||
# Inject version into all templates (cache buster for CSS/JS)
|
||||
templates.env.globals["version"] = TEMPLATE_VERSION
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
|
||||
Reference in New Issue
Block a user