From f76be1a64c73738951ec5d4a3e5db4cad1ba0b77 Mon Sep 17 00:00:00 2001 From: Laurent Ghigonis Date: Wed, 19 Jun 2013 02:38:34 +0200 Subject: jsaccess: direct download for cleartext files --- jsaccess/jsa/jsa.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/jsaccess/jsa/jsa.js b/jsaccess/jsa/jsa.js index 4dd1782..cca0f95 100644 --- a/jsaccess/jsa/jsa.js +++ b/jsaccess/jsa/jsa.js @@ -132,22 +132,20 @@ function _dl(file, pass) { var path = 'store/' + dirhash + '/' + RMD160.hex(dirhash + filename); _status("Downloading \""+filename+"\" ..."); + if (crypt = '(nocrypt)') { + _status("File is in your hands,
Have a good day.
"); + window.location = path; + return; + } + dlreq = $.ajax({ url: path, beforeSend: function ( xhr ) { xhr.overrideMimeType("application/base64"); }, success: function ( data ) { - switch (crypt) { - case '(base64+aes256)': - _status("Download complete, decrypting ...", - function() { _decrypt(data, pass, filename); }); - break; - case '(nocrypt)': - _status("Download complete, saving ..."); - _save(data, filename); - break; - } + _status("Download complete, decrypting ...", + function() { _decrypt(data, pass, filename); }); }, error: function (xhr, opts, err) { _status("Dowload failed (status="+xhr.status+")"); @@ -182,13 +180,15 @@ function _save(obj, name) { function _status(txt, run_func) { var div = document.getElementById('status_p'); div.innerHTML = div.innerHTML + '
' + txt; + /* force refresh with trick */ jQuery.fn.redraw = function() { return this.hide(0, function() { $(this).show(); }); }; $('#status_p').redraw(); + /* force refresh with async execution */ if (run_func) - setTimeout(run_func, 100); /* to force refresh */ + setTimeout(run_func, 100); } -- cgit v1.2.3-59-g8ed1b