Skip to content

Node.js based forum software built for the modern web

added cache-buster to template xhr urls -- closed #1392

Julian Lam126260a027fa
diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js
index 885e1bcb6c..04b6c420b9 100644
--- a/public/src/ajaxify.js
+++ b/public/src/ajaxify.js
@@ -209,7 +209,7 @@ var ajaxify = ajaxify || {};
callback(templates.cache[template]);
} else {
$.ajax({
- url: RELATIVE_PATH + '/templates/' + template + '.tpl',
+ url: RELATIVE_PATH + '/templates/' + template + '.tpl' + (config['cache-buster'] ? '?v=' + config['cache-buster'] : ''),
type: 'GET',
success: function(data) {
callback(data.toString());
diff --git a/src/controllers/api.js b/src/controllers/api.js
index ef95ad8ebe..512afe14bd 100644
--- a/src/controllers/api.js
+++ b/src/controllers/api.js
@@ -39,6 +39,7 @@ apiController.getConfig = function(req, res, next) {
config.defaultLang = meta.config.defaultLang || 'en_GB';
config.environment = process.env.NODE_ENV;
config.isLoggedIn = !!req.user;
+ config['cache-buster'] = meta.config['cache-buster'] || '';
if (!req.user) {
if (res.locals.isAPI) {