This commit is contained in:
pika 2025-03-31 17:48:23 +02:00
parent f7f28b35ec
commit eedc354160
6 changed files with 56 additions and 6 deletions

View file

@ -25,6 +25,7 @@
<link rel="stylesheet" href="{{ url_for('static', filename='css/theme.css') }}">
<!-- Favicon -->
<link rel="icon" type="image/png" href="{{ url_for('static', filename='img/favicon.png') }}">
<meta name="csrf-token" content="{{ csrf_token() }}">
{% block styles %}{% endblock %}
<script>
// Check for saved theme preference or respect OS preference
@ -602,6 +603,18 @@
to { opacity: 0; }
}
</script>
<script>
// Add CSRF token to all AJAX requests
$(document).ready(function () {
$.ajaxSetup({
beforeSend: function (xhr, settings) {
if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) {
xhr.setRequestHeader("X-CSRFToken", $('meta[name="csrf-token"]').attr('content'));
}
}
});
});
</script>
{% block scripts %}{% endblock %}
</body>