feat: allow disabling CSP, following the hierarchy

Introduces new option `enable_csp`, true by default.
Can be set on a page, section or globally.
This commit is contained in:
welpo
2024-03-15 15:04:37 +01:00
parent 8537bbc10e
commit 5e0cbdd67d
10 changed files with 30 additions and 7 deletions

View File

@@ -25,6 +25,7 @@
"show_previous_next_article_links",
"invert_previous_next_article_links",
"previous_next_article_links_full_width",
"enable_csp",
] %}
<table>

View File

@@ -143,7 +143,9 @@
<meta property="og:site_name" content="{{ config.title }}">
{%- include "partials/content_security_policy.html" -%}
{%- if macros_settings::evaluate_setting_priority(setting="enable_csp", page=page | default(value=""), section=section | default(value=""), default_global_value="true") == "true" -%}
{%- include "partials/content_security_policy.html" -%}
{%- endif -%}
{%- if config.extra.theme_switcher and config.extra.theme_switcher == true -%}
{# If JavaScript is disabled, hide the button. #}