diff options
author | Manuel Jiménez Friaza <mjfriaza@openmailbox.org> | 2019-05-19 13:25:00 +0200 |
---|---|---|
committer | Manuel Jiménez Friaza <mjfriaza@openmailbox.org> | 2019-05-19 13:25:00 +0200 |
commit | 429140df97a2c273fba6974147ac2e48e7688263 (patch) | |
tree | 2e337542da1b0f4c9c383dfeb8a7d9eb63990a72 /vendor/twbs/bootstrap/build/generate-sri.js | |
parent | f92d2e3f7c6573bd7bab04223c7e28662605c6d8 (diff) | |
parent | af2b263bc74b16601ec7c123a58f0549613aed27 (diff) | |
download | volse-hubzilla-429140df97a2c273fba6974147ac2e48e7688263.tar.gz volse-hubzilla-429140df97a2c273fba6974147ac2e48e7688263.tar.bz2 volse-hubzilla-429140df97a2c273fba6974147ac2e48e7688263.zip |
Merge remote-tracking branch 'upstream/dev' into dev
Diffstat (limited to 'vendor/twbs/bootstrap/build/generate-sri.js')
-rw-r--r-- | vendor/twbs/bootstrap/build/generate-sri.js | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/vendor/twbs/bootstrap/build/generate-sri.js b/vendor/twbs/bootstrap/build/generate-sri.js index 10936e8a1..a93f3e538 100644 --- a/vendor/twbs/bootstrap/build/generate-sri.js +++ b/vendor/twbs/bootstrap/build/generate-sri.js @@ -5,18 +5,20 @@ * Remember to use the same vendor files as the CDN ones, * otherwise the hashes won't match! * - * Copyright 2017-2018 The Bootstrap Authors - * Copyright 2017-2018 Twitter, Inc. + * Copyright 2017-2019 The Bootstrap Authors + * Copyright 2017-2019 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ 'use strict' +const crypto = require('crypto') const fs = require('fs') const path = require('path') -const sriToolbox = require('sri-toolbox') const sh = require('shelljs') +const pkg = require('../package.json') + sh.config.fatal = true const configFile = path.join(__dirname, '../_config.yml') @@ -34,11 +36,15 @@ const files = [ configPropertyName: 'js_hash' }, { - file: 'site/docs/4.1/assets/js/vendor/jquery-slim.min.js', + file: 'dist/js/bootstrap.bundle.min.js', + configPropertyName: 'js_bundle_hash' + }, + { + file: `site/docs/${pkg.version_short}/assets/js/vendor/jquery-slim.min.js`, configPropertyName: 'jquery_hash' }, { - file: 'site/docs/4.1/assets/js/vendor/popper.min.js', + file: 'node_modules/popper.js/dist/umd/popper.min.js', configPropertyName: 'popper_hash' } ] @@ -49,9 +55,9 @@ files.forEach((file) => { throw err } - const integrity = sriToolbox.generate({ - algorithms: ['sha384'] - }, data) + const algo = 'sha384' + const hash = crypto.createHash(algo).update(data, 'utf8').digest('base64') + const integrity = `${algo}-${hash}` console.log(`${file.configPropertyName}: ${integrity}`) |