diff options
author | Mario Vavti <mario@mariovavti.com> | 2019-06-04 10:19:04 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2019-06-04 10:19:04 +0200 |
commit | e4ca3609d90bb437061e4b8db95ed0424b25eb76 (patch) | |
tree | aa070e40ab01cb1354cbf879a0fb8b2f570631d5 /vendor/twbs/bootstrap/build/generate-sri.js | |
parent | 071fba2f7121aeb9690a21398935a53deac09af8 (diff) | |
parent | bc092d8d7815195d62299c0ea54caa4759e6f2e7 (diff) | |
download | volse-hubzilla-4.2.tar.gz volse-hubzilla-4.2.tar.bz2 volse-hubzilla-4.2.zip |
Merge branch '4.2RC'4.2
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}`) |