cachebust style and js at build time

This commit is contained in:
2025-08-04 03:10:38 +03:00
parent f08c60de75
commit 7702384c40
6 changed files with 15 additions and 8 deletions

View File

@ -141,4 +141,11 @@ def create_app():
for id_, text in matches for id_, text in matches
] ]
# this only happens at build time but
# build time is when updates are done anyway
# sooo... /shrug
@app.template_filter('cachebust')
def cachebust(subject):
return f"{subject}?v={str(int(time.time()))}"
return app return app

View File

@ -8,7 +8,7 @@
{% else %} {% else %}
<title>Porom</title> <title>Porom</title>
{% endif %} {% endif %}
<link rel="stylesheet" href="/static/style.css"> <link rel="stylesheet" href="{{ "/static/style.css" | cachebust }}">
<link rel="icon" type="image/png" href="/static/favicon.png"> <link rel="icon" type="image/png" href="/static/favicon.png">
</head> </head>
<body> <body>
@ -24,7 +24,7 @@
<footer class="darkbg"> <footer class="darkbg">
<span>Pyrom commit <a href="{{ "https://git.poto.cafe/yagich/pyrom/commit/" + __commit }}">{{ __commit[:8] }}</a></span> <span>Pyrom commit <a href="{{ "https://git.poto.cafe/yagich/pyrom/commit/" + __commit }}">{{ __commit[:8] }}</a></span>
</footer> </footer>
<script src="/static/js/copy-code.js"></script> <script src="{{ "/static/js/copy-code.js" | cachebust }}"></script>
<script src="/static/js/ui.js"></script> <script src="{{ "/static/js/ui.js" | cachebust }}"></script>
<script src="/static/js/date-fmt.js"></script> <script src="{{ "/static/js/date-fmt.js" | cachebust }}"></script>
</body> </body>

View File

@ -67,7 +67,7 @@
<div id="babycode-preview-container"></div> <div id="babycode-preview-container"></div>
</div> </div>
</div> </div>
<script src="/static/js/babycode-editor.js?v=2"></script> <script src="{{ "/static/js/babycode-editor.js" | cachebust }}"></script>
{% endmacro %} {% endmacro %}
{% macro babycode_editor_form(ta_name, prefill = "", cancel_url="", endpoint="") %} {% macro babycode_editor_form(ta_name, prefill = "", cancel_url="", endpoint="") %}

View File

@ -14,5 +14,5 @@
<input type=submit value="Save order"> <input type=submit value="Save order">
</form> </form>
</div> </div>
<script src="/static/js/sort-topics.js"></script> <script src="{{ "/static/js/sort-topics.js" | cachebust }}"></script>
{% endblock %} {% endblock %}

View File

@ -83,5 +83,5 @@
</span> </span>
</div> </div>
</div> </div>
<script src="/static/js/thread.js?v=1"></script> <script src="{{ "/static/js/thread.js" | cachebust }}"></script>
{% endblock %} {% endblock %}

View File

@ -75,5 +75,5 @@
</div> </div>
</dialog> </dialog>
<script src="/static/js/topic.js"></script> <script src="{{ "/static/js/topic.js" | cachebust }}"></script>
{% endblock %} {% endblock %}