mirror of
https://github.com/MasterAcnolo/Freedom-Loader.git
synced 2026-07-29 18:25:47 +02:00
Refactor: Translate all comms in English
This commit is contained in:
@@ -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}`);
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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, () => {
|
||||
|
||||
@@ -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])));
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user