From 4ec621387710bfc88f110b371ccb92b27dc73266 Mon Sep 17 00:00:00 2001 From: Pierre Date: Mon, 14 May 2018 16:53:11 +0200 Subject: [PATCH] User data are included in data archive --- assets/3rdparty/jszip-utils/jszip-utils.js | 3 +++ assets/js/components/account/export/ui.js | 2 +- assets/js/components/account/export/worker.js | 15 +++++++++------ system/config/dev.config.php | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/assets/3rdparty/jszip-utils/jszip-utils.js b/assets/3rdparty/jszip-utils/jszip-utils.js index 948471a8..13fe7356 100644 --- a/assets/3rdparty/jszip-utils/jszip-utils.js +++ b/assets/3rdparty/jszip-utils/jszip-utils.js @@ -80,6 +80,9 @@ JSZipUtils.getBinaryContent = function(path, callback) { xhr.overrideMimeType("text/plain; charset=x-user-defined"); } + //Allow big files download + xhr.setRequestHeader("Range", "bytes=0-9999999999999999999999999999999"); + xhr.onreadystatechange = function(evt) { var file, err; // use `xhr` and not `this`... thanks IE diff --git a/assets/js/components/account/export/ui.js b/assets/js/components/account/export/ui.js index 6eb557d8..928a6bbb 100644 --- a/assets/js/components/account/export/ui.js +++ b/assets/js/components/account/export/ui.js @@ -60,7 +60,7 @@ ComunicWeb.components.account.export.ui = { var closeModal = function(){ $(modal).modal('hide'); emptyElem(modal); - remove(); + modal.remove(); } this._exportModal.close = closeModal; this._exportModal.closeModal.onclick = closeModal; diff --git a/assets/js/components/account/export/worker.js b/assets/js/components/account/export/worker.js index f042dc22..3043ad8e 100644 --- a/assets/js/components/account/export/worker.js +++ b/assets/js/components/account/export/worker.js @@ -82,12 +82,12 @@ ComunicWeb.components.account.export.worker = { //Add raw json file zip.file("source.json", JSON.stringify(data)); - + //Add the files to download - /*files_list.forEach(function(url){ + files_list.forEach(function(url){ var path = urlToPath(url); zip.file(path, urlToPromise(url), {binary:true}); - });*/ + }); //Generated zip archive zip.generateAsync({type:"blob"}, function updateCallback(metadata) { @@ -147,9 +147,12 @@ ComunicWeb.components.account.export.worker = { * @param {Object} info Information about the post to parse */ var parsePost = function(post){ - if(post.file_path_url != null){ - if(!files.includes(post.file_path_url)) - files.push(post.file_path_url); + + if(post.kind != "youtube"){ + if(post.file_path_url != null){ + if(!files.includes(post.file_path_url)) + files.push(post.file_path_url); + } } //Parse comments diff --git a/system/config/dev.config.php b/system/config/dev.config.php index 2650a77b..71c6c284 100644 --- a/system/config/dev.config.php +++ b/system/config/dev.config.php @@ -139,7 +139,7 @@ class Dev { "3rdparty/jszip/jszip.min.js", //JSZip utils - "3rdparty/jszip-utils/jszip-utils.min.js", + "3rdparty/jszip-utils/jszip-utils.js", ); /**