From 9d3c700b796cc80f9c73a0e75b5f2425250ed4c0 Mon Sep 17 00:00:00 2001 From: Martin Folkers Date: Tue, 31 Oct 2017 19:17:47 +0100 Subject: [PATCH 01/11] Add user-defined CORS-settings for script files --- core/js.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/js.php b/core/js.php index c344399..f779c64 100644 --- a/core/js.php +++ b/core/js.php @@ -4,6 +4,7 @@ use Asset; use f; +use c; use html; class JS extends \Kirby\Component\JS { @@ -51,7 +52,7 @@ public function tag($src, $async = false) { $attr = array( 'src' => url($src), 'integrity' => $jsIntegrity, // inject generated sri hash - 'crossorigin' => 'anonymous' + 'crossorigin' => c::get('sri-hash.use-credentials') ? 'use-credentials' : 'anonymous' // set user-defined 'crossorigin' attribute ); if(is_array($async)) { From 738a768e4cc122a7a02bc073f265efecd93b007e Mon Sep 17 00:00:00 2001 From: Martin Folkers Date: Tue, 31 Oct 2017 19:20:22 +0100 Subject: [PATCH 02/11] Add user-defined CORS-settings for style files --- core/css.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/css.php b/core/css.php index cd37b8c..59d8c32 100644 --- a/core/css.php +++ b/core/css.php @@ -4,6 +4,7 @@ use Asset; use f; +use c; use html; class CSS extends \Kirby\Component\CSS { @@ -52,7 +53,7 @@ public function tag($url, $media = null) { 'rel' => 'stylesheet', 'href' => url($url), 'integrity' => $cssIntegrity, // inject generated sri hash - 'crossorigin' => 'anonymous' + 'crossorigin' => c::get('sri-hash.use-credentials') ? 'use-credentials' : 'anonymous' // set user-defined 'crossorigin' attribute ); if(is_array($media)) { From aa1fca69489610862361077bc693b353c73e2bab Mon Sep 17 00:00:00 2001 From: Martin Folkers Date: Tue, 31 Oct 2017 19:22:21 +0100 Subject: [PATCH 03/11] Update kirby-sri.php --- kirby-sri.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kirby-sri.php b/kirby-sri.php index 835c0df..092f2d6 100644 --- a/kirby-sri.php +++ b/kirby-sri.php @@ -3,7 +3,7 @@ /** * Adding SRI Hash to css & js files and cache-busting them * - * @version 0.1.0 + * @version 0.3.0 * @author S1SYPHOS */ From 76632e9129d43bf465861a8a9832f84875b191c7 Mon Sep 17 00:00:00 2001 From: Martin Folkers Date: Tue, 31 Oct 2017 19:24:02 +0100 Subject: [PATCH 04/11] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 44c58ed..f1f3066 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "sri-hash", "description": "Kirby SRI Hash & Cache-bust Plugin", "author": "S1SYPHOS ", - "version": "0.2.0", + "version": "0.3.0", "type": "kirby-plugin", "license": "MIT" } From f2fa3ef9a311b4a89761febced0ef338dd797d7a Mon Sep 17 00:00:00 2001 From: Martin Folkers Date: Tue, 31 Oct 2017 20:18:39 +0100 Subject: [PATCH 05/11] Added section 'Options' --- README.md | 49 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index a29540d..691cfc7 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,36 @@ # kirby-sri -This plugin generates base64-encoded cryptographic hashes for your css / js files based on their content and adds them to the `integrity` attribute of their corresponding `