mirror of
https://github.com/MasterAcnolo/Freedom-Loader.git
synced 2026-07-29 18:25:47 +02:00
Notification + Open On CLICK
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,4 +2,5 @@
|
||||
/downloads
|
||||
/dist
|
||||
logs/*.json
|
||||
logs/*.log
|
||||
/out
|
||||
BIN
build/confirm-icon.png
Normal file
BIN
build/confirm-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.8 KiB |
@@ -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"
|
||||
|
||||
@@ -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}`);
|
||||
|
||||
Reference in New Issue
Block a user