From c416aedb2db52f8321ba768a514f6aa6480cad24 Mon Sep 17 00:00:00 2001 From: curben <2809763-curben@users.noreply.gitlab.com> Date: Mon, 26 Aug 2019 06:18:09 +0930 Subject: [PATCH] feat(cloudinary): use Staticaly CDN --- scripts/cloudinary.js | 9 +++++---- source/_headers | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/cloudinary.js b/scripts/cloudinary.js index a369816..0f27273 100644 --- a/scripts/cloudinary.js +++ b/scripts/cloudinary.js @@ -14,8 +14,9 @@ hexo.extend.tag.register('cloudinary', (args) => { const alt = args[1] || '' let modern = '' let legacy = '' - const cloudinary = 'https://res.cloudinary.com/' + user + - '/image/upload/f_auto,q_auto' + const cloudinary = 'https://cdn.statically.io/img/res.cloudinary.com/' + user + + '/image/upload/q_auto' + const original = 'https://cdn.statically.io/img/res.cloudinary.com/' + user + '/' + fileName if (fileName.endsWith('.png')) { modern = fileName.replace(/\.png$/, '.webp') @@ -40,7 +41,7 @@ hexo.extend.tag.register('cloudinary', (args) => { alt="${alt}">` if (fileName.endsWith('.png') || fileName.endsWith('.webp')) { - return ` + return ` + return ` ${img}` } }) diff --git a/source/_headers b/source/_headers index 1224654..5e7abcc 100644 --- a/source/_headers +++ b/source/_headers @@ -3,7 +3,7 @@ X-XSS-Protection: 1; mode=block X-Content-Type-Options: nosniff Content-Language: en - Content-Security-Policy: default-src 'self'; child-src 'none'; connect-src 'none'; font-src 'none'; frame-src 'none'; img-src https: 'self'; manifest-src 'none'; media-src 'none'; object-src 'none'; prefetch-src 'none'; script-src https://cdnjs.cloudflare.com 'self'; style-src https://cdnjs.cloudflare.com 'self'; worker-src 'none'; base-uri 'none'; form-action https://duckduckgo.com; frame-ancestors 'none'; block-all-mixed-content + Content-Security-Policy: default-src 'self'; child-src 'none'; connect-src 'none'; font-src 'none'; frame-src 'none'; img-src https://cdn.statically.io 'self'; manifest-src 'none'; media-src 'none'; object-src 'none'; prefetch-src 'none'; script-src https://cdnjs.cloudflare.com 'self'; style-src https://cdnjs.cloudflare.com 'self'; worker-src 'none'; base-uri 'none'; form-action https://duckduckgo.com; frame-ancestors 'none'; block-all-mixed-content Referrer-Policy: no-referrer Strict-Transport-Security: max-age=31536000 Feature-Policy: accelerometer 'none'; autoplay 'none'; camera 'none'; document.domain 'none'; display-capture 'none'; encrypted-media 'none'; geolocation 'none'; gyroscope 'none'; magnetometer 'none'; microphone 'none'; midi 'none'; payment 'none'; sync-xhr 'none'; usb 'none'