working s3 integration, commented out load credentials from json
This commit is contained in:
parent
f377aa4551
commit
af4edfef16
6 changed files with 116 additions and 86 deletions
|
@ -5,7 +5,6 @@ class FileReceiver extends EventEmitter {
|
|||
constructor() {
|
||||
super();
|
||||
this.salt = strToIv(location.pathname.slice(10, -1));
|
||||
window.salt = this.salt;
|
||||
}
|
||||
|
||||
download() {
|
||||
|
@ -31,8 +30,6 @@ class FileReceiver extends EventEmitter {
|
|||
let blob = new Blob([this.response]);
|
||||
let fileReader = new FileReader();
|
||||
fileReader.onload = function() {
|
||||
window.data = this.result;
|
||||
console.log(this.result);
|
||||
resolve({
|
||||
data: this.result,
|
||||
fname: xhr
|
||||
|
|
|
@ -85,10 +85,13 @@ class FileSender extends EventEmitter {
|
|||
|
||||
xhr.onreadystatechange = () => {
|
||||
if (xhr.readyState == XMLHttpRequest.DONE) {
|
||||
// uuid field and url field
|
||||
let responseObj = JSON.parse(xhr.responseText);
|
||||
resolve({
|
||||
url: responseObj.url,
|
||||
fileId: fileId,
|
||||
secretKey: keydata.k,
|
||||
deleteToken: xhr.responseText
|
||||
deleteToken: responseObj.uuid
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -58,8 +58,7 @@ $(document).ready(function() {
|
|||
progress.innerText = `Progress: ${percentComplete}%`;
|
||||
});
|
||||
fileSender.upload().then(info => {
|
||||
const url = `${window.location
|
||||
.origin}/download/${info.fileId}/#${info.secretKey}`;
|
||||
const url = info.url.trim() + `#${info.secretKey}`.trim();
|
||||
$('#link').attr('value', url);
|
||||
link.innerHTML = url;
|
||||
localStorage.setItem(info.fileId, info.deleteToken);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue