From 9fbf507cda126f6d4a49112640b4f4c8b5a4fc5e Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 12 Jun 2018 14:23:54 +0200 Subject: [PATCH 1/3] Fix new version detection --- www/common/cryptpad-common.js | 4 +++- www/common/sframe-common.js | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 9c29fbe4d..001358651 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -708,9 +708,11 @@ define([ var update = updateLocalVersion(NewConfig.requireConf && NewConfig.requireConf.urlArgs); if (update) { postMessage('DISCONNECT'); + return; } + common.onNetworkReconnect.fire(data); }); - common.onNetworkReconnect.fire(data); break; + break; } // Messenger case 'CONTACTS_MESSAGE': { diff --git a/www/common/sframe-common.js b/www/common/sframe-common.js index 6039ead70..5ab973476 100644 --- a/www/common/sframe-common.js +++ b/www/common/sframe-common.js @@ -443,6 +443,7 @@ define([ $err.find('a').click(function () { funcs.gotoURL(); }); + UI.findOKButton().click(); UI.errorLoadingScreen($err, true, true); }); From 01a3c13a8ca2a8b0327e17d78eb4270b246faa5b Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 12 Jun 2018 15:15:46 +0200 Subject: [PATCH 2/3] Fix CSP issues for missing files (404) --- customize.dist/translations/messages.fr.js | 2 +- customize.dist/translations/messages.js | 2 +- www/file/file-crypto.js | 1 + www/file/inner.js | 4 +++- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index 47dba647e..23fe16f91 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -618,7 +618,7 @@ define(function () { out.upload_mustLogin = "Vous devez vous connecter pour importer un fichier"; out.download_button = "Déchiffrer et télécharger"; out.download_mt_button = "Télécharger"; - out.download_resourceNotAvailable = "Le fichier demandé n'est pas disponible..."; + out.download_resourceNotAvailable = "Le fichier demandé n'est pas disponible... Appuyez sur Échap pour continuer."; out.todo_title = "CryptTodo"; out.todo_newTodoNamePlaceholder = "Décrivez votre tâche..."; diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index 7fe20b5d5..02ed5859c 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -622,7 +622,7 @@ define(function () { out.upload_mustLogin = "You must be logged in to upload files"; out.download_button = "Decrypt & Download"; out.download_mt_button = "Download"; - out.download_resourceNotAvailable = "The requested resource was not available..."; + out.download_resourceNotAvailable = "The requested resource was not available... Press Esc to continue."; out.todo_title = "CryptTodo"; out.todo_newTodoNamePlaceholder = "Describe your task..."; diff --git a/www/file/file-crypto.js b/www/file/file-crypto.js index 06f9804cd..1c274cbe7 100644 --- a/www/file/file-crypto.js +++ b/www/file/file-crypto.js @@ -65,6 +65,7 @@ define([ xhr.setRequestHeader('Range', 'bytes=0-1'); xhr.responseType = 'arraybuffer'; + xhr.onerror= function () { return CB('XHR_ERROR'); }; xhr.onload = function () { if (/^4/.test('' + this.status)) { return CB('XHR_ERROR'); } var res = new Uint8Array(xhr.response); diff --git a/www/file/inner.js b/www/file/inner.js index 1e2a4f3e1..e9e2d868d 100644 --- a/www/file/inner.js +++ b/www/file/inner.js @@ -95,7 +95,9 @@ define([ FileCrypto.fetchDecryptedMetadata(src, key, function (e, metadata) { if (e) { if (e === 'XHR_ERROR') { - return void UI.errorLoadingScreen(Messages.download_resourceNotAvailable); + return void UI.errorLoadingScreen(Messages.download_resourceNotAvailable, false, function () { + common.gotoURL('/file/'); + }); } return void console.error(e); } From d558b9e3e8669a42d92722eb209609a1af4e0bdd Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 12 Jun 2018 15:21:57 +0200 Subject: [PATCH 3/3] Fix 404 issues in media-tag --- www/common/media-tag.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/www/common/media-tag.js b/www/common/media-tag.js index b84629ec8..5b911f2b8 100644 --- a/www/common/media-tag.js +++ b/www/common/media-tag.js @@ -96,11 +96,17 @@ // Download a blob from href - var download = function (src, cb) { + var download = function (src, _cb) { + var cb = function (e, res) { + _cb(e, res); + cb = function () {}; + }; + var xhr = new XMLHttpRequest(); xhr.open('GET', src, true); xhr.responseType = 'arraybuffer'; + xhr.onerror = function () { return void cb("XHR_ERROR"); }; xhr.onload = function () { // Error? if (/^4/.test('' + this.status)) { return void cb("XHR_ERROR " + this.status); }