From 7702384c4042f8daf87a969a744676c4378ac2e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lera=20Elvo=C3=A9?= Date: Mon, 4 Aug 2025 03:10:38 +0300 Subject: [PATCH] cachebust style and js at build time --- app/__init__.py | 7 +++++++ app/templates/base.html | 8 ++++---- app/templates/common/macros.html | 2 +- app/templates/mod/sort-topics.html | 2 +- app/templates/threads/thread.html | 2 +- app/templates/topics/topic.html | 2 +- 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index af80e96..d611d3c 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -141,4 +141,11 @@ def create_app(): 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 diff --git a/app/templates/base.html b/app/templates/base.html index 9589ff9..eea9687 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -8,7 +8,7 @@ {% else %} Porom {% endif %} - + @@ -24,7 +24,7 @@ - - - + + + diff --git a/app/templates/common/macros.html b/app/templates/common/macros.html index 0b5cf97..ec94cd0 100644 --- a/app/templates/common/macros.html +++ b/app/templates/common/macros.html @@ -67,7 +67,7 @@
- + {% endmacro %} {% macro babycode_editor_form(ta_name, prefill = "", cancel_url="", endpoint="") %} diff --git a/app/templates/mod/sort-topics.html b/app/templates/mod/sort-topics.html index 7e03b33..a679fff 100644 --- a/app/templates/mod/sort-topics.html +++ b/app/templates/mod/sort-topics.html @@ -14,5 +14,5 @@ - + {% endblock %} diff --git a/app/templates/threads/thread.html b/app/templates/threads/thread.html index 8852156..7b327e6 100644 --- a/app/templates/threads/thread.html +++ b/app/templates/threads/thread.html @@ -83,5 +83,5 @@ - + {% endblock %} diff --git a/app/templates/topics/topic.html b/app/templates/topics/topic.html index 520bdeb..b287820 100644 --- a/app/templates/topics/topic.html +++ b/app/templates/topics/topic.html @@ -75,5 +75,5 @@ - + {% endblock %}