Use Sub Resource Integrity

pull/1/head
mat ess 2022-08-13 01:18:01 -04:00
parent 97ef0bab82
commit b79056d561
2 changed files with 7 additions and 6 deletions

View File

@ -25,12 +25,13 @@ favicon = "/favicon.svg"
stylesheets = [] stylesheets = []
use_cdn = true use_cdn = true
# include hashes for SRI
cdns = [ cdns = [
"https://cdn.jsdelivr.net/npm/firacode@6.2.0/distr/fira_code.min.css", { url = "https://cdn.jsdelivr.net/npm/firacode@6.2.0/distr/fira_code.min.css", hash = "sWIpcFPnJFfPqQU7FWn8H9+Xax/h5ihI8hVjQTBa5WmUde6CZZLw9DUAaIyA6j5u" },
"https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.5/dist/web/static/pretendard-std-dynamic-subset.min.css", { url = "https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.5/dist/web/static/pretendard-std-dynamic-subset.min.css", hash = "UzN3sOqBetZN9G2CDFfxg1PNJ+Qrv8/HZIoBp6XsCD+2DOehpvXGqkj2WFCNge5Q" },
"https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.5/dist/web/variable/pretendardvariable-std.min.css", { url = "https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.5/dist/web/variable/pretendardvariable-std.min.css", hash = "3OYJp8uUv2MJWyKGgrZOrSjf+WP+nD7ifpJ04kAsI02PYi+nghC4TF37YkN/2Qxt" },
"https://cdn.jsdelivr.net/gh/codex-src/iA-Fonts@master/iA%20Writer%20Quattro/Webfonts/index.min.css", { url = "https://cdn.jsdelivr.net/gh/codex-src/iA-Fonts@master/iA%20Writer%20Quattro/Webfonts/index.min.css", hash = "Vx6OU3QBwm96rTUebUtdfD/AW3d3uzT896pixaUYg9Nb87zqHuXmjmv9aGwBmFjP" },
"https://cdn.jsdelivr.net/gh/codex-src/iA-Fonts@master/iA%20Writer%20Quattro/Variable/index.min.css", { url = "https://cdn.jsdelivr.net/gh/codex-src/iA-Fonts@master/iA%20Writer%20Quattro/Variable/index.min.css", hash = "sFJyxW2UhZcJ0SAweDcoU6dBgqox5PbLK5nZStQSQitBeRHigPu7OPWDvoIHEXeo" },
] ]
menu = [ menu = [

View File

@ -26,7 +26,7 @@
{# Font from cdn or disk #} {# Font from cdn or disk #}
{% if config.extra.use_cdn | default(value=false) %} {% if config.extra.use_cdn | default(value=false) %}
{% for cdn in config.extra.cdns %} {% for cdn in config.extra.cdns %}
<link href={{ cdn }} rel="stylesheet"> <link href={{ cdn.url }} rel="stylesheet" integrity="sha384-{{ cdn.hash }}" crossorigin="anonymous">
{% endfor %} {% endfor %}
{% else %} {% else %}
<link href="{{ get_url(path='fonts.css') }}" rel="stylesheet" /> <link href="{{ get_url(path='fonts.css') }}" rel="stylesheet" />