mirror of
https://gitlab.com/timvisee/send.git
synced 2025-12-07 14:40:55 +03:00
removing unused code
This commit is contained in:
@@ -94,33 +94,6 @@ $(document).ready(function() {
|
|||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
};
|
};
|
||||||
|
|
||||||
//load previous uploads
|
|
||||||
function checkUploads(file) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
const xhr = new XMLHttpRequest();
|
|
||||||
xhr.responseType = 'json';
|
|
||||||
xhr.onreadystatechange = () => {
|
|
||||||
if (xhr.readyState == 4 && xhr.status == 200) {
|
|
||||||
resolve(xhr.response);
|
|
||||||
} else if (xhr.readyState == 4 && xhr.status == 404) {
|
|
||||||
reject('error code: ' + xhr.status);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
xhr.onerror = () => {
|
|
||||||
reject('There was a network error.');
|
|
||||||
};
|
|
||||||
xhr.open('get', '/file/' + id, true);
|
|
||||||
xhr.send();
|
|
||||||
}).then(
|
|
||||||
response => {
|
|
||||||
populateFileList(response, url);
|
|
||||||
},
|
|
||||||
error => {
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//update file table with current files in localStorage
|
//update file table with current files in localStorage
|
||||||
function populateFileList(file) {
|
function populateFileList(file) {
|
||||||
file = JSON.parse(file);
|
file = JSON.parse(file);
|
||||||
|
|||||||
@@ -50,24 +50,6 @@ app.get('/exists/:id', (req, res) => {
|
|||||||
}).catch(err => res.sendStatus(404));
|
}).catch(err => res.sendStatus(404));
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/file/:id', (req, res) => {
|
|
||||||
let id = req.params.id;
|
|
||||||
storage.filename(id).then(filename => {
|
|
||||||
storage
|
|
||||||
.length(id)
|
|
||||||
.then(contentLength => {
|
|
||||||
res.json({
|
|
||||||
name: filename,
|
|
||||||
filesize: bytes(contentLength),
|
|
||||||
fileId: id
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
console.log('error retrieving id ' + id);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
app.get('/download/:id', (req, res) => {
|
app.get('/download/:id', (req, res) => {
|
||||||
const id = req.params.id;
|
const id = req.params.id;
|
||||||
storage.filename(id).then(filename => {
|
storage.filename(id).then(filename => {
|
||||||
|
|||||||
Reference in New Issue
Block a user