From 7f534221c0230a058a06c5751dac8000d93ff04c Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 8 Dec 2020 11:34:34 +0100 Subject: [PATCH 1/3] Use prod values for history trim reminder --- www/common/common-ui-elements.js | 1 - www/common/sframe-common.js | 1 - 2 files changed, 2 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index cf1366714..bd9cb784a 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -2702,7 +2702,6 @@ define([ var dontShowAgain = function () { var until = (+new Date()) + (7 * 24 * 3600 * 1000); // 7 days from now - until = (+new Date()) + 30000; // XXX 30s from now if (data.drive) { common.setAttribute(['drive', 'trim'], until); return; diff --git a/www/common/sframe-common.js b/www/common/sframe-common.js index c665f2ec6..7a28f7f79 100644 --- a/www/common/sframe-common.js +++ b/www/common/sframe-common.js @@ -290,7 +290,6 @@ define([ var priv = ctx.metadataMgr.getPrivateData(); var limit = 100 * 1024 * 1024; // 100MB - limit = 100 * 1024; // XXX 100KB var owned; nThen(function (w) { From 25a5783fb34dae7a33001e537d511dae4b21d9cb Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 8 Dec 2020 11:44:27 +0100 Subject: [PATCH 2/3] Remove drive trim history from settings for anon users --- www/settings/inner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/settings/inner.js b/www/settings/inner.js index 8b5095cba..b4668efff 100644 --- a/www/settings/inner.js +++ b/www/settings/inner.js @@ -955,7 +955,7 @@ define([ cb(content); }; makeBlock('trim-history', function(cb, $div) { - if (!common.isLoggedIn()) { return; } + if (!common.isLoggedIn()) { return void cb(false); } redrawTrimHistory(cb, $div); }, true); From 34284fcc0caa7999d048ddb93c4cbbbb120e440f Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 8 Dec 2020 12:03:40 +0100 Subject: [PATCH 3/3] Fix issues with deprecated cache --- lib/hk-util.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/hk-util.js b/lib/hk-util.js index 20e0ce5d4..495f4ff81 100644 --- a/lib/hk-util.js +++ b/lib/hk-util.js @@ -438,13 +438,12 @@ const getHistoryOffset = (Env, channelName, lastKnownHash, _cb) => { to reconcile their differences. */ } - // If our lastKnownHash is older than the 2nd to last checkpoint, - // only send the last 2 checkpoints and ignore "lkh" - // XXX XXX this is probably wrong! ChainPad may not accept checkpoints that are not connected to root - // XXX We probably need to send an EUNKNOWN here so that the client can recreate a new chainpad - /*if (lkh && index.cpIndex.length >= 2 && lkh < index.cpIndex[0].offset) { - return void cb(null, index.cpIndex[0].offset); - }*/ + // If our lastKnownHash is older than the 2nd to last checkpoint, send + // EUNKNOWN to tell the user to empty their cache + if (lkh && index.cpIndex.length >= 2 && lkh < index.cpIndex[0].offset) { + waitFor.abort(); + return void cb(new Error('EUNKNOWN')); + } // Otherwise use our lastKnownHash cb(null, lkh);