0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

🎨 create assetHash if not available in asset_url helper

refs #6982
- was before generated in ConfigManager

[ci skip]
This commit is contained in:
kirrg001 2016-09-13 20:28:20 +02:00 committed by Hannah Wolfe
parent 66dbd5f5f2
commit f4bee50e86

View file

@ -1,5 +1,6 @@
var config = require('../../config'),
utils = require('../../utils');
utils = require('../../utils'),
crypto = require('crypto');
function getAssetUrl(path, isAdmin, minify) {
var output = '';
@ -25,6 +26,10 @@ function getAssetUrl(path, isAdmin, minify) {
output += path;
if (!path.match(/^favicon\.ico$/)) {
if (!config.get('assetHash')) {
config.set('assetHash', (crypto.createHash('md5').update(config.get('ghostVersion') + Date.now()).digest('hex')).substring(0, 10));
}
output = output + '?v=' + config.get('assetHash');
}