diff --git a/.gitignore b/.gitignore index d602921..47a88c4 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ /downloads /dist logs/*.json +logs/*.log /out \ No newline at end of file diff --git a/build/confirm-icon.png b/build/confirm-icon.png new file mode 100644 index 0000000..f01fac2 Binary files /dev/null and b/build/confirm-icon.png differ diff --git a/package.json b/package.json index 3f9fcd3..714e825 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,12 @@ "buildResources": "build" }, "asar": false, + "extraResources": [ + { + "from": "build/confirm-icon.png", + "to": "confirm-icon.png" + } + ], "win": { "target": "nsis", "icon": "build/installer-icon.ico" diff --git a/server/routes/download.js b/server/routes/download.js index 30ad166..f922ce7 100644 --- a/server/routes/download.js +++ b/server/routes/download.js @@ -18,7 +18,7 @@ const router = express.Router(); const { execFile } = require("child_process"); const path = require("path"); const fs = require("fs"); - +const { Notification } = require("electron"); const logger = require("../logger").logger; // Path vers le fichier exécutable yt-dlp (outil tiers pour le téléchargement) @@ -144,6 +144,25 @@ router.post("/", (req, res) => { child.on("close", (code) => { logger.info(`yt-dlp terminé avec code de sortie : ${code}`); if (code === 0) { + + const iconPath = path.join(process.resourcesPath, "confirm-icon.png"); // la sécurité pour toutes les machines + + console.log("Icon path pour la notif :", iconPath); + + const notif = new Notification({ + title: "Freedom Loader", + body: "Ton téléchargement est terminé, clique ici pour l'ouvrir.", + icon: iconPath, + }); + + notif.on("click", () => { + console.log("Notification cliquée !"); + //Pour pouvoir ouvrir le dossier de la vidéo + const { shell } = require("electron"); + shell.openPath(requestedOutputFolder); + }); + + notif.show(); res.send("✅ Téléchargement terminé !"); } else { res.status(500).send(`❌ yt-dlp a échoué avec le code : ${code}`);