Skip to content
Permalink
Browse files

Add missing integrity attributes (#520)

* Verify minified dark-mode.js integrity

* Verify forkawesome-webfont.woff2 integrity

* Use pipes to fingerprint forkawesome-webfont.woff2
  • Loading branch information
0rzech committed Feb 23, 2021
1 parent 36514f2 commit 501a5bcbc49d0c67383905faeb08e6a71f3f0906
File renamed without changes.
@@ -22,7 +22,9 @@
<link rel="canonical" href="{{ .Permalink }}">
{{ end }}

<link rel="preload" href="/fonts/forkawesome-webfont.woff2?v=1.1.7" as="font" type="font/woff2" crossorigin>
{{ $fa := resources.Get "fonts/forkawesome-webfont.woff2" }}
{{ $faFingerprint := $fa | fingerprint }}
<link rel="preload" href="{{ $fa.RelPermalink }}?v=1.1.7" as="font" type="font/woff2" integrity="{{ $faFingerprint.Data.Integrity }}" crossorigin>

{{ if .Site.IsServer }}
{{ $cssOpts := (dict "targetPath" "css/coder.css" "enableSourceMap" true ) }}
@@ -118,7 +120,7 @@
<script src="{{ $script.RelPermalink }}"></script>
{{ else }}
{{ $script := resources.Get "js/dark-mode.js" | minify | fingerprint }}
<script src="{{ $script.RelPermalink }}"></script>
<script src="{{ $script.RelPermalink }}" integrity="{{ $script.Data.Integrity }}"></script>
{{ end }}
{{ end }}

0 comments on commit 501a5bc

Please sign in to comment.