From 88c3bc1b5baaa93d1a97915693c541c4751cf58a Mon Sep 17 00:00:00 2001 From: Kobe Date: Wed, 4 Jun 2025 11:47:35 +0200 Subject: [PATCH] proper cache busting --- app.py | 6 +++ templates/auth/login.html | 6 +-- templates/auth/register.html | 6 +-- templates/common/base.html | 8 +-- templates/contacts/form.html | 4 +- templates/contacts/list.html | 4 +- templates/conversations/conversation.html | 8 +-- templates/conversations/conversations.html | 2 +- .../conversations/create_conversation.html | 4 +- templates/dashboard/dashboard.html | 2 +- templates/home.html | 2 +- templates/notifications/notifications.html | 2 +- templates/profile/profile.html | 2 +- templates/rooms/room.html | 14 +++--- templates/rooms/room_members.html | 4 +- templates/rooms/rooms.html | 4 +- templates/settings/settings.html | 6 +-- templates/starred/starred.html | 6 +-- templates/trash/trash.html | 6 +-- utils/asset_utils.py | 49 +++++++++++++++++++ 20 files changed, 100 insertions(+), 45 deletions(-) create mode 100644 utils/asset_utils.py diff --git a/app.py b/app.py index 287008f..48d597b 100644 --- a/app.py +++ b/app.py @@ -15,6 +15,7 @@ from extensions import db, login_manager, csrf from utils.email_templates import create_default_templates from datetime import datetime from sqlalchemy import text +from utils.asset_utils import get_asset_version # Load environment variables load_dotenv() @@ -49,6 +50,11 @@ def create_app(): db.session.commit() return dict(config=app.config, site_settings=site_settings) + @app.template_filter('asset_version') + def asset_version_filter(filename): + """Template filter to get version hash for static assets""" + return get_asset_version(filename) or '' + # User loader for Flask-Login @login_manager.user_loader def load_user(user_id): diff --git a/templates/auth/login.html b/templates/auth/login.html index 32e24d9..ab000dc 100644 --- a/templates/auth/login.html +++ b/templates/auth/login.html @@ -6,10 +6,10 @@ Login - DocuPulse - - + + - +
diff --git a/templates/auth/register.html b/templates/auth/register.html index d39f430..87a58d7 100644 --- a/templates/auth/register.html +++ b/templates/auth/register.html @@ -6,10 +6,10 @@ Register - DocuPulse - - + + - +
diff --git a/templates/common/base.html b/templates/common/base.html index 49f27b6..3b46e1d 100644 --- a/templates/common/base.html +++ b/templates/common/base.html @@ -9,12 +9,12 @@ - - - + + + {% block extra_css %}{% endblock %} - + diff --git a/templates/contacts/form.html b/templates/contacts/form.html index f27a6c8..ad3531f 100644 --- a/templates/contacts/form.html +++ b/templates/contacts/form.html @@ -157,9 +157,9 @@
- + {% endblock %} {% block extra_js %} - + {% endblock %} \ No newline at end of file diff --git a/templates/contacts/list.html b/templates/contacts/list.html index c07fbb4..634ace5 100644 --- a/templates/contacts/list.html +++ b/templates/contacts/list.html @@ -43,7 +43,7 @@ - + @@ -206,5 +206,5 @@ {% endblock %} {% block extra_js %} - + {% endblock %} \ No newline at end of file diff --git a/templates/conversations/conversation.html b/templates/conversations/conversation.html index 920ee87..0a6f292 100644 --- a/templates/conversations/conversation.html +++ b/templates/conversations/conversation.html @@ -6,7 +6,7 @@ {% block extra_css %} - + {% endblock %} {% block content %} @@ -200,8 +200,8 @@ window.currentUserId = "{{ current_user.id }}"; window.sendMessageUrl = "{{ url_for('conversations.send_message', conversation_id=conversation.id) }}"; - - - + + + {% endblock %} {% endblock content %} \ No newline at end of file diff --git a/templates/conversations/conversations.html b/templates/conversations/conversations.html index 624b3aa..48a4391 100644 --- a/templates/conversations/conversations.html +++ b/templates/conversations/conversations.html @@ -122,6 +122,6 @@ {% block extra_js %} - + {% endblock %} {% endblock %} \ No newline at end of file diff --git a/templates/conversations/create_conversation.html b/templates/conversations/create_conversation.html index e92f3e1..474582e 100644 --- a/templates/conversations/create_conversation.html +++ b/templates/conversations/create_conversation.html @@ -6,7 +6,7 @@ {% block extra_css %} - +