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 os = require("os");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const notify = require("./notify")
|
const notify = require("./notify")
|
||||||
|
const { logger } = require("../logger");
|
||||||
|
|
||||||
function getUserBrowser() {
|
function getUserBrowser() {
|
||||||
const userProfile = os.homedir();
|
const userProfile = os.homedir();
|
||||||
@@ -18,15 +19,21 @@ function getUserBrowser() {
|
|||||||
// { name: "whale", path: path.join(userProfile, "AppData", "Local", "Naver", "Naver Whale", "User Data", "Default") }
|
// { name: "whale", path: path.join(userProfile, "AppData", "Local", "Naver", "Naver Whale", "User Data", "Default") }
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Chercher un navigateur disponible
|
||||||
for (const browser of browsers) {
|
for (const browser of browsers) {
|
||||||
if (fs.existsSync(browser.path)) {
|
if (fs.existsSync(browser.path)) {
|
||||||
|
logger.info(`Browser found: ${browser.name}`);
|
||||||
return browser.name;
|
return browser.name;
|
||||||
} else{
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aucun navigateur trouvé - notifier l'utilisateur
|
||||||
|
logger.warn("No supported browser found on the system");
|
||||||
notify.notifyFirefoxBrowserMissing();
|
notify.notifyFirefoxBrowserMissing();
|
||||||
}
|
|
||||||
}
|
// Fallback: retourner "firefox" pour laisser yt-dlp gérer l'erreur
|
||||||
notify.notifyCookiesBrowserError()
|
// plutôt que de crasher l'application
|
||||||
return ;
|
return "firefox";
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = getUserBrowser
|
module.exports = getUserBrowser
|
||||||
Reference in New Issue
Block a user