Initial commit

This commit is contained in:
Thomas Forgione 2020-03-15 23:40:38 +01:00
commit f7cf161830
9 changed files with 745 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
auth.json
node_modules
data

11
README.md Normal file
View File

@ -0,0 +1,11 @@
# Easy-Editing
*Une application de montage ultra simple pour vidéos pédagogiques*
## Listes des soft nécessaires au serveur
- image magick
- ffmpeg
- sox
- pdfinfo
- node / npm

118
html/index.html Normal file
View File

@ -0,0 +1,118 @@
<!doctype HTML>
<html>
<head>
<title>Easy-Editing</title>
<meta charset="utf-8">
<link href="/static/main.css" rel="stylesheet">
</head>
<body class="layout-documentation page-components">
<nav class="navbar is-link" role="navigation" aria-label="main navigation">
<div class="container">
<div class="navbar-brand">
<a class="navbar-item is-size-4" href="/"><strong>Easy-Editing</strong></a>
<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
</div>
</div>
</nav>
<section class="section">
<div class="container">
<div class="columns is-desktop">
<div class="column is-6 is-offset-3">
<article id="success" class="message is-success" style="display: none;">
<div class="message-header">
<p>Votre archive a été envoyée</p>
</div>
<div class="message-body">
Vous recevrez un email quand votre vidéo sera prête.
</div>
</article>
<article id="error" class="message is-danger" style="display: none;">
<div class="message-header">
<p>Erreur</p>
</div>
<div class="message-body content">
<p>Les erreurs suivantes ont été détectées dans votre archive :</p>
<ul id="error-message">
</ul>
</div>
</article>
<div id="form">
<div class="field">
<div class="control">
<input class="input is-primary" id="email" type="email" placeholder="Adresse email" name="email">
</div>
</div>
<div class="field is-grouped">
<div class="file has-name">
<div class="control">
<label class="file-label">
<input id="file-input" class="file-input" type="file" name="archive" accept="application/zip,application/octet-stream,application/x-zip-compressed,multipart/x-zip">
<span class="file-cta">
<span class="file-icon">
<i class="fas fa-upload"></i>
</span>
<span class="file-label">
Choisissez un fichier…
</span>
</span>
<span id="file-name" class="file-name">
Aucun fichier selectionné
</span>
</label>
</div>
</div>
</div>
<div class="field is-grouped">
<div class="control">
<button id="button" class="button is-link">Envoyer</button>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<script>
const button = document.getElementById('button');
const fileInput = document.getElementById('file-input');
fileInput.onchange = () => {
if (fileInput.files.length > 0) {
const fileName = document.getElementById('file-name');
fileName.textContent = fileInput.files[0].name;
}
}
button.addEventListener('click', () => {
button.disabled = true;
let formData = new FormData();
formData.append("email", document.getElementById("email").value);
formData.append("archive", fileInput.files[0]);
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = () => {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
document.getElementById('success').style.display = "";
document.getElementById('error').style.display = "none";
document.getElementById('form').style.display = "none";
} else {
document.getElementById('error-message').innerHTML = xhr.responseText;
document.getElementById('error').style.display = "";
document.getElementById('success').style.display = "none";
button.disabled = false;
}
}
}
xhr.open("POST", "/easy-edit");
xhr.send(formData);
});
</script>
</body>
</html>

144
index.js Normal file
View File

