diff --git a/lib/commands/pin-rpc.js b/lib/commands/pin-rpc.js index 4aaeb7aaf..cda482d6b 100644 --- a/lib/commands/pin-rpc.js +++ b/lib/commands/pin-rpc.js @@ -547,8 +547,9 @@ const deferResponse = function (Env, channel, cb) { }; */ +// FIXME this will be removed from the client Pinning.isChannelPinned = function (Env, channel, cb) { - return void cb(void 0, true); // XXX + return void cb(void 0, true); /* // if the pins are fully loaded then you can answer yes/no definitively if (Env.pinsLoaded) { diff --git a/lib/compute-index.js b/lib/compute-index.js index 7a146e060..b246b0c9c 100644 --- a/lib/compute-index.js +++ b/lib/compute-index.js @@ -15,18 +15,15 @@ const init = function (config, cb) { return void cb('E_INVALID_CONFIG'); } - Store.create(config, function (_store) { + Store.create(config, function (err, _store) { + if (err) { return void cb(err); } store = _store; cb(); }); }; const tryParse = function (Env, str) { - try { - return JSON.parse(str); - } catch (err) { - // XXX - } + try { return JSON.parse(str); } catch (err) { } }; /* computeIndex diff --git a/lib/historyKeeper.js b/lib/historyKeeper.js index 23dbf5fd1..2f6043dfd 100644 --- a/lib/historyKeeper.js +++ b/lib/historyKeeper.js @@ -215,12 +215,14 @@ module.exports.create = function (config, cb) { // create a pin store Store.create({ filePath: pinPath, - }, w(function (s) { + }, w(function (err, s) { + if (err) { throw err; } Env.pinStore = s; })); // create a channel store - Store.create(config, w(function (_store) { + Store.create(config, w(function (err, _store) { + if (err) { throw err; } config.store = _store; Env.msgStore = _store; // API used by rpc Env.store = _store; // API used by historyKeeper diff --git a/lib/hk-util.js b/lib/hk-util.js index 97e5c3014..bfc9883c1 100644 --- a/lib/hk-util.js +++ b/lib/hk-util.js @@ -835,7 +835,14 @@ HK.initializeIndexWorkers = function (Env, config, _cb) { worker.on('message', function (res) { if (!res || !res.txid) { return; } //console.log(res); - response.handle(res.txid, [res.error, res.value]); + try { + response.handle(res.txid, [res.error, res.value]); + } catch (err) { + Env.Log.error("INDEX_WORKER", { + error: err, + response: res, + }); + } }); worker.on('exit', function () { var idx = workers.indexOf(worker); diff --git a/lib/load-config.js b/lib/load-config.js index 4d6fa894f..49dbbf58a 100644 --- a/lib/load-config.js +++ b/lib/load-config.js @@ -38,7 +38,7 @@ if (!isPositiveNumber(config.defaultStorageLimit)) { // premiumUploadSize is worthless if it isn't a valid positive number // or if it's less than the default upload size -if (!isPositiveNumber(config.premiumUploadSize) || config.premiumUploadSize < config.defaultStorageLimit) { +if (!isPositiveNumber(config.premiumUploadSize) || config.premiumUploadSize < config.maxUploadSize) { delete config.premiumUploadSize; } diff --git a/lib/log.js b/lib/log.js index 756da8734..0e0567a69 100644 --- a/lib/log.js +++ b/lib/log.js @@ -96,12 +96,17 @@ Logger.create = function (config, cb) { if (!config.logPath) { console.log("No logPath configured. Logging to file disabled"); - return void cb(Object.freeze(createMethods(ctx))); + var logger = createMethods(ctx); + logger.shutdown = noop; + return void cb(Object.freeze(logger)); } Store.create({ filePath: config.logPath, - }, function (store) { + }, function (err, store) { + if (err) { + throw err; + } ctx.store = store; var logger = createMethods(ctx); logger.shutdown = function () { diff --git a/lib/rpc.js b/lib/rpc.js index 241f77d41..df9deab8c 100644 --- a/lib/rpc.js +++ b/lib/rpc.js @@ -17,7 +17,7 @@ const UNAUTHENTICATED_CALLS = { GET_FILE_SIZE: Pinning.getFileSize, GET_MULTIPLE_FILE_SIZE: Pinning.getMultipleFileSize, GET_DELETED_PADS: Pinning.getDeletedPads, - IS_CHANNEL_PINNED: Pinning.isChannelPinned, + IS_CHANNEL_PINNED: Pinning.isChannelPinned, // FIXME drop this RPC IS_NEW_CHANNEL: Channel.isNewChannel, WRITE_PRIVATE_MESSAGE: Channel.writePrivateMessage, GET_METADATA: Metadata.getMetadata, @@ -198,8 +198,6 @@ RPC.create = function (Env, cb) { updateLimitDaily(); Env.intervals.dailyLimitUpdate = setInterval(updateLimitDaily, 24*3600*1000); - //Pinning.loadChannelPins(Env); // XXX - // expire old sessions once per minute Env.intervals.sessionExpirationInterval = setInterval(function () { Core.expireSessions(Sessions); diff --git a/lib/storage/file.js b/lib/storage/file.js index 25ff021f0..e040bf807 100644 --- a/lib/storage/file.js +++ b/lib/storage/file.js @@ -951,7 +951,9 @@ var trimChannel = function (env, channelName, hash, _cb) { }); }; -module.exports.create = function (conf, cb) { +module.exports.create = function (conf, _cb) { + var cb = Util.once(Util.mkAsync(_cb)); + var env = { root: conf.filePath || './datastore', archiveRoot: conf.archivePath || './data/archive', @@ -984,18 +986,19 @@ module.exports.create = function (conf, cb) { // make sure the store's directory exists Fse.mkdirp(env.root, PERMISSIVE, w(function (err) { if (err && err.code !== 'EEXIST') { - throw err; // XXX + w.abort(); + return void cb(err); } })); // make sure the cold storage directory exists Fse.mkdirp(env.archiveRoot, PERMISSIVE, w(function (err) { if (err && err.code !== 'EEXIST') { - throw err; // XXX + w.abort(); + return void cb(err); } })); }).nThen(function () { - // XXX leave a place for an error - cb({ + cb(void 0, { // OLDER METHODS // write a new message to a log message: function (channelName, content, cb) { diff --git a/package-lock.json b/package-lock.json index e9abb0519..99f65cf27 100644 --- a/package-lock.json +++ b/package-lock.json @@ -190,9 +190,9 @@ } }, "chainpad-server": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/chainpad-server/-/chainpad-server-4.0.7.tgz", - "integrity": "sha512-79BTtbFI/nP3HCzPcth8VyeGPYZXGxQRJ8Vm5gE1/hIXWP5ktqBVyabiTiJwsA0tXCAznSa+jnY1DmOLcvCKvA==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/chainpad-server/-/chainpad-server-4.0.8.tgz", + "integrity": "sha512-QlmomAMQN4msdYnRqGEjL12FAeOPIJ5yoxIzROohWt/31SwF1UlyV+zFp1M1dhtV8PoS7JXvLyBBLCEEVN73Cg==", "requires": { "nthen": "0.1.8", "pull-stream": "^3.6.9", diff --git a/package.json b/package.json index f042d7981..a12997e39 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ }, "dependencies": { "chainpad-crypto": "^0.2.2", - "chainpad-server": "^4.0.7", + "chainpad-server": "^4.0.8", "express": "~4.16.0", "fs-extra": "^7.0.0", "get-folder-size": "^2.0.1", diff --git a/scripts/diagnose-archive-conflicts.js b/scripts/diagnose-archive-conflicts.js index 0e75f4abe..7e5ee92bc 100644 --- a/scripts/diagnose-archive-conflicts.js +++ b/scripts/diagnose-archive-conflicts.js @@ -8,7 +8,11 @@ var Log; nThen(function (w) { // load the store which will be used for iterating over channels // and performing operations like archival and deletion - Store.create(config, w(function (_) { + Store.create(config, w(function (err, _) { + if (err) { + w.abort(); + throw err; + } store = _; })); diff --git a/scripts/evict-inactive.js b/scripts/evict-inactive.js index 18730fd1e..a3a595ca4 100644 --- a/scripts/evict-inactive.js +++ b/scripts/evict-inactive.js @@ -34,7 +34,11 @@ var msSinceStart = function () { nThen(function (w) { // load the store which will be used for iterating over channels // and performing operations like archival and deletion - Store.create(config, w(function (_) { + Store.create(config, w(function (err, _) { + if (err) { + w.abort(); + throw err; + } store = _; })); // load the list of pinned files so you know which files // should not be archived or deleted diff --git a/scripts/restore-archived.js b/scripts/restore-archived.js index 3f68b607e..4ee01c02f 100644 --- a/scripts/restore-archived.js +++ b/scripts/restore-archived.js @@ -8,7 +8,8 @@ var Log; nThen(function (w) { // load the store which will be used for iterating over channels // and performing operations like archival and deletion - Store.create(config, w(function (_) { + Store.create(config, w(function (err, _) { + if (err) { throw err; } store = _; })); diff --git a/www/auth/main.js b/www/auth/main.js index 65c091695..84a17d922 100644 --- a/www/auth/main.js +++ b/www/auth/main.js @@ -66,7 +66,7 @@ define([ }), { network: network }); - }).nThen(function (waitFor) { + }).nThen(function () { var origin = ApiConfig.fileHost || window.location.origin; // Get contacts and extract their avatar channel and key var getData = function (obj, href) { diff --git a/www/common/onlyoffice/v2a/sdkjs/cell/sdk-all.js b/www/common/onlyoffice/v2a/sdkjs/cell/sdk-all.js index 0bc2199ed..41d630c03 100644 --- a/www/common/onlyoffice/v2a/sdkjs/cell/sdk-all.js +++ b/www/common/onlyoffice/v2a/sdkjs/cell/sdk-all.js @@ -15913,7 +15913,7 @@ CParagraphContentWithContentBase.prototype.protected_GetRangesCount=function(Lin CParagraphContentWithContentBase.prototype.protected_AddRange=function(LineIndex,RangeIndex){if(this.Lines[0]>=LineIndex+1){var RangeOffset=this.protected_GetRangeOffset(LineIndex,0)+RangeIndex*2;this.Lines.splice(RangeOffset,this.Lines.length-RangeOffset);if(this.Lines[0]!==LineIndex+1&&0===RangeIndex)this.Lines.splice(LineIndex+1,this.Lines[0]-LineIndex);else if(this.Lines[0]!==LineIndex+1&&0!==RangeIndex){this.Lines.splice(LineIndex+2,this.Lines[0]-LineIndex-1);this.Lines[0]=LineIndex+1}}if(0=== RangeIndex)if(this.Lines[0]!==LineIndex+1){var OffsetValue=this.Lines.length-LineIndex-1;this.Lines.splice(LineIndex+1,0,OffsetValue);this.Lines[0]=LineIndex+1}var RangeOffset=1+this.Lines[0]+this.Lines[LineIndex+1]+RangeIndex*2;this.Lines[RangeOffset+0]=0;this.Lines[RangeOffset+1]=0;if(0!==LineIndex||0!==RangeIndex)return this.Lines[RangeOffset-1];else return 0}; CParagraphContentWithContentBase.prototype.protected_FillRange=function(LineIndex,RangeIndex,StartPos,EndPos){var RangeOffset=this.protected_GetRangeOffset(LineIndex,RangeIndex);this.Lines[RangeOffset+0]=StartPos;this.Lines[RangeOffset+1]=EndPos};CParagraphContentWithContentBase.prototype.protected_FillRangeEndPos=function(LineIndex,RangeIndex,EndPos){var RangeOffset=this.protected_GetRangeOffset(LineIndex,RangeIndex);this.Lines[RangeOffset+1]=EndPos}; -CParagraphContentWithContentBase.prototype.private_UpdateSpellChecking=function(){if(this.Paragraph){this.Paragraph.SpellChecker.ClearPausedEngine();this.Paragraph.RecalcInfo.Set_Type_0_Spell(pararecalc_0_Spell_All)}};CParagraphContentWithContentBase.prototype.Is_UseInDocument=function(Id){if(this.Paragraph){for(var i=0;i=LineIndex+1){var RangeOffset=this.protected_GetRangeOffset(LineIndex,0)+RangeIndex*2;this.Lines.splice(RangeOffset,this.Lines.length-RangeOffset);if(this.Lines[0]!==LineIndex+1&&0===RangeIndex)this.Lines.splice(LineIndex+1,this.Lines[0]-LineIndex);else if(this.Lines[0]!==LineIndex+1&&0!==RangeIndex){this.Lines.splice(LineIndex+2,this.Lines[0]-LineIndex-1);this.Lines[0]=LineIndex+1}}if(0=== RangeIndex)if(this.Lines[0]!==LineIndex+1){var OffsetValue=this.Lines.length-LineIndex-1;this.Lines.splice(LineIndex+1,0,OffsetValue);this.Lines[0]=LineIndex+1}var RangeOffset=1+this.Lines[0]+this.Lines[LineIndex+1]+RangeIndex*2;this.Lines[RangeOffset+0]=0;this.Lines[RangeOffset+1]=0;if(0!==LineIndex||0!==RangeIndex)return this.Lines[RangeOffset-1];else return 0}; CParagraphContentWithContentBase.prototype.protected_FillRange=function(LineIndex,RangeIndex,StartPos,EndPos){var RangeOffset=this.protected_GetRangeOffset(LineIndex,RangeIndex);this.Lines[RangeOffset+0]=StartPos;this.Lines[RangeOffset+1]=EndPos};CParagraphContentWithContentBase.prototype.protected_FillRangeEndPos=function(LineIndex,RangeIndex,EndPos){var RangeOffset=this.protected_GetRangeOffset(LineIndex,RangeIndex);this.Lines[RangeOffset+1]=EndPos}; -CParagraphContentWithContentBase.prototype.private_UpdateSpellChecking=function(){if(this.Paragraph){this.Paragraph.SpellChecker.ClearPausedEngine();this.Paragraph.RecalcInfo.Set_Type_0_Spell(pararecalc_0_Spell_All)}};CParagraphContentWithContentBase.prototype.Is_UseInDocument=function(Id){if(this.Paragraph){for(var i=0;i=LineIndex+1){var RangeOffset=this.protected_GetRangeOffset(LineIndex,0)+RangeIndex*2;this.Lines.splice(RangeOffset,this.Lines.length-RangeOffset);if(this.Lines[0]!==LineIndex+1&&0===RangeIndex)this.Lines.splice(LineIndex+1,this.Lines[0]-LineIndex);else if(this.Lines[0]!==LineIndex+1&&0!==RangeIndex){this.Lines.splice(LineIndex+2,this.Lines[0]-LineIndex-1);this.Lines[0]=LineIndex+1}}if(0=== RangeIndex)if(this.Lines[0]!==LineIndex+1){var OffsetValue=this.Lines.length-LineIndex-1;this.Lines.splice(LineIndex+1,0,OffsetValue);this.Lines[0]=LineIndex+1}var RangeOffset=1+this.Lines[0]+this.Lines[LineIndex+1]+RangeIndex*2;this.Lines[RangeOffset+0]=0;this.Lines[RangeOffset+1]=0;if(0!==LineIndex||0!==RangeIndex)return this.Lines[RangeOffset-1];else return 0}; CParagraphContentWithContentBase.prototype.protected_FillRange=function(LineIndex,RangeIndex,StartPos,EndPos){var RangeOffset=this.protected_GetRangeOffset(LineIndex,RangeIndex);this.Lines[RangeOffset+0]=StartPos;this.Lines[RangeOffset+1]=EndPos};CParagraphContentWithContentBase.prototype.protected_FillRangeEndPos=function(LineIndex,RangeIndex,EndPos){var RangeOffset=this.protected_GetRangeOffset(LineIndex,RangeIndex);this.Lines[RangeOffset+1]=EndPos}; -CParagraphContentWithContentBase.prototype.private_UpdateSpellChecking=function(){if(this.Paragraph){this.Paragraph.SpellChecker.ClearPausedEngine();this.Paragraph.RecalcInfo.Set_Type_0_Spell(pararecalc_0_Spell_All)}};CParagraphContentWithContentBase.prototype.Is_UseInDocument=function(Id){if(this.Paragraph){for(var i=0;iPad è un termine popolare per Etherpad, un editor collaborativo in tempo reale.\nSi riferisce ad un documento che puoi modificare nel tuo browser, generalmente con le modifiche di altri utenti visibili in modo quasi istantaneo." }, "expiring": { - "q": "Cos'è un pad effimero?" + "q": "Cos'è un pad effimero?", + "a": "Un expiring pad è un pad creato con una scadenza, raggiunta il pad verrà automaticamente cancellato dal server. Gli expiring pad possono essere configurati per durare da un minimo di un'ora ad un massimo di 100 mesi. Il pad e tutta la sua cronologia diventeranno permanentemente non disponibili anche se vengono modificati nel momento in cui scadono.

Se un pad è impostato con una scadenza, puoi controllare il suo tempo di durata visualizzando le sue proprietà , sia facendo clic con il tasto destro del mouse sul pad in CryptDrive, sia usando la proprietà -menu dalla barra degli strumenti di un'applicazione." }, "owned": { "a": "Un pad di proprietà è un pad creato da un esplicito proprietario, identificato dal server dalla sua chiave di crittografia pubblica. Il proprietario di un pad può scegliere di cancellare i suoi pad dal server, rendendoli invalidi per gli altri collaboratori nel futuro, sia che essi li avessero oppure no nei loro Cryptdrive.", diff --git a/www/profile/inner.js b/www/profile/inner.js index 5dfbaf491..ba348d829 100644 --- a/www/profile/inner.js +++ b/www/profile/inner.js @@ -457,9 +457,9 @@ define([ APP.editor.save(); }; - Messages.profile_copyKey = "Copy edPublic key"; // XXX var addPublicKey = function ($container) { if (!APP.readOnly) { return; } + if (!Messages.profile_copyKey) { return; } // XXX var $div = $(h('div.cp-sidebarlayout-element')).appendTo($container); APP.$edPublic = $('