diff --git a/app.py b/app.py index f900b24..4f6c3d5 100644 --- a/app.py +++ b/app.py @@ -311,18 +311,15 @@ def root(request: Request): return RedirectResponse(url="/admin/matches") return RedirectResponse(url="/login") -@app.context_processor -def inject_static_version(): - def static_version(filename): - path = os.path.join(app.root_path, "static", filename) - try: - return int(os.path.getmtime(path)) - except OSError: - return "1" - - return dict(static_version=static_version) - +def static_version(filename: str) -> str: + path = Path(__file__).parent / "static" / filename + try: + return str(int(os.path.getmtime(path))) + except OSError: + return "1" + + def log_action( request: Request, action: str, @@ -642,6 +639,7 @@ def session_workspace( return templates.TemplateResponse( name="match_workspace.html", request=request, + static_version = static_version, context={ "session": session_row, "tab": tab, diff --git a/templates/match_workspace.html b/templates/match_workspace.html index 52d4b89..d6f917d 100644 --- a/templates/match_workspace.html +++ b/templates/match_workspace.html @@ -10,9 +10,9 @@