автообновлении версии js и css
This commit is contained in:
12
app.py
12
app.py
@@ -311,17 +311,14 @@ def root(request: Request):
|
|||||||
return RedirectResponse(url="/admin/matches")
|
return RedirectResponse(url="/admin/matches")
|
||||||
return RedirectResponse(url="/login")
|
return RedirectResponse(url="/login")
|
||||||
|
|
||||||
@app.context_processor
|
|
||||||
def inject_static_version():
|
def static_version(filename: str) -> str:
|
||||||
def static_version(filename):
|
path = Path(__file__).parent / "static" / filename
|
||||||
path = os.path.join(app.root_path, "static", filename)
|
|
||||||
try:
|
try:
|
||||||
return int(os.path.getmtime(path))
|
return str(int(os.path.getmtime(path)))
|
||||||
except OSError:
|
except OSError:
|
||||||
return "1"
|
return "1"
|
||||||
|
|
||||||
return dict(static_version=static_version)
|
|
||||||
|
|
||||||
|
|
||||||
def log_action(
|
def log_action(
|
||||||
request: Request,
|
request: Request,
|
||||||
@@ -642,6 +639,7 @@ def session_workspace(
|
|||||||
return templates.TemplateResponse(
|
return templates.TemplateResponse(
|
||||||
name="match_workspace.html",
|
name="match_workspace.html",
|
||||||
request=request,
|
request=request,
|
||||||
|
static_version = static_version,
|
||||||
context={
|
context={
|
||||||
"session": session_row,
|
"session": session_row,
|
||||||
"tab": tab,
|
"tab": tab,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<meta http-equiv="Expires" content="0" />
|
<meta http-equiv="Expires" content="0" />
|
||||||
<title>ЖФЛ Управление vMix</title>
|
<title>ЖФЛ Управление vMix</title>
|
||||||
<link rel="icon" href="/static/smith.ico" type="image/x-icon">
|
<link rel="icon" href="/static/smith.ico" type="image/x-icon">
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}?v={{ static_version('styles.css') }}">
|
<link rel="stylesheet" href="/static/styles.css?v={{ static_version('styles.css') }}">
|
||||||
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -1400,7 +1400,7 @@ data-role="{{ p.position or '' }}"
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<script src="{{ url_for('static', filename='script.js') }}?v={{ static_version('script.js') }}"></script>
|
<script src="/static/script.js?v={{ static_version('script.js') }}"></script>
|
||||||
<div id="matrixLoader" class="matrix-loader" aria-hidden="true">
|
<div id="matrixLoader" class="matrix-loader" aria-hidden="true">
|
||||||
<canvas id="matrixCanvas" class="matrix-canvas"></canvas>
|
<canvas id="matrixCanvas" class="matrix-canvas"></canvas>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user