From b13c98dda25dea283522ad145c2e259ead0fa8ef Mon Sep 17 00:00:00 2001 From: MasterAcnolo <68693319+MasterAcnolo@users.noreply.github.com> Date: Sat, 21 Feb 2026 12:27:13 +0100 Subject: [PATCH] Refactor: Translate all comms in English --- public/script/customthemes.js | 4 ++-- public/script/downloadstatus.js | 2 +- public/script/fetchinfo.js | 6 +++--- public/script/progressBar.js | 6 +++--- public/script/settingsPanel.js | 4 ++-- server/controller/info.controller.js | 5 +++-- server/helpers/getBrowser.js | 10 +++++----- server/helpers/path.js | 3 +-- server/logger.js | 6 +++--- server/routes/download.route.js | 2 +- server/server.js | 4 ++-- server/services/download.services.js | 2 +- server/services/info.services.js | 4 ++-- 13 files changed, 29 insertions(+), 29 deletions(-) diff --git a/public/script/customthemes.js b/public/script/customthemes.js index 129a7e7..7e5262c 100644 --- a/public/script/customthemes.js +++ b/public/script/customthemes.js @@ -43,12 +43,12 @@ function loadTheme() { applyTheme(savedTheme); themeSelect.value = savedTheme; } else { - applyTheme("dark"); // thème par défaut + applyTheme("dark"); themeSelect.value = "dark"; } } -// Quand l'utilisateur change le thème depuis le select +// When the user changes the theme from the select themeSelect.addEventListener("change", (event) => { const selectedTheme = event.target.value; if (themes[selectedTheme]) { diff --git a/public/script/downloadstatus.js b/public/script/downloadstatus.js index e3b6a23..e6818b0 100644 --- a/public/script/downloadstatus.js +++ b/public/script/downloadstatus.js @@ -4,7 +4,7 @@ const button = form.querySelector("button"); form.addEventListener("submit", async (e) => { e.preventDefault(); - button.disabled = true; // Empêche les clics multiples + button.disabled = true; // Avoid multiple clicks statusDiv.textContent = "Download in progress..."; const formData = new FormData(form); diff --git a/public/script/fetchinfo.js b/public/script/fetchinfo.js index d4e1a2c..1fc1f75 100644 --- a/public/script/fetchinfo.js +++ b/public/script/fetchinfo.js @@ -43,7 +43,7 @@ async function init() { const url = urlInput.value.trim(); - // Si champ vide -> reset total + // IF field empty -> total reset if (!url || url.length < 2) { infoDiv.innerHTML = ""; infoDiv.classList.remove("visible", "playlist-mode"); @@ -58,7 +58,7 @@ async function init() { const data = await fetchVideoInfo(url); loaderBox.style.display = "none"; - // Gestion des erreurs + if (data.error) { infoDiv.innerHTML = `
{ if (event.target.classList.contains("copy-btn") || event.target.closest(".copy-btn")) { const btn = event.target.closest(".copy-btn") || event.target; diff --git a/public/script/progressBar.js b/public/script/progressBar.js index 4deb4f3..780a551 100644 --- a/public/script/progressBar.js +++ b/public/script/progressBar.js @@ -30,7 +30,7 @@ function resetProgress() { speedElement.style.display = "none"; } -// Connexion SSE +// SSE Connexion const evtSource = new EventSource("/download/progress"); evtSource.onmessage = e => { if (e.data === "reset") { @@ -49,10 +49,10 @@ evtSource.onmessage = e => { if (!isNaN(percent)) { updateProgress(percent); - window.electronAPI.setProgress(percent); // update barre des tâches + window.electronAPI.setProgress(percent); // Update Task Bar if (percent >= 100) setTimeout(() => { resetProgress(); - window.electronAPI.setProgress(-1); // retire la barre + window.electronAPI.setProgress(-1); // Remove the bar }, 500); } }; diff --git a/public/script/settingsPanel.js b/public/script/settingsPanel.js index ae8f2f9..50fd402 100644 --- a/public/script/settingsPanel.js +++ b/public/script/settingsPanel.js @@ -15,7 +15,7 @@ function closePanel() { settingsPanel.style.display = "none"; } -// charge les features + async function loadSettings() { const features = await window.electronAPI.getFeatures(); @@ -33,7 +33,7 @@ async function loadSettings() { }); } -// ouvrir le JSON +// Open The JSON document.getElementById("open-json-btn").addEventListener("click", () => { window.topbarAPI.openConfig(); // ton IPC existant }); diff --git a/server/controller/info.controller.js b/server/controller/info.controller.js index 81837a9..b3f1a36 100644 --- a/server/controller/info.controller.js +++ b/server/controller/info.controller.js @@ -5,10 +5,11 @@ const { isValidUrl } = require("../helpers/validation"); async function infoController(req, res){ - const url = req.body.url || req.query.url; // Gérer POST et GET + const url = req.body.url || req.query.url; // POST et GET - /* Si pas d'url, url non-string ou url invalide*/ + // If no url, non-string url or invalid url + if (!url || typeof url !== "string" || !isValidUrl(url)) return res.status(400).send("❌ Invalid URL Or Missing"); logger.info(`/Info Request receive by the Info Controller. URL: ${url}`); diff --git a/server/helpers/getBrowser.js b/server/helpers/getBrowser.js index a362a55..2b4b374 100644 --- a/server/helpers/getBrowser.js +++ b/server/helpers/getBrowser.js @@ -7,7 +7,7 @@ const { logger } = require("../logger"); function getUserBrowser() { const userProfile = os.homedir(); - // Liste des navigateurs supportés par yt-dlp (Actuellement je peux que garantir Firefox, Désolé) + // List of browsers supported by yt-dlp (Currently I can only guarantee Firefox, Sorry) 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", "Default") }, @@ -19,7 +19,7 @@ function getUserBrowser() { // { name: "whale", path: path.join(userProfile, "AppData", "Local", "Naver", "Naver Whale", "User Data", "Default") } ]; - // Chercher un navigateur disponible + // Search for an available browser for (const browser of browsers) { if (fs.existsSync(browser.path)) { logger.info(`Browser found: ${browser.name}`); @@ -27,12 +27,12 @@ function getUserBrowser() { } } - // Aucun navigateur trouvé - notifier l'utilisateur + // No browser found - notify user logger.warn("No supported browser found on the system"); notify.notifyFirefoxBrowserMissing(); - // Fallback: retourner "firefox" pour laisser yt-dlp gérer l'erreur - // plutôt que de crasher l'application + // Fallback: return "Firefox" to let YT-DLP manage error + // this avoid app crash return "firefox"; } diff --git a/server/helpers/path.js b/server/helpers/path.js index 2a7d823..4e987c9 100644 --- a/server/helpers/path.js +++ b/server/helpers/path.js @@ -23,7 +23,7 @@ const sourceYtDlp = path.join(resourcesPath, "binaries","yt-dlp.exe"); if (config.localMode) { userYtDlp = path.join(__dirname, "../../ressources/yt-dlp.exe"); - ffmpegPath = path.join(__dirname, "../../ressources/"); // <- contient ffmpeg.exe et ffprobe.exe + ffmpegPath = path.join(__dirname, "../../ressources/"); // <- has ffmpeg.exe and ffprobe.exe denoPath = path.join(__dirname, "../../ressources/deno.exe"); } else { userYtDlp = path.join(app.getPath("userData"),"yt-dlp.exe"); @@ -33,7 +33,6 @@ if (config.localMode) { if (!fs.existsSync(userYtDlp)) { fs.copyFileSync(sourceYtDlp, userYtDlp); } - } // Notification icon paths diff --git a/server/logger.js b/server/logger.js index 9e4274c..9f4f2cf 100644 --- a/server/logger.js +++ b/server/logger.js @@ -5,10 +5,10 @@ const path = require("path"); const os = require("os"); const config = require("../config"); -// Dossier de logs Windows +// Logs folder in Windows const logDir = path.join(os.homedir(), "AppData", "Local", "FreedomLoader", "logs"); -// Création du dossier "logs" si nécessaire +// Create "Logs" folder if needed try { fs.mkdirSync(logDir, { recursive: true }); } catch (error) { @@ -20,7 +20,7 @@ const logFormat = format.combine( format.printf(({ timestamp, level, message }) => `${timestamp} | ${level.toUpperCase()} | ${message}`) ); -// Configuration du logger +// Logger configuration const logger = createLogger({ level: "info", format: logFormat, diff --git a/server/routes/download.route.js b/server/routes/download.route.js index a57b244..14a9f3f 100644 --- a/server/routes/download.route.js +++ b/server/routes/download.route.js @@ -4,7 +4,7 @@ const { downloadController, progressController, speedController } = require("../ router.post("/", downloadController); -// SSE pour la progression du téléchargement +// SSE for download progress router.get("/progress", progressController); router.get("/speed", speedController); diff --git a/server/server.js b/server/server.js index 2f229ed..28d5065 100644 --- a/server/server.js +++ b/server/server.js @@ -10,7 +10,7 @@ const app = express(); app.use(express.json()); -// Mise à jour yt-dlp au démarrage +// Update YT-DLP on Startup execFile(userYtDlp, ["-U"], (err, stdout, stderr) => { if (err) logger.warn("yt-dlp update error:", err); else logger.info(`Update yt-dlp : ${stdout}`); @@ -24,11 +24,11 @@ app.use(express.static(path.join(__dirname, "../public"))); app.use("/download", require("./routes/download.route")); app.use("/info", require("./routes/info.route")); +// When we get API Root, it return the front pages. app.get("/", rateLimite ,(req, res) => { res.sendFile(path.join(__dirname, "../public/index.html")); }); -// Fonction pour démarrer le serveur async function startServer() { return new Promise((resolve, reject) => { const server = app.listen(config.applicationPort, () => { diff --git a/server/services/download.services.js b/server/services/download.services.js index d869c4a..e3260a3 100644 --- a/server/services/download.services.js +++ b/server/services/download.services.js @@ -48,7 +48,7 @@ function fetchDownload(options, listeners, speedListeners) { if (!line.trim()) return; logger.info(`[yt-dlp] ${line}`); - /* Progress Bar */ + // Progress Bar if (line.startsWith("[download] Destination:")) listeners.forEach(fn => fn("reset")); const match = line.match(/\[download\]\s+(\d+\.\d+)%/); if (match) listeners.forEach(fn => fn(parseFloat(match[1]))); diff --git a/server/services/info.services.js b/server/services/info.services.js index 66038fd..38fb218 100644 --- a/server/services/info.services.js +++ b/server/services/info.services.js @@ -17,8 +17,8 @@ function fetchInfo(url) { return new Promise((resolve, reject) => { execFile(userYtDlp,[...args, url], - { timeout: 30_000, // 30s, si jamais plus, abandon de la requête - maxBuffer: 10 * 1024 * 1024 }, // 10MO de réponse max (Par défaut: 200ko) + { timeout: 30_000, // 30s, if more timeout + maxBuffer: 10 * 1024 * 1024 }, // 10MO max response (Default: 200ko) (error, stdout, stderr) => {