mirror of
https://github.com/MasterAcnolo/Freedom-Loader.git
synced 2026-07-29 18:25:47 +02:00
refactor: add full documentation and fix theme loading robustness
- Add JSDoc comments across frontend and backend modules - Improve code readability and maintainability with consistent documentation style - Document Electron IPC handlers, UI utilities, and theme system - Add missing function/class documentation in theme loader and app services - Minor structural improvements and cleanup across Electron main process modules - Minor fixes on variable names
This commit is contained in:
@@ -1,8 +1,19 @@
|
||||
const { Notification, shell } = require("electron");
|
||||
const { iconPaths } = require("./path.helpers");
|
||||
const { logger } = require("../logger");
|
||||
|
||||
/**
|
||||
* Displays a system notification when a download completes successfully.
|
||||
*
|
||||
* If enabled, clicking the notification opens the download folder
|
||||
* using the system file explorer.
|
||||
*
|
||||
* @param {string} folder - Path to the completed download folder.
|
||||
* @param {boolean} notifyEnabled - Whether notifications are enabled in config.
|
||||
*/
|
||||
function notifyDownloadFinished(folder, notifyEnabled = true) {
|
||||
if (!notifyEnabled) return;
|
||||
if (!folder) return;
|
||||
|
||||
const notif = new Notification({
|
||||
title: "Freedom Loader",
|
||||
@@ -14,6 +25,15 @@ function notifyDownloadFinished(folder, notifyEnabled = true) {
|
||||
notif.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a notification when browser cookies cannot be extracted.
|
||||
*
|
||||
* This usually indicates:
|
||||
* - User is not logged in to the browser
|
||||
* - Browser profile is inaccessible
|
||||
*
|
||||
* Clicking the notification opens a tutorial link.
|
||||
*/
|
||||
function notifyCookiesBrowserError(){
|
||||
const notif = new Notification({
|
||||
title: "Cookies Error",
|
||||
@@ -21,23 +41,41 @@ function notifyCookiesBrowserError(){
|
||||
icon: iconPaths.error,
|
||||
});
|
||||
|
||||
notif.on("click", () => shell.openExternal("https://youtube.com/shorts/cN9f4s1Mf88?si=519QCVd_-fzJqRf1"));
|
||||
notif.on("click", () =>
|
||||
shell.openExternal(
|
||||
"https://youtube.com/shorts/cN9f4s1Mf88?si=519QCVd_-fzJqRf1"
|
||||
)
|
||||
);
|
||||
|
||||
notif.show();
|
||||
}
|
||||
|
||||
function notifyFirefoxBrowserMissing(){
|
||||
/**
|
||||
* Displays a notification when Firefox is not detected
|
||||
* on the user system.
|
||||
*
|
||||
* This is required for cookie extraction via yt-dlp.
|
||||
*
|
||||
* Clicking the notification opens an installation guide.
|
||||
*/
|
||||
function notifyFirefoxBrowserMissing() {
|
||||
const notif = new Notification({
|
||||
title: "Firefox Missing",
|
||||
body: "Firefox was not found on your system. Click here to follow the installation guide",
|
||||
icon: iconPaths.error,
|
||||
});
|
||||
|
||||
notif.on("click", () => shell.openExternal("https://youtube.com/shorts/cN9f4s1Mf88?si=519QCVd_-fzJqRf1"))
|
||||
notif.on("click", () =>
|
||||
shell.openExternal(
|
||||
"https://youtube.com/shorts/cN9f4s1Mf88?si=519QCVd_-fzJqRf1"
|
||||
)
|
||||
);
|
||||
|
||||
notif.show();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
notifyDownloadFinished,
|
||||
notifyDownloadFinished,
|
||||
notifyCookiesBrowserError,
|
||||
notifyFirefoxBrowserMissing
|
||||
notifyFirefoxBrowserMissing,
|
||||
};
|
||||
Reference in New Issue
Block a user