mirror of https://gitlab.com/curben/blog
refactor: switch to more modern sri-fallback
https://github.com/JackuB/subresource-integrity-fallback
This commit is contained in:
parent
d314bff200
commit
43bf50dac5
|
@ -1,16 +1,13 @@
|
||||||
<%/* Fallback function for SRI */%>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" data-sri-fallback="/js/jquery.min.js" integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT" crossorigin="anonymous"></script>
|
||||||
<%- js('js/sri-fallback.min') %>
|
|
||||||
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" x-sri-fallback="/js/jquery.min.js" integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT" crossorigin="anonymous"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" data-sri-fallback="/js/clipboard.min.js" integrity="sha384-8CYhPwYlLELodlcQV713V9ZikA3DlCVaXFDpjHfP8Z36gpddf/Vrt47XmKDsCttu" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" x-sri-fallback="/js/clipboard.min.js" integrity="sha384-8CYhPwYlLELodlcQV713V9ZikA3DlCVaXFDpjHfP8Z36gpddf/Vrt47XmKDsCttu" crossorigin="anonymous"></script>
|
<script src="https://cdn.jsdelivr.net/npm/cloudinary-jquery@2.6.3/cloudinary-jquery.min.js" data-sri-fallback="/js/cloudinary-jquery.min.js" integrity="sha384-7r/pYA0kKTYRA5gvNNmg/8Z5uHwjrPf1TVF8bcIVj52wHxbo9GU3P/69gZGRtpvH" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/cloudinary-jquery@2.6.3/cloudinary-jquery.min.js" x-sri-fallback="/js/cloudinary-jquery.min.js" integrity="sha384-7r/pYA0kKTYRA5gvNNmg/8Z5uHwjrPf1TVF8bcIVj52wHxbo9GU3P/69gZGRtpvH" crossorigin="anonymous"></script>
|
|
||||||
|
|
||||||
<% if (theme.fancybox) { %>
|
<% if (theme.fancybox) { %>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.js" x-sri-fallback="/fancybox/jquery.fancybox.min.js" integrity="sha384-Zm+UU4tdcfAm29vg+MTbfu//q5B/lInMbMCr4T8c9rQFyOv6PlfQYpB5wItcXWe7" crossorigin="anonymous"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.js" data-sri-fallback="/fancybox/jquery.fancybox.min.js" integrity="sha384-Zm+UU4tdcfAm29vg+MTbfu//q5B/lInMbMCr4T8c9rQFyOv6PlfQYpB5wItcXWe7" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.css" x-sri-fallback="/fancybox/jquery.fancybox.min.css" integrity="sha384-Q8BgkilbsFGYNNiDqJm69hvDS7NCJWOodvfK/cwTyQD4VQA0qKzuPpvqNER1UC0F" crossorigin="anonymous">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.css" data-sri-fallback="/fancybox/jquery.fancybox.min.css" integrity="sha384-Q8BgkilbsFGYNNiDqJm69hvDS7NCJWOodvfK/cwTyQD4VQA0qKzuPpvqNER1UC0F" crossorigin="anonymous">
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<%/* Initialize cloudinary responsive function */%>
|
<%/* Initialize cloudinary responsive function */%>
|
||||||
|
|
|
@ -39,10 +39,13 @@
|
||||||
<meta name="msapplication-config" content="/browserconfig.xml">
|
<meta name="msapplication-config" content="/browserconfig.xml">
|
||||||
<meta name="theme-color" content="#ffffff">
|
<meta name="theme-color" content="#ffffff">
|
||||||
|
|
||||||
|
<%/* Fallback function for SRI */%>
|
||||||
|
<%- js('js/sri.min') %>
|
||||||
|
|
||||||
<%- css('css/typing') %>
|
<%- css('css/typing') %>
|
||||||
<% if (theme.icons) { %>
|
<% if (theme.icons) { %>
|
||||||
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.1/js/solid.min.js" x-sri-fallback="/fontawesome/solid.min.js" integrity="sha384-IA6YnujJIO+z1m4NKyAGvZ9Wmxrd4Px8WFqhFcgRmwLaJaiwijYgApVpo1MV8p77" crossorigin="anonymous"></script>
|
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.1/js/solid.min.js" data-sri-fallback="/fontawesome/solid.min.js" integrity="sha384-IA6YnujJIO+z1m4NKyAGvZ9Wmxrd4Px8WFqhFcgRmwLaJaiwijYgApVpo1MV8p77" crossorigin="anonymous"></script>
|
||||||
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.1/js/brands.min.js" x-sri-fallback="/fontawesome/brands.min.js" integrity="sha384-rUOIFHM3HXni/WG5pzDhA1e2Js5nn4bWudTYujHbbI9ztBIxK54CL4ZNZWwcBQeD" crossorigin="anonymous"></script>
|
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.1/js/brands.min.js" data-sri-fallback="/fontawesome/brands.min.js" integrity="sha384-rUOIFHM3HXni/WG5pzDhA1e2Js5nn4bWudTYujHbbI9ztBIxK54CL4ZNZWwcBQeD" crossorigin="anonymous"></script>
|
||||||
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.1/js/fontawesome.min.js" x-sri-fallback="/fontawesome/fontawesome.min.js" integrity="sha384-EMmnH+Njn8umuoSMZ3Ae3bC9hDknHKOWL2e9WJD/cN6XLeAN7tr5ZQ0Hx5HDHtkS" crossorigin="anonymous"></script>
|
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.1/js/fontawesome.min.js" data-sri-fallback="/fontawesome/fontawesome.min.js" integrity="sha384-EMmnH+Njn8umuoSMZ3Ae3bC9hDknHKOWL2e9WJD/cN6XLeAN7tr5ZQ0Hx5HDHtkS" crossorigin="anonymous"></script>
|
||||||
<% } %>
|
<% } %>
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
!function(){var a="x-sri-fallback";function o(e){var r=e.getAttribute&&e.getAttribute(a),i=(e.tagName||"").toLowerCase(),n="script"===i&&e.src?"src":"link"===i&&"stylesheet"===e.rel&&e.href?"href":null;r&&n&&(e.onerror=function(){var t=document.createElement(i);t.crossOrigin=e.crossOrigin,t.integrity=e.integrity,t[n]=r,"link"===i&&(t.rel=e.rel),t.onerror=function(){console.log("SRI fallback "+r+" also failed to match integrity string "+t.integrity+".")},document.head.appendChild(t)})}new MutationObserver(function(t){for(var e=0;e<t.length;++e){for(var r=t[e],i=r.addedNodes,n=0;n<i.length;++n)o(i[n]);r.attributeName===a&&o(r.target)}}).observe(document,{childList:!0,attributes:!0,characterData:!1,subtree:!0,attributeOldValue:!1,attributeFilter:[a]})}();
|
|
|
@ -0,0 +1 @@
|
||||||
|
try{!function(){const t=window.resourceLoadError||(()=>{}),e="data-sri-fallback",r=window.MutationObserver||window.WebKitMutationObserver;r&&new r(function(t){t.forEach(function(t){t.addedNodes.forEach(i)})}).observe(document,{childList:!0,subtree:!0});const i=function(r){const i=(r.tagName||"").toLowerCase();"link"!==i&&"script"!==i||!r.integrity||r.getAttribute("data-sri-fallback-retry")||(r.onerror=function(o){if(r.getAttribute(e)){const o=document.createElement(i),n=r.parentNode;o.setAttribute("data-sri-fallback-retry","1"),o.setAttribute("integrity",r.integrity),r.src&&o.setAttribute("src",r.getAttribute(e)),r.href&&o.setAttribute("href",r.getAttribute(e)),o.onerror=function(e){t(e,!0)},n.appendChild(o),r.remove()}else t(o,!1)})}}()}catch(t){console.error(t)}
|
Loading…
Reference in New Issue