mirror of
https://github.com/MasterAcnolo/Freedom-Loader.git
synced 2026-07-29 18:25:47 +02:00
Translate English
This commit is contained in:
@@ -5,7 +5,7 @@ const button = form.querySelector("button");
|
|||||||
form.addEventListener("submit", async (e) => {
|
form.addEventListener("submit", async (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
button.disabled = true; // Empêche les clics multiples
|
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 formData = new FormData(form);
|
||||||
const params = new URLSearchParams(formData);
|
const params = new URLSearchParams(formData);
|
||||||
@@ -26,7 +26,7 @@ form.addEventListener("submit", async (e) => {
|
|||||||
statusDiv.textContent = text;
|
statusDiv.textContent = text;
|
||||||
|
|
||||||
} catch {
|
} catch {
|
||||||
statusDiv.textContent = "❌ Une erreur s’est produite.";
|
statusDiv.textContent = "❌ An Error has Occured.";
|
||||||
} finally {
|
} finally {
|
||||||
button.disabled = false;
|
button.disabled = false;
|
||||||
|
|
||||||
|
|||||||
@@ -16,15 +16,15 @@ async function downloadController(req, res) {
|
|||||||
outputFolder: req.body.savePath || undefined,
|
outputFolder: req.body.savePath || undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!options.url || !isValidUrl(options.url)) return res.status(400).send("❌ URL invalide !");
|
if (!options.url || !isValidUrl(options.url)) return res.status(400).send("❌ Invalid URL !");
|
||||||
if (options.outputFolder && !isSafePath(options.outputFolder)) return res.status(400).send("❌ Chemin de sauvegarde non autorisé.");
|
if (options.outputFolder && !isSafePath(options.outputFolder)) return res.status(400).send("❌ Save Path Not Allowed.");
|
||||||
|
|
||||||
const filePath = await fetchDownload(options, listeners, speedListeners);
|
const filePath = await fetchDownload(options, listeners, speedListeners);
|
||||||
notifyDownloadFinished(filePath);
|
notifyDownloadFinished(filePath);
|
||||||
res.send("✅ Téléchargement terminé !");
|
res.send("✅ Download Done !");
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error(`Erreur serveur dans /download : ${err.message}`);
|
logger.error(`Server Error in /download : ${err.message}`);
|
||||||
res.status(500).send(`❌ ${err.message}`);
|
res.status(500).send(`❌ ${err.message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ async function infoController(req, res){
|
|||||||
|
|
||||||
|
|
||||||
/* Si pas d'url ou url invalide*/
|
/* 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")) {
|
if (url.includes("?list")) {
|
||||||
logger.info("Type de contenu: Playlist")
|
logger.info("Type de contenu: Playlist")
|
||||||
@@ -29,12 +29,12 @@ async function infoController(req, res){
|
|||||||
if (data._type === "playlist") {
|
if (data._type === "playlist") {
|
||||||
|
|
||||||
const playlist = parsePlaylist(data);
|
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);
|
return res.json(playlist);
|
||||||
|
|
||||||
} else{
|
} else{
|
||||||
const video = parseVideo(data);
|
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);
|
return res.json(video);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ function startRPC() {
|
|||||||
await rpc.destroy();
|
await rpc.destroy();
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error("Erreur lors de la fermeture du RPC :", err);
|
logger.error("Error while closing the RPC:", err);
|
||||||
} finally {
|
} finally {
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@ function startRPC() {
|
|||||||
process.on("SIGTERM", cleanExit);
|
process.on("SIGTERM", cleanExit);
|
||||||
|
|
||||||
rpc.login({ clientId }).catch(err => {
|
rpc.login({ clientId }).catch(err => {
|
||||||
logger.error("Impossible de connecter le RPC :", err);
|
logger.error("Unable to connect to the RPC:", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,14 +8,21 @@ function getUserBrowser() {
|
|||||||
|
|
||||||
// Liste des navigateurs supportés par yt-dlp
|
// Liste des navigateurs supportés par yt-dlp
|
||||||
const browsers = [
|
const browsers = [
|
||||||
{ name: "firefox", path: path.join(userProfile, "AppData", "Roaming", "Mozilla", "Firefox", "Profiles")},
|
{ name: "firefox", path: path.join(userProfile, "AppData", "Roaming", "Mozilla", "Firefox", "Profiles") },
|
||||||
{ name: "chrome", path: path.join(userProfile, "AppData", "Local", "Google", "Chrome", "User Data") },
|
// { name: "chrome", path: path.join(userProfile, "AppData", "Local", "Google", "Chrome", "User Data", "Default") },
|
||||||
{ name: "edge", path: path.join(userProfile, "AppData", "Local", "Microsoft", "Edge", "User Data") },
|
// { 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) {
|
for (const browser of browsers) {
|
||||||
if (fs.existsSync(browser.path)) {
|
if (fs.existsSync(browser.path)) {
|
||||||
return browser.name;
|
return browser.name;
|
||||||
|
} else{
|
||||||
|
notify.notifyFirefoxBrowserMissing();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
notify.notifyCookiesBrowserError()
|
notify.notifyCookiesBrowserError()
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ function notifyDownloadFinished(folder) {
|
|||||||
const iconPath = path.join(process.resourcesPath, "confirm-icon.png");
|
const iconPath = path.join(process.resourcesPath, "confirm-icon.png");
|
||||||
const notif = new Notification({
|
const notif = new Notification({
|
||||||
title: "Freedom Loader",
|
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,
|
icon: iconPath,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ function notifyCookiesBrowserError(){
|
|||||||
const iconPath = path.join(process.resourcesPath, "error.png");
|
const iconPath = path.join(process.resourcesPath, "error.png");
|
||||||
const notif = new Notification({
|
const notif = new Notification({
|
||||||
title: "Cookies Error",
|
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,
|
icon: iconPath,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -25,7 +25,20 @@ function notifyCookiesBrowserError(){
|
|||||||
notif.show();
|
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 = {
|
module.exports = {
|
||||||
notifyDownloadFinished,
|
notifyDownloadFinished,
|
||||||
notifyCookiesBrowserError
|
notifyCookiesBrowserError,
|
||||||
|
notifyFirefoxBrowserMissing
|
||||||
};
|
};
|
||||||
@@ -37,16 +37,16 @@ const logger = createLogger({
|
|||||||
});
|
});
|
||||||
|
|
||||||
function getSessionStartLine() {
|
function getSessionStartLine() {
|
||||||
return `--- Démarrage de la session : ${new Date().toISOString()} ---`;
|
return `--- Starting session: ${new Date().toISOString()} ---`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSessionEndLine() {
|
function getSessionEndLine() {
|
||||||
return `--- Fin de la session : ${new Date().toISOString()} ---`;
|
return `--- Ending session: ${new Date().toISOString()} ---`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function logSessionStart() {
|
function logSessionStart() {
|
||||||
logger.info(getSessionStartLine());
|
logger.info(getSessionStartLine());
|
||||||
logger.info(`Version de l'Application: ${config.version}`)
|
logger.info(`Application Version: ${config.version}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
function logSessionEnd() {
|
function logSessionEnd() {
|
||||||
|
|||||||
@@ -22,15 +22,15 @@ const outputFolder = path.join(process.env.USERPROFILE, "Downloads", "Freedom Lo
|
|||||||
// Création du dossier si nécessaire
|
// Création du dossier si nécessaire
|
||||||
try {
|
try {
|
||||||
fs.mkdirSync(outputFolder, { recursive: true });
|
fs.mkdirSync(outputFolder, { recursive: true });
|
||||||
logger.info(`Dossier Freedom Loader prêt dans ${outputFolder}`);
|
logger.info(`Freedom Loader folder ready in ${outputFolder}`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error("Impossible de créer le dossier :", err);
|
logger.error("Unable to create folder:", err);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mise à jour yt-dlp au
|
// Mise à jour yt-dlp au
|
||||||
execFile(userYtDlp, ["-U"], (err, stdout, stderr) => {
|
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}`);
|
else logger.info(`Update yt-dlp : ${stdout}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -50,19 +50,19 @@ app.get("/", (req, res) => {
|
|||||||
async function startServer() {
|
async function startServer() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const server = app.listen(config.applicationPort, () => {
|
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);
|
resolve(server);
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on("error", (err) => {
|
server.on("error", (err) => {
|
||||||
logger.error("Erreur serveur Express :", err);
|
logger.error("Express Server Error :", err);
|
||||||
reject(err);
|
reject(err);
|
||||||
});
|
});
|
||||||
|
|
||||||
const gracefulExit = () => {
|
const gracefulExit = () => {
|
||||||
logSessionEnd();
|
logSessionEnd();
|
||||||
server.close(() => {
|
server.close(() => {
|
||||||
logger.info("Serveur Express fermé proprement.");
|
logger.info("Express Server close cleanly.");
|
||||||
process.exit();
|
process.exit();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,19 +17,19 @@ function fetchDownload(options, listeners, speedListeners) {
|
|||||||
|
|
||||||
const child = execFile(userYtDlp, args);
|
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 => {
|
child.on("close", code => {
|
||||||
listeners.forEach(fn => fn("done"));
|
listeners.forEach(fn => fn("done"));
|
||||||
if (code === 0) resolve(outputFolder);
|
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 => {
|
child.stdout.on("data", data => {
|
||||||
data.toString().split("\n").forEach(line => {
|
data.toString().split("\n").forEach(line => {
|
||||||
if (!line.trim()) return;
|
if (!line.trim()) return;
|
||||||
logger.info(`[yt-dlp stdout] ${line}`);
|
logger.info(`[yt-dlp] ${line}`);
|
||||||
|
|
||||||
/* Barre de Chargement*/
|
/* Barre de Chargement*/
|
||||||
if (line.startsWith("[download] Destination:")) listeners.forEach(fn => fn("reset"));
|
if (line.startsWith("[download] Destination:")) listeners.forEach(fn => fn("reset"));
|
||||||
|
|||||||
@@ -25,24 +25,24 @@ function fetchInfo(url) {
|
|||||||
if (stderr) {
|
if (stderr) {
|
||||||
const lower = stderr.toLowerCase();
|
const lower = stderr.toLowerCase();
|
||||||
if (lower.includes("sign in to confirm") || lower.includes("failed to decrypt") || lower.includes("could not copy")) {
|
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) {
|
if (error) {
|
||||||
logger.error(`Erreur yt-dlp: ${error.message}`);
|
logger.error(`YT-DLP Error: ${error.message}`);
|
||||||
if (stderr) logger.debug(`stderr: ${stderr}`);
|
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 {
|
try {
|
||||||
const data = JSON.parse(stdout);
|
const data = JSON.parse(stdout);
|
||||||
resolve(data);
|
resolve(data);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error(`Erreur parsing JSON: ${e.message}`);
|
logger.error(`JSON Parsing Error: ${e.message}`);
|
||||||
reject(new Error("JSON illisible."));
|
reject(new Error("JSON unreadable."));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,18 +5,18 @@ const { logger } = require("./logger");
|
|||||||
function AutoUpdater() {
|
function AutoUpdater() {
|
||||||
|
|
||||||
autoUpdater.on("update-available", (info) => {
|
autoUpdater.on("update-available", (info) => {
|
||||||
logger.info(`Nouvelle version disponible : ${info.version}`);
|
logger.info(`New Version Available : ${info.version}`);
|
||||||
new Notification({
|
new Notification({
|
||||||
title: "Freedom Loader",
|
title: "Freedom Loader",
|
||||||
body: `Nouvelle version disponible : ${info.version}. L'application va redémarrer`
|
body: `New Version Available : ${info.version}. Application will restart`
|
||||||
}).show();
|
}).show();
|
||||||
});
|
});
|
||||||
|
|
||||||
autoUpdater.on("update-downloaded", (info) => {
|
autoUpdater.on("update-downloaded", (info) => {
|
||||||
logger.info(`Mise à jour téléchargée : ${info.version}`);
|
logger.info(`Update Downloaded : ${info.version}`);
|
||||||
new Notification({
|
new Notification({
|
||||||
title: "Freedom Loader",
|
title: "Freedom Loader",
|
||||||
body: `Mise à jour ${info.version} téléchargée.`
|
body: `Update ${info.version} downloaded.`
|
||||||
}).show();
|
}).show();
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -25,9 +25,9 @@ function AutoUpdater() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
autoUpdater.on("error", (err) => {
|
autoUpdater.on("error", (err) => {
|
||||||
logger.error("Erreur auto-update :", err.message);
|
logger.error("Auto Update Error :", err.message);
|
||||||
new Notification({
|
new Notification({
|
||||||
title: "Freedom Loader - Erreur de mise à jour",
|
title: "Freedom Loader - Update Error",
|
||||||
body: err.message
|
body: err.message
|
||||||
}).show();
|
}).show();
|
||||||
});
|
});
|
||||||
@@ -35,9 +35,9 @@ function AutoUpdater() {
|
|||||||
app.whenReady().then(async () => {
|
app.whenReady().then(async () => {
|
||||||
try {
|
try {
|
||||||
await autoUpdater.checkForUpdates();
|
await autoUpdater.checkForUpdates();
|
||||||
logger.info("Vérification des mises à jour effectuée");
|
logger.info("Update check completed");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error("Erreur lors du check update :", err.message);
|
logger.error("Error during update check :", err.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user