mirror of
https://github.com/MasterAcnolo/Freedom-Loader.git
synced 2026-07-29 18:25:47 +02:00
Fix: Improve browser detection logging and error handling
This commit is contained in:
@@ -2,6 +2,7 @@ const fs = require("fs");
|
||||
const os = require("os");
|
||||
const path = require("path");
|
||||
const notify = require("./notify")
|
||||
const { logger } = require("../logger");
|
||||
|
||||
function getUserBrowser() {
|
||||
const userProfile = os.homedir();
|
||||
@@ -18,15 +19,21 @@ function getUserBrowser() {
|
||||
// { name: "whale", path: path.join(userProfile, "AppData", "Local", "Naver", "Naver Whale", "User Data", "Default") }
|
||||
];
|
||||
|
||||
// Chercher un navigateur disponible
|
||||
for (const browser of browsers) {
|
||||
if (fs.existsSync(browser.path)) {
|
||||
logger.info(`Browser found: ${browser.name}`);
|
||||
return browser.name;
|
||||
} else{
|
||||
}
|
||||
}
|
||||
|
||||
// Aucun navigateur trouvé - notifier l'utilisateur
|
||||
logger.warn("No supported browser found on the system");
|
||||
notify.notifyFirefoxBrowserMissing();
|
||||
}
|
||||
}
|
||||
notify.notifyCookiesBrowserError()
|
||||
return ;
|
||||
|
||||
// Fallback: retourner "firefox" pour laisser yt-dlp gérer l'erreur
|
||||
// plutôt que de crasher l'application
|
||||
return "firefox";
|
||||
}
|
||||
|
||||
module.exports = getUserBrowser
|
||||
Reference in New Issue
Block a user