mirror of
https://github.com/MasterAcnolo/Freedom-Loader.git
synced 2026-07-29 18:25:47 +02:00
Notify Error + Cookies Gestion
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
const path = require("path");
|
||||
|
||||
const getUserBrowser = require("./getBrowser")
|
||||
|
||||
function buildYtDlpArgs({ url, audioOnly, quality, outputFolder }) {
|
||||
const args = [
|
||||
"--cookies-from-browser", `${getUserBrowser()}`,
|
||||
"--no-continue",
|
||||
"--no-overwrites",
|
||||
"--embed-thumbnail",
|
||||
@@ -32,3 +35,4 @@ function buildYtDlpArgs({ url, audioOnly, quality, outputFolder }) {
|
||||
}
|
||||
|
||||
module.exports = { buildYtDlpArgs };
|
||||
|
||||
|
||||
27
server/helpers/getBrowser.js
Normal file
27
server/helpers/getBrowser.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const fs = require("fs");
|
||||
const os = require("os");
|
||||
const path = require("path");
|
||||
const notify = require("./notify")
|
||||
|
||||
function getUserBrowser() {
|
||||
const userProfile = os.homedir();
|
||||
|
||||
// Liste des navigateurs supportés par yt-dlp
|
||||
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") },
|
||||
{ name: "edge", path: path.join(userProfile, "AppData", "Local", "Microsoft", "Edge", "User Data") },
|
||||
];
|
||||
|
||||
for (const browser of browsers) {
|
||||
if (fs.existsSync(browser.path)) {
|
||||
return browser.name;
|
||||
} else{
|
||||
|
||||
}
|
||||
}
|
||||
notify.notifyCookiesBrowserError()
|
||||
return ;
|
||||
}
|
||||
|
||||
module.exports = getUserBrowser
|
||||
@@ -13,4 +13,19 @@ function notifyDownloadFinished(folder) {
|
||||
notif.show();
|
||||
}
|
||||
|
||||
module.exports = { notifyDownloadFinished };
|
||||
function notifyCookiesBrowserError(){
|
||||
const iconPath = path.join(process.resourcesPath, "error.png");
|
||||
const notif = new Notification({
|
||||
title: "Cookies Error",
|
||||
body: "Impossible de récupérer les cookies. Connectez-vous sur votre navigateur et cliquez ici pour voir le tuto.",
|
||||
icon: iconPath,
|
||||
});
|
||||
|
||||
notif.on("click", () => shell.openExternal("https://youtube.com/shorts/cN9f4s1Mf88?si=519QCVd_-fzJqRf1"));
|
||||
notif.show();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
notifyDownloadFinished,
|
||||
notifyCookiesBrowserError
|
||||
};
|
||||
Reference in New Issue
Block a user