format
This commit is contained in:
parent
8bc1cb4e63
commit
ae3e18c443
@ -16,7 +16,9 @@ $(document).ready(function() {
|
|||||||
$('.send-new').hide();
|
$('.send-new').hide();
|
||||||
$('#download-progress').show();
|
$('#download-progress').show();
|
||||||
// update progress bar
|
// update progress bar
|
||||||
document.querySelector('#progress-bar').style.setProperty('--progress', percentComplete+'%');
|
document
|
||||||
|
.querySelector('#progress-bar')
|
||||||
|
.style.setProperty('--progress', percentComplete + '%');
|
||||||
$('#progress-text').html(`${percentComplete}%`);
|
$('#progress-text').html(`${percentComplete}%`);
|
||||||
//on complete
|
//on complete
|
||||||
if (percentComplete === 100) {
|
if (percentComplete === 100) {
|
||||||
@ -29,33 +31,33 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
fileReceiver
|
fileReceiver
|
||||||
.download()
|
.download()
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
$('.title').text(
|
$('.title').text(
|
||||||
'This link has expired or never existed in the first place.'
|
'This link has expired or never existed in the first place.'
|
||||||
);
|
);
|
||||||
$('#download-btn').hide();
|
$('#download-btn').hide();
|
||||||
$('#expired-img').show();
|
$('#expired-img').show();
|
||||||
console.log('The file has expired, or has already been deleted.');
|
console.log('The file has expired, or has already been deleted.');
|
||||||
return;
|
|
||||||
})
|
|
||||||
.then(([decrypted, fname]) => {
|
|
||||||
name.innerText = fname;
|
|
||||||
const dataView = new DataView(decrypted);
|
|
||||||
const blob = new Blob([dataView]);
|
|
||||||
const downloadUrl = URL.createObjectURL(blob);
|
|
||||||
|
|
||||||
const a = document.createElement('a');
|
|
||||||
a.href = downloadUrl;
|
|
||||||
if (window.navigator.msSaveBlob) {
|
|
||||||
// if we are in microsoft edge or IE
|
|
||||||
window.navigator.msSaveBlob(blob, fname);
|
|
||||||
return;
|
return;
|
||||||
}
|
})
|
||||||
a.download = fname;
|
.then(([decrypted, fname]) => {
|
||||||
document.body.appendChild(a);
|
name.innerText = fname;
|
||||||
a.click();
|
const dataView = new DataView(decrypted);
|
||||||
});
|
const blob = new Blob([dataView]);
|
||||||
|
const downloadUrl = URL.createObjectURL(blob);
|
||||||
|
|
||||||
|
const a = document.createElement('a');
|
||||||
|
a.href = downloadUrl;
|
||||||
|
if (window.navigator.msSaveBlob) {
|
||||||
|
// if we are in microsoft edge or IE
|
||||||
|
window.navigator.msSaveBlob(blob, fname);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
a.download = fname;
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
window.download = download;
|
window.download = download;
|
||||||
|
@ -21,9 +21,9 @@ $(document).ready(function() {
|
|||||||
document.execCommand('copy');
|
document.execCommand('copy');
|
||||||
document.body.removeChild(aux);
|
document.body.removeChild(aux);
|
||||||
//disable button for 3s
|
//disable button for 3s
|
||||||
$copyBtn.attr('disabled', true)
|
$copyBtn.attr('disabled', true);
|
||||||
$copyBtn.html('Copied!');
|
$copyBtn.html('Copied!');
|
||||||
window.setTimeout(()=>{
|
window.setTimeout(() => {
|
||||||
$copyBtn.attr('disabled', false);
|
$copyBtn.attr('disabled', false);
|
||||||
$copyBtn.html('Copy');
|
$copyBtn.html('Copy');
|
||||||
}, 3000);
|
}, 3000);
|
||||||
@ -90,7 +90,9 @@ $(document).ready(function() {
|
|||||||
$('#upload-progress').show();
|
$('#upload-progress').show();
|
||||||
$('#upload-filename').innerHTML += file.name;
|
$('#upload-filename').innerHTML += file.name;
|
||||||
// update progress bar
|
// update progress bar
|
||||||
document.querySelector('#progress-bar').style.setProperty('--progress', percentComplete+'%');
|
document
|
||||||
|
.querySelector('#progress-bar')
|
||||||
|
.style.setProperty('--progress', percentComplete + '%');
|
||||||
$('#progress-text').html(`${percentComplete}%`);
|
$('#progress-text').html(`${percentComplete}%`);
|
||||||
});
|
});
|
||||||
fileSender.upload().then(info => {
|
fileSender.upload().then(info => {
|
||||||
|
@ -155,7 +155,12 @@ td {
|
|||||||
#progress-bar {
|
#progress-bar {
|
||||||
width: 300px;
|
width: 300px;
|
||||||
height: 5px;
|
height: 5px;
|
||||||
background: linear-gradient(90deg, #FD9800, #D73000 var(--progress), white var(--progress));
|
background: linear-gradient(
|
||||||
|
90deg,
|
||||||
|
#FD9800,
|
||||||
|
#D73000 var(--progress),
|
||||||
|
white var(--progress)
|
||||||
|
);
|
||||||
border: 0.5px solid;
|
border: 0.5px solid;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
|
@ -71,13 +71,16 @@ app.get('/assets/download/:id', (req, res) => {
|
|||||||
const file_stream = storage.get(id);
|
const file_stream = storage.get(id);
|
||||||
|
|
||||||
file_stream.on(notLocalHost ? 'finish' : 'close', () => {
|
file_stream.on(notLocalHost ? 'finish' : 'close', () => {
|
||||||
storage.forceDelete(id).then(err => {
|
storage
|
||||||
if (!err) {
|
.forceDelete(id)
|
||||||
log.info('Deleted:', id);
|
.then(err => {
|
||||||
}
|
if (!err) {
|
||||||
}).catch(err => {
|
log.info('Deleted:', id);
|
||||||
log.info('DeleteError:', id);
|
}
|
||||||
});
|
})
|
||||||
|
.catch(err => {
|
||||||
|
log.info('DeleteError:', id);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
file_stream.pipe(res);
|
file_stream.pipe(res);
|
||||||
@ -104,7 +107,7 @@ app.post('/delete/:id', (req, res) => {
|
|||||||
|
|
||||||
storage
|
storage
|
||||||
.delete(id, delete_token)
|
.delete(id, delete_token)
|
||||||
.then((err) => {
|
.then(err => {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
log.info('Deleted:', id);
|
log.info('Deleted:', id);
|
||||||
res.sendStatus(200);
|
res.sendStatus(200);
|
||||||
|
@ -145,7 +145,7 @@ function awsGet(id) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
return s3.getObject(params).createReadStream();
|
return s3.getObject(params).createReadStream();
|
||||||
} catch(err) {
|
} catch (err) {
|
||||||
log.info('GetFailed', 'Get Object from s3 failed.');
|
log.info('GetFailed', 'Get Object from s3 failed.');
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user