@ -0,0 +1,144 @@
const fs = require('fs');
const uuid = require('uuid').v4;
const { exec } = require('child_process');
const express = require('express');
const bodyParser = require('body-parser');
const formidable = require('formidable');
const nodemailer = require("nodemailer");
const app = express();
const port = 3000;
const transporter = nodemailer.createTransport(JSON.parse(fs.readFileSync(__dirname + '/auth.json', 'utf-8')));
const root = "https://easy-editing.tforgione.fr/";
function responseText(id) {
return "Votre video est prête!\n\nVous pouvez télécharger votre video à l'adresse " + root + 'video/' + id;
}
function responseHtml(id) {
return "<h1>Votre video est prête</h1><p><a href=\"" + root + "video/" + id + "\">Cliquez ici pour télécharger votre video</a></p>";
}
function sorryText() {
return "Nous sommes désolés!\n\nUne erreur s'est produite pendant l'encodage de la vidéo. L'administrateur a été contacté et reviendra vers vous.";
}
function sorryHtml() {
return "<h3>Nous sommes désolés!</h3><p>Une erreur s'est produite pendant l'encodage de la vidéo. L'administrateur a été contacté et reviendra vers vous.</p>";
}
function failureText(id, email, stdout, stderr) {
return (
"Une erreur a eu lieu !\n\nQuelque chose s'est mal passé pendant l'encodage de la video de " + email + " (" + id + + ")\n\n" +
"STDOUT\n" + stdout + "\n\nSTDERR\n" + stderr
);
}
function failureHtml(id, email, stdout, stderr) {
return (
"<p>Une erreur a eu lieu !\n\nQuelque chose s'est mal passé pendant l'encodage de la video de " + email + " (" + id + + ")</p><p>" +
"<h3>STDOUT</h3><pre><code>" + stdout + "</code></pre><h3>STDERR</h3><pre><code>" + stderr + "</code></pre></p>"
);
}
app.use(bodyParser.urlencoded({ extended: false }));
app.use((req, res, next) => {
console.log("Received request");
next();
});
app.get('/', (req, res) => {
res.sendFile(__dirname + '/html/index.html');
});
app.get('/video/:id', (req, res) => {
fs.stat(__dirname + '/data/' + req.params.id + '/final.mp4', (err, stats) => {
if (err) {
res.send("Nope");
} else {
res.download(__dirname + '/data/' + req.params.id + '/final.mp4');
}
});
});
app.post('/easy-edit', async (req, res, next) => {
const form = formidable({ multiples: true });
form.parse(req, async (err, fields, files) => {
if (err) {
console.log(err);
next(err);
return;
}
let id = uuid();
fs.mkdir(__dirname + '/data/' + id, () => {
exec('unzip ' + files.archive.path + ' -d ' + __dirname + '/data/' + id, (err, stdout, stderr) => {
if (err) {
next(err);
return;
}
exec(__dirname + '/test-merge', {cwd: __dirname + '/data/' + id}, (err, stdout, stderr) => {
if (err) {
res.status(400).send(stderr);
} else {
res.send("");
exec(__dirname + '/merge', {cwd: __dirname + '/data/' + id}, (err, stdout, stderr) => {
if (err) {
transporter.sendMail({
from: '"Easy-Editing" <postmaster@tforgione.fr>',
to: fields.email,
subject: "Votre video est prête",
text: sorryText(),
html: sorryHtml(),
})
transporter.sendMail({
from: '"Easy-Editing" <postmaster@tforgione.fr>',
to: fields.email,
subject: "Votre video est prête",
text: failureText(id, email, stdout, stderr),
html: failureHtml(id, email, stdout, stderr),
})
} else {
transporter.sendMail({
from: '"Easy-Editing" <postmaster@tforgione.fr>',
to: fields.email,
subject: "Votre video est prête",
text: responseText(id),
html: responseHtml(id),
})
}
});
}
});
});
});
});
});
app.use('/static', express.static('static'));
app.use((req, res) => {
res.send('oops');
});
app.listen(port, '0.0.0.0', () => {
console.log(`Example app listening on port ${port}!`)
});

21
merge Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env bash
files=$(ls | wc -l)
if [ $files -eq 1 ]; then
cd $(ls)
fi
convert -density 300 *.pdf -resize 1440x1080! '%01d'.png
for i in `seq 0 4`; do
# fade
duration=$(sox $i.wav -n stat 2>&1 | grep Length | cut -d ':' -f 2 | tr -d '[:space:]')
sox $i.wav faded-$i.wav fade 0:0.1 $(soxi -d $i.wav) 0:0.1
echo -e "file '$i.png'\nduration $duration" >> video-input-list.txt
done
sox faded-*wav output.wav
ffmpeg -f concat -safe 0 -i video-input-list.txt output.mp4
ffmpeg -i output.mp4 -i output.wav -c:v libx264 final.mp4

389
package-lock.json generated Normal file
View File

@ -0,0 +1,389 @@
{
"name": "easy-editing",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"accepts": {
"version": "1.3.7",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
"integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
"requires": {
"mime-types": "~2.1.24",
"negotiator": "0.6.2"
}
},
"array-flatten": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
},
"body-parser": {
"version": "1.19.0",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
"integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==",
"requires": {
"bytes": "3.1.0",
"content-type": "~1.0.4",
"debug": "2.6.9",
"depd": "~1.1.2",
"http-errors": "1.7.2",
"iconv-lite": "0.4.24",
"on-finished": "~2.3.0",
"qs": "6.7.0",
"raw-body": "2.4.0",
"type-is": "~1.6.17"
}
},
"bytes": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
"integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
},
"content-disposition": {
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz",
"integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==",
"requires": {
"safe-buffer": "5.1.2"
}
},
"content-type": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
},
"cookie": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz",
"integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg=="
},
"cookie-signature": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
"integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
},
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"requires": {
"ms": "2.0.0"
}
},
"depd": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
},
"destroy": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
},
"ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
},
"encodeurl": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
},
"escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
},
"etag": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
},
"express": {
"version": "4.17.1",
"resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz",
"integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==",
"requires": {
"accepts": "~1.3.7",
"array-flatten": "1.1.1",
"body-parser": "1.19.0",
"content-disposition": "0.5.3",
"content-type": "~1.0.4",
"cookie": "0.4.0",
"cookie-signature": "1.0.6",
"debug": "2.6.9",
"depd": "~1.1.2",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"finalhandler": "~1.1.2",
"fresh": "0.5.2",
"merge-descriptors": "1.0.1",
"methods": "~1.1.2",
"on-finished": "~2.3.0",
"parseurl": "~1.3.3",
"path-to-regexp": "0.1.7",
"proxy-addr": "~2.0.5",
"qs": "6.7.0",
"range-parser": "~1.2.1",
"safe-buffer": "5.1.2",
"send": "0.17.1",
"serve-static": "1.14.1",
"setprototypeof": "1.1.1",
"statuses": "~1.5.0",
"type-is": "~1.6.18",
"utils-merge": "1.0.1",
"vary": "~1.1.2"
}
},
"finalhandler": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz",
"integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==",
"requires": {
"debug": "2.6.9",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"on-finished": "~2.3.0",
"parseurl": "~1.3.3",
"statuses": "~1.5.0",
"unpipe": "~1.0.0"
}
},
"formidable": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.2.tgz",
"integrity": "sha512-V8gLm+41I/8kguQ4/o1D3RIHRmhYFG4pnNyonvua+40rqcEmT4+V71yaZ3B457xbbgCsCfjSPi65u/W6vK1U5Q=="
},
"forwarded": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
"integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
},
"fresh": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
},
"http-errors": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
"integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==",
"requires": {
"depd": "~1.1.2",
"inherits": "2.0.3",
"setprototypeof": "1.1.1",
"statuses": ">= 1.5.0 < 2",
"toidentifier": "1.0.0"
}
},
"iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"requires": {
"safer-buffer": ">= 2.1.2 < 3"
}
},
"inherits": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
},
"ipaddr.js": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g=="
},
"media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
},
"merge-descriptors": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
"integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
},
"methods": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
"integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
},
"mime": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="
},
"mime-db": {
"version": "1.43.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz",
"integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ=="
},
"mime-types": {
"version": "2.1.26",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz",
"integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==",
"requires": {
"mime-db": "1.43.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"negotiator": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
"integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
},
"nodemailer": {
"version": "6.4.5",
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.4.5.tgz",
"integrity": "sha512-NH7aNVQyZLAvGr2+EOto7znvz+qJ02Cb/xpou98ApUt5tEAUSVUxhvHvgV/8I5dhjKTYqUw0nasoKzLNBJKrDQ=="
},
"on-finished": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
"integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
"requires": {
"ee-first": "1.1.1"
}
},
"parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
},
"path-to-regexp": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
},
"proxy-addr": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz",
"integrity": "sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==",
"requires": {
"forwarded": "~0.1.2",
"ipaddr.js": "1.9.1"
}
},
"qs": {
"version": "6.7.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
"integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ=="
},
"range-parser": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="
},
"raw-body": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz",
"integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==",
"requires": {
"bytes": "3.1.0",
"http-errors": "1.7.2",
"iconv-lite": "0.4.24",
"unpipe": "1.0.0"
}
},
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
},
"safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"send": {
"version": "0.17.1",
"resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz",
"integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==",
"requires": {
"debug": "2.6.9",
"depd": "~1.1.2",
"destroy": "~1.0.4",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"fresh": "0.5.2",
"http-errors": "~1.7.2",
"mime": "1.6.0",
"ms": "2.1.1",
"on-finished": "~2.3.0",
"range-parser": "~1.2.1",
"statuses": "~1.5.0"
},
"dependencies": {
"ms": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
}
}
},
"serve-static": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz",
"integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==",
"requires": {
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"parseurl": "~1.3.3",
"send": "0.17.1"
}
},
"setprototypeof": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
"integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
},
"statuses": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
},
"toidentifier": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
},
"type-is": {
"version": "1.6.18",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
"requires": {
"media-typer": "0.3.0",
"mime-types": "~2.1.24"
}
},
"unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
},
"utils-merge": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
},
"uuid": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.2.tgz",
"integrity": "sha512-vy9V/+pKG+5ZTYKf+VcphF5Oc6EFiu3W8Nv3P3zIh0EqVI80ZxOzuPfe9EHjkFNvf8+xuTHVeei4Drydlx4zjw=="
},
"vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
}
}
}

