Compare commits

..

2 commits

Author SHA1 Message Date
bf3543d47f docker 2021-05-18 20:23:18 +02:00
d2566ba184 handle some error better idk 2021-05-18 20:23:11 +02:00
3 changed files with 31 additions and 3 deletions

24
Dockerfile Normal file
View file

@ -0,0 +1,24 @@
# My first docker hope it isn't too bad :)
FROM node:14
WORKDIR /var/www/jeffdownloader/
RUN git clone https://git.namejeff.xyz/Supositware/jeff-downloader.git .
RUN git checkout progress
RUN npm install
RUN npm i -g pm2
RUN echo "[]" > proxy/proxy.json
RUN NODE_ENV=production
RUN PORT=3333
RUN apt-get update && apt-get install -y ffmpeg
EXPOSE 3333
CMD ["pm2-runtime", "bin/www"]

View file

@ -142,6 +142,7 @@ router.post('/', async function(req, res, next) {
video.on('error', function(err) { video.on('error', function(err) {
console.error(err); console.error(err);
progress[data.uuid] = 0;
res.json({ error: err.stderr}); res.json({ error: err.stderr});
}); });

View file

@ -224,12 +224,13 @@ Come take a look here https://git.namejeff.xyz/Supositware/jeff-downloader for a
CheckProgress(); CheckProgress();
}, 1000); }, 1000);
// Définissez ce qui se passe si la soumission s'est opérée avec succès
xhttp.addEventListener("load", function(event) { xhttp.addEventListener("load", function(event) {
const json = JSON.parse(event.target.responseText); const json = JSON.parse(event.target.responseText);
console.log(json); console.log(json);
if (json.error) { if (json.error) {
alert(json.error); clearInterval(progress);
document.getElementById('progress').innerHTML = '';
alert(json.error);
} else { } else {
const url = json.url; const url = json.url;
@ -250,7 +251,6 @@ Come take a look here https://git.namejeff.xyz/Supositware/jeff-downloader for a
}, 500) }, 500)
}); });
// Definissez ce qui se passe en cas d'erreur
xhttp.addEventListener("error", function(event) { xhttp.addEventListener("error", function(event) {
clearInterval(progress); clearInterval(progress);
document.getElementById('progress').innerHTML = ''; document.getElementById('progress').innerHTML = '';
@ -272,6 +272,9 @@ Come take a look here https://git.namejeff.xyz/Supositware/jeff-downloader for a
}); });
xhttp.addEventListener("error", function(event) { xhttp.addEventListener("error", function(event) {
clearInterval(progress);
document.getElementById('progress').innerHTML = '';
alert('whoops, something gone wrong');
console.error(event.target.responseText); console.error(event.target.responseText);
}); });
} }