diff --git a/docs/cryptpad.service b/docs/cryptpad.service index eee8b2af5..43d8652f6 100644 --- a/docs/cryptpad.service +++ b/docs/cryptpad.service @@ -17,7 +17,7 @@ SyslogIdentifier=cryptpad User=cryptpad Group=cryptpad # modify to match your working directory -Environment='PWD="/home/cryptpad/cryptpad/cryptpad"' +Environment='PWD="/home/cryptpad/cryptpad"' # systemd sets the open file limit to 4000 unless you override it # cryptpad stores its data with the filesystem, so you should increase this to match the value of `ulimit -n` diff --git a/lib/workers/db-worker.js b/lib/workers/db-worker.js index 42c75fdca..0b4c4d03d 100644 --- a/lib/workers/db-worker.js +++ b/lib/workers/db-worker.js @@ -568,7 +568,7 @@ process.on('message', function (data) { const cb = function (err, value) { process.send({ - error: err, + error: Util.serializeError(err), txid: data.txid, pid: data.pid, value: value, @@ -577,7 +577,7 @@ process.on('message', function (data) { if (!ready) { return void init(data.config, function (err) { - if (err) { return void cb(err); } + if (err) { return void cb(Util.serializeError(err)); } ready = true; cb(); }); diff --git a/lib/workers/index.js b/lib/workers/index.js index 6e9f57e88..522339812 100644 --- a/lib/workers/index.js +++ b/lib/workers/index.js @@ -9,6 +9,7 @@ const PID = process.pid; const DB_PATH = 'lib/workers/db-worker'; const MAX_JOBS = 16; +const DEFAULT_QUERY_TIMEOUT = 60000 * 15; // increased from three to fifteen minutes because queries for very large files were taking as long as seven minutes Workers.initialize = function (Env, config, _cb) { var cb = Util.once(Util.mkAsync(_cb)); @@ -113,6 +114,7 @@ Workers.initialize = function (Env, config, _cb) { const txid = guid(); var cb = Util.once(Util.mkAsync(Util.both(_cb, function (err /*, value */) { if (err !== 'TIMEOUT') { return; } + Log.debug("WORKER_TIMEOUT_CAUSE", msg); // in the event of a timeout the user will receive an error // but the state used to resend a query in the event of a worker crash // won't be cleared. This also leaks a slot that could be used to keep @@ -132,7 +134,7 @@ Workers.initialize = function (Env, config, _cb) { state.tasks[txid] = msg; // default to timing out affter 180s if no explicit timeout is passed - var timeout = typeof(opt.timeout) !== 'undefined'? opt.timeout: 180000; + var timeout = typeof(opt.timeout) !== 'undefined'? opt.timeout: DEFAULT_QUERY_TIMEOUT; response.expect(txid, cb, timeout); state.worker.send(msg); }; diff --git a/server.js b/server.js index 60247f47a..eb2787475 100644 --- a/server.js +++ b/server.js @@ -202,6 +202,7 @@ var serveConfig = (function () { adminKeys: Env.admins, inactiveTime: Env.inactiveTime, supportMailbox: Env.supportMailbox, + defaultStorageLimit: Env.defaultStorageLimit, maxUploadSize: Env.maxUploadSize, premiumUploadSize: Env.premiumUploadSize, }, null, '\t'), diff --git a/www/common/common-util.js b/www/common/common-util.js index 41797e7c8..dfc6e12d7 100644 --- a/www/common/common-util.js +++ b/www/common/common-util.js @@ -30,6 +30,15 @@ return JSON.parse(JSON.stringify(o)); }; + Util.serializeError = function (err) { + if (!(err instanceof Error)) { return err; } + var ser = {}; + Object.getOwnPropertyNames(err).forEach(function (key) { + ser[key] = err[key]; + }); + return ser; + }; + Util.tryParse = function (s) { try { return JSON.parse(s); } catch (e) { return;} }; @@ -113,13 +122,13 @@ var handle = function (id, args) { var fn = pending[id]; if (typeof(fn) !== 'function') { - errorHandler("MISSING_CALLBACK", { + return void errorHandler("MISSING_CALLBACK", { id: id, args: args, }); } try { - pending[id].apply(null, Array.isArray(args)? args : [args]); + fn.apply(null, Array.isArray(args)? args : [args]); } catch (err) { errorHandler('HANDLER_ERROR', { error: err, diff --git a/www/common/notify.js b/www/common/notify.js index a3c8cd2b8..81dee662d 100644 --- a/www/common/notify.js +++ b/www/common/notify.js @@ -16,6 +16,8 @@ define(['/api/config'], function (ApiConfig) { var getPermission = Module.getPermission = function (f) { f = f || function () {}; + // "Notification.requestPermission is not a function" on Firefox 68.11.0esr + if (!Notification || typeof(Notification.requestPermission) !== 'function') { return void f(false); } Notification.requestPermission(function (permission) { if (permission === "granted") { f(true); } else { f(false); } diff --git a/www/common/translations/messages.fi.json b/www/common/translations/messages.fi.json index fe4ee1f64..ac5ace154 100644 --- a/www/common/translations/messages.fi.json +++ b/www/common/translations/messages.fi.json @@ -1459,5 +1459,14 @@ "history_cantRestore": "Palauttaminen epäonnistui. Yhteytesi on katkennut.", "history_close": "Sulje", "history_restore": "Palauta", - "share_bar": "Luo linkki" + "share_bar": "Luo linkki", + "error_unhelpfulScriptError": "Skriptivirhe: Lisätietoja selaimen kehittäjäkonsolissa", + "tag_edit": "Muokkaa", + "tag_add": "Lisää", + "loading_state_5": "Uudelleenrakenna asiakirja", + "loading_state_4": "Lataa Teams", + "loading_state_3": "Lataa jaetut kansiot", + "loading_state_2": "Päivitä sisältö", + "loading_state_1": "Lataa Drive", + "loading_state_0": "Rakenna käyttöliittymä" }