mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 03:12:42 +01:00
Last modification is more specific (when possible).
This commit is contained in:
parent
3da1464ae0
commit
a5006255b7
1 changed files with 26 additions and 3 deletions
|
@ -54,7 +54,7 @@ exports.minifyJS = function(req, res, next)
|
|||
var filename = req.params['filename'];
|
||||
res.header("Content-Type","text/javascript");
|
||||
|
||||
lastModifiedDate(function (date) {
|
||||
lastModifiedDateOf(filename, function (error, date) {
|
||||
date = new Date(date);
|
||||
res.setHeader('last-modified', date.toUTCString());
|
||||
res.setHeader('date', (new Date()).toUTCString());
|
||||
|
@ -161,7 +161,30 @@ function getAceFile(callback) {
|
|||
});
|
||||
}
|
||||
|
||||
function lastModifiedDate(callback) {
|
||||
function lastModifiedDateOf(filename, callback) {
|
||||
if (filename == 'ace.js') {
|
||||
lastModifiedDateOfEverything(callback);
|
||||
} else {
|
||||
fs.stat(JS_DIR + filename, function (error, stats) {
|
||||
if (error) {
|
||||
if (error.code == "ENOENT") { // Stat the directory instead.
|
||||
fs.stat(JS_DIR, function (error, stats) {
|
||||
if (error) {
|
||||
callback(error);
|
||||
} else {
|
||||
callback(null, stats.mtime.getTime());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
callback(error);
|
||||
}
|
||||
} else {
|
||||
callback(null, stats.mtime.getTime());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function lastModifiedDateOfEverything(callback) {
|
||||
var folders2check = [CSS_DIR, JS_DIR];
|
||||
var latestModification = 0;
|
||||
//go trough this two folders
|
||||
|
@ -197,7 +220,7 @@ function lastModifiedDate(callback) {
|
|||
}, callback);
|
||||
});
|
||||
}, function () {
|
||||
callback(latestModification);
|
||||
callback(null, latestModification);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue