Push avant Clean

This commit is contained in:
MasterAcnolo
2025-11-09 09:04:57 +01:00
parent ac854ae559
commit 4954de5f1a
71 changed files with 1256 additions and 1350 deletions

View File

@@ -0,0 +1,55 @@
/*
This file is part of Freedom Loader.
Copyright (C) 2025 MasterAcnolo
Freedom Loader is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License.
Freedom Loader is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
const form = document.getElementById("downloadForm");
const statusDiv = document.getElementById("downloadStatus");
const button = form.querySelector("button");
form.addEventListener("submit", async (e) => {
e.preventDefault();
button.disabled = true; // Empêche les clics multiples
statusDiv.textContent = "Téléchargement en cours...";
const formData = new FormData(form);
const params = new URLSearchParams(formData);
try {
const res = await fetch("/download", {
method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
body: params,
});
if (!res.ok) {
statusDiv.textContent = "❌ Erreur pendant le téléchargement.";
return;
}
const text = await res.text();
statusDiv.textContent = text;
} catch {
statusDiv.textContent = "❌ Une erreur sest produite.";
} finally {
button.disabled = false;
setTimeout(() => {
statusDiv.textContent = "";
}, 5000);
}
});