diff --git a/public/script/downloadstatus.js b/public/script/downloadstatus.js index d80888e..e3b6a23 100644 --- a/public/script/downloadstatus.js +++ b/public/script/downloadstatus.js @@ -5,7 +5,7 @@ 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..."; + statusDiv.textContent = "Download in progress..."; const formData = new FormData(form); const params = new URLSearchParams(formData); @@ -26,7 +26,7 @@ form.addEventListener("submit", async (e) => { statusDiv.textContent = text; } catch { - statusDiv.textContent = "❌ Une erreur s’est produite."; + statusDiv.textContent = "❌ An Error has Occured."; } finally { button.disabled = false; diff --git a/server/controller/download.controller.js b/server/controller/download.controller.js index 248dc97..3b820ee 100644 --- a/server/controller/download.controller.js +++ b/server/controller/download.controller.js @@ -16,15 +16,15 @@ async function downloadController(req, res) { outputFolder: req.body.savePath || undefined, }; - if (!options.url || !isValidUrl(options.url)) return res.status(400).send("❌ URL invalide !"); - if (options.outputFolder && !isSafePath(options.outputFolder)) return res.status(400).send("❌ Chemin de sauvegarde non autorisé."); + if (!options.url || !isValidUrl(options.url)) return res.status(400).send("❌ Invalid URL !"); + if (options.outputFolder && !isSafePath(options.outputFolder)) return res.status(400).send("❌ Save Path Not Allowed."); const filePath = await fetchDownload(options, listeners, speedListeners); notifyDownloadFinished(filePath); - res.send("✅ Téléchargement terminé !"); + res.send("✅ Download Done !"); } catch (err) { - logger.error(`Erreur serveur dans /download : ${err.message}`); + logger.error(`Server Error in /download : ${err.message}`); res.status(500).send(`❌ ${err.message}`); } } diff --git a/server/controller/info.controller.js b/server/controller/info.controller.js index 72e4a2e..da0e3ae 100644 --- a/server/controller/info.controller.js +++ b/server/controller/info.controller.js @@ -12,9 +12,9 @@ async function infoController(req, res){ /* Si pas d'url ou url invalide*/ - if (!url || !isValidUrl(url)) return res.status(400).send("❌ URL invalide ou manquante"); + if (!url || !isValidUrl(url)) return res.status(400).send("❌ Invalid URL Or Missing"); - logger.info(`Requête /info reçue par le controller. URL: ${url}`); + logger.info(`/Info Request receive by the Info Controller. URL: ${url}`); if (url.includes("?list")) { logger.info("Type de contenu: Playlist") @@ -29,12 +29,12 @@ async function infoController(req, res){ if (data._type === "playlist") { const playlist = parsePlaylist(data); - logger.info(`Playlist détectée : ${playlist.title} (${playlist.count} vidéos)`); + logger.info(`Playlist : ${playlist.title} (${playlist.count} vidéos)`); return res.json(playlist); } else{ const video = parseVideo(data); - logger.info(`Vidéo unique récupérée : ${video.title}`); + logger.info(`Unique Video: ${video.title}`); return res.json(video); } diff --git a/server/discordRPC.js b/server/discordRPC.js index d987764..98d5ee8 100644 --- a/server/discordRPC.js +++ b/server/discordRPC.js @@ -33,7 +33,7 @@ function startRPC() { await rpc.destroy(); } } catch (err) { - logger.error("Erreur lors de la fermeture du RPC :", err); + logger.error("Error while closing the RPC:", err); } finally { process.exit(); } @@ -44,7 +44,7 @@ function startRPC() { process.on("SIGTERM", cleanExit); rpc.login({ clientId }).catch(err => { - logger.error("Impossible de connecter le RPC :", err); + logger.error("Unable to connect to the RPC:", err); }); } diff --git a/server/helpers/getBrowser.js b/server/helpers/getBrowser.js index eab9832..e40b473 100644 --- a/server/helpers/getBrowser.js +++ b/server/helpers/getBrowser.js @@ -8,14 +8,21 @@ function getUserBrowser() { // Liste des navigateurs supportés par yt-dlp const browsers = [ - { name: "firefox", path: path.join(userProfile, "AppData", "Roaming", "Mozilla", "Firefox", "Profiles")}, - { name: "chrome", path: path.join(userProfile, "AppData", "Local", "Google", "Chrome", "User Data") }, - { name: "edge", path: path.join(userProfile, "AppData", "Local", "Microsoft", "Edge", "User Data") }, + { name: "firefox", path: path.join(userProfile, "AppData", "Roaming", "Mozilla", "Firefox", "Profiles") }, + // { name: "chrome", path: path.join(userProfile, "AppData", "Local", "Google", "Chrome", "User Data", "Default") }, + // { name: "brave", path: path.join(userProfile, "AppData", "Local", "BraveSoftware", "Brave-Browser", "User Data", "Default") }, + // { name: "edge", path: path.join(userProfile, "AppData", "Local", "Microsoft", "Edge", "User Data", "Default") }, + // { name: "opera", path: path.join(userProfile, "AppData", "Roaming", "Opera Software", "Opera Stable") }, + // { name: "vivaldi", path: path.join(userProfile, "AppData", "Local", "Vivaldi", "User Data", "Default") }, + // { name: "safari", path: path.join(userProfile, "AppData", "Local", "Apple Computer", "Safari") }, + // { name: "whale", path: path.join(userProfile, "AppData", "Local", "Naver", "Naver Whale", "User Data", "Default") } ]; for (const browser of browsers) { if (fs.existsSync(browser.path)) { return browser.name; + } else{ + notify.notifyFirefoxBrowserMissing(); } } notify.notifyCookiesBrowserError() diff --git a/server/helpers/notify.js b/server/helpers/notify.js index dfc6d64..f9a24b7 100644 --- a/server/helpers/notify.js +++ b/server/helpers/notify.js @@ -5,7 +5,7 @@ function notifyDownloadFinished(folder) { const iconPath = path.join(process.resourcesPath, "confirm-icon.png"); const notif = new Notification({ title: "Freedom Loader", - body: "Ton téléchargement est terminé, clique ici pour l'ouvrir.", + body: "Your download is complete, click here to open it.", icon: iconPath, }); @@ -17,7 +17,7 @@ function notifyCookiesBrowserError(){ const iconPath = path.join(process.resourcesPath, "error.png"); const notif = new Notification({ title: "Cookies Error", - body: "Impossible de récupérer les cookies. Connectez-vous sur votre navigateur et cliquez ici pour voir le tuto.", + body: "Unable to retrieve cookies. Please log in to your browser and click here to view the tutorial.", icon: iconPath, }); @@ -25,7 +25,20 @@ function notifyCookiesBrowserError(){ notif.show(); } +function notifyFirefoxBrowserMissing(){ + const iconPath = path.join(process.ressourcesPath, "error.png"); + const notif = new Notification({ + title: "Firefox Missing", + body: "Firefox was not found on your system. Click here to follow the installation guide", + icon: iconPath, + }); + + notif.on("click", () => shell.openExternal("https://youtube.com/shorts/cN9f4s1Mf88?si=519QCVd_-fzJqRf1")) + notif.show(); +} + module.exports = { notifyDownloadFinished, - notifyCookiesBrowserError + notifyCookiesBrowserError, + notifyFirefoxBrowserMissing }; \ No newline at end of file diff --git a/server/logger.js b/server/logger.js index 5c5d70e..632d553 100644 --- a/server/logger.js +++ b/server/logger.js @@ -37,16 +37,16 @@ const logger = createLogger({ }); function getSessionStartLine() { - return `--- Démarrage de la session : ${new Date().toISOString()} ---`; + return `--- Starting session: ${new Date().toISOString()} ---`; } function getSessionEndLine() { - return `--- Fin de la session : ${new Date().toISOString()} ---`; + return `--- Ending session: ${new Date().toISOString()} ---`; } function logSessionStart() { logger.info(getSessionStartLine()); - logger.info(`Version de l'Application: ${config.version}`) + logger.info(`Application Version: ${config.version}`) } function logSessionEnd() { diff --git a/server/server.js b/server/server.js index eb1e926..c8b726b 100644 --- a/server/server.js +++ b/server/server.js @@ -22,15 +22,15 @@ const outputFolder = path.join(process.env.USERPROFILE, "Downloads", "Freedom Lo // Création du dossier si nécessaire try { fs.mkdirSync(outputFolder, { recursive: true }); - logger.info(`Dossier Freedom Loader prêt dans ${outputFolder}`); + logger.info(`Freedom Loader folder ready in ${outputFolder}`); } catch (err) { - logger.error("Impossible de créer le dossier :", err); + logger.error("Unable to create folder:", err); process.exit(1); } // Mise à jour yt-dlp au execFile(userYtDlp, ["-U"], (err, stdout, stderr) => { - if (err) logger.warn("Erreur update yt-dlp:", err); + if (err) logger.warn("yt-dlp update error:", err); else logger.info(`Update yt-dlp : ${stdout}`); }); @@ -50,19 +50,19 @@ app.get("/", (req, res) => { async function startServer() { return new Promise((resolve, reject) => { const server = app.listen(config.applicationPort, () => { - logger.info(`Serveur Express prêt sur http://localhost:${config.applicationPort}`); + logger.info(`Express server ready at http://localhost:${config.applicationPort}`); resolve(server); }); server.on("error", (err) => { - logger.error("Erreur serveur Express :", err); + logger.error("Express Server Error :", err); reject(err); }); const gracefulExit = () => { logSessionEnd(); server.close(() => { - logger.info("Serveur Express fermé proprement."); + logger.info("Express Server close cleanly."); process.exit(); }); }; diff --git a/server/services/download.services.js b/server/services/download.services.js index 2109b71..789fbd7 100644 --- a/server/services/download.services.js +++ b/server/services/download.services.js @@ -17,19 +17,19 @@ function fetchDownload(options, listeners, speedListeners) { const child = execFile(userYtDlp, args); - child.on("error", err => reject(new Error(`Erreur yt-dlp : ${err.message}`))); + child.on("error", err => reject(new Error(`YT-DLP Error : ${err.message}`))); child.on("close", code => { listeners.forEach(fn => fn("done")); if (code === 0) resolve(outputFolder); - else reject(new Error(`yt-dlp a échoué avec le code : ${code}`)); + else reject(new Error(`YT-DLP failed with code : ${code}`)); }); child.stdout.on("data", data => { data.toString().split("\n").forEach(line => { if (!line.trim()) return; - logger.info(`[yt-dlp stdout] ${line}`); + logger.info(`[yt-dlp] ${line}`); /* Barre de Chargement*/ if (line.startsWith("[download] Destination:")) listeners.forEach(fn => fn("reset")); diff --git a/server/services/info.services.js b/server/services/info.services.js index 010c776..66038fd 100644 --- a/server/services/info.services.js +++ b/server/services/info.services.js @@ -25,24 +25,24 @@ function fetchInfo(url) { if (stderr) { const lower = stderr.toLowerCase(); if (lower.includes("sign in to confirm") || lower.includes("failed to decrypt") || lower.includes("could not copy")) { - return reject(new Error(`Impossible d'extraire les cookies depuis ${getUserBrowser()}. Connectez-vous dans ce navigateur et réessayez.`)); + return reject(new Error(`Unable to extract cookies from ${getUserBrowser()}. Please log in to this browser and try again.`)); } } if (error) { - logger.error(`Erreur yt-dlp: ${error.message}`); + logger.error(`YT-DLP Error: ${error.message}`); if (stderr) logger.debug(`stderr: ${stderr}`); - return reject(new Error("Impossible de récupérer les infos.")); + return reject(new Error("Unable to fetch Info.")); } - if (!stdout) return reject(new Error("Aucune donnée reçue.")); + if (!stdout) return reject(new Error("No Data Received.")); try { const data = JSON.parse(stdout); resolve(data); } catch (e) { - logger.error(`Erreur parsing JSON: ${e.message}`); - reject(new Error("JSON illisible.")); + logger.error(`JSON Parsing Error: ${e.message}`); + reject(new Error("JSON unreadable.")); } }); }); diff --git a/server/update.js b/server/update.js index 01b70d0..d644bfc 100644 --- a/server/update.js +++ b/server/update.js @@ -5,18 +5,18 @@ const { logger } = require("./logger"); function AutoUpdater() { autoUpdater.on("update-available", (info) => { - logger.info(`Nouvelle version disponible : ${info.version}`); + logger.info(`New Version Available : ${info.version}`); new Notification({ title: "Freedom Loader", - body: `Nouvelle version disponible : ${info.version}. L'application va redémarrer` + body: `New Version Available : ${info.version}. Application will restart` }).show(); }); autoUpdater.on("update-downloaded", (info) => { - logger.info(`Mise à jour téléchargée : ${info.version}`); + logger.info(`Update Downloaded : ${info.version}`); new Notification({ title: "Freedom Loader", - body: `Mise à jour ${info.version} téléchargée.` + body: `Update ${info.version} downloaded.` }).show(); setTimeout(() => { @@ -25,9 +25,9 @@ function AutoUpdater() { }); autoUpdater.on("error", (err) => { - logger.error("Erreur auto-update :", err.message); + logger.error("Auto Update Error :", err.message); new Notification({ - title: "Freedom Loader - Erreur de mise à jour", + title: "Freedom Loader - Update Error", body: err.message }).show(); }); @@ -35,9 +35,9 @@ function AutoUpdater() { app.whenReady().then(async () => { try { await autoUpdater.checkForUpdates(); - logger.info("Vérification des mises à jour effectuée"); + logger.info("Update check completed"); } catch (err) { - logger.error("Erreur lors du check update :", err.message); + logger.error("Error during update check :", err.message); } }); }