From b3e066eacaf49e1115753854b8776dd8b89a2bd5 Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 26 Sep 2017 10:59:25 +0200 Subject: [PATCH 1/7] show loading screen tips during loading screen --- customize.dist/src/less2/loading.less | 2 +- www/common/loading.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/customize.dist/src/less2/loading.less b/customize.dist/src/less2/loading.less index 6a14fe29b..504e1e393 100644 --- a/customize.dist/src/less2/loading.less +++ b/customize.dist/src/less2/loading.less @@ -40,7 +40,7 @@ The CSS inside of loading.js is precompiled in order to save 200ish milliseconds } #cp-loading-tip { position: fixed; - z-index: 100000; // loading tip + z-index: 10000000; // loading tip top: 80%; left: 0; right: 0; diff --git a/www/common/loading.js b/www/common/loading.js index 66e67bd58..a613554d2 100644 --- a/www/common/loading.js +++ b/www/common/loading.js @@ -36,7 +36,7 @@ define([], function () { } #cp-loading-tip { position: fixed; - z-index: 100000; + z-index: 10000000; top: 80%; left: 0; right: 0; From 69014e5fde0d7361e93d67d7d37ce0e0df42a6a0 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 26 Sep 2017 11:21:36 +0200 Subject: [PATCH 2/7] Fix mediatags in pad not cached --- www/pad/inner.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/www/pad/inner.js b/www/pad/inner.js index 517fcef5b..a3d9683e1 100644 --- a/www/pad/inner.js +++ b/www/pad/inner.js @@ -372,11 +372,9 @@ define([ var mediaMap = {}; var restoreMediaTags = function (tempDom) { - var pattern = /()<\/media-tag>/i; var tags = tempDom.querySelectorAll('media-tag:empty'); Cryptpad.slice(tags).forEach(function (tag) { - if (pattern.length !== 4) { return; } - var src = pattern[3]; + var src = tag.getAttribute('src'); if (mediaMap[src]) { mediaMap[src].forEach(function (n) { tag.appendChild(n); From 52be5501d6ce0ec96e379acbcf847d7ad24ab2e0 Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 26 Sep 2017 14:34:54 +0200 Subject: [PATCH 3/7] remove invalid test --- www/drive/tests.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/www/drive/tests.js b/www/drive/tests.js index 5861e5410..eaae78e13 100644 --- a/www/drive/tests.js +++ b/www/drive/tests.js @@ -243,6 +243,7 @@ define([ }, "DRIVE4: migration and fixFiles with a pad in trash not root"); // Pad attributes migration +/* assert(function (cb) { console.log('START PAD ATTRIBUTES'); var files = JSON.parse(JSON.stringify(example)); @@ -253,6 +254,7 @@ define([ return cb(files.filesData[id1].userid === 'value' && files.filesData[id1].previewMode); }, "PAD ATTRIBUTES"); +*/ // userObject Tests From 345bfc1cea00f8d00bf693881ce0233059d51ec2 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 26 Sep 2017 14:36:49 +0200 Subject: [PATCH 4/7] Remove migration for pad attributes --- www/common/migrate-user-object.js | 32 ++----------------------------- 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/www/common/migrate-user-object.js b/www/common/migrate-user-object.js index 5ac2ceac7..c9c3bbd01 100644 --- a/www/common/migrate-user-object.js +++ b/www/common/migrate-user-object.js @@ -7,41 +7,13 @@ define([], function () { return function (userObject, Cryptpad) { var version = userObject.version || 0; + // DEPRECATED // Migration 1: pad attributes moved to filesData var migratePadAttributesToData = function () { - var files = userObject && userObject.drive; - if (!files) { return; } - - var migratePadAttributes = function (el, id, parsed) { - // Migrate old pad attributes - ['userid', 'previewMode'].forEach(function (attr) { - var key = parsed.hash + '.' + attr; - var key2 = parsed.hash.slice(0,-1) + '.' + attr;// old pads not ending with / - if (typeof(files[key]) !== "undefined" || typeof(files[key2]) !== "undefined") { - console.log("Migrating pad attribute", attr, "for pad", id); - el[attr] = files[key] || files[key2]; - delete files[key]; - delete files[key2]; - } - }); - }; - var filesData = files.filesData; - if (!filesData) { return; } - - var el, parsed; - for (var id in filesData) { - id = Number(id); - el = filesData[id]; - parsed = el.href && Cryptpad.parsePadUrl(el.href); - if (!parsed) { continue; } - migratePadAttributes(el, id, parsed); - } - // Migration done + return true; }; if (version < 1) { migratePadAttributesToData(); - Cryptpad.feedback('Migrate-1', true); - userObject.version = version = 1; } // Migration 2: global attributes from root to 'settings' subobjects From 748172585e62a684fb2188e906113fa02a442095 Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 26 Sep 2017 15:00:25 +0200 Subject: [PATCH 5/7] update for modified id --- www/whiteboard/inner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/whiteboard/inner.js b/www/whiteboard/inner.js index 459744e01..96ca8c8e5 100644 --- a/www/whiteboard/inner.js +++ b/www/whiteboard/inner.js @@ -516,7 +516,7 @@ define([ canvas.on('mouse:up', onLocal); - $('#clear').on('click', function () { + $('#cp-app-whiteboard-clear').on('click', function () { canvas.clear(); onLocal(); }); From 9571b3c018ac21354b33e9c8f68add462c2ba9db Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 26 Sep 2017 15:16:17 +0200 Subject: [PATCH 6/7] persist whiteboard content across sessions --- www/whiteboard/inner.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/www/whiteboard/inner.js b/www/whiteboard/inner.js index 96ca8c8e5..cd14ef9f3 100644 --- a/www/whiteboard/inner.js +++ b/www/whiteboard/inner.js @@ -433,6 +433,7 @@ define([ var userDoc = APP.realtime.getUserDoc(); var isNew = false; + var newDoc = ''; if (userDoc === "" || userDoc === "{}") { isNew = true; } if (userDoc !== "") { @@ -448,15 +449,19 @@ define([ Cryptpad.errorLoadingScreen(errorText); throw new Error(errorText); } + newDoc = hjson.content; } else { Title.updateTitle(Cryptpad.initialName || Title.defaultTitle); } + if (newDoc) { + canvas.loadFromJSON(newDoc); + canvas.renderAll(); + } - Cryptpad.removeLoadingScreen(); setEditable(!readOnly); initializing = false; config.onLocal(); - + Cryptpad.removeLoadingScreen(); if (readOnly) { return; } if (isNew) { common.openTemplatePicker(); From e62c5e1d07dd81da0af753d98c0f0920b7a10c89 Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Tue, 26 Sep 2017 15:58:25 +0200 Subject: [PATCH 7/7] Add some debugging lines to help synthesize error cases --- www/common/sframe-chainpad-netflux-outer.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/www/common/sframe-chainpad-netflux-outer.js b/www/common/sframe-chainpad-netflux-outer.js index 54688c2e3..b62a25a05 100644 --- a/www/common/sframe-chainpad-netflux-outer.js +++ b/www/common/sframe-chainpad-netflux-outer.js @@ -154,7 +154,9 @@ define([], function () { // Do not remove wcObject, it allows us to use a new 'wc' without changing the handler if we // want to keep the same chainpad (realtime) object try { + if (window.Cryptpad_SUPPRESS_MSG) { return; } wcObject.wc.bcast(message).then(function() { + if (window.Cryptpad_SUPPRESS_ACK) { return; } cb(); }, function(err) { // The message has not been sent, display the error.