18
package.json Normal file
View File

@ -0,0 +1,18 @@
{
"name": "easy-editing",
"version": "1.0.0",
"description": "",
"main": "index.js",
"repository": {
"type": "git",
"url": "git@gitea.tforgione.fr:tforgione/easy-editing"
},
"author": "Thomas Forgione",
"dependencies": {
"body-parser": "^1.19.0",
"express": "^4.17.1",
"formidable": "^1.2.2",
"nodemailer": "^6.4.5",
"uuid": "^7.0.2"
}
}

1
static/main.css Normal file

File diff suppressed because one or more lines are too long

40
test-merge Executable file
View File

@ -0,0 +1,40 @@
#!/usr/bin/env bash
set -o pipefail
errored=0
files=$(ls | wc -l)
if [ $files -eq 1 ]; then
mv $(ls)/* .
fi
pdf_count=$(ls *.pdf 2>/dev/null | wc -l)
if [ $? -ne 0 ]; then
echo >&2 "<li>il doit y avoir un fichier PDF dans l'archive</li>"
errored=1
elif [ $pdf_count -ne 1 ]; then
echo >&2 "<li>il ne doit y avoir qu'un seul fichier PDF dans l'archive</li>"
errored=1
else
number_of_pages=$(pdfinfo *.pdf 2>/dev/null| grep Pages | cut -d ':' -f 2 | tr -d '[:space:]')
number_of_sounds=$(ls *.wav 2>/dev/null | wc -l)
if [ $? -ne 0 ]; then
echo >&2 "<li>il doit y avoir des fichiers .wav dans l'archive</li>"
errored=1
elif [ $number_of_sounds -ne $number_of_pages ]; then
echo >&2 "<li>il y a $number_of_sounds fichiers sonores mais $number_of_pages planches dans vos slides</li>"
errored=1
fi
fi
exit $errored