Download:
child 199:bf329ed737e4
parent 197:078233f1a322
198:9f3006a2154f
Anton Shestakov <av6@dwimlabs.net>, Wed, 25 May 2016 21:04:11 +0800
contrib: and ad-hoc script to update SRI hashes

1 файлов изменено, 13 вставок(+), 0 удалений(-) [+]
contrib/updatesri.sh file | annotate | diff | comparison | revisions
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/updatesri.sh Wed May 25 21:04:11 2016 +0800
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+set -euo pipefail
+
+egrep -oh 'https://[^"]+\.js' "$@" | sort -u | while read url; do
+ hash=`curl -fsS "$url" | openssl dgst -sha384 -binary | openssl base64 -A`
+ sed -i "\|$url| c\\ <script src=\"$url\" integrity=\"sha384-$hash\" crossorigin=\"anonymous\"></script>" "$@"
+done
+
+egrep -oh 'https://[^"]+\.css' "$@" | sort -u | while read url; do
+ hash=`curl -fsS "$url" | openssl dgst -sha384 -binary | openssl base64 -A`
+ sed -i "\|$url| c\\ <link rel=\"stylesheet\" href=\"$url\" integrity=\"sha384-$hash\" crossorigin=\"anonymous\">" "$@"
+done