mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
forcing back to last known stable before parent merge
This commit is contained in:
parent
49cd270592
commit
564e8fee07
4 changed files with 906 additions and 492 deletions
|
@ -14,6 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var async = require('async');
|
||||||
var Buffer = require('buffer').Buffer;
|
var Buffer = require('buffer').Buffer;
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
@ -144,39 +145,30 @@ CachingMiddleware.prototype = new function () {
|
||||||
res.write = function(data, encoding) {
|
res.write = function(data, encoding) {
|
||||||
buffer += data.toString(encoding);
|
buffer += data.toString(encoding);
|
||||||
};
|
};
|
||||||
res.end = async function(data, encoding) {
|
res.end = function(data, encoding) {
|
||||||
// Parallel.
|
async.parallel([
|
||||||
Promise.all([compressMinified(), compressMinifiedGz()])
|
function (callback) {
|
||||||
|
var path = CACHE_DIR + 'minified_' + cacheKey;
|
||||||
async function compressMinified() {
|
fs.writeFile(path, buffer, function (error, stats) {
|
||||||
var path = CACHE_DIR + 'minified_' + cacheKey;
|
callback();
|
||||||
fs.writeFile(path, buffer, function (error, stats) {
|
});
|
||||||
if(error){
|
}
|
||||||
return Promise.reject(error)
|
, function (callback) {
|
||||||
}
|
var path = CACHE_DIR + 'minified_' + cacheKey + '.gz';
|
||||||
else{
|
zlib.gzip(buffer, function(error, content) {
|
||||||
return Promise.resolve(stats)
|
if (error) {
|
||||||
}
|
callback();
|
||||||
});
|
} else {
|
||||||
}
|
fs.writeFile(path, content, function (error, stats) {
|
||||||
|
callback();
|
||||||
async function compressMinifiedGz() {
|
});
|
||||||
var path = CACHE_DIR + 'minified_' + cacheKey + '.gz';
|
}
|
||||||
zlib.gzip(buffer, function(error, content) {
|
});
|
||||||
if (error) {
|
}
|
||||||
return Promise.reject(error)
|
], function () {
|
||||||
} else {
|
responseCache[cacheKey] = {statusCode: status, headers: headers};
|
||||||
fs.writeFile(path, content, function (error, stats) {
|
respond();
|
||||||
if(error){
|
});
|
||||||
return Promise.reject(error)
|
|
||||||
}
|
|
||||||
return Promise.resolve('ok')
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
responseCache[cacheKey] = {statusCode: status, headers: headers};
|
|
||||||
respond();
|
|
||||||
};
|
};
|
||||||
} else if (status == 304) {
|
} else if (status == 304) {
|
||||||
// Nothing new changed from the cached version.
|
// Nothing new changed from the cached version.
|
||||||
|
|
1311
src/package-lock.json
generated
1311
src/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -51,11 +51,11 @@
|
||||||
"lodash.clonedeep": "4.5.0",
|
"lodash.clonedeep": "4.5.0",
|
||||||
"log4js": "0.6.35",
|
"log4js": "0.6.35",
|
||||||
"measured-core": "1.11.2",
|
"measured-core": "1.11.2",
|
||||||
|
"rehype": "^10.0.0",
|
||||||
|
"rehype-format": "^3.0.1",
|
||||||
"nodeify": "1.0.1",
|
"nodeify": "1.0.1",
|
||||||
"npm": "6.14.5",
|
"npm": "6.14.5",
|
||||||
"openapi-backend": "2.4.1",
|
"openapi-backend": "2.4.1",
|
||||||
"rehype": "^10.0.0",
|
|
||||||
"rehype-format": "^3.0.1",
|
|
||||||
"request": "2.88.2",
|
"request": "2.88.2",
|
||||||
"resolve": "1.1.7",
|
"resolve": "1.1.7",
|
||||||
"security": "1.0.0",
|
"security": "1.0.0",
|
||||||
|
@ -67,7 +67,6 @@
|
||||||
"tiny-worker": "^2.3.0",
|
"tiny-worker": "^2.3.0",
|
||||||
"tinycon": "0.0.1",
|
"tinycon": "0.0.1",
|
||||||
"ueberdb2": "0.4.9",
|
"ueberdb2": "0.4.9",
|
||||||
"uglify-js": "3.8.1",
|
|
||||||
"underscore": "1.8.3",
|
"underscore": "1.8.3",
|
||||||
"unorm": "1.4.1"
|
"unorm": "1.4.1"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
var async = require("async");
|
||||||
var _ = require("underscore");
|
var _ = require("underscore");
|
||||||
|
|
||||||
exports.bubbleExceptions = true
|
exports.bubbleExceptions = true
|
||||||
|
@ -77,22 +78,19 @@ exports.callAll = function (hook_name, args) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function aCallAll(hook_name, args, cb) {
|
function aCallAll(hook_name, args, cb) {
|
||||||
if (!args) args = {};
|
if (!args) args = {};
|
||||||
if (!cb) cb = function () {};
|
if (!cb) cb = function () {};
|
||||||
if (exports.plugins.hooks[hook_name] === undefined) return cb(null, []);
|
if (exports.plugins.hooks[hook_name] === undefined) return cb(null, []);
|
||||||
|
async.map(
|
||||||
var newArray = [];
|
exports.plugins.hooks[hook_name],
|
||||||
// This should be a map.
|
function (hook, cb) {
|
||||||
await exports.plugins.hooks[hook_name].forEach(async function(hook, index){
|
hookCallWrapper(hook, hook_name, args, function (res) { cb(null, res); });
|
||||||
let test = await hookCallWrapper(hook, hook_name, args, function (res) {
|
},
|
||||||
return Promise.resolve(res);
|
function (err, res) {
|
||||||
});
|
cb(null, _.flatten(res, true));
|
||||||
newArray.push(test)
|
}
|
||||||
});
|
);
|
||||||
|
|
||||||
// after forEach
|
|
||||||
cb(null, _.flatten(newArray, true));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return a Promise if cb is not supplied */
|
/* return a Promise if cb is not supplied */
|
||||||
|
|
Loading…
Reference in a new issue