diff options
author | Laurent Ghigonis <laurent@p1sec.com> | 2013-06-19 02:38:34 +0200 |
---|---|---|
committer | Laurent Ghigonis <laurent@p1sec.com> | 2013-06-19 02:38:34 +0200 |
commit | f76be1a64c73738951ec5d4a3e5db4cad1ba0b77 (patch) | |
tree | af66d4d1509e90a3b53d4f8dee06d37f06899748 /jsaccess | |
parent | jsaccess: fix jstore add/rm (diff) | |
download | laurent-tools-f76be1a64c73738951ec5d4a3e5db4cad1ba0b77.tar.xz laurent-tools-f76be1a64c73738951ec5d4a3e5db4cad1ba0b77.zip |
jsaccess: direct download for cleartext files
Diffstat (limited to 'jsaccess')
-rw-r--r-- | jsaccess/jsa/jsa.js | 22 |
1 files 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,<br/>Have a good day.<br/>"); + 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 + '<br/>' + 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); } |