mirror of https://gitlab.com/curben/blog
feat(cloudinary): use Staticaly CDN
This commit is contained in:
parent
910dde814f
commit
c416aedb2d
|
@ -14,8 +14,9 @@ hexo.extend.tag.register('cloudinary', (args) => {
|
||||||
const alt = args[1] || ''
|
const alt = args[1] || ''
|
||||||
let modern = ''
|
let modern = ''
|
||||||
let legacy = ''
|
let legacy = ''
|
||||||
const cloudinary = 'https://res.cloudinary.com/' + user +
|
const cloudinary = 'https://cdn.statically.io/img/res.cloudinary.com/' + user +
|
||||||
'/image/upload/f_auto,q_auto'
|
'/image/upload/q_auto'
|
||||||
|
const original = 'https://cdn.statically.io/img/res.cloudinary.com/' + user + '/' + fileName
|
||||||
|
|
||||||
if (fileName.endsWith('.png')) {
|
if (fileName.endsWith('.png')) {
|
||||||
modern = fileName.replace(/\.png$/, '.webp')
|
modern = fileName.replace(/\.png$/, '.webp')
|
||||||
|
@ -40,7 +41,7 @@ hexo.extend.tag.register('cloudinary', (args) => {
|
||||||
alt="${alt}">`
|
alt="${alt}">`
|
||||||
|
|
||||||
if (fileName.endsWith('.png') || fileName.endsWith('.webp')) {
|
if (fileName.endsWith('.png') || fileName.endsWith('.webp')) {
|
||||||
return `<a href="https://res.cloudinary.com/curben/${fileName}">
|
return `<a href="${original}">
|
||||||
<picture>
|
<picture>
|
||||||
<source type="image/webp"
|
<source type="image/webp"
|
||||||
srcset="${cloudinary}/c_limit,w_320/${modern} 320w,
|
srcset="${cloudinary}/c_limit,w_320/${modern} 320w,
|
||||||
|
@ -54,7 +55,7 @@ hexo.extend.tag.register('cloudinary', (args) => {
|
||||||
${img}
|
${img}
|
||||||
</picture></a>`
|
</picture></a>`
|
||||||
} else {
|
} else {
|
||||||
return `<a href="https://res.cloudinary.com/curben/${fileName}">
|
return `<a href="${original}">
|
||||||
${img}</a>`
|
${img}</a>`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
X-XSS-Protection: 1; mode=block
|
X-XSS-Protection: 1; mode=block
|
||||||
X-Content-Type-Options: nosniff
|
X-Content-Type-Options: nosniff
|
||||||
Content-Language: en
|
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
|
Referrer-Policy: no-referrer
|
||||||
Strict-Transport-Security: max-age=31536000
|
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'
|
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'
|
||||||
|
|
Loading…
Reference in New Issue