aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Module/Attach.php19
-rw-r--r--view/js/mod_cloud.js37
2 files changed, 3 insertions, 53 deletions
diff --git a/Zotlabs/Module/Attach.php b/Zotlabs/Module/Attach.php
index f70366448..172f6a4bc 100644
--- a/Zotlabs/Module/Attach.php
+++ b/Zotlabs/Module/Attach.php
@@ -14,8 +14,6 @@ class Attach extends Controller {
$attach_ids = ((x($_REQUEST, 'attach_ids')) ? $_REQUEST['attach_ids'] : []);
$attach_path = ((x($_REQUEST, 'attach_path')) ? $_REQUEST['attach_path'] : '');
- $download_token = ((x($_REQUEST, 'download_token')) ? $_REQUEST['download_token'] : '');
-
$channel_id = ((x($_REQUEST, 'channel_id')) ? intval($_REQUEST['channel_id']) : 0);
$channel = channelx_by_n($channel_id);
@@ -53,7 +51,6 @@ class Attach extends Controller {
];
Verify::create('zip_token', 0, $token, json_encode($meta));
- Verify::create('download_token', 0, $download_token, $token);
json_return_and_die([
'success' => true,
@@ -72,19 +69,6 @@ class Attach extends Controller {
}
$token = ((x($_REQUEST, 'token')) ? $_REQUEST['token'] : '');
- $download_token = ((x($_REQUEST, 'download_token')) ? $_REQUEST['download_token'] : '');
-
- if(argv(1) === 'check') {
- $meta = Verify::get_meta('download_token', 0, $download_token);
-
- if(! $meta)
- killme();
-
- json_return_and_die([
- 'success' => true,
- 'token' => $meta
- ]);
- }
if(argv(1) === 'download') {
$meta = Verify::get_meta('zip_token', 0, $token);
@@ -94,9 +78,6 @@ class Attach extends Controller {
$meta = json_decode($meta, true);
- // make sure we remove the download_token in case we have not checked yet
- Verify::get_meta('download_token', 0, $download_token);
-
header('Content-Type: application/zip');
header('Content-Disposition: attachment; filename="'. $meta['zip_filename'] . '"');
header('Content-Length: ' . filesize($meta['zip_path']));
diff --git a/view/js/mod_cloud.js b/view/js/mod_cloud.js
index aeaac8c69..8fb66c5aa 100644
--- a/view/js/mod_cloud.js
+++ b/view/js/mod_cloud.js
@@ -70,11 +70,8 @@ $(document).ready(function () {
$('body').css('cursor', 'wait');
$.jGrowl('Please stand by while your download is being prepared...', { sticky: false, theme: 'info', life: 10000 });
- var download_token = makeid(32);
-
let data = [
{name: 'attach_path', value: window.location.pathname},
- {name: 'download_token', value: download_token},
{name: 'channel_id', value: channelId},
{name: 'attach_ids[]', value: id}
]
@@ -82,21 +79,9 @@ $(document).ready(function () {
$.post('attach', data, function (data) {
if (data.success) {
$('body').css('cursor', 'auto');
- window.location.href = '/attach/download?token=' + data.token + '&download_token=' + download_token;
- clearInterval(fallback);
- }
- });
-
- // fallback if server timed out
-
- var fallback = setInterval(function(){ $.get('/attach/check?download_token=' + download_token, function(data){
- if (data.success) {
- $('body').css('cursor', 'auto');
window.location.href = '/attach/download?token=' + data.token;
- clearInterval(fallback);
}
-
- }); }, 30000);
+ });
});
@@ -313,33 +298,17 @@ $(document).ready(function () {
$('body').css('cursor', 'wait');
$.jGrowl('Please stand by while your download is being prepared...', { sticky: false, theme: 'info', life: 10000 });
- var download_token = makeid(32);
-
post_data.push(
{name: 'attach_path', value: window.location.pathname},
- {name: 'download_token', value: download_token},
- {name: 'channel_id', value: channelId},
+ {name: 'channel_id', value: channelId}
);
$.post('attach', post_data, function (data) {
if (data.success) {
$('body').css('cursor', 'auto');
- window.location.href = '/attach/download?token=' + data.token + '&download_token=' + download_token;
- clearInterval(fallback);
- }
- });
-
- // fallback if server timed out
-
- var fallback = setInterval(function(){ $.get('/attach/check?download_token=' + download_token, function(data){
- if (data.success) {
- $('body').css('cursor', 'auto');
window.location.href = '/attach/download?token=' + data.token;
- clearInterval(fallback);
}
-
- }); }, 30000);
-
+ });
});