Omit integrity hashes for local vendor plugins (#964)

This commit is contained in:
Philippe Ivaldi 2026-06-28 01:57:07 +02:00 committed by GitHub
parent 1746ed135c
commit 0bfb454a74
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -49,7 +49,13 @@ module.exports = hexo => {
}); });
vendors[key] = { vendors[key] = {
url : links[plugins] || links.cdnjs, url : links[plugins] || links.cdnjs,
integrity: value.integrity // Subresource Integrity only adds value for cross-origin CDN assets.
// The hashes in _vendors.yml are computed for the CDN builds; when
// self-hosting (`plugins: local`) the files are served same-origin and
// may differ byte-for-byte from those builds (e.g. a newer bundled
// version), so a hardcoded hash would make the browser block them.
// Omit integrity for local assets.
integrity: plugins === 'local' ? undefined : value.integrity
}; };
} }
}; };