cache busting on CSS files
This commit is contained in:
5
app.py
5
app.py
@@ -24,6 +24,7 @@ def create_app():
|
||||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
||||
app.config['SECRET_KEY'] = os.getenv('SECRET_KEY', 'your-secure-secret-key-here')
|
||||
app.config['UPLOAD_FOLDER'] = os.path.join(app.root_path, 'static', 'uploads')
|
||||
app.config['CSS_VERSION'] = os.getenv('CSS_VERSION', '1.0.0') # Add CSS version for cache busting
|
||||
|
||||
# Initialize extensions
|
||||
db.init_app(app)
|
||||
@@ -36,6 +37,10 @@ def create_app():
|
||||
def inject_csrf_token():
|
||||
return dict(csrf_token=generate_csrf())
|
||||
|
||||
@app.context_processor
|
||||
def inject_config():
|
||||
return dict(config=app.config)
|
||||
|
||||
# User loader for Flask-Login
|
||||
@login_manager.user_loader
|
||||
def load_user(user_id):
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<title>Login - DocuPulse</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/auth.css') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/colors.css') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/auth.css', v=config.CSS_VERSION) }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/colors.css', v=config.CSS_VERSION) }}">
|
||||
<link rel="stylesheet" href="{{ url_for('main.dynamic_colors') }}?v={{ site_settings.updated_at.timestamp() }}" onload="console.log('[CSS] Dynamic colors loaded with version:', '{{ site_settings.updated_at.timestamp() }}')">
|
||||
<script src="{{ url_for('static', filename='js/color-logger.js') }}"></script>
|
||||
</head>
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<title>Register - DocuPulse</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/auth.css') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/colors.css') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/auth.css', v=config.CSS_VERSION) }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/colors.css', v=config.CSS_VERSION) }}">
|
||||
<link rel="stylesheet" href="{{ url_for('main.dynamic_colors') }}?v={{ site_settings.updated_at.timestamp() }}" onload="console.log('[CSS] Dynamic colors loaded with version:', '{{ site_settings.updated_at.timestamp() }}')">
|
||||
<script src="{{ url_for('static', filename='js/color-logger.js') }}"></script>
|
||||
</head>
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
|
||||
<link href="{{ url_for('static', filename='css/file-grid.css') }}" rel="stylesheet">
|
||||
<link href="{{ url_for('static', filename='css/base.css') }}" rel="stylesheet">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/colors.css') }}">
|
||||
<link href="{{ url_for('static', filename='css/file-grid.css', v=config.CSS_VERSION) }}" rel="stylesheet">
|
||||
<link href="{{ url_for('static', filename='css/base.css', v=config.CSS_VERSION) }}" rel="stylesheet">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/colors.css', v=config.CSS_VERSION) }}">
|
||||
<link rel="stylesheet" href="{{ url_for('main.dynamic_colors') }}?v={{ site_settings.updated_at.timestamp() }}" onload="console.log('[CSS] Dynamic colors loaded with version:', '{{ site_settings.updated_at.timestamp() }}')">
|
||||
{% block extra_css %}{% endblock %}
|
||||
<script src="{{ url_for('static', filename='js/color-logger.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/color-logger.js', v=config.CSS_VERSION) }}"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Navigation -->
|
||||
@@ -42,7 +42,7 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="dropdown">
|
||||
<a class="nav-link d-flex align-items-center gap-2 d-lg-none" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown">
|
||||
<a class="nav-link d-flex align-items-center gap-2 d-lg-none" href="{{ url_for('main.profile') }}">
|
||||
<img src="{{ url_for('profile_pic', filename=current_user.profile_picture) if current_user.profile_picture else url_for('static', filename='default-avatar.png') }}"
|
||||
alt="Profile Picture"
|
||||
class="w-8 h-8 rounded-full object-cover border-2 border-white shadow"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
{% block extra_css %}
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2-bootstrap-5-theme@1.3.0/dist/select2-bootstrap-5-theme.min.css" rel="stylesheet" />
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/conversation.css') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/conversation.css', v=config.CSS_VERSION) }}">
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
{% block extra_css %}
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2-bootstrap-5-theme@1.3.0/dist/select2-bootstrap-5-theme.min.css" rel="stylesheet" />
|
||||
<link href="{{ url_for('static', filename='css/member-management.css') }}" rel="stylesheet" />
|
||||
<link href="{{ url_for('static', filename='css/member-management.css', v=config.CSS_VERSION) }}" rel="stylesheet" />
|
||||
<style>
|
||||
.member-avatar {
|
||||
width: 40px;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{% block title %}Dashboard - DocuPulse{% endblock %}
|
||||
|
||||
{% block extra_css %}
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/dashboard.css') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/dashboard.css', v=config.CSS_VERSION) }}">
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<title>DocuPulse - Legal Document Management</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/home.css') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/home.css', v=config.CSS_VERSION) }}">
|
||||
</head>
|
||||
<body>
|
||||
<!-- Navigation -->
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{% block title %}{{ room.name }} - DocuPulse{% endblock %}
|
||||
|
||||
{% block extra_css %}
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/room.css') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/room.css', v=config.CSS_VERSION) }}">
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
{% block extra_css %}
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2-bootstrap-5-theme@1.3.0/dist/select2-bootstrap-5-theme.min.css" rel="stylesheet" />
|
||||
<link href="{{ url_for('static', filename='css/room_members.css') }}" rel="stylesheet" />
|
||||
<link href="{{ url_for('static', filename='css/room_members.css', v=config.CSS_VERSION) }}" rel="stylesheet" />
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{% block title %}Rooms - DocuPulse{% endblock %}
|
||||
|
||||
{% block extra_css %}
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/rooms.css') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/rooms.css', v=config.CSS_VERSION) }}">
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
{% block title %}Settings - DocuPulse{% endblock %}
|
||||
|
||||
{% block extra_css %}
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/settings.css') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/settings.css', v=config.CSS_VERSION) }}">
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{% block title %}Starred - DocuPulse{% endblock %}
|
||||
|
||||
{% block extra_css %}
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/starred.css') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/starred.css', v=config.CSS_VERSION) }}">
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{% block title %}Trash - DocuPulse{% endblock %}
|
||||
|
||||
{% block extra_css %}
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/trash.css') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/trash.css', v=config.CSS_VERSION) }}">
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
Reference in New Issue
Block